From 9e3a08b2223a94541dc1cf175b713f5e4e2d1995 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 14 May 2021 14:24:30 +0200 Subject: [PATCH 1/6] Fix signedness warning in gio/gcontenttype-win32.c gio/gcontenttype-win32.c: In function 'get_registry_classes_key': gio/gcontenttype-win32.c:66:78: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'int' if (ExpandEnvironmentStringsW (wc_temp, wc_temp_expanded, len) == len) ^~ --- gio/gcontenttype-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gcontenttype-win32.c b/gio/gcontenttype-win32.c index 2f07fa36e..726759d8c 100644 --- a/gio/gcontenttype-win32.c +++ b/gio/gcontenttype-win32.c @@ -59,7 +59,7 @@ get_registry_classes_key (const char *subdir, if (key_type == REG_EXPAND_SZ) { wchar_t dummy[1]; - int len = ExpandEnvironmentStringsW (wc_temp, dummy, 1); + DWORD len = ExpandEnvironmentStringsW (wc_temp, dummy, 1); if (len > 0) { wchar_t *wc_temp_expanded = g_new (wchar_t, len); From f9b4a557b177a79de0ee4408ca72e89dd1956e87 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 14 May 2021 14:27:27 +0200 Subject: [PATCH 2/6] Fix signedness warning in gio/gwin32packageparser.c gio/gwin32packageparser.c: In function 'WIN32_FROM_HRESULT': gio/gwin32packageparser.c:99:30: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'long int' if ((hresult & 0xFFFF0000) == MAKE_HRESULT (SEVERITY_ERROR, FACILITY_WIN32, 0) || ^~ --- gio/gwin32packageparser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gio/gwin32packageparser.c b/gio/gwin32packageparser.c index ee05bb1dd..58b99947c 100755 --- a/gio/gwin32packageparser.c +++ b/gio/gwin32packageparser.c @@ -96,7 +96,7 @@ static BOOL WIN32_FROM_HRESULT (HRESULT hresult, DWORD *win32_error_code) { - if ((hresult & 0xFFFF0000) == MAKE_HRESULT (SEVERITY_ERROR, FACILITY_WIN32, 0) || + if ((hresult & (HRESULT) 0xFFFF0000) == MAKE_HRESULT (SEVERITY_ERROR, FACILITY_WIN32, 0) || hresult == S_OK) { *win32_error_code = HRESULT_CODE (hresult); @@ -815,4 +815,4 @@ xml_parser_iteration (struct _xml_sax_state *sax, } return TRUE; -} \ No newline at end of file +} From 264055f3c0f44e9a9779a3b5e97b3ff2de8bba23 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 14 May 2021 14:30:11 +0200 Subject: [PATCH 3/6] Fix signedness warnings in gio/gwin32appinfo.c gio/gwin32appinfo.c: In function 'uwp_package_cb': gio/gwin32appinfo.c:3383:17: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'} for (i = 0; i < supported_extgroups->len; i++) ^ gio/gwin32appinfo.c:3389:29: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'} for (i_ext = 0; i_ext < grp->extensions->len; i_ext++) ^ gio/gwin32appinfo.c:3430:35: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'} for (i_verb = 0; i_verb < grp->verbs->len; i_verb++) ^ gio/gwin32appinfo.c:3463:33: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'} for (i_hverb = 0; i_hverb < ext->verbs->len; i_hverb++) ^ gio/gwin32appinfo.c:3478:17: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'} for (i = 0; i < supported_protocols->len; i++) ^ gio/gwin32appinfo.c:3541:33: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'} for (i_hverb = 0; i_hverb < url->verbs->len; i_hverb++) ^ gio/gwin32appinfo.c: In function 'g_win32_app_info_launch_internal': gio/gwin32appinfo.c:4799:37: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'} for (p_index = 0; p_index <= g_strv_length (envp); p_index++) ^~ --- gio/gwin32appinfo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gio/gwin32appinfo.c b/gio/gwin32appinfo.c index 3dc35d99a..38719c4c0 100644 --- a/gio/gwin32appinfo.c +++ b/gio/gwin32appinfo.c @@ -3359,7 +3359,7 @@ uwp_package_cb (gpointer user_data, GPtrArray *supported_extgroups, GPtrArray *supported_protocols) { - gint i, i_verb, i_ext; + guint i, i_verb, i_ext; gint extensions_considered; GWin32AppInfoApplication *app; gchar *app_user_model_id_u8; @@ -3459,7 +3459,7 @@ uwp_package_cb (gpointer user_data, */ while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &ext)) { - gint i_hverb; + guint i_hverb; if (!ext) continue; @@ -3537,7 +3537,7 @@ uwp_package_cb (gpointer user_data, while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &url)) { - gint i_hverb; + guint i_hverb; if (!url) continue; @@ -4788,7 +4788,7 @@ g_win32_app_info_launch_internal (GWin32AppInfo *info, if (apppath) { gchar **p; - gint p_index; + gsize p_index; for (p = envp, p_index = 0; p[0]; p++, p_index++) if ((p[0][0] == 'p' || p[0][0] == 'P') && From 8c35109a2162d263c14c2270e2df1950e380978d Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 4 Nov 2021 21:48:31 +0100 Subject: [PATCH 4/6] Fix signedness warnings in glib/gutf8.c glib/gutf8.c: In function 'g_utf8_get_char_extended': glib/gutf8.c:626:39: error: comparison of integer expressions of different signedness: 'guint' {aka 'unsigned int'} and 'gssize' {aka 'int'} 626 | if (G_UNLIKELY (max_len >= 0 && len > max_len)) | ^ glib/gmacros.h:1091:27: note: in definition of macro 'G_UNLIKELY' 1091 | #define G_UNLIKELY(expr) (expr) | ^~~~ glib/gutf8.c:628:21: error: comparison of integer expressions of different signedness: 'guint' {aka 'unsigned int'} and 'gssize' {aka 'int'} 628 | for (i = 1; i < max_len; i++) | ^ --- glib/gutf8.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glib/gutf8.c b/glib/gutf8.c index 7d053540d..52e593d93 100644 --- a/glib/gutf8.c +++ b/glib/gutf8.c @@ -574,7 +574,7 @@ static inline gunichar g_utf8_get_char_extended (const gchar *p, gssize max_len) { - guint i, len; + gsize i, len; gunichar min_code; gunichar wc = (guchar) *p; const gunichar partial_sequence = (gunichar) -2; @@ -623,9 +623,9 @@ g_utf8_get_char_extended (const gchar *p, return malformed_sequence; } - if (G_UNLIKELY (max_len >= 0 && len > max_len)) + if (G_UNLIKELY (max_len >= 0 && len > (gsize) max_len)) { - for (i = 1; i < max_len; i++) + for (i = 1; i < (gsize) max_len; i++) { if ((((guchar *)p)[i] & 0xc0) != 0x80) return malformed_sequence; From dea0ec3df61f93a21479741a7cd4b7fc88261cfb Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 4 Nov 2021 22:05:30 +0100 Subject: [PATCH 5/6] Fix signedness warning in gio/ginputstream.c gio/ginputstream.c: In function 'g_input_stream_real_skip': gio/ginputstream.c:433:31: error: comparison of integer expressions of different signedness: 'goffset' {aka 'long long int'} and 'long long unsigned int' 433 | (start + count) > (guint64) end) | ^ --- gio/ginputstream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gio/ginputstream.c b/gio/ginputstream.c index a40c7d9c4..8fda2693c 100644 --- a/gio/ginputstream.c +++ b/gio/ginputstream.c @@ -429,8 +429,8 @@ g_input_stream_real_skip (GInputStream *stream, end = g_seekable_tell (seekable); g_assert (start >= 0); g_assert (end >= start); - if ((guint64) start > (G_MAXSIZE - count) || - (start + count) > (guint64) end) + if (start > (goffset) (G_MAXOFFSET - count) || + (goffset) (start + count) > end) { stream->priv->pending = TRUE; return end - start; From 22037bfab2be055adfdedcc7164dfef9ab6adffa Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 4 Nov 2021 22:40:43 +0100 Subject: [PATCH 6/6] Fix set but unused parameter warning in gio/tests/gio-du.c gio/tests/gio-du.c: In function 'main': gio/tests/gio-du.c:74:11: error: parameter 'argc' set but not used 74 | main (int argc, char **argv) | ~~~~^~~~ --- gio/tests/gio-du.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gio/tests/gio-du.c b/gio/tests/gio-du.c index 58d1797d2..253a21f70 100644 --- a/gio/tests/gio-du.c +++ b/gio/tests/gio-du.c @@ -79,7 +79,6 @@ main (int argc, char **argv) #ifdef G_OS_WIN32 argv = g_win32_get_command_line (); - argc = g_strv_length (argv); #endif setlocale (LC_ALL, "");