diff --git a/gio/gsocket.c b/gio/gsocket.c index d13e2cab7..43eb98692 100644 --- a/gio/gsocket.c +++ b/gio/gsocket.c @@ -3138,7 +3138,7 @@ g_socket_get_available_bytes (GSocket *socket) * systems add internal header size to the reported size, making it * unusable for this function. */ avail = recv (socket->priv->fd, buf, bufsize, MSG_PEEK); - if (avail == -1) + if ((gint) avail == -1) { int errsv = get_socket_errno (); #ifdef G_OS_WIN32 @@ -5275,7 +5275,7 @@ g_socket_send_messages_with_timeout (GSocket *socket, #else { gssize result; - gint i; + guint i; gint64 wait_timeout; wait_timeout = timeout_us; @@ -5305,7 +5305,11 @@ g_socket_send_messages_with_timeout (GSocket *socket, #endif } - result = pollable_result == G_POLLABLE_RETURN_OK ? bytes_written : -1; + if (G_MAXSSIZE > bytes_written && + pollable_result == G_POLLABLE_RETURN_OK) + result = (gssize) bytes_written; + else + result = -1; /* check if we've timed out or how much time to wait at most */ if (timeout_us > 0) diff --git a/gio/win32/gwin32fsmonitorutils.c b/gio/win32/gwin32fsmonitorutils.c index b47124634..f2ab5472a 100644 --- a/gio/win32/gwin32fsmonitorutils.c +++ b/gio/win32/gwin32fsmonitorutils.c @@ -92,7 +92,7 @@ g_win32_fs_monitor_handle_event (GWin32FSMonitorPrivate *monitor, monitor->pfni_prev->Action == FILE_ACTION_RENAMED_OLD_NAME) { /* don't bother sending events, was already sent (rename) */ - fme = -1; + fme = (GFileMonitorEvent) -1; } else fme = G_FILE_MONITOR_EVENT_MOVED_IN; @@ -104,7 +104,7 @@ g_win32_fs_monitor_handle_event (GWin32FSMonitorPrivate *monitor, break; } - if (fme != -1) + if (fme != (GFileMonitorEvent) -1) return g_file_monitor_source_handle_event (monitor->fms, fme, filename, diff --git a/gio/win32/gwinhttpfile.c b/gio/win32/gwinhttpfile.c index 5b8dcfe0b..e73c87658 100644 --- a/gio/win32/gwinhttpfile.c +++ b/gio/win32/gwinhttpfile.c @@ -546,7 +546,7 @@ g_winhttp_file_query_info (GFile *file, NULL)) { gint64 cl; - int n; + size_t n; const char *gint64_format = "%"G_GINT64_FORMAT"%n"; wchar_t *gint64_format_w = g_utf8_to_utf16 (gint64_format, -1, NULL, NULL, NULL); diff --git a/gio/win32/gwinhttpvfs.c b/gio/win32/gwinhttpvfs.c index 03feaf983..4d5f51498 100644 --- a/gio/win32/gwinhttpvfs.c +++ b/gio/win32/gwinhttpvfs.c @@ -165,7 +165,7 @@ g_winhttp_vfs_get_file_for_uri (GVfs *vfs, const char *uri) { GWinHttpVfs *winhttp_vfs = G_WINHTTP_VFS (vfs); - int i; + gsize i; GFile *ret = NULL; /* If it matches one of "our" schemes, handle it */ @@ -192,7 +192,7 @@ g_winhttp_vfs_get_supported_uri_schemes (GVfs *vfs) { GWinHttpVfs *winhttp_vfs = G_WINHTTP_VFS (vfs); const gchar * const *wrapped_vfs_uri_schemes = g_vfs_get_supported_uri_schemes (winhttp_vfs->wrapped_vfs); - int i, n; + gsize i, n; const gchar **retval; n = 0; diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c index 79e397820..8ea6af3cc 100644 --- a/glib/gthread-win32.c +++ b/glib/gthread-win32.c @@ -514,7 +514,7 @@ g_system_thread_new (GThreadFunc proxy, goto error; } - if (ResumeThread (thread->handle) == -1) + if (ResumeThread (thread->handle) == (DWORD) -1) { message = "Error resuming new thread"; goto error; diff --git a/glib/gtimezone.c b/glib/gtimezone.c index 4b4324222..2f65ab95e 100644 --- a/glib/gtimezone.c +++ b/glib/gtimezone.c @@ -157,7 +157,7 @@ typedef struct */ typedef struct { - gint start_year; + guint start_year; gint32 std_offset; gint32 dlt_offset; TimeZoneDate dlt_start; @@ -906,8 +906,7 @@ rules_from_windows_time_zone (const gchar *identifier, if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, subkey_dynamic_w, 0, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS) { - DWORD first, last; - int year, i; + DWORD i, first, last, year; wchar_t s[12]; size = sizeof first; @@ -1458,6 +1457,8 @@ set_tz_name (gchar **pos, gchar *buffer, guint size) gchar *name_pos = *pos; guint len; + g_assert (size != 0); + if (quoted) { name_pos++; @@ -1479,7 +1480,7 @@ set_tz_name (gchar **pos, gchar *buffer, guint size) memset (buffer, 0, size); /* name_pos isn't 0-terminated, so we have to limit the length expressly */ - len = *pos - name_pos > size - 1 ? size - 1 : *pos - name_pos; + len = (guint) (*pos - name_pos) > size - 1 ? size - 1 : (guint) (*pos - name_pos); strncpy (buffer, name_pos, len); *pos += quoted; return TRUE; @@ -1542,8 +1543,7 @@ rules_from_identifier (const gchar *identifier, #ifdef G_OS_WIN32 /* Windows allows us to use the US DST boundaries if they're not given */ { - int i; - guint rules_num = 0; + guint i, rules_num = 0; /* Use US rules, Windows' default is Pacific Standard Time */ if ((rules_num = rules_from_windows_time_zone ("Pacific Standard Time", diff --git a/glib/gwin32.c b/glib/gwin32.c index f4590916f..30c60575e 100644 --- a/glib/gwin32.c +++ b/glib/gwin32.c @@ -534,7 +534,7 @@ g_win32_check_windows_version (const gint major, HMODULE hmodule; #endif /* We Only Support Checking for XP or later */ - g_return_val_if_fail (major >= 5 && (major <=6 || major == 10), FALSE); + g_return_val_if_fail (major >= 5 && (major <= 6 || major == 10), FALSE); g_return_val_if_fail ((major >= 5 && minor >= 1) || major >= 6, FALSE); /* Check for Service Pack Version >= 0 */ @@ -553,14 +553,14 @@ g_win32_check_windows_version (const gint major, RtlGetVersion (&osverinfo); /* check the OS and Service Pack Versions */ - if (osverinfo.dwMajorVersion > major) + if (osverinfo.dwMajorVersion > (DWORD) major) is_ver_checked = TRUE; - else if (osverinfo.dwMajorVersion == major) + else if (osverinfo.dwMajorVersion == (DWORD) major) { - if (osverinfo.dwMinorVersion > minor) + if (osverinfo.dwMinorVersion > (DWORD) minor) is_ver_checked = TRUE; - else if (osverinfo.dwMinorVersion == minor) - if (osverinfo.wServicePackMajor >= spver) + else if (osverinfo.dwMinorVersion == (DWORD) minor) + if (osverinfo.wServicePackMajor >= (DWORD) spver) is_ver_checked = TRUE; }