diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c index 2308c38a7..1e30d3673 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; 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]; 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++) { diff --git a/glib/tests/markup-collect.c b/glib/tests/markup-collect.c index b796b4238..04b814b6c 100644 --- a/glib/tests/markup-collect.c +++ b/glib/tests/markup-collect.c @@ -220,14 +220,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); } 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); } 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')); 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"); 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); } 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++) 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) 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++) { 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)); } 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);