guri: Use gssize for array/string lengths

This reduces the possibility for overflow, and makes the code a little
more conventional to read.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2020-08-06 14:05:40 +01:00
parent e446c3487b
commit b5c59cc3fc

View File

@ -2555,7 +2555,7 @@ g_uri_escape_bytes (const guint8 *unescaped,
return g_string_free (string, FALSE); return g_string_free (string, FALSE);
} }
static gint static gssize
g_uri_scheme_length (const gchar *uri) g_uri_scheme_length (const gchar *uri)
{ {
const gchar *p; const gchar *p;
@ -2593,7 +2593,7 @@ g_uri_scheme_length (const gchar *uri)
gchar * gchar *
g_uri_parse_scheme (const gchar *uri) g_uri_parse_scheme (const gchar *uri)
{ {
gint len; gssize len;
g_return_val_if_fail (uri != NULL, NULL); g_return_val_if_fail (uri != NULL, NULL);
@ -2625,7 +2625,7 @@ g_uri_parse_scheme (const gchar *uri)
const gchar * const gchar *
g_uri_peek_scheme (const gchar *uri) g_uri_peek_scheme (const gchar *uri)
{ {
gint len; gssize len;
gchar *lower_scheme; gchar *lower_scheme;
const gchar *scheme; const gchar *scheme;