mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
Fix signedness warnings in tests/gio-test.c
tests/gio-test.c: In function ‘recv_message’: tests/gio-test.c:172:24: error: comparison of unsigned expression in ‘>= 0’ is always true 172 | g_assert (nbytes >= 0 && nbytes < BUFSIZE); | ^~ glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’ 941 | #define G_LIKELY(expr) (expr) | ^~~~ tests/gio-test.c:172:7: note: in expansion of macro ‘g_assert’ 172 | g_assert (nbytes >= 0 && nbytes < BUFSIZE); | ^~~~~~~~ tests/gio-test.c:188:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 188 | for (j = 0; j < nbytes; j++) | ^ tests/gio-test.c:189:30: error: comparison of integer expressions of different signedness: ‘char’ and ‘guint’ {aka ‘unsigned int’} 189 | g_assert (buf[j] == ' ' + ((nbytes + j) % 95)); | ^~ glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’ 941 | #define G_LIKELY(expr) (expr) | ^~~~ tests/gio-test.c:189:13: note: in expansion of macro ‘g_assert’ 189 | g_assert (buf[j] == ' ' + ((nbytes + j) % 95)); | ^~~~~~~~
This commit is contained in:
parent
4d3c741ddb
commit
1d02b96655
@ -130,7 +130,8 @@ recv_message (GIOChannel *channel,
|
||||
char buf[BUFSIZE];
|
||||
guint nbytes;
|
||||
guint nb;
|
||||
int i, j, seq;
|
||||
guint j;
|
||||
int i, seq;
|
||||
GIOError error;
|
||||
|
||||
error = read_all (fd, channel, (gchar *) &seq, sizeof (seq), &nb);
|
||||
@ -169,7 +170,7 @@ recv_message (GIOChannel *channel,
|
||||
g_assert (nb == sizeof (nbytes));
|
||||
|
||||
g_assert_cmpint (nbytes, <, BUFSIZE);
|
||||
g_assert (nbytes >= 0 && nbytes < BUFSIZE);
|
||||
g_assert (nbytes < BUFSIZE);
|
||||
g_debug ("gio-test: ...from %d: %d bytes", fd, nbytes);
|
||||
if (nbytes > 0)
|
||||
{
|
||||
@ -186,7 +187,7 @@ recv_message (GIOChannel *channel,
|
||||
}
|
||||
|
||||
for (j = 0; j < nbytes; j++)
|
||||
g_assert (buf[j] == ' ' + ((nbytes + j) % 95));
|
||||
g_assert (buf[j] == ' ' + (char) ((nbytes + j) % 95));
|
||||
g_debug ("gio-test: ...from %d: OK", fd);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user