From 5a361aeeaa7f1e14b41b981de4609c380e196815 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 11 Sep 2020 17:49:47 +0200 Subject: [PATCH 1/5] Fix signedness warning in glib/tests/base64.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/base64.c:28:20: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’} 28 | while (input_len < length) | ^ --- glib/tests/base64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/base64.c b/glib/tests/base64.c index bb9d4db72..bf32ac629 100644 --- a/glib/tests/base64.c +++ b/glib/tests/base64.c @@ -9,7 +9,7 @@ static guchar data[DATA_SIZE]; static void test_incremental (gboolean line_break, - gint length) + gsize length) { char *p; gsize len, decoded_len, max, input_len, block_size; From fd7f2e6c8a151460074d9f8bda65ce16db8efb8f Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 11 Sep 2020 17:58:06 +0200 Subject: [PATCH 2/5] Fix several signedness problems in glib/tests/checksum.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/checksum.c:1079:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} 1079 | for (length = 0; length <= FIXED_LEN; length++) | ^~ glib/tests/checksum.c:1103:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} 1103 | for (length = 0; length <= FIXED_LEN; length++) | ^~ glib/tests/checksum.c:1187:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} 1187 | for (length = 0; length <= FIXED_LEN; length++) | ^~ glib/tests/checksum.c:1192:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} 1192 | for (length = 0; length <= FIXED_LEN; length++) | ^~ glib/tests/checksum.c:1197:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} 1197 | for (length = 0; length <= FIXED_LEN; length++) | ^~ glib/tests/checksum.c:1202:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} 1202 | for (length = 0; length <= FIXED_LEN; length++) | ^~ glib/tests/checksum.c:1207:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} 1207 | for (length = 0; length <= FIXED_LEN; length++) | ^~ --- glib/tests/checksum.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/glib/tests/checksum.c b/glib/tests/checksum.c index 5f32f858e..cc78d1170 100644 --- a/glib/tests/checksum.c +++ b/glib/tests/checksum.c @@ -1014,9 +1014,8 @@ hexval (const gchar c) static guint8 * sum_to_digest (const gchar *sum, gsize *len) { - gsize l; + gsize i, l; guint8 *digest; - gint i; g_assert (strlen (sum) % 2 == 0); l = strlen (sum) / 2; @@ -1074,7 +1073,7 @@ static void test_checksum_string (gconstpointer d) { const ChecksumComputeTest *test = d; - int length; + gsize length; gchar *checksum; for (length = 0; length <= FIXED_LEN; length++) @@ -1098,7 +1097,7 @@ test_checksum_bytes (gconstpointer d) { const ChecksumComputeTest *test = d; GBytes *input; - int length; + gsize length; gchar *checksum; for (length = 0; length <= FIXED_LEN; length++) @@ -1179,7 +1178,7 @@ test_unsupported (void) int main (int argc, char *argv[]) { - int length; + gsize length; g_test_init (&argc, &argv, NULL); From d6eaa742e79a135868849000d1625d4d38e9fda4 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 11 Sep 2020 18:15:11 +0200 Subject: [PATCH 3/5] Fix signedness warnings in glib/tests/convert.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/convert.c:168:16: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} 168 | if (utf8_len == strlen (utf8)) | ^~ glib/tests/convert.c:309:16: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} 309 | if (utf8_len == strlen (utf8)) | ^~ --- glib/tests/convert.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glib/tests/convert.c b/glib/tests/convert.c index c43b3db6e..de6c8a73a 100644 --- a/glib/tests/convert.c +++ b/glib/tests/convert.c @@ -138,7 +138,7 @@ test_byte_order (void) static void check_utf8_to_ucs4 (const char *utf8, - glong utf8_len, + gsize utf8_len, const gunichar *ucs4, glong ucs4_len, glong error_pos) @@ -292,7 +292,7 @@ check_ucs4_to_utf8 (const gunichar *ucs4, static void check_utf8_to_utf16 (const char *utf8, - glong utf8_len, + gsize utf8_len, const gunichar2 *utf16, glong utf16_len, glong error_pos) From 019c6746db1de8149ecc9e8cb6d311af8e1b9ee1 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 11 Sep 2020 18:22:22 +0200 Subject: [PATCH 4/5] Fix several signedness warnings in glib/tests/array-test.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/array-test.c: In function ‘array_remove_index’: glib/tests/array-test.c:388:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 388 | for (i = 0; i < garray->len; i++) | ^ glib/tests/array-test.c: In function ‘array_remove_index_fast’: glib/tests/array-test.c:425:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 425 | for (i = 0; i < garray->len; i++) | ^ glib/tests/array-test.c: In function ‘array_remove_range’: glib/tests/array-test.c:462:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 462 | for (i = 0; i < garray->len; i++) | ^ glib/tests/array-test.c: In function ‘array_sort’: glib/tests/array-test.c:604:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 604 | for (i = 0; i < garray->len; i++) | ^ glib/tests/array-test.c: In function ‘array_sort_with_data’: glib/tests/array-test.c:636:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 636 | for (i = 0; i < garray->len; i++) | ^ glib/tests/array-test.c: In function ‘byte_array_sort’: glib/tests/array-test.c:1876:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 1876 | for (i = 0; i < gbarray->len; i++) | ^ glib/tests/array-test.c: In function ‘byte_array_sort_with_data’: glib/tests/array-test.c:1904:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} 1904 | for (i = 0; i < gbarray->len; i++) | ^ --- glib/tests/array-test.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/glib/tests/array-test.c b/glib/tests/array-test.c index 745cf8b6a..8fd76693b 100644 --- a/glib/tests/array-test.c +++ b/glib/tests/array-test.c @@ -366,7 +366,7 @@ array_remove_index (gconstpointer test_data) { const ArrayTestData *config = test_data; GArray *garray; - gint i; + guint i; gint prev, cur; garray = g_array_new (config->zero_terminated, config->clear_, sizeof (gint)); @@ -403,7 +403,7 @@ array_remove_index_fast (gconstpointer test_data) { const ArrayTestData *config = test_data; GArray *garray; - gint i; + guint i; gint prev, cur; garray = g_array_new (config->zero_terminated, config->clear_, sizeof (gint)); @@ -443,7 +443,7 @@ array_remove_range (gconstpointer test_data) { const ArrayTestData *config = test_data; GArray *garray; - gint i; + guint i; gint prev, cur; garray = g_array_new (config->zero_terminated, config->clear_, sizeof (gint)); @@ -586,7 +586,7 @@ array_sort (gconstpointer test_data) { const ArrayTestData *config = test_data; GArray *garray; - gint i; + guint i; gint prev, cur; garray = g_array_new (config->zero_terminated, config->clear_, sizeof (gint)); @@ -618,7 +618,7 @@ array_sort_with_data (gconstpointer test_data) { const ArrayTestData *config = test_data; GArray *garray; - gint i; + guint i; gint prev, cur; garray = g_array_new (config->zero_terminated, config->clear_, sizeof (gint)); @@ -1859,7 +1859,7 @@ static void byte_array_sort (void) { GByteArray *gbarray; - gint i; + guint i; guint8 val; guint8 prev, cur; @@ -1887,7 +1887,7 @@ static void byte_array_sort_with_data (void) { GByteArray *gbarray; - gint i; + guint i; guint8 val; guint8 prev, cur; From dfa4907072893ba7ba11f2254797d928cb010a26 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 11 Sep 2020 18:48:03 +0200 Subject: [PATCH 5/5] Fix signedness warning in glib/tests/fileutils.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘GFileError’ 134 | if (!err || (err)->domain != dom || (err)->code != c) \ | ^~ glib/tests/fileutils.c:1072:15: note: in expansion of macro ‘g_assert_error’ 1072 | g_assert_error (error, G_FILE_ERROR, tests[i].expected_error); | ^~~~~~~~~~~~~~ --- glib/tests/fileutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c index 4baedf6f9..fa6fc6acf 100644 --- a/glib/tests/fileutils.c +++ b/glib/tests/fileutils.c @@ -976,7 +976,7 @@ test_set_contents_full (void) gboolean use_strlen; gboolean expected_success; - GFileError expected_error; + gint expected_error; } tests[] = {