[glib: 11/15] guri: Use gssize for array/string lengths




commit b5c59cc3fc030080acc16c7f54e03cdb3e85a052
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Aug 6 14:05:40 2020 +0100

    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>

 glib/guri.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/glib/guri.c b/glib/guri.c
index ec8658e68..508fd69e4 100644
--- a/glib/guri.c
+++ b/glib/guri.c
@@ -2555,7 +2555,7 @@ g_uri_escape_bytes (const guint8 *unescaped,
   return g_string_free (string, FALSE);
 }
 
-static gint
+static gssize
 g_uri_scheme_length (const gchar *uri)
 {
   const gchar *p;
@@ -2593,7 +2593,7 @@ g_uri_scheme_length (const gchar *uri)
 gchar *
 g_uri_parse_scheme (const gchar *uri)
 {
-  gint len;
+  gssize len;
 
   g_return_val_if_fail (uri != NULL, NULL);
 
@@ -2625,7 +2625,7 @@ g_uri_parse_scheme (const gchar *uri)
 const gchar *
 g_uri_peek_scheme (const gchar *uri)
 {
-  gint len;
+  gssize len;
   gchar *lower_scheme;
   const gchar *scheme;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]