From 7b78f0b8ced550edde0a1b6277b9c8ee37a1a82f Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 4 May 2021 16:11:33 +0200 Subject: [PATCH 1/7] Fix signedness warnings in tests/gobject/performance-threaded.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I did it wrong last time... my bad... tests/gobject/performance-threaded.c: In function ‘main’: tests/gobject/performance-threaded.c:361:21: warning: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’ 361 | for (k = 1; k < argc; k++) | ^ --- tests/gobject/performance-threaded.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/gobject/performance-threaded.c b/tests/gobject/performance-threaded.c index 897372e9b..6a04ba0fd 100644 --- a/tests/gobject/performance-threaded.c +++ b/tests/gobject/performance-threaded.c @@ -357,7 +357,7 @@ main (int argc, if (argc > 1) { - gsize k; + int k; for (k = 1; k < argc; k++) { test = find_test (argv[k]); From 026611b5a9ee9e0e51e255cfcf4b5bfd61f5f47b Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 20 Nov 2020 22:03:14 +0100 Subject: [PATCH 2/7] Fix several signedness warnings in tests/slice-threadinit.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/slice-threadinit.c: In function ‘main’: tests/slice-threadinit.c:77:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 77 | for (j = 0; j < N_MAGAZINE_PROBES; j++) | ^ tests/slice-threadinit.c:108:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 108 | for (j = 0; j < N_MAGAZINE_PROBES; j++) | ^ tests/slice-threadinit.c:113:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 113 | for (j = 0; j < N_MAGAZINE_PROBES; j++) | ^ tests/slice-threadinit.c:131:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 131 | for (j = 0; j < N_MAGAZINE_PROBES; j++) | ^ tests/slice-threadinit.c:139:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 139 | for (j = 0; j < N_MAGAZINE_PROBES; j++) | ^ tests/slice-threadinit.c:161:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 161 | for (j = 0; j < N_MAGAZINE_PROBES; j++) | ^ --- tests/slice-threadinit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/slice-threadinit.c b/tests/slice-threadinit.c index f29dcbed1..30b186147 100644 --- a/tests/slice-threadinit.c +++ b/tests/slice-threadinit.c @@ -70,7 +70,7 @@ int main (int argc, char *argv[]) { - int j, n_pages = 0; + gsize j, n_pages = 0; void *mps[N_MAGAZINE_PROBES]; /* probe some magazine sizes */ From 249f46ac76549a7e2a3ba0032ca0aa09f7832932 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 20 Nov 2020 22:11:02 +0100 Subject: [PATCH 3/7] Fix signedness warning in tests/timeloop.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/timeloop.c: In function ‘read_all’: tests/timeloop.c:41:21: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’ 41 | while (bytes_read < len) | ^ tests/timeloop.c: In function ‘write_all’: tests/timeloop.c:65:24: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’ 65 | while (bytes_written < len) | ^ --- tests/timeloop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/timeloop.c b/tests/timeloop.c index 8b5aa3641..40064a140 100644 --- a/tests/timeloop.c +++ b/tests/timeloop.c @@ -32,7 +32,7 @@ io_pipe (GIOChannel **channels) } static gboolean -read_all (GIOChannel *channel, char *buf, int len) +read_all (GIOChannel *channel, char *buf, gsize len) { gsize bytes_read = 0; gsize count; @@ -56,7 +56,7 @@ read_all (GIOChannel *channel, char *buf, int len) } static gboolean -write_all (GIOChannel *channel, char *buf, int len) +write_all (GIOChannel *channel, char *buf, gsize len) { gsize bytes_written = 0; gsize count; From 65d93a16ab7c9ec5ba54ad60831f1599c58c7612 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 20 Nov 2020 22:18:19 +0100 Subject: [PATCH 4/7] Fix several signedness warnings in tests/testglib.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/testglib.c: In function ‘glist_test’: tests/testglib.c:90:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 90 | if (*((gint*) t->data) != (9 - i)) | ^~ tests/testglib.c:95:54: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 95 | if (g_list_position (list, g_list_nth (list, i)) != i) | ^~ tests/testglib.c:112:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 112 | if (*((gint*) t->data) != i) | ^~ tests/testglib.c:130:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 130 | if (*((gint*) t->data) != (9 - i)) | ^~ tests/testglib.c:150:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 150 | if (*((gint*) t->data) != (9 - i)) | ^~ tests/testglib.c: In function ‘gslist_test’: tests/testglib.c:170:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 170 | if (*((gint*) st->data) != (9 - i)) | ^~ tests/testglib.c:188:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 188 | if (*((gint*) st->data) != i) | ^~ tests/testglib.c:206:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 206 | if (*((gint*) st->data) != (9 - i)) | ^~ tests/testglib.c:226:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 226 | if (*((gint*) st->data) != (9 - i)) | ^~ --- tests/testglib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testglib.c b/tests/testglib.c index 86c807922..926010e5d 100644 --- a/tests/testglib.c +++ b/tests/testglib.c @@ -78,7 +78,7 @@ static void glist_test (void) { GList *list = NULL; - guint i; + gint i; for (i = 0; i < 10; i++) list = g_list_append (list, &test_nums[i]); @@ -158,7 +158,7 @@ static void gslist_test (void) { GSList *slist = NULL; - guint i; + gint i; for (i = 0; i < 10; i++) slist = g_slist_append (slist, &test_nums[i]); From 4d3c741ddb2f9bddb6e1a78c24b42d28f57660bd Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 20 Nov 2020 22:28:07 +0100 Subject: [PATCH 5/7] Fix several signedness warnings in tests/testglib.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/testglib.c: In function ‘gnode_test’: tests/testglib.c:302:34: error: comparison of integer expressions of different signedness: ‘char’ and ‘guint’ {aka ‘unsigned int’} 302 | g_assert (P2C (node->data) == ('C' + i)); | ^~ glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’ 941 | #define G_LIKELY(expr) (expr) | ^~~~ tests/testglib.c:302:7: note: in expansion of macro ‘g_assert’ 302 | g_assert (P2C (node->data) == ('C' + i)); | ^~~~~~~~ tests/testglib.c:306:76: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 306 | g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i); | ^~ glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’ 941 | #define G_LIKELY(expr) (expr) | ^~~~ tests/testglib.c:306:5: note: in expansion of macro ‘g_assert’ 306 | g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i); | ^~~~~~~~ tests/testglib.c: In function ‘test_arrays’: tests/testglib.c:1316:41: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 1316 | if (g_array_index (garray, gint, i) != i) | ^~ tests/testglib.c:1324:41: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 1324 | if (g_array_index (garray, gint, i) != (100 - i - 1)) | ^~ --- tests/testglib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/testglib.c b/tests/testglib.c index 926010e5d..071afdc1d 100644 --- a/tests/testglib.c +++ b/tests/testglib.c @@ -299,11 +299,11 @@ gnode_test (void) for (i = 0; i < g_node_n_children (node_B); i++) { node = g_node_nth_child (node_B, i); - g_assert (P2C (node->data) == ('C' + i)); + g_assert (P2C (node->data) == (gchar) ('C' + i)); } for (i = 0; i < g_node_n_children (node_G); i++) - g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i); + g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == (gint) i); /* we have built: A * / \ @@ -1313,7 +1313,7 @@ test_arrays (void) for (i = 0; i < 10000; i++) g_array_append_val (garray, i); for (i = 0; i < 10000; i++) - if (g_array_index (garray, gint, i) != i) + if (g_array_index (garray, gint, i) != (gint) i) g_error ("failure: %d ( %d )", g_array_index (garray, gint, i), i); g_array_free (garray, TRUE); @@ -1321,7 +1321,7 @@ test_arrays (void) for (i = 0; i < 100; i++) g_array_prepend_val (garray, i); for (i = 0; i < 100; i++) - if (g_array_index (garray, gint, i) != (100 - i - 1)) + if (g_array_index (garray, gint, i) != (gint) (100 - i - 1)) g_error ("failure: %d ( %d )", g_array_index (garray, gint, i), 100 - i - 1); g_array_free (garray, TRUE); } From 1d02b96655710a207173d26c726e8faeae9a06ba Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 20 Nov 2020 22:42:12 +0100 Subject: [PATCH 6/7] Fix signedness warnings in tests/gio-test.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/gio-test.c: In function ‘recv_message’: tests/gio-test.c:172:24: error: comparison of unsigned expression in ‘>= 0’ is always true 172 | g_assert (nbytes >= 0 && nbytes < BUFSIZE); | ^~ glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’ 941 | #define G_LIKELY(expr) (expr) | ^~~~ tests/gio-test.c:172:7: note: in expansion of macro ‘g_assert’ 172 | g_assert (nbytes >= 0 && nbytes < BUFSIZE); | ^~~~~~~~ tests/gio-test.c:188:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 188 | for (j = 0; j < nbytes; j++) | ^ tests/gio-test.c:189:30: error: comparison of integer expressions of different signedness: ‘char’ and ‘guint’ {aka ‘unsigned int’} 189 | g_assert (buf[j] == ' ' + ((nbytes + j) % 95)); | ^~ glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’ 941 | #define G_LIKELY(expr) (expr) | ^~~~ tests/gio-test.c:189:13: note: in expansion of macro ‘g_assert’ 189 | g_assert (buf[j] == ' ' + ((nbytes + j) % 95)); | ^~~~~~~~ --- tests/gio-test.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/gio-test.c b/tests/gio-test.c index deffa4d09..6c40632b3 100644 --- a/tests/gio-test.c +++ b/tests/gio-test.c @@ -130,7 +130,8 @@ recv_message (GIOChannel *channel, char buf[BUFSIZE]; guint nbytes; guint nb; - int i, j, seq; + guint j; + int i, seq; GIOError error; error = read_all (fd, channel, (gchar *) &seq, sizeof (seq), &nb); @@ -169,7 +170,7 @@ recv_message (GIOChannel *channel, g_assert (nb == sizeof (nbytes)); g_assert_cmpint (nbytes, <, BUFSIZE); - g_assert (nbytes >= 0 && nbytes < BUFSIZE); + g_assert (nbytes < BUFSIZE); g_debug ("gio-test: ...from %d: %d bytes", fd, nbytes); if (nbytes > 0) { @@ -186,7 +187,7 @@ recv_message (GIOChannel *channel, } for (j = 0; j < nbytes; j++) - g_assert (buf[j] == ' ' + ((nbytes + j) % 95)); + g_assert (buf[j] == ' ' + (char) ((nbytes + j) % 95)); g_debug ("gio-test: ...from %d: OK", fd); } } From 5299ee541ae2afba6c1795eaff78f05291f07711 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 20 Nov 2020 22:48:03 +0100 Subject: [PATCH 7/7] Fix signedness warning in tests/unicode-collate.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/unicode-collate.c: In function ‘main’: tests/unicode-collate.c:77:11: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 77 | if (argc > i) | ^ --- tests/unicode-collate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unicode-collate.c b/tests/unicode-collate.c index b276a2f67..8de3f60ca 100644 --- a/tests/unicode-collate.c +++ b/tests/unicode-collate.c @@ -74,7 +74,7 @@ int main (int argc, char **argv) } } - if (argc > i) + if (argc > (gint) i) { in = g_io_channel_new_file (argv[i], "r", &error); if (!in)