Fixing signedness problem in glib/gstrfuncs.c

glib/gstrfuncs.c: In function ‘g_strstr_len’:
glib/gstrfuncs.c:2709:24: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
       if (haystack_len < needle_len)
                        ^
This commit is contained in:
Emmanuel Fleury 2019-02-04 09:49:35 +01:00
parent 81a4698c45
commit 592d4369d4

View File

@ -2700,13 +2700,14 @@ g_strstr_len (const gchar *haystack,
{
const gchar *p = haystack;
gsize needle_len = strlen (needle);
gsize haystack_len_unsigned = haystack_len;
const gchar *end;
gsize i;
if (needle_len == 0)
return (gchar *)haystack;
if (haystack_len < needle_len)
if (haystack_len_unsigned < needle_len)
return NULL;
end = haystack + haystack_len - needle_len;