[gnome-commander/ConvertWarningsToErrors] fix warning: MAX signed vs unsigned comparison



commit a76b535e81181517a584c6a87ba6aae16062427d
Author: Andreas Henriksson <andreas fatal se>
Date:   Tue Apr 18 23:39:39 2017 +0200

    fix warning: MAX signed vs unsigned comparison
    
    text-render.cc: In function ‘guint get_max_char_width(GtkWidget*, PangoFontDescription*, 
PangoFontMetrics*)’:
    /usr/include/glib-2.0/glib/gmacros.h:288:26: error: comparison between signed and unsigned integer 
expressions [-Werror=sign-compare]
     #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
                          ~~~~^~~~~
    text-render.cc:1032:20: note: in expansion of macro ‘MAX’
             maxwidth = MAX(maxwidth, logical_rect.width);
                        ^~~

 src/intviewer/text-render.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/intviewer/text-render.cc b/src/intviewer/text-render.cc
index 491c222..3247cf1 100644
--- a/src/intviewer/text-render.cc
+++ b/src/intviewer/text-render.cc
@@ -1029,7 +1029,7 @@ static guint get_max_char_width(GtkWidget *widget, PangoFontDescription *font_de
             pango_layout_set_text(layout, str, -1);
             pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
         }
-        maxwidth = MAX(maxwidth, logical_rect.width);
+        maxwidth = MAX(maxwidth, MAX(0, logical_rect.width));
     }
 
     g_object_unref (layout);


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