mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
Fix several signedness warnings in tests/testglib.c
tests/testglib.c: In function ‘gnode_test’: tests/testglib.c:302:34: error: comparison of integer expressions of different signedness: ‘char’ and ‘guint’ {aka ‘unsigned int’} 302 | g_assert (P2C (node->data) == ('C' + i)); | ^~ glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’ 941 | #define G_LIKELY(expr) (expr) | ^~~~ tests/testglib.c:302:7: note: in expansion of macro ‘g_assert’ 302 | g_assert (P2C (node->data) == ('C' + i)); | ^~~~~~~~ tests/testglib.c:306:76: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 306 | g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i); | ^~ glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’ 941 | #define G_LIKELY(expr) (expr) | ^~~~ tests/testglib.c:306:5: note: in expansion of macro ‘g_assert’ 306 | g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i); | ^~~~~~~~ tests/testglib.c: In function ‘test_arrays’: tests/testglib.c:1316:41: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 1316 | if (g_array_index (garray, gint, i) != i) | ^~ tests/testglib.c:1324:41: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 1324 | if (g_array_index (garray, gint, i) != (100 - i - 1)) | ^~
This commit is contained in:
parent
65d93a16ab
commit
4d3c741ddb
@ -299,11 +299,11 @@ gnode_test (void)
|
||||
for (i = 0; i < g_node_n_children (node_B); i++)
|
||||
{
|
||||
node = g_node_nth_child (node_B, i);
|
||||
g_assert (P2C (node->data) == ('C' + i));
|
||||
g_assert (P2C (node->data) == (gchar) ('C' + i));
|
||||
}
|
||||
|
||||
for (i = 0; i < g_node_n_children (node_G); i++)
|
||||
g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i);
|
||||
g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == (gint) i);
|
||||
|
||||
/* we have built: A
|
||||
* / \
|
||||
@ -1313,7 +1313,7 @@ test_arrays (void)
|
||||
for (i = 0; i < 10000; i++)
|
||||
g_array_append_val (garray, i);
|
||||
for (i = 0; i < 10000; i++)
|
||||
if (g_array_index (garray, gint, i) != i)
|
||||
if (g_array_index (garray, gint, i) != (gint) i)
|
||||
g_error ("failure: %d ( %d )", g_array_index (garray, gint, i), i);
|
||||
g_array_free (garray, TRUE);
|
||||
|
||||
@ -1321,7 +1321,7 @@ test_arrays (void)
|
||||
for (i = 0; i < 100; i++)
|
||||
g_array_prepend_val (garray, i);
|
||||
for (i = 0; i < 100; i++)
|
||||
if (g_array_index (garray, gint, i) != (100 - i - 1))
|
||||
if (g_array_index (garray, gint, i) != (gint) (100 - i - 1))
|
||||
g_error ("failure: %d ( %d )", g_array_index (garray, gint, i), 100 - i - 1);
|
||||
g_array_free (garray, TRUE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user