mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 19:36:18 +01:00
Fix signedness warnings in glib/tests/queue.c
glib/tests/queue.c: In function ‘check_integrity’: glib/tests/queue.c:36:15: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 36 | g_assert (n == queue->length); | ^~ glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’ 939 | #define G_LIKELY(expr) (expr) | ^~~~ glib/tests/queue.c:36:3: note: in expansion of macro ‘g_assert’ 36 | g_assert (n == queue->length); | ^~~~~~~~ glib/tests/queue.c:47:15: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 47 | g_assert (n == queue->length); | ^~ glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’ 939 | #define G_LIKELY(expr) (expr) | ^~~~ glib/tests/queue.c:47:3: note: in expansion of macro ‘g_assert’ 47 | g_assert (n == queue->length); | ^~~~~~~~ glib/tests/queue.c: In function ‘random_test’: glib/tests/queue.c:274:36: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ 274 | g_assert (qinf->length == l); | ^~ glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’ 939 | #define G_LIKELY(expr) (expr) | ^~~~ glib/tests/queue.c:274:13: note: in expansion of macro ‘g_assert’ 274 | g_assert (qinf->length == l); | ^~~~~~~~ glib/tests/queue.c:419:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 419 | if (n == q->length - 1) | ^~ glib/tests/queue.c:425:31: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 425 | if (n >= 0 && n < q->length) | ^ glib/tests/queue.c:453:30: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 453 | if (n < 0 || n >= q->length) | ^~ glib/tests/queue.c:640:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 640 | if (n == g_queue_get_length (q) - 1) | ^~
This commit is contained in:
parent
9464721324
commit
a1758820d7
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user