[libgd] main-icon-box, main-icon-box-icon: Silence warnings with GLib 2.57.2



commit ad398275f3f64cd0e7d335a44ef048fcd1d8f4db
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Aug 17 10:20:03 2018 +0200

    main-icon-box, main-icon-box-icon: Silence warnings with GLib 2.57.2
    
    The g_clear_pointer macro in GLib gained a bit of type safety when
    using GCC and GCC-compatible compilers. It checks if the function
    pointer is meant to accept a pointer to the type that the first
    argument refers to. Now, GCC doesn't like it if the function pointer is
    cast to GDestroyNotify, and emits this warning:
      warning: function called through a non-compatible type
    
    Since the macro, even the earlier version of it, was explicitly
    designed to avoid the need to cast the arguments, these redundant casts
    should be removed.
    
    https://gitlab.gnome.org/GNOME/glib/issues/1425

 libgd/gd-main-icon-box-icon.c |  8 ++++----
 libgd/gd-main-icon-box.c      | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/libgd/gd-main-icon-box-icon.c b/libgd/gd-main-icon-box-icon.c
index e05efba..54fa139 100644
--- a/libgd/gd-main-icon-box-icon.c
+++ b/libgd/gd-main-icon-box-icon.c
@@ -123,7 +123,7 @@ gd_main_icon_box_icon_get_preferred_size (GdMainIconBoxIcon *self, gint *minimum
 static void
 gd_main_icon_box_icon_notify_icon (GdMainIconBoxIcon *self)
 {
-  g_clear_pointer (&self->surface_zoomed, (GDestroyNotify) cairo_surface_destroy);
+  g_clear_pointer (&self->surface_zoomed, cairo_surface_destroy);
   gtk_widget_queue_resize (GTK_WIDGET (self));
 }
 
@@ -233,7 +233,7 @@ gd_main_icon_box_icon_size_allocate (GtkWidget *widget, GtkAllocation *allocatio
       width_zoomed_scaled = width_scaled;
     }
 
-  g_clear_pointer (&self->surface_zoomed, (GDestroyNotify) cairo_surface_destroy);
+  g_clear_pointer (&self->surface_zoomed, cairo_surface_destroy);
   self->surface_zoomed = gd_zoom_image_surface (surface, width_zoomed_scaled, height_zoomed_scaled);
 
   self->x = (gdouble) (allocation_width_scaled - width_zoomed_scaled) / (2.0 * (gdouble) scale_factor);
@@ -255,7 +255,7 @@ gd_main_icon_box_icon_finalize (GObject *obj)
 {
   GdMainIconBoxIcon *self = GD_MAIN_ICON_BOX_ICON (obj);
 
-  g_clear_pointer (&self->surface_zoomed, (GDestroyNotify) cairo_surface_destroy);
+  g_clear_pointer (&self->surface_zoomed, cairo_surface_destroy);
 
   G_OBJECT_CLASS (gd_main_icon_box_icon_parent_class)->finalize (obj);
 }
@@ -349,7 +349,7 @@ gd_main_icon_box_icon_set_item (GdMainIconBoxIcon *self, GdMainBoxItem *item)
   if (self->item != NULL)
     g_signal_handlers_disconnect_by_func (self->item, gd_main_icon_box_icon_notify_icon, self);
 
-  g_clear_pointer (&self->surface_zoomed, (GDestroyNotify) cairo_surface_destroy);
+  g_clear_pointer (&self->surface_zoomed, cairo_surface_destroy);
   g_set_object (&self->item, item);
 
   if (self->item != NULL)
diff --git a/libgd/gd-main-icon-box.c b/libgd/gd-main-icon-box.c
index 341df19..1d6cdf4 100644
--- a/libgd/gd-main-icon-box.c
+++ b/libgd/gd-main-icon-box.c
@@ -323,7 +323,7 @@ gd_main_icon_box_activate_cursor_child (GtkFlowBox *flow_box)
 
  out:
   GTK_FLOW_BOX_CLASS (gd_main_icon_box_parent_class)->activate_cursor_child (flow_box);
-  g_clear_pointer (&event, (GDestroyNotify) gdk_event_free);
+  g_clear_pointer (&event, gdk_event_free);
 }
 
 static gboolean
@@ -522,7 +522,7 @@ gd_main_icon_box_child_activated (GtkFlowBox *flow_box, GtkFlowBoxChild *child)
     }
 
  out:
-  g_clear_pointer (&event, (GDestroyNotify) gdk_event_free);
+  g_clear_pointer (&event, gdk_event_free);
 }
 
 static void
@@ -571,7 +571,7 @@ gd_main_icon_box_drag_begin (GtkWidget *widget, GdkDragContext *context)
   gtk_drag_set_icon_surface (context, drag_icon);
 
  out:
-  g_clear_pointer (&drag_icon, (GDestroyNotify) cairo_surface_destroy);
+  g_clear_pointer (&drag_icon, cairo_surface_destroy);
 }
 
 static void
@@ -636,7 +636,7 @@ gd_main_icon_box_drag_data_get (GtkWidget *widget,
   gtk_selection_data_set_uris (data, (gchar **) uri_array->pdata);
 
  out:
-  g_clear_pointer (&uri_array, (GDestroyNotify) g_ptr_array_unref);
+  g_clear_pointer (&uri_array, g_ptr_array_unref);
 }
 
 static gboolean
@@ -676,8 +676,8 @@ gd_main_icon_box_focus (GtkWidget *widget, GtkDirectionType direction)
   res = GDK_EVENT_STOP;
 
  out:
-  g_clear_pointer (&fake_event, (GDestroyNotify) gdk_event_free);
-  g_clear_pointer (&event, (GDestroyNotify) gdk_event_free);
+  g_clear_pointer (&fake_event, gdk_event_free);
+  g_clear_pointer (&event, gdk_event_free);
   return res;
 }
 
@@ -759,8 +759,8 @@ gd_main_icon_box_move_cursor (GtkFlowBox *flow_box, GtkMovementStep step, gint c
   res = GDK_EVENT_STOP;
 
  out:
-  g_clear_pointer (&fake_event, (GDestroyNotify) gdk_event_free);
-  g_clear_pointer (&event, (GDestroyNotify) gdk_event_free);
+  g_clear_pointer (&fake_event, gdk_event_free);
+  g_clear_pointer (&event, gdk_event_free);
   return res;
 }
 


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