[glib: 5/8] Fix several signedness warnings in gio/tests/contexts.c
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 5/8] Fix several signedness warnings in gio/tests/contexts.c
- Date: Mon, 5 Apr 2021 10:42:34 +0000 (UTC)
commit 8bcb2b9e7632d5e1e804dfbb545d7b58dd72450c
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date: Tue Nov 17 23:40:22 2020 +0100
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)
| ^
gio/tests/contexts.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gio/tests/contexts.c b/gio/tests/contexts.c
index c6dc26111..3b64c7622 100644
--- a/gio/tests/contexts.c
+++ b/gio/tests/contexts.c
@@ -360,7 +360,8 @@ test_context_specific_emit (void)
{
GThread *threads[N_THREADS];
gboolean exited = FALSE;
- guint i, n;
+ gsize i;
+ gint k, n;
for (i = 0; i < N_THREADS; 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 */
for (n = 0; n < 1000; n++)
{
- guint64 expiry;
+ gint64 expiry;
/* don't burn CPU forever */
expiry = g_get_monotonic_time () + 10 * G_TIME_SPAN_SECOND;
@@ -376,7 +377,7 @@ test_context_specific_emit (void)
g_atomic_int_set (¤t_value, n);
/* 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 ()));
for (i = 0; i < N_THREADS; i++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]