From 592d4369d4668b11649f94aa1d5335925934d5df Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Mon, 4 Feb 2019 09:49:35 +0100 Subject: [PATCH] Fixing signedness problem in glib/gstrfuncs.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) ^ --- glib/gstrfuncs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c index 756dbc5bc..78eb71d3e 100644 --- a/glib/gstrfuncs.c +++ b/glib/gstrfuncs.c @@ -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;