Fix several signedness warnings in gio/tests/contexts.c

gio/tests/contexts.c: In function ‘test_context_specific_emit’:
gio/tests/contexts.c:379:21: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint32’ {aka ‘int’}
  379 |       for (i = 0; i < g_test_rand_int_range (1, 5); i++)
      |                     ^
gio/tests/contexts.c:383:55: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  383 |         while (g_atomic_int_get (&observed_values[i]) != n)
      |                                                       ^~
gio/tests/contexts.c:387:41: error: comparison of integer expressions of different signedness: ‘gint64’ {aka ‘long int’} and ‘guint64’ {aka ‘long unsigned int’}
  387 |             if (g_get_monotonic_time () > expiry)
      |                                         ^
This commit is contained in:
Emmanuel Fleury 2020-11-17 23:40:22 +01:00
parent a7d3ecca77
commit 8bcb2b9e76

View File

@ -360,7 +360,8 @@ test_context_specific_emit (void)
{ {
GThread *threads[N_THREADS]; GThread *threads[N_THREADS];
gboolean exited = FALSE; gboolean exited = FALSE;
guint i, n; gsize i;
gint k, n;
for (i = 0; i < N_THREADS; i++) for (i = 0; i < N_THREADS; i++)
threads[i] = g_thread_new ("test", test_emit_thread, &observed_values[i]); threads[i] = g_thread_new ("test", test_emit_thread, &observed_values[i]);
@ -368,7 +369,7 @@ test_context_specific_emit (void)
/* make changes and ensure that they are observed */ /* make changes and ensure that they are observed */
for (n = 0; n < 1000; n++) for (n = 0; n < 1000; n++)
{ {
guint64 expiry; gint64 expiry;
/* don't burn CPU forever */ /* don't burn CPU forever */
expiry = g_get_monotonic_time () + 10 * G_TIME_SPAN_SECOND; expiry = g_get_monotonic_time () + 10 * G_TIME_SPAN_SECOND;
@ -376,7 +377,7 @@ test_context_specific_emit (void)
g_atomic_int_set (&current_value, n); g_atomic_int_set (&current_value, n);
/* wake them to notice */ /* wake them to notice */
for (i = 0; i < g_test_rand_int_range (1, 5); i++) for (k = 0; k < g_test_rand_int_range (1, 5); k++)
g_context_specific_group_emit (&group, g_signal_lookup ("changed", per_thread_thing_get_type ())); g_context_specific_group_emit (&group, g_signal_lookup ("changed", per_thread_thing_get_type ()));
for (i = 0; i < N_THREADS; i++) for (i = 0; i < N_THREADS; i++)