From 29cd18b04441bdb528f8e4d96773e609f015cb1a Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 23:48:39 +0100 Subject: [PATCH 1/7] Fix several signedness warnings in gio/tests/converter-stream.c:test_converter_pollable() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/tests/converter-stream.c: In function ‘test_converter_pollable’: gio/tests/converter-stream.c:1077:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} 1077 | for (i = 0; i < expanded_size; i++) | ^ gio/tests/converter-stream.c:1086:16: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} 1086 | g_assert (i == expanded_size -1); | ^~ --- gio/tests/converter-stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/tests/converter-stream.c b/gio/tests/converter-stream.c index 45fb6a673..dac3da834 100644 --- a/gio/tests/converter-stream.c +++ b/gio/tests/converter-stream.c @@ -972,7 +972,7 @@ test_converter_pollable (void) GPollableOutputStream *pollable_out; GConverter *expander, *compressor; GError *error; - int i; + gsize i; expander = g_expander_converter_new (); expanded = g_malloc (100*1000); /* Large enough */ From d2c0fd468c7e8b1310ad80967bcb9391336a3f06 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 23:51:47 +0100 Subject: [PATCH 2/7] Fix several signedness warnings in gio/tests/converter-stream.c:test_compressor() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/tests/converter-stream.c: In function ‘test_compressor’: gio/tests/converter-stream.c:445:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} 445 | for (i = 0; i < expanded_size; i++) | ^ gio/tests/converter-stream.c:454:16: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} 454 | g_assert (i == expanded_size -1); | ^~ --- gio/tests/converter-stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/tests/converter-stream.c b/gio/tests/converter-stream.c index dac3da834..a00a9bd38 100644 --- a/gio/tests/converter-stream.c +++ b/gio/tests/converter-stream.c @@ -393,7 +393,7 @@ test_compressor (void) GOutputStream *mem_out, *cstream_out; GConverter *expander, *compressor; GError *error; - int i; + gsize i; expander = g_expander_converter_new (); expanded = g_malloc (100*1000); /* Large enough */ From cc1e7302f3dbe53e561ea8547559c7a99d31f29e Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 23:53:10 +0100 Subject: [PATCH 3/7] Fix signedness warning in gio/tests/converter-stream.c:test_expander() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/tests/converter-stream.c: In function ‘test_expander’: gio/tests/converter-stream.c:356:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 356 | for (i = 0; i < sizeof(unexpanded_data); i++) | ^ --- gio/tests/converter-stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/tests/converter-stream.c b/gio/tests/converter-stream.c index a00a9bd38..2c2a4ed01 100644 --- a/gio/tests/converter-stream.c +++ b/gio/tests/converter-stream.c @@ -297,7 +297,7 @@ test_expander (void) GConverter *expander; GConverter *converter; GError *error; - int i; + gsize i; expander = g_expander_converter_new (); From 56e25d81f6b5727c264ee9b100a77c6dc18d5ae6 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 23:56:30 +0100 Subject: [PATCH 4/7] Fix several signedness warnings in gio/tests/converter-stream.c:g_compressor_converter_convert() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/tests/converter-stream.c: In function ‘g_compressor_converter_convert’: gio/tests/converter-stream.c:234:23: error: comparison of integer expressions of different signedness: ‘long int’ and ‘gsize’ {aka ‘long unsigned int’} 234 | if (in_end - in < block_size) | ^ gio/tests/converter-stream.c:244:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} 244 | for (i = 0; i < block_size; i++) | ^ gio/tests/converter-stream.c:257:33: error: comparison of integer expressions of different signedness: ‘long int’ and ‘gsize’ {aka ‘long unsigned int’} 257 | if (v == 0 && in_end - in == block_size && (flags & G_CONVERTER_INPUT_AT_END) == 0) | ^~ --- gio/tests/converter-stream.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gio/tests/converter-stream.c b/gio/tests/converter-stream.c index 2c2a4ed01..254fe8a22 100644 --- a/gio/tests/converter-stream.c +++ b/gio/tests/converter-stream.c @@ -210,7 +210,7 @@ g_compressor_converter_convert (GConverter *converter, { const guint8 *in, *in_end; guint8 v, *out; - int i; + gsize i; gsize block_size; in = inbuf; @@ -231,7 +231,7 @@ g_compressor_converter_convert (GConverter *converter, block_size = v * 1000; /* Not enough data */ - if (in_end - in < block_size) + if ((gsize) (in_end - in) < block_size) { if (*bytes_read > 0) break; @@ -254,7 +254,7 @@ g_compressor_converter_convert (GConverter *converter, } } - if (v == 0 && in_end - in == block_size && (flags & G_CONVERTER_INPUT_AT_END) == 0) + if (v == 0 && (gsize) (in_end - in) == block_size && (flags & G_CONVERTER_INPUT_AT_END) == 0) { if (*bytes_read > 0) break; From b07fdb6e4af68518e114f4c45ec043f1e17327a0 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 23:58:05 +0100 Subject: [PATCH 5/7] Fix signedness warning in gio/tests/converter-stream.c:g_expander_converter_convert() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/tests/converter-stream.c: In function ‘g_expander_converter_convert’: gio/tests/converter-stream.c:128:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} 128 | for (i = 0; i < block_size; i++) | ^ --- gio/tests/converter-stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/tests/converter-stream.c b/gio/tests/converter-stream.c index 254fe8a22..6f0bf6a3e 100644 --- a/gio/tests/converter-stream.c +++ b/gio/tests/converter-stream.c @@ -94,7 +94,7 @@ g_expander_converter_convert (GConverter *converter, { const guint8 *in, *in_end; guint8 v, *out; - int i; + gsize i; gsize block_size; in = inbuf; From c216f2299d81bedbcf68bc9929532989242d1a57 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 18 Nov 2020 21:07:23 +0100 Subject: [PATCH 6/7] Fix several missing initializer warnings in gio/tests/gsubprocess.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/tests/gsubprocess.c: In function ‘test_communicate_async’: gio/tests/gsubprocess.c:774:3: error: missing initializer for field ‘running’ of ‘TestAsyncCommunicateData’ 774 | TestAsyncCommunicateData data = { flags, 0, }; | ^~~~~~~~~~~~~~~~~~~~~~~~ gio/tests/gsubprocess.c: In function ‘test_communicate_utf8_async’: gio/tests/gsubprocess.c:1025:3: error: missing initializer for field ‘running’ of ‘TestAsyncCommunicateData’ 1025 | TestAsyncCommunicateData data = { flags, 0, }; | ^~~~~~~~~~~~~~~~~~~~~~~~ gio/tests/gsubprocess.c: In function ‘test_communicate_utf8_cancelled_async’: gio/tests/gsubprocess.c:1058:3: error: missing initializer for field ‘running’ of ‘TestAsyncCommunicateData’ 1058 | TestAsyncCommunicateData data = { flags, 0, }; | ^~~~~~~~~~~~~~~~~~~~~~~~ gio/tests/gsubprocess.c: In function ‘test_communicate_utf8_async_invalid’: gio/tests/gsubprocess.c:1202:3: error: missing initializer for field ‘running’ of ‘TestAsyncCommunicateData’ 1202 | TestAsyncCommunicateData data = { flags, 0, }; | ^~~~~~~~~~~~~~~~~~~~~~~~ --- gio/tests/gsubprocess.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gio/tests/gsubprocess.c b/gio/tests/gsubprocess.c index 7e22678ec..9c7898806 100644 --- a/gio/tests/gsubprocess.c +++ b/gio/tests/gsubprocess.c @@ -771,7 +771,7 @@ test_communicate_async (gconstpointer test_data) GSubprocessFlags flags = GPOINTER_TO_INT (test_data); GError *error = NULL; GPtrArray *args; - TestAsyncCommunicateData data = { flags, 0, }; + TestAsyncCommunicateData data = { flags, 0, 0, NULL }; GSubprocess *proc; GCancellable *cancellable = NULL; GBytes *input; @@ -1022,7 +1022,7 @@ test_communicate_utf8_async (gconstpointer test_data) GSubprocessFlags flags = GPOINTER_TO_INT (test_data); GError *error = NULL; GPtrArray *args; - TestAsyncCommunicateData data = { flags, 0, }; + TestAsyncCommunicateData data = { flags, 0, 0, NULL }; GSubprocess *proc; GCancellable *cancellable = NULL; @@ -1055,7 +1055,7 @@ test_communicate_utf8_cancelled_async (gconstpointer test_data) GSubprocessFlags flags = GPOINTER_TO_INT (test_data); GError *error = NULL; GPtrArray *args; - TestAsyncCommunicateData data = { flags, 0, }; + TestAsyncCommunicateData data = { flags, 0, 0, NULL }; GSubprocess *proc; GCancellable *cancellable = NULL; @@ -1199,7 +1199,7 @@ test_communicate_utf8_async_invalid (void) GSubprocessFlags flags = G_SUBPROCESS_FLAGS_STDOUT_PIPE; GError *error = NULL; GPtrArray *args; - TestAsyncCommunicateData data = { flags, 0, }; + TestAsyncCommunicateData data = { flags, 0, 0, NULL }; GSubprocess *proc; GCancellable *cancellable = NULL; From d936ff10e69cceeae6eab6b9467a4a9900b7030e Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 18 Nov 2020 21:11:22 +0100 Subject: [PATCH 7/7] Fix several signedness warnings in gio/tests/network-address.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/tests/network-address.c: In function ‘main’: gio/tests/network-address.c:1194:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 1194 | for (i = 0; i < G_N_ELEMENTS (host_tests); i++) | ^ gio/tests/network-address.c:1201:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 1201 | for (i = 0; i < G_N_ELEMENTS (uri_tests); i++) | ^ gio/tests/network-address.c:1208:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 1208 | for (i = 0; i < G_N_ELEMENTS (address_tests); i++) | ^ gio/tests/network-address.c:1215:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 1215 | for (i = 0; i < G_N_ELEMENTS (address_tests); i++) | ^ --- gio/tests/network-address.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gio/tests/network-address.c b/gio/tests/network-address.c index cbebb6c9f..3426e8c06 100644 --- a/gio/tests/network-address.c +++ b/gio/tests/network-address.c @@ -1183,7 +1183,7 @@ test_happy_eyeballs_both_error_delays_3 (HappyEyeballsFixture *fixture, int main (int argc, char *argv[]) { - gint i; + gsize i; gchar *path; g_test_init (&argc, &argv, NULL); @@ -1193,28 +1193,28 @@ main (int argc, char *argv[]) for (i = 0; i < G_N_ELEMENTS (host_tests); i++) { - path = g_strdup_printf ("/network-address/parse-host/%d", i); + path = g_strdup_printf ("/network-address/parse-host/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &host_tests[i], test_parse_host); g_free (path); } for (i = 0; i < G_N_ELEMENTS (uri_tests); i++) { - path = g_strdup_printf ("/network-address/parse-uri/%d", i); + path = g_strdup_printf ("/network-address/parse-uri/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &uri_tests[i], test_parse_uri); g_free (path); } for (i = 0; i < G_N_ELEMENTS (address_tests); i++) { - path = g_strdup_printf ("/network-address/resolve-address/%d", i); + path = g_strdup_printf ("/network-address/resolve-address/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &address_tests[i], test_resolve_address); g_free (path); } for (i = 0; i < G_N_ELEMENTS (address_tests); i++) { - path = g_strdup_printf ("/gresolver/resolve-address/%d", i); + path = g_strdup_printf ("/gresolver/resolve-address/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &address_tests[i], test_resolve_address_gresolver); g_free (path); }