[glib: 1/5] Fix signedness problem in glib/gutils.c




commit 33bfae70acf76dcca6cfdfe21ca4c0236c40e63e
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date:   Thu Sep 10 18:05:40 2020 +0200

    Fix signedness problem in glib/gutils.c
    
    glib/gutils.c:998:26: error: comparison of integer expressions of
     different signedness: ‘glong’ {aka ‘long int’} and ‘long unsigned int’
      998 |       if (max > 0 && max <= G_MAXSIZE - 1)
          |                          ^~

 glib/gutils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gutils.c b/glib/gutils.c
index c5aef47fa..aff3ed442 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -995,7 +995,7 @@ g_get_host_name (void)
 
 #ifdef _SC_HOST_NAME_MAX
       max = sysconf (_SC_HOST_NAME_MAX);
-      if (max > 0 && max <= G_MAXSIZE - 1)
+      if (max > 0 && (gsize) max <= G_MAXSIZE - 1)
         size = (gsize) max + 1;
       else
 #ifdef HOST_NAME_MAX


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