Fixing signedness in glib/gmarkup.c

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++)
                 ^
This commit is contained in:
Emmanuel Fleury 2019-02-03 19:29:48 +01:00
parent f58702ebbf
commit 4eed83a0ff

View File

@ -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++)
{