From 4eed83a0ff35eca094febd609d4136334acbc149 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 3 Feb 2019 19:29:48 +0100 Subject: [PATCH] Fixing signedness in glib/gmarkup.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In file included from glib/glibconfig.h:9, from ../glib.git/glib/gtypes.h:32, from ../glib.git/glib/gquark.h:32, from ../glib.git/glib/gerror.h:28, from ../glib.git/glib/gmarkup.h:28, from ../glib.git/glib/gmarkup.c:28: ../glib.git/glib/gmarkup.c: In function ‘unescape_gstring_inplace’: ../glib.git/glib/gmarkup.c:789:30: error: comparison of integer expressions of different signedness: ‘long int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare] g_assert (to - string->str <= string->len); ^~ ../glib.git/glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’ #define G_LIKELY(expr) (expr) ^~~~ ../glib.git/glib/gmarkup.c:789:3: note: in expansion of macro ‘g_assert’ g_assert (to - string->str <= string->len); ^~~~~~~~ ../glib.git/glib/gmarkup.c:790:24: error: comparison of integer expressions of different signedness: ‘long int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare] if (to - string->str != string->len) ^~ ../glib.git/glib/gmarkup.c: In function ‘g_markup_parse_boolean’: ../glib.git/glib/gmarkup.c:2634:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] for (i = 0; i < G_N_ELEMENTS (falses); i++) ^ ../glib.git/glib/gmarkup.c:2645:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] for (i = 0; i < G_N_ELEMENTS (trues); i++) ^ --- glib/gmarkup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glib/gmarkup.c b/glib/gmarkup.c index 2d94aecaf..8a4e943eb 100644 --- a/glib/gmarkup.c +++ b/glib/gmarkup.c @@ -786,8 +786,8 @@ unescape_gstring_inplace (GMarkupParseContext *context, } } - g_assert (to - string->str <= string->len); - if (to - string->str != string->len) + g_assert (to - string->str <= (gssize) string->len); + if (to - string->str != (gssize) string->len) g_string_truncate (string, to - string->str); *is_ascii = !(mask & 0x80); @@ -2629,7 +2629,7 @@ g_markup_parse_boolean (const char *string, { char const * const falses[] = { "false", "f", "no", "n", "0" }; char const * const trues[] = { "true", "t", "yes", "y", "1" }; - int i; + gsize i; for (i = 0; i < G_N_ELEMENTS (falses); i++) {