[glib: 1/8] Fix signedness warning in gio/giomodule.c




commit 5fec11245307347082bc9ccae8d495a37a40abb0
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date:   Wed Nov 18 19:53:33 2020 +0100

    Fix signedness warning in gio/giomodule.c
    
    gio/giomodule.c: In function ‘print_help’:
    glib/gmacros.h:806:26: error: comparison of integer expressions of different signedness: ‘int’ and 
‘size_t’ {aka ‘long unsigned int’}
      806 | #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
          |                          ^
    ../glib.git/gio/giomodule.c:733:19: note: in expansion of macro ‘MAX’
      733 |           width = MAX (width, strlen (g_io_extension_get_name (extension)));
          |                   ^~~

 gio/giomodule.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gio/giomodule.c b/gio/giomodule.c
index a2909a8ef..d3b5e482a 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -731,7 +731,7 @@ print_help (const char        *envvar,
     {
       GList *l;
       GIOExtension *extension;
-      int width = 0;
+      gsize width = 0;
 
       for (l = g_io_extension_point_get_extensions (ep); l; l = l->next)
         {
@@ -743,7 +743,9 @@ print_help (const char        *envvar,
         {
           extension = l->data;
 
-          g_print (" %*s - %d\n", width, g_io_extension_get_name (extension), g_io_extension_get_priority 
(extension));
+          g_print (" %*s - %d\n", (int) MIN (width, G_MAXINT),
+                   g_io_extension_get_name (extension),
+                   g_io_extension_get_priority (extension));
         }
     }
 }


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