[glib: 5/6] Fix signedness warnings in gio/ghttpproxy.c:g_http_proxy_connect()




commit ccb43b382194e30cda1466244afd7d671fbf0faa
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date:   Tue Nov 17 21:21:17 2020 +0100

    Fix signedness warnings in gio/ghttpproxy.c:g_http_proxy_connect()
    
    gio/ghttpproxy.c: In function ‘g_http_proxy_connect’:
    gio/ghttpproxy.c:245:17: error: comparison of integer expressions of different signedness: ‘gsize’ {aka 
‘long unsigned int’} and ‘int’
      245 |       if (nread == -1)
          |                 ^~
    gio/ghttpproxy.c:253:22: error: comparison of integer expressions of different signedness: ‘gssize’ {aka 
‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
      253 |       if (bytes_read == buffer_length)
          |                      ^~

 gio/ghttpproxy.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gio/ghttpproxy.c b/gio/ghttpproxy.c
index 554e85ec3..cd0bda4e6 100644
--- a/gio/ghttpproxy.c
+++ b/gio/ghttpproxy.c
@@ -190,7 +190,7 @@ g_http_proxy_connect (GProxy         *proxy,
   GOutputStream *out;
   gchar *buffer = NULL;
   gsize buffer_length;
-  gssize bytes_read;
+  gsize bytes_read;
   gboolean has_cred;
   GIOStream *tlsconn = NULL;
 
@@ -239,12 +239,15 @@ g_http_proxy_connect (GProxy         *proxy,
    */
   do
     {
+      gssize signed_nread;
       gsize nread;
 
-      nread = g_input_stream_read (in, buffer + bytes_read, 1, cancellable, error);
-      if (nread == -1)
+      signed_nread =
+          g_input_stream_read (in, buffer + bytes_read, 1, cancellable, error);
+      if (signed_nread == -1)
         goto error;
 
+      nread = signed_nread;
       if (nread == 0)
         break;
 


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