[gtk+/gtk-3-14] Avoid some clang compiler warnings



commit ca759c3eb66ea3c6be683a6a219841b7e1e6d90b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 22 15:12:30 2015 -0400

    Avoid some clang compiler warnings
    
    Avoid some compiler warnings from clang in deprecated code.
    Most of these are around our habit of using -1 as an 'unset'
    value for enumerations.

 gtk/deprecated/gtkfontsel.c     |    4 ++--
 gtk/deprecated/gtkhandlebox.c   |    4 ++--
 gtk/deprecated/gtkiconfactory.c |    6 +++---
 gtk/deprecated/gtkstock.c       |    2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/gtk/deprecated/gtkfontsel.c b/gtk/deprecated/gtkfontsel.c
index d7b5154..7812e75 100644
--- a/gtk/deprecated/gtkfontsel.c
+++ b/gtk/deprecated/gtkfontsel.c
@@ -1111,7 +1111,7 @@ gtk_font_selection_size_activate (GtkWidget   *w,
   const gchar *text;
 
   text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
-  new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
+  new_size = (int) MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
 
   if (priv->size != new_size)
     gtk_font_selection_set_size (fontsel, new_size);
@@ -1130,7 +1130,7 @@ gtk_font_selection_size_focus_out (GtkWidget     *w,
   const gchar *text;
 
   text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
-  new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
+  new_size = (int) MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
 
   gtk_font_selection_set_size (fontsel, new_size);
 
diff --git a/gtk/deprecated/gtkhandlebox.c b/gtk/deprecated/gtkhandlebox.c
index 3fb37c3..09e63b4 100644
--- a/gtk/deprecated/gtkhandlebox.c
+++ b/gtk/deprecated/gtkhandlebox.c
@@ -76,7 +76,7 @@ struct _GtkHandleBoxPrivate
 {
   /* Properties */
   GtkPositionType handle_position;
-  GtkPositionType snap_edge;
+  gint snap_edge;
   GtkShadowType   shadow_type;
   gboolean        child_detached;
   /* Properties */
@@ -1050,7 +1050,7 @@ gtk_handle_box_get_snap_edge (GtkHandleBox *handle_box)
 {
   g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), (GtkPositionType)-1);
 
-  return handle_box->priv->snap_edge;
+  return (GtkPositionType)handle_box->priv->snap_edge;
 }
 
 /**
diff --git a/gtk/deprecated/gtkiconfactory.c b/gtk/deprecated/gtkiconfactory.c
index 0911e73..8ccae84 100644
--- a/gtk/deprecated/gtkiconfactory.c
+++ b/gtk/deprecated/gtkiconfactory.c
@@ -2944,17 +2944,17 @@ gtk_icon_factory_buildable_custom_tag_end (GtkBuildable *buildable,
            }
          if (source_data->icon_name)
            gtk_icon_source_set_icon_name (icon_source, source_data->icon_name);
-         if (source_data->size != -1)
+         if ((gint)source_data->size != -1)
             {
               gtk_icon_source_set_size (icon_source, source_data->size);
               gtk_icon_source_set_size_wildcarded (icon_source, FALSE);
             }
-         if (source_data->direction != -1)
+         if ((gint)source_data->direction != -1)
             {
               gtk_icon_source_set_direction (icon_source, source_data->direction);
               gtk_icon_source_set_direction_wildcarded (icon_source, FALSE);
             }
-         if (source_data->state != -1)
+         if ((gint)source_data->state != -1)
             {
               gtk_icon_source_set_state (icon_source, source_data->state);
               gtk_icon_source_set_state_wildcarded (icon_source, FALSE);
diff --git a/gtk/deprecated/gtkstock.c b/gtk/deprecated/gtkstock.c
index 3415f6e..71f3c69 100644
--- a/gtk/deprecated/gtkstock.c
+++ b/gtk/deprecated/gtkstock.c
@@ -95,7 +95,7 @@ real_add (const GtkStockItem *items,
       gpointer old_key, old_value;
       const GtkStockItem *item = &items[i];
 
-      if (replace_primary && item->modifier == PRIMARY_MODIFIER)
+      if (replace_primary && (guint)item->modifier == PRIMARY_MODIFIER)
         {
           item = gtk_stock_item_copy (item);
           ((GtkStockItem *)item)->modifier = (NON_STATIC_MASK |


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