summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Fleury <emmanuel.fleury@gmail.com>2020-11-20 19:58:20 +0100
committerEmmanuel Fleury <emmanuel.fleury@gmail.com>2021-04-29 12:39:51 +0200
commita9652620045172cafd2f863df8b3260ccde6b469 (patch)
tree38b89977b1107483988311dbb88d9d1d9d0bd0bc
parent4669f91e0b12aed28f055de3550db4d020e4831c (diff)
downloadglib-a9652620045172cafd2f863df8b3260ccde6b469.tar.gz
Fix several signedness warnings in gio/tests/unix-streams.c
gio/tests/unix-streams.c: In function ‘test_write_async_wouldblock’: gio/tests/unix-streams.c:692:17: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’} 692 | for (i = 0; i < 4 * pipe_capacity; i++) | ^ gio/tests/unix-streams.c: In function ‘test_writev_async_wouldblock’: gio/tests/unix-streams.c:780:17: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’} 780 | for (i = 0; i < 4 * pipe_capacity; i++) | ^
-rw-r--r--gio/tests/unix-streams.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/gio/tests/unix-streams.c b/gio/tests/unix-streams.c
index 5ec829919..407a67dbd 100644
--- a/gio/tests/unix-streams.c
+++ b/gio/tests/unix-streams.c
@@ -474,8 +474,9 @@ test_write_wouldblock (void)
gint fd[2];
GError *err = NULL;
guint8 data_write[1024], data_read[1024];
- guint i;
- gint pipe_capacity;
+ gsize i;
+ int retval;
+ gsize pipe_capacity;
for (i = 0; i < sizeof (data_write); i++)
data_write[i] = i;
@@ -483,7 +484,9 @@ test_write_wouldblock (void)
g_assert_cmpint (pipe (fd), ==, 0);
g_assert_cmpint (fcntl (fd[0], F_SETPIPE_SZ, 4096, NULL), !=, 0);
- pipe_capacity = fcntl (fd[0], F_GETPIPE_SZ, &pipe_capacity, NULL);
+ retval = fcntl (fd[0], F_GETPIPE_SZ);
+ g_assert_cmpint (retval, >=, 0);
+ pipe_capacity = (gsize) retval;
g_assert_cmpint (pipe_capacity, >=, 4096);
g_assert_cmpint (pipe_capacity % 1024, >=, 0);
@@ -552,10 +555,11 @@ test_writev_wouldblock (void)
gint fd[2];
GError *err = NULL;
guint8 data_write[1024], data_read[1024];
- guint i;
+ gsize i;
+ int retval;
+ gsize pipe_capacity;
GOutputVector vectors[4];
GPollableReturn res;
- gint pipe_capacity;
for (i = 0; i < sizeof (data_write); i++)
data_write[i] = i;
@@ -563,7 +567,9 @@ test_writev_wouldblock (void)
g_assert_cmpint (pipe (fd), ==, 0);
g_assert_cmpint (fcntl (fd[0], F_SETPIPE_SZ, 4096, NULL), !=, 0);
- pipe_capacity = fcntl (fd[0], F_GETPIPE_SZ, &pipe_capacity, NULL);
+ retval = fcntl (fd[0], F_GETPIPE_SZ);
+ g_assert_cmpint (retval, >=, 0);
+ pipe_capacity = (gsize) retval;
g_assert_cmpint (pipe_capacity, >=, 4096);
g_assert_cmpint (pipe_capacity % 1024, >=, 0);
@@ -667,8 +673,9 @@ test_write_async_wouldblock (void)
GUnixOutputStream *os;
gint fd[2];
guint8 *data, *data_read;
- guint i;
- gint pipe_capacity;
+ gsize i;
+ int retval;
+ gsize pipe_capacity;
gsize bytes_written = 0, bytes_read = 0;
g_assert_cmpint (pipe (fd), ==, 0);
@@ -685,7 +692,9 @@ test_write_async_wouldblock (void)
g_unix_set_fd_nonblocking (fd[1], TRUE, NULL);
g_assert_cmpint (fcntl (fd[0], F_SETPIPE_SZ, 4096, NULL), !=, 0);
- pipe_capacity = fcntl (fd[0], F_GETPIPE_SZ, &pipe_capacity, NULL);
+ retval = fcntl (fd[0], F_GETPIPE_SZ);
+ g_assert_cmpint (retval, >=, 0);
+ pipe_capacity = (gsize) retval;
g_assert_cmpint (pipe_capacity, >=, 4096);
data = g_new (guint8, 4 * pipe_capacity);
@@ -754,8 +763,9 @@ test_writev_async_wouldblock (void)
GUnixOutputStream *os;
gint fd[2];
guint8 *data, *data_read;
- guint i;
- gint pipe_capacity;
+ gsize i;
+ int retval;
+ gsize pipe_capacity;
gsize bytes_written = 0, bytes_read = 0;
GOutputVector vectors[4];
@@ -773,7 +783,9 @@ test_writev_async_wouldblock (void)
g_unix_set_fd_nonblocking (fd[1], TRUE, NULL);
g_assert_cmpint (fcntl (fd[0], F_SETPIPE_SZ, 4096, NULL), !=, 0);
- pipe_capacity = fcntl (fd[0], F_GETPIPE_SZ, &pipe_capacity, NULL);
+ retval = fcntl (fd[0], F_GETPIPE_SZ);
+ g_assert_cmpint (retval, >=, 0);
+ pipe_capacity = (gsize) retval;
g_assert_cmpint (pipe_capacity, >=, 4096);
data = g_new (guint8, 4 * pipe_capacity);