[glib: 5/8] Fix several signedness warnings in glib/tests/sequence.c
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 5/8] Fix several signedness warnings in glib/tests/sequence.c
- Date: Tue, 17 Nov 2020 17:20:02 +0000 (UTC)
commit 89729bcd28707514ada0a5c54ebe27f940ea5abb
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date: Sat Nov 14 13:40:19 2020 +0100
Fix several signedness warnings in glib/tests/sequence.c
glib/tests/sequence.c: In function ‘check_integrity’:
glib/tests/sequence.c:139:27: error: comparison of integer expressions of different signedness: ‘int’ and
‘guint’ {aka ‘unsigned int’}
139 | g_assert (info->n_items == g_queue_get_length (info->queue));
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
glib/tests/sequence.c:139:3: note: in expansion of macro ‘g_assert’
139 | g_assert (info->n_items == g_queue_get_length (info->queue));
| ^~~~~~~~
glib/tests/sequence.c:157:27: error: comparison of integer expressions of different signedness: ‘int’ and
‘guint’ {aka ‘unsigned int’}
157 | g_assert (info->n_items == g_queue_get_length (info->queue));
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
glib/tests/sequence.c:157:3: note: in expansion of macro ‘g_assert’
157 | g_assert (info->n_items == g_queue_get_length (info->queue));
| ^~~~~~~~
glib/tests/sequence.c: In function ‘run_random_tests’:
glib/tests/sequence.c:554:55: error: comparison of integer expressions of different signedness: ‘guint’
{aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
554 | g_assert (g_queue_get_length (seq->queue) == g_sequence_get_length (seq->sequence));
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
glib/tests/sequence.c:554:13: note: in expansion of macro ‘g_assert’
554 | g_assert (g_queue_get_length (seq->queue) == g_sequence_get_length (seq->sequence));
| ^~~~~~~~
glib/tests/sequence.c: In function ‘main’:
glib/tests/sequence.c:1404:17: error: comparison of integer expressions of different signedness: ‘gint’
{aka ‘int’} and ‘long unsigned int’
1404 | for (i = 0; i < G_N_ELEMENTS (seeds); ++i)
| ^
glib/tests/sequence.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/glib/tests/sequence.c b/glib/tests/sequence.c
index db7d2a559..c2eba2c79 100644
--- a/glib/tests/sequence.c
+++ b/glib/tests/sequence.c
@@ -15,7 +15,7 @@ struct _GSequence
struct _GSequenceNode
{
- gint n_nodes;
+ guint n_nodes;
GSequenceNode * parent;
GSequenceNode * left;
GSequenceNode * right;
@@ -99,7 +99,7 @@ typedef struct SequenceInfo
{
GQueue * queue;
GSequence * sequence;
- int n_items;
+ guint n_items;
} SequenceInfo;
typedef struct
@@ -137,7 +137,7 @@ check_integrity (SequenceInfo *info)
g_sequence_get_length (info->sequence), info->n_items);
#endif
g_assert (info->n_items == g_queue_get_length (info->queue));
- g_assert (g_sequence_get_length (info->sequence) == info->n_items);
+ g_assert ((guint) g_sequence_get_length (info->sequence) == info->n_items);
iter = g_sequence_get_begin_iter (info->sequence);
list = info->queue->head;
@@ -155,7 +155,7 @@ check_integrity (SequenceInfo *info)
}
g_assert (info->n_items == g_queue_get_length (info->queue));
- g_assert (g_sequence_get_length (info->sequence) == info->n_items);
+ g_assert ((guint) g_sequence_get_length (info->sequence) == info->n_items);
}
static gpointer
@@ -551,7 +551,7 @@ run_random_tests (gconstpointer d)
{
int i;
- g_assert (g_queue_get_length (seq->queue) == g_sequence_get_length (seq->sequence));
+ g_assert (g_queue_get_length (seq->queue) == (guint) g_sequence_get_length (seq->sequence));
for (i = 0; i < 10; ++i)
{
@@ -1387,7 +1387,7 @@ int
main (int argc,
char **argv)
{
- gint i;
+ gsize i;
guint32 seed;
gchar *path;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]