From be5d48fe7700b892acc40415f85e59f82685882d Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 11:39:04 +0200 Subject: [PATCH] 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;