[gnome-builder] egg: fix various -Wsign-compare warnings



commit 220daf8809d10d88f42e3c5b705338a0552d7047
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 28 12:56:27 2017 -0800

    egg: fix various -Wsign-compare warnings

 contrib/egg/egg-column-layout.c       |    2 +-
 contrib/egg/egg-menu-manager.c        |    6 ++----
 contrib/egg/egg-simple-label.c        |    4 ++--
 contrib/egg/egg-three-grid.c          |   16 ++++++++--------
 contrib/egg/egg-widget-action-group.c |    8 +++-----
 5 files changed, 16 insertions(+), 20 deletions(-)
---
diff --git a/contrib/egg/egg-column-layout.c b/contrib/egg/egg-column-layout.c
index dc8cb11..3503aef 100644
--- a/contrib/egg/egg-column-layout.c
+++ b/contrib/egg/egg-column-layout.c
@@ -120,7 +120,7 @@ egg_column_layout_layout (EggColumnLayout *self,
     n_columns = MAX (1, (width - (border_width * 2)) / (priv->column_width + priv->column_spacing));
 
   if (priv->max_columns > 0)
-    n_columns = MIN (n_columns, priv->max_columns);
+    n_columns = MIN (n_columns, (gint)priv->max_columns);
 
   for (column = 0, i = 0; column < n_columns; column++)
     {
diff --git a/contrib/egg/egg-menu-manager.c b/contrib/egg/egg-menu-manager.c
index 0d56527..c42485f 100644
--- a/contrib/egg/egg-menu-manager.c
+++ b/contrib/egg/egg-menu-manager.c
@@ -97,7 +97,6 @@ find_with_attribute_string (GMenuModel  *model,
                             const gchar *value)
 {
   guint n_items;
-  gint i;
 
   g_assert (G_IS_MENU_MODEL (model));
   g_assert (attribute != NULL);
@@ -105,7 +104,7 @@ find_with_attribute_string (GMenuModel  *model,
 
   n_items = g_menu_model_get_n_items (model);
 
-  for (i = 0; i < n_items; i++)
+  for (guint i = 0; i < n_items; i++)
     {
       g_autofree gchar *item_value = NULL;
 
@@ -225,7 +224,6 @@ egg_menu_manager_merge_model (EggMenuManager *self,
                               guint           merge_id)
 {
   guint n_items;
-  gint i;
 
   g_assert (EGG_IS_MENU_MANAGER (self));
   g_assert (G_IS_MENU (menu));
@@ -246,7 +244,7 @@ egg_menu_manager_merge_model (EggMenuManager *self,
 
   n_items = g_menu_model_get_n_items (model);
 
-  for (i = 0; i < n_items; i++)
+  for (guint i = 0; i < n_items; i++)
     {
       g_autoptr(GMenuItem) item = NULL;
       g_autoptr(GMenuLinkIter) link_iter = NULL;
diff --git a/contrib/egg/egg-simple-label.c b/contrib/egg/egg-simple-label.c
index 1a26cd6..211cb7b 100644
--- a/contrib/egg/egg-simple-label.c
+++ b/contrib/egg/egg-simple-label.c
@@ -25,7 +25,7 @@ struct _EggSimpleLabel
   GtkWidget    parent_instance;
 
   gchar       *label;
-  guint        label_len;
+  gint         label_len;
 
   gint         width_chars;
 
@@ -313,7 +313,7 @@ egg_simple_label_set_label (EggSimpleLabel *self,
 
   if (g_strcmp0 (label, self->label) != 0)
     {
-      guint last_len = self->label_len;
+      gint last_len = self->label_len;
 
       g_free (self->label);
 
diff --git a/contrib/egg/egg-three-grid.c b/contrib/egg/egg-three-grid.c
index 56f887a..5b96cef 100644
--- a/contrib/egg/egg-three-grid.c
+++ b/contrib/egg/egg-three-grid.c
@@ -24,13 +24,13 @@
 
 typedef struct
 {
-  GtkWidget *widget;
-  gint       column;
-  gint       row;
-  gint       min_height;
-  gint       nat_height;
-  gint       min_baseline;
-  gint       nat_baseline;
+  GtkWidget          *widget;
+  EggThreeGridColumn  column;
+  gint                row;
+  gint                min_height;
+  gint                nat_height;
+  gint                min_baseline;
+  gint                nat_baseline;
 } EggThreeGridChild;
 
 typedef struct
@@ -499,7 +499,7 @@ egg_three_grid_size_allocate (GtkWidget     *widget,
    * We can handle #1 and #2 with the same logic though.
    */
 
-  if ((MAX (left_min_width, right_min_width) * 2 + center_nat_width) >= (area.width - (priv->column_spacing 
* 2)))
+  if ((MAX (left_min_width, right_min_width) * 2 + center_nat_width) >= (area.width - 
(gint)(priv->column_spacing * 2)))
     {
       /* Handle #3 */
       left = left_min_width;
diff --git a/contrib/egg/egg-widget-action-group.c b/contrib/egg/egg-widget-action-group.c
index 33e4d1f..35ec6b6 100644
--- a/contrib/egg/egg-widget-action-group.c
+++ b/contrib/egg/egg-widget-action-group.c
@@ -88,13 +88,12 @@ create_variant_type (const GType *types,
 {
   const GVariantType *ret = NULL;
   GString *str;
-  gint i;
 
   g_assert (types != NULL || n_types == 0);
 
   str = g_string_new ("(");
 
-  for (i = 0; i < n_types; i++)
+  for (guint i = 0; i < n_types; i++)
     {
       switch (types [i])
         {
@@ -184,7 +183,6 @@ do_activate (EggWidgetActionGroup *self,
   GArray *ar;
   GVariantIter iter;
   gsize n_children;
-  gint i;
 
   g_assert (query != NULL);
   g_assert (GTK_IS_WIDGET (widget));
@@ -230,7 +228,7 @@ do_activate (EggWidgetActionGroup *self,
 
   g_variant_iter_init (&iter, params);
 
-  for (i = 0; i < query->n_params; i++)
+  for (guint i = 0; i < query->n_params; i++)
     {
       g_autoptr(GVariant) param = NULL;
       GValue value = G_VALUE_INIT;
@@ -297,7 +295,7 @@ do_activate (EggWidgetActionGroup *self,
 
 skip_emit:
   /* ignore instance */
-  for (i = 1; i < ar->len; i++)
+  for (guint i = 1; i < ar->len; i++)
     g_value_unset (&g_array_index (ar, GValue, i));
 
   g_array_unref (ar);


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