Fix signedness warnings in glib/tests/option-context.c

glib/tests/option-context.c: In function ‘test_group_captions’:
glib/tests/option-context.c:123:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  123 |       for (j = 0; j < G_N_ELEMENTS (test_name_base); ++j)
      |                     ^

glib/tests/option-context.c: In function ‘option_context_parse_command_line’:
glib/tests/option-context.c:2364:46: error: operand of ‘?:’ changes signedness from ‘int’ to ‘guint’ {aka ‘unsigned int’} due to unsignedness of other operand
 2364 |   return success ? argv_len - argv_new_len : -1;
      |                                              ^~
This commit is contained in:
Emmanuel Fleury 2020-11-08 22:07:56 +01:00
parent 043cf25631
commit 75ba0e552d

View File

@ -111,7 +111,8 @@ test_group_captions (void)
{
const gchar *test_name_base[] = { "help", "help-all", "help-test" };
gchar *test_name;
gint i, j;
guint i;
gsize j;
g_test_bug ("504142");
@ -132,7 +133,7 @@ test_group_captions (void)
if (g_test_verbose ())
trap_flags |= G_TEST_SUBPROCESS_INHERIT_STDOUT | G_TEST_SUBPROCESS_INHERIT_STDERR;
test_name = g_strdup_printf ("/option/group/captions/subprocess/%s-%d",
test_name = g_strdup_printf ("/option/group/captions/subprocess/%s-%u",
test_name_base[j], i);
g_test_trap_subprocess (test_name, 0, trap_flags);
g_free (test_name);
@ -2361,7 +2362,7 @@ option_context_parse_command_line (GOptionContext *context,
argv_new_len = g_strv_length (argv);
g_strfreev (argv);
return success ? argv_len - argv_new_len : -1;
return success ? (gint) (argv_len - argv_new_len) : -1;
}
static void