From 7619148aa5364f6ff2aea3914690c4db81f2c786 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Sat, 11 Jan 2020 13:52:40 +0100 Subject: [PATCH] charsets: fix warnings with -Wsign-compare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mm-charsets.c: In function ‘mm_charset_gsm_unpacked_to_utf8’: mm-charsets.c:423:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare] 423 | for (i = 0; i < len; i++) { | ^ mm-charsets.c: In function ‘pccp437_is_subset’: mm-charsets.c:544:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] 544 | for (i = 0; i < G_N_ELEMENTS (t); i++) { | ^ mm-charsets.c: In function ‘pcdn_is_subset’: mm-charsets.c:575:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] 575 | for (i = 0; i < sizeof (t) / sizeof (t[0]); i++) { | ^ mm-charsets.c: In function ‘mm_charset_gsm_unpack’: mm-charsets.c:657:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare] 657 | for (i = 0; i < num_septets; i++) { | ^ mm-charsets.c: In function ‘mm_charset_gsm_pack’: mm-charsets.c:701:42: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare] 701 | for (i = 0, lshift = start_offset; i < src_len; i++) { | ^ --- src/mm-charsets.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mm-charsets.c b/src/mm-charsets.c index 31c4a85e..c93bae69 100644 --- a/src/mm-charsets.c +++ b/src/mm-charsets.c @@ -411,7 +411,7 @@ utf8_to_gsm_ext_char (const char *utf8, guint32 len, guint8 *out_gsm) guint8 * mm_charset_gsm_unpacked_to_utf8 (const guint8 *gsm, guint32 len) { - int i; + guint i; GByteArray *utf8; g_return_val_if_fail (gsm != NULL, NULL); @@ -559,7 +559,7 @@ pccp437_is_subset (gunichar c, const char *utf8, gsize ulen) 0x2321, 0x00f7, 0x2248, 0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0 }; - int i; + guint i; if (c <= 0x7F) return TRUE; @@ -590,7 +590,7 @@ pcdn_is_subset (gunichar c, const char *utf8, gsize ulen) 0x00a7, 0x00f7, 0x00b8, 0x00b0, 0x00a8, 0x00b7, 0x00b9, 0x00b3, 0x00b2, 0x25a0, 0x00a0 }; - int i; + guint i; if (c <= 0x7F) return TRUE; @@ -672,7 +672,7 @@ mm_charset_gsm_unpack (const guint8 *gsm, guint32 *out_unpacked_len) { GByteArray *unpacked; - int i; + guint i; unpacked = g_byte_array_sized_new (num_septets + 1); @@ -709,7 +709,7 @@ mm_charset_gsm_pack (const guint8 *src, { guint8 *packed; guint octet = 0, lshift, plen; - int i = 0; + guint i = 0; g_return_val_if_fail (start_offset < 8, NULL);