From e80114311001e86ae5761d95cf234739642c5fea Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 10:23:36 +0200 Subject: [PATCH 01/14] Fix signedness warning in glib/test/tree.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/tree.c: In function ‘test_tree_traverse’: glib/tests/tree.c:394:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 394 | for (i = 0; i < G_N_ELEMENTS (orders); i++) | ^ --- glib/tests/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/tree.c b/glib/tests/tree.c index 5bf7bd368..8811d962d 100644 --- a/glib/tests/tree.c +++ b/glib/tests/tree.c @@ -333,7 +333,7 @@ static void test_tree_traverse (void) { GTree *tree; - gint i; + gsize i; TraverseData orders[] = { { G_IN_ORDER, -1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" }, { G_IN_ORDER, 1, "0" }, From b3244bee0c5a49e7fd8cded288824e6e68bf843b Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 10:26:07 +0200 Subject: [PATCH 02/14] Fix signedness warning in glib/tests/hash.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/hash.c: In function ‘test_hash_misc’: glib/tests/hash.c:616:43: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 616 | if (values_len != keys_len && keys_len != g_hash_table_size (hash_table)) | ^~ --- glib/tests/hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/hash.c b/glib/tests/hash.c index 6b0197101..4623d18d1 100644 --- a/glib/tests/hash.c +++ b/glib/tests/hash.c @@ -591,7 +591,7 @@ test_hash_misc (void) gint value = 120; gint *pvalue; GList *keys, *values; - gint keys_len, values_len; + gsize keys_len, values_len; GHashTableIter iter; gpointer ikey, ivalue; int result_array[10000]; From 8fc0080b5ea01c72ae64bd7ffaf69cc0e33fe9d4 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 10:29:44 +0200 Subject: [PATCH 03/14] Fix signedness warnings in glib/tests/logging.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/logging.c: In function ‘compare_fields’: glib/tests/logging.c:403:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} 403 | for (i = 0; i < n1; i++) | ^ glib/tests/logging.c:405:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} 405 | for (j = 0; j < n2; j++) | ^ glib/tests/logging.c:410:13: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} 410 | if (j == n2) | ^~ --- glib/tests/logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/logging.c b/glib/tests/logging.c index f16503ad1..096fe4467 100644 --- a/glib/tests/logging.c +++ b/glib/tests/logging.c @@ -398,7 +398,7 @@ compare_field (const GLogField *f1, const GLogField *f2) static gboolean compare_fields (const GLogField *f1, gsize n1, const GLogField *f2, gsize n2) { - int i, j; + gsize i, j; for (i = 0; i < n1; i++) { From fbb492b3eb9d80d4d438e315bcc4da50df97544a Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 10:32:35 +0200 Subject: [PATCH 04/14] Fix signedness warning in glib/tests/node.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/node.c: In function ‘traversal_test’: glib/tests/node.c:214:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 214 | for (i = 0; i < G_N_ELEMENTS (orders); i++) | ^ --- glib/tests/node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/node.c b/glib/tests/node.c index a62b95fe3..22e80233f 100644 --- a/glib/tests/node.c +++ b/glib/tests/node.c @@ -168,7 +168,7 @@ traversal_test (void) { G_LEVEL_ORDER, G_TRAVERSE_ALL, 3, 7, "ABFCDEG" }, { G_LEVEL_ORDER, G_TRAVERSE_ALL, 3, 8, "ABFCDEG" }, }; - gint i; + gsize i; CallbackData data; root = g_node_new (C2P ('A')); From d15260ee6989d3c6d6e403e7dca76fddef557132 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 10:36:36 +0200 Subject: [PATCH 05/14] Fix signedness warnings in glib/tests/markup-escape.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/markup-escape.c: In function ‘main’: glib/tests/markup-escape.c:152:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 152 | for (i = 0; i < G_N_ELEMENTS (escape_tests); i++) | ^ ../glib.git/glib/tests/markup-escape.c:159:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 159 | for (i = 0; i < G_N_ELEMENTS (unichar_tests); i++) | ^ --- glib/tests/markup-escape.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glib/tests/markup-escape.c b/glib/tests/markup-escape.c index 2d5de854d..44290fed9 100644 --- a/glib/tests/markup-escape.c +++ b/glib/tests/markup-escape.c @@ -144,21 +144,21 @@ format_test (void) int main (int argc, char **argv) { - gint i; + gsize i; gchar *path; g_test_init (&argc, &argv, NULL); for (i = 0; i < G_N_ELEMENTS (escape_tests); i++) { - path = g_strdup_printf ("/markup/escape-text/%d", i); + path = g_strdup_printf ("/markup/escape-text/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &escape_tests[i], escape_test); g_free (path); } for (i = 0; i < G_N_ELEMENTS (unichar_tests); i++) { - path = g_strdup_printf ("/markup/escape-unichar/%d", i); + path = g_strdup_printf ("/markup/escape-unichar/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &unichar_tests[i], unichar_test); g_free (path); } From 700a9d4042661df1eb098911e9f8932bec39ca69 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 11:12:03 +0200 Subject: [PATCH 06/14] Fix signedness warnings in glib/tests/once.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/once.c: In function ‘test_once_init_multi_threaded’: glib/tests/once.c:183:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 183 | for (i = 0; i < G_N_ELEMENTS (threads); i++) | ^ glib/tests/once.c:186:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 186 | for (i = 0; i < G_N_ELEMENTS (threads); i++) | ^ --- glib/tests/once.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/once.c b/glib/tests/once.c index c34156173..8fc8d5014 100644 --- a/glib/tests/once.c +++ b/glib/tests/once.c @@ -173,7 +173,7 @@ thread_func (gpointer data) static void test_once_init_multi_threaded (void) { - gint i; + gsize i; GThread *threads[THREADS]; g_test_summary ("Test g_once_init_{enter,leave}() usage from multiple threads"); From be5d48fe7700b892acc40415f85e59f82685882d Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 11:39:04 +0200 Subject: [PATCH 07/14] Fix various warnings in glib/tests/gvariant.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/gvariant.c: In function ‘append_tuple_type_string’: glib/tests/gvariant.c:206:17: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’} 206 | for (i = 0; i < size; i++) | ^ glib/tests/gvariant.c:210:13: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’ 210 | if (i < size - 1) | ^ glib/tests/gvariant.c:223:17: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’} 223 | for (i = 0; i < size; i++) | ^ glib/tests/gvariant.c: In function ‘describe_type’: glib/tests/gvariant.c:386:29: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’} 386 | for (i = 0; i < length; i++) | ^ glib/tests/gvariant.c: In function ‘describe_info’: glib/tests/gvariant.c:882:23: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’} 882 | for (i = 0; i < length; i++) | ^ glib/tests/gvariant.c: In function ‘check_offsets’: glib/tests/gvariant.c:962:21: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’} 962 | for (i = 0; i < length; i++) | ^ glib/tests/gvariant.c: In function ‘tree_instance_check_gvariant’: glib/tests/gvariant.c:2636:44: error: comparison of integer expressions of different signedness: ‘gboolean’ {aka ‘int’} and ‘guint64’ {aka ‘long unsigned int’} 2636 | return g_variant_get_boolean (value) == tree->data.integer; | ^~ glib/tests/gvariant.c: In function ‘test_varargs’: glib/tests/gvariant.c:3090:26: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 3090 | g_assert_true (val == i++ || val == 0); | ^~ --- glib/tests/gvariant.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c index 3905e20bc..fd852a34b 100644 --- a/glib/tests/gvariant.c +++ b/glib/tests/gvariant.c @@ -194,8 +194,7 @@ append_tuple_type_string (GString *string, { GVariantType *result, *other_result; GVariantType **types; - gint size; - gsize i; + gsize i, size; g_string_append_c (string, '('); g_string_append (description, "t of ["); @@ -376,8 +375,7 @@ describe_type (const GVariantType *type) { const GVariantType *sub; GString *string; - gint length; - gsize i; + gsize i, length; string = g_string_new ("t of ["); @@ -873,8 +871,7 @@ describe_info (GVariantTypeInfo *info) { const gchar *sep = ""; GString *string; - gint length; - gsize i; + gsize i, length; string = g_string_new ("t of ["); length = g_variant_type_info_n_members (info); @@ -935,11 +932,10 @@ static void check_offsets (GVariantTypeInfo *info, const GVariantType *type) { - gsize flavour; - gint length; + gsize flavour, length; length = g_variant_type_info_n_members (info); - g_assert_cmpint (length, ==, g_variant_type_n_items (type)); + g_assert_cmpuint (length, ==, g_variant_type_n_items (type)); /* the 'flavour' is the low order bits of the ending point of * variable-size items in the tuple. this lets us test that the type @@ -2637,7 +2633,7 @@ tree_instance_check_gvariant (TreeInstance *tree, break; case 'b': - return g_variant_get_boolean (value) == tree->data.integer; + return g_variant_get_boolean (value) == (gboolean) tree->data.integer; case 'y': return g_variant_get_byte (value) == (guchar) tree->data.integer; @@ -3091,7 +3087,7 @@ test_varargs (void) i = 0; g_variant_iter_init (&iter, value); while (g_variant_iter_loop (&iter, "mi", NULL, &val)) - g_assert_true (val == i++ || val == 0); + g_assert_true (val == (gint) i++ || val == 0); g_assert_cmpuint (i, ==, 100); i = 0; From 76b84c5f6604c94bb0d13a5b6cad6873112a898b Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 11:44:43 +0200 Subject: [PATCH 08/14] Fix signedness warnings in glib/tests/pattern.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/pattern.c: In function ‘main’: glib/tests/pattern.c:218:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 218 | for (i = 0; i < G_N_ELEMENTS (compile_tests); i++) | ^ glib/tests/pattern.c:225:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 225 | for (i = 0; i < G_N_ELEMENTS (match_tests); i++) | ^ glib/tests/pattern.c:232:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 232 | for (i = 0; i < G_N_ELEMENTS (equal_tests); i++) | ^ --- glib/tests/pattern.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glib/tests/pattern.c b/glib/tests/pattern.c index 2f3f9e887..70553a882 100644 --- a/glib/tests/pattern.c +++ b/glib/tests/pattern.c @@ -210,28 +210,28 @@ test_equal (gconstpointer d) int main (int argc, char** argv) { - gint i; + gsize i; gchar *path; g_test_init (&argc, &argv, NULL); for (i = 0; i < G_N_ELEMENTS (compile_tests); i++) { - path = g_strdup_printf ("/pattern/compile/%d", i); + path = g_strdup_printf ("/pattern/compile/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &compile_tests[i], test_compilation); g_free (path); } for (i = 0; i < G_N_ELEMENTS (match_tests); i++) { - path = g_strdup_printf ("/pattern/match/%d", i); + path = g_strdup_printf ("/pattern/match/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &match_tests[i], test_match); g_free (path); } for (i = 0; i < G_N_ELEMENTS (equal_tests); i++) { - path = g_strdup_printf ("/pattern/equal/%d", i); + path = g_strdup_printf ("/pattern/equal/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &equal_tests[i], test_equal); g_free (path); } From 946472132430267f4fa835732a298d5ce59ebc9d Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 11:45:24 +0200 Subject: [PATCH 09/14] Fix signedness warning in glib/tests/protocol.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/protocol.c: In function ‘test_error’: glib/tests/protocol.c:252:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 252 | for (i = 0; i < G_N_ELEMENTS (tests); i++) | ^ --- glib/tests/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/protocol.c b/glib/tests/protocol.c index f1e969af3..27ebd99be 100644 --- a/glib/tests/protocol.c +++ b/glib/tests/protocol.c @@ -246,7 +246,7 @@ test_error (void) "/glib/testing/protocol/critical", "/glib/testing/protocol/error" }; - gint i; + gsize i; int messages = 0; for (i = 0; i < G_N_ELEMENTS (tests); i++) From a1758820d700bde333e7a550ba5608be730e285a Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 12:08:06 +0200 Subject: [PATCH 10/14] Fix signedness warnings in glib/tests/queue.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/queue.c: In function ‘check_integrity’: glib/tests/queue.c:36:15: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 36 | g_assert (n == queue->length); | ^~ glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’ 939 | #define G_LIKELY(expr) (expr) | ^~~~ glib/tests/queue.c:36:3: note: in expansion of macro ‘g_assert’ 36 | g_assert (n == queue->length); | ^~~~~~~~ glib/tests/queue.c:47:15: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 47 | g_assert (n == queue->length); | ^~ glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’ 939 | #define G_LIKELY(expr) (expr) | ^~~~ glib/tests/queue.c:47:3: note: in expansion of macro ‘g_assert’ 47 | g_assert (n == queue->length); | ^~~~~~~~ glib/tests/queue.c: In function ‘random_test’: glib/tests/queue.c:274:36: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ 274 | g_assert (qinf->length == l); | ^~ glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’ 939 | #define G_LIKELY(expr) (expr) | ^~~~ glib/tests/queue.c:274:13: note: in expansion of macro ‘g_assert’ 274 | g_assert (qinf->length == l); | ^~~~~~~~ glib/tests/queue.c:419:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 419 | if (n == q->length - 1) | ^~ glib/tests/queue.c:425:31: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 425 | if (n >= 0 && n < q->length) | ^ glib/tests/queue.c:453:30: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 453 | if (n < 0 || n >= q->length) | ^~ glib/tests/queue.c:640:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 640 | if (n == g_queue_get_length (q) - 1) | ^~ --- glib/tests/queue.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/glib/tests/queue.c b/glib/tests/queue.c index dd9dd2127..e77821372 100644 --- a/glib/tests/queue.c +++ b/glib/tests/queue.c @@ -14,7 +14,7 @@ check_integrity (GQueue *queue) GList *last; GList *links; GList *link; - gint n; + guint n; g_assert (queue->length < 4000000000u); @@ -266,7 +266,7 @@ random_test (gconstpointer d) break; case GET_LENGTH: { - int l; + guint l; l = g_queue_get_length (q); @@ -416,13 +416,13 @@ random_test (gconstpointer d) int n = get_random_position (q, TRUE); gpointer elm = g_queue_peek_nth (q, n); - if (n == q->length - 1) + if (n == (int) (q->length - 1)) qinf->tail = qinf->tail->prev; if (n == 0) qinf->head = qinf->head->next; - if (n >= 0 && n < q->length) + if (n >= 0 && (guint) n < q->length) qinf->length--; g_assert (elm == g_queue_pop_nth (q, n)); @@ -450,7 +450,7 @@ random_test (gconstpointer d) { GList *list; int n = get_random_position (q, TRUE); - if (n < 0 || n >= q->length) + if (n < 0 || (guint) n >= q->length) { g_assert (g_queue_peek_nth (q, n) == NULL); } @@ -637,7 +637,7 @@ random_test (gconstpointer d) { int n = get_random_position (q, FALSE); - if (n == g_queue_get_length (q) - 1) + if (n == (int) (g_queue_get_length (q) - 1)) qinf->tail = qinf->tail->prev; if (n == 0) From 101a6043300a7187c8e83f0683e267e363d57ccf Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 13:27:32 +0200 Subject: [PATCH 11/14] Fix signedness warnings in glib/tests/rcbox.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/rcbox.c: In function ‘test_rcbox_alignment’: glib/tests/rcbox.c:246:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 246 | for (i = 0; i < G_N_ELEMENTS (block_sizes); i++) | ^ glib/tests/rcbox.c: In function ‘test_atomic_rcbox_alignment’: glib/tests/rcbox.c:270:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 270 | for (i = 0; i < G_N_ELEMENTS (block_sizes); i++) | ^ --- glib/tests/rcbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glib/tests/rcbox.c b/glib/tests/rcbox.c index 73126c7ea..fe10075da 100644 --- a/glib/tests/rcbox.c +++ b/glib/tests/rcbox.c @@ -241,7 +241,7 @@ test_rcbox_alignment (void) sizeof (gint32) * 3, }; - int i; + gsize i; for (i = 0; i < G_N_ELEMENTS (block_sizes); i++) { @@ -265,7 +265,7 @@ test_atomic_rcbox_alignment (void) sizeof (gint32) * 3, }; - int i; + gsize i; for (i = 0; i < G_N_ELEMENTS (block_sizes); i++) { From cc041eb74201449a554ea4fc0d36f55b191fe007 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 13:30:19 +0200 Subject: [PATCH 12/14] Fix signedness warning in glib/tests/regex.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/regex.c: In function ‘test_match_all’: glib/tests/regex.c:1317:19: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 1317 | if (match_count != g_slist_length (data->expected)) | ^~ --- glib/tests/regex.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/glib/tests/regex.c b/glib/tests/regex.c index 1ea6f9288..d86d32f9b 100644 --- a/glib/tests/regex.c +++ b/glib/tests/regex.c @@ -1305,8 +1305,7 @@ test_match_all (gconstpointer d) GMatchInfo *match_info; GSList *l_exp; gboolean match_ok; - gint match_count; - gint i; + guint i, match_count; regex = g_regex_new (data->pattern, 0, 0, NULL); match_ok = g_regex_match_all (regex, data->string, 0, &match_info); @@ -1331,7 +1330,7 @@ test_match_all (gconstpointer d) matched_string = g_match_info_fetch (match_info, i); g_match_info_fetch_pos (match_info, i, &start, &end); - g_message ("%d. %d-%d '%s'", i, start, end, matched_string); + g_message ("%u. %d-%d '%s'", i, start, end, matched_string); g_free (matched_string); } @@ -1342,11 +1341,11 @@ test_match_all (gconstpointer d) { Match *exp = l_exp->data; - g_message ("%d. %d-%d '%s'", i, exp->start, exp->end, exp->string); + g_message ("%u. %d-%d '%s'", i, exp->start, exp->end, exp->string); i++; } - g_error ("match_count not as expected: %d != %d", + g_error ("match_count not as expected: %u != %d", match_count, g_slist_length (data->expected)); } From a7fdca46e7b91ef13475b3e97e56ea6f43a955be Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 13:34:33 +0200 Subject: [PATCH 13/14] Fix signedness warning in glib/tests/scannerapi.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/scannerapi.c: In function ‘test_scanner_tokens’: glib/tests/scannerapi.c:124:17: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘const int’} 124 | for (i = 1; i < tokbuflen; i++) | ^ --- glib/tests/scannerapi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glib/tests/scannerapi.c b/glib/tests/scannerapi.c index a8c6879d3..6813184cf 100644 --- a/glib/tests/scannerapi.c +++ b/glib/tests/scannerapi.c @@ -111,8 +111,8 @@ test_scanner_tokens (ScannerFixture *fix, gchar buf[] = "(\t\n\r\\){}"; const gint buflen = strlen (buf); gchar tokbuf[] = "(\\){}"; - const gint tokbuflen = strlen (tokbuf); - guint i; + const gsize tokbuflen = strlen (tokbuf); + gsize i; g_scanner_input_text (fix->scanner, buf, buflen); From d29270db6029b297277e77b73e55b70e9a23ca0e Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 13:48:20 +0200 Subject: [PATCH 14/14] Fix signedness warning in glib/tests/markup-collect.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/markup-collect.c: In function ‘main’: glib/tests/markup-collect.c:227:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 227 | for (i = 0; i < G_N_ELEMENTS (tests); i++) | ^ --- glib/tests/markup-collect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glib/tests/markup-collect.c b/glib/tests/markup-collect.c index dd9b1b4bd..86c12bb84 100644 --- a/glib/tests/markup-collect.c +++ b/glib/tests/markup-collect.c @@ -219,14 +219,14 @@ test_cleanup (void) int main (int argc, char **argv) { - int i; + gsize i; gchar *path; g_test_init (&argc, &argv, NULL); for (i = 0; i < G_N_ELEMENTS (tests); i++) { - path = g_strdup_printf ("/markup/collect/%d", i); + path = g_strdup_printf ("/markup/collect/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &tests[i], test_collect); g_free (path); }