From d55e3b25a7a6f0363f833b543905eea3a89ea5f6 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 5 Sep 2014 21:21:49 -0400 Subject: [PATCH] Fix various compiler warnings Mostly missing declarations and missing statics. --- gtk/gtkadjustment.c | 1 + gtk/gtkapplication-dbus.c | 2 + gtk/gtkapplication.c | 16 +--- gtk/gtkcssimageicontheme.c | 2 +- gtk/gtkcsstransformvalue.c | 1 + gtk/gtkdialog.c | 1 + gtk/gtkfilesystem.c | 2 +- gtk/gtkgladecatalog.c | 2 + gtk/gtkmenusectionbox.h | 1 + gtk/gtkmodelmenuitem.c | 5 +- gtk/gtkpixelcache.c | 152 ++++++++++++++++++------------------- gtk/gtkstylecontext.c | 2 +- gtk/gtkwidget.c | 2 +- 13 files changed, 91 insertions(+), 98 deletions(-) diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c index 88a02a5a66..2a2f60d163 100644 --- a/gtk/gtkadjustment.c +++ b/gtk/gtkadjustment.c @@ -24,6 +24,7 @@ #include "config.h" #include "gtkadjustment.h" +#include "gtkadjustmentprivate.h" #include "gtkmarshalers.h" #include "gtkprivate.h" #include "gtkintl.h" diff --git a/gtk/gtkapplication-dbus.c b/gtk/gtkapplication-dbus.c index 60d4edddf0..45136b0d86 100644 --- a/gtk/gtkapplication-dbus.c +++ b/gtk/gtkapplication-dbus.c @@ -206,6 +206,8 @@ gtk_application_impl_dbus_shutdown (GtkApplicationImpl *impl) { } +GQuark gtk_application_impl_dbus_export_id_quark (void); + G_DEFINE_QUARK (GtkApplicationImplDBus export id, gtk_application_impl_dbus_export_id) static void diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c index 4b1ca1faf0..5afae77fe0 100644 --- a/gtk/gtkapplication.c +++ b/gtk/gtkapplication.c @@ -423,7 +423,7 @@ accels_set_accels_for_action (Accels *accels, g_hash_table_remove (accels->action_to_accels, action_and_target); } -gchar ** +static gchar ** accels_get_accels_for_action (Accels *accels, const gchar *action_and_target) { @@ -486,18 +486,6 @@ struct _GtkApplicationPrivate G_DEFINE_TYPE_WITH_PRIVATE (GtkApplication, gtk_application, G_TYPE_APPLICATION) -const gchar * -gtk_application_get_app_menu_object_path (GtkApplication *application) -{ - g_assert_not_reached (); /* XXX */ -} - -const gchar * -gtk_application_get_menubar_object_path (GtkApplication *application) -{ - g_assert_not_reached (); /* XXX */ -} - static gboolean gtk_application_focus_in_event_cb (GtkWindow *window, GdkEventFocus *event, @@ -1612,7 +1600,7 @@ gtk_application_list_action_descriptions (GtkApplication *application) return result; } -gchar * +static gchar * normalise_detailed_name (const gchar *detailed_action_name) { GError *error = NULL; diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c index bfbcb70f57..28c3e020d1 100644 --- a/gtk/gtkcssimageicontheme.c +++ b/gtk/gtkcssimageicontheme.c @@ -29,7 +29,7 @@ G_DEFINE_TYPE (GtkCssImageIconTheme, _gtk_css_image_icon_theme, GTK_TYPE_CSS_IMAGE) -double +static double gtk_css_image_icon_theme_get_aspect_ratio (GtkCssImage *image) { /* icon theme icons only take a single size when requesting, so we insist on being square */ diff --git a/gtk/gtkcsstransformvalue.c b/gtk/gtkcsstransformvalue.c index 303440396c..dbab6491ec 100644 --- a/gtk/gtkcsstransformvalue.c +++ b/gtk/gtkcsstransformvalue.c @@ -22,6 +22,7 @@ #include #include +#include "gtkcsstransformvalueprivate.h" #include "gtkcssnumbervalueprivate.h" typedef union _GtkCssTransform GtkCssTransform; diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index 3595e25dd9..b1ae4c215c 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -29,6 +29,7 @@ #include "gtkbutton.h" #include "gtkdialog.h" +#include "gtkdialogprivate.h" #include "gtkheaderbar.h" #include "gtkbbox.h" #include "gtklabel.h" diff --git a/gtk/gtkfilesystem.c b/gtk/gtkfilesystem.c index d424e44fcb..12e3c8eab3 100644 --- a/gtk/gtkfilesystem.c +++ b/gtk/gtkfilesystem.c @@ -830,7 +830,7 @@ _gtk_file_system_volume_unref (GtkFileSystemVolume *volume) } /* GFileInfo helper functions */ -cairo_surface_t * +static cairo_surface_t * _gtk_file_info_render_icon_internal (GFileInfo *info, GtkWidget *widget, gint icon_size, diff --git a/gtk/gtkgladecatalog.c b/gtk/gtkgladecatalog.c index f9fb7df064..44f91e07e3 100644 --- a/gtk/gtkgladecatalog.c +++ b/gtk/gtkgladecatalog.c @@ -31,6 +31,8 @@ # include "gtkprinteroptionwidget.h" #endif +void gtk_glade_catalog_init (const gchar *catalog_name); + /* This function is referred to in gtk/glade/gtk-private-widgets.xml * and is used to ensure the private types for use in Glade while * editing UI files that define GTK+’s various composite widget classes. diff --git a/gtk/gtkmenusectionbox.h b/gtk/gtkmenusectionbox.h index 96c85e43eb..f7ec6ab811 100644 --- a/gtk/gtkmenusectionbox.h +++ b/gtk/gtkmenusectionbox.h @@ -40,6 +40,7 @@ G_BEGIN_DECLS typedef struct _GtkMenuSectionBox GtkMenuSectionBox; +GType gtk_menu_section_box_get_type (void) G_GNUC_CONST; void gtk_menu_section_box_new_toplevel (GtkStack *stack, GMenuModel *model, const gchar *action_namespace); diff --git a/gtk/gtkmodelmenuitem.c b/gtk/gtkmodelmenuitem.c index d327495d6e..d27248b253 100644 --- a/gtk/gtkmodelmenuitem.c +++ b/gtk/gtkmodelmenuitem.c @@ -389,7 +389,7 @@ gtk_model_menu_item_get_accel (GtkModelMenuItem *item) return NULL; } -void +static void gtk_model_menu_item_get_property (GObject *object, guint prop_id, GValue *value, @@ -423,7 +423,8 @@ gtk_model_menu_item_get_property (GObject *object, g_assert_not_reached (); } } -void + +static void gtk_model_menu_item_set_property (GObject *object, guint prop_id, const GValue *value, diff --git a/gtk/gtkpixelcache.c b/gtk/gtkpixelcache.c index 4ab8bb9549..3e88302199 100644 --- a/gtk/gtkpixelcache.c +++ b/gtk/gtkpixelcache.c @@ -112,7 +112,7 @@ _gtk_pixel_cache_get_extra_size (GtkPixelCache *cache, void _gtk_pixel_cache_set_content (GtkPixelCache *cache, - cairo_content_t content) + cairo_content_t content) { cache->content = content; _gtk_pixel_cache_invalidate (cache, NULL); @@ -120,8 +120,8 @@ _gtk_pixel_cache_set_content (GtkPixelCache *cache, /* Region is in canvas coordinates */ void -_gtk_pixel_cache_invalidate (GtkPixelCache *cache, - cairo_region_t *region) +_gtk_pixel_cache_invalidate (GtkPixelCache *cache, + cairo_region_t *region) { cairo_rectangle_int_t r; cairo_region_t *free_region = NULL; @@ -138,25 +138,25 @@ _gtk_pixel_cache_invalidate (GtkPixelCache *cache, r.height = cache->surface_h; free_region = region = - cairo_region_create_rectangle (&r); + cairo_region_create_rectangle (&r); } if (cache->surface_dirty == NULL) { cache->surface_dirty = cairo_region_copy (region); cairo_region_translate (cache->surface_dirty, - -cache->surface_x, - -cache->surface_y); + -cache->surface_x, + -cache->surface_y); } else { cairo_region_translate (region, - -cache->surface_x, - -cache->surface_y); + -cache->surface_x, + -cache->surface_y); cairo_region_union (cache->surface_dirty, region); cairo_region_translate (region, - cache->surface_x, - cache->surface_y); + cache->surface_x, + cache->surface_y); } if (free_region) @@ -172,9 +172,9 @@ _gtk_pixel_cache_invalidate (GtkPixelCache *cache, static void _gtk_pixel_cache_create_surface_if_needed (GtkPixelCache *cache, - GdkWindow *window, - cairo_rectangle_int_t *view_rect, - cairo_rectangle_int_t *canvas_rect) + GdkWindow *window, + cairo_rectangle_int_t *view_rect, + cairo_rectangle_int_t *canvas_rect) { cairo_rectangle_int_t rect; int surface_w, surface_h; @@ -219,7 +219,7 @@ _gtk_pixel_cache_create_surface_if_needed (GtkPixelCache *cache, cairo_surface_destroy (cache->surface); cache->surface = NULL; if (cache->surface_dirty) - cairo_region_destroy (cache->surface_dirty); + cairo_region_destroy (cache->surface_dirty); cache->surface_dirty = NULL; } @@ -236,21 +236,21 @@ _gtk_pixel_cache_create_surface_if_needed (GtkPixelCache *cache, cache->surface_scale = gdk_window_get_scale_factor (window); cache->surface = - gdk_window_create_similar_surface (window, content, - surface_w, surface_h); + gdk_window_create_similar_surface (window, content, + surface_w, surface_h); rect.x = 0; rect.y = 0; rect.width = surface_w; rect.height = surface_h; cache->surface_dirty = - cairo_region_create_rectangle (&rect); + cairo_region_create_rectangle (&rect); } } -void +static void _gtk_pixel_cache_set_position (GtkPixelCache *cache, - cairo_rectangle_int_t *view_rect, - cairo_rectangle_int_t *canvas_rect) + cairo_rectangle_int_t *view_rect, + cairo_rectangle_int_t *canvas_rect) { cairo_rectangle_int_t r, view_pos; cairo_region_t *copy_region; @@ -268,25 +268,23 @@ _gtk_pixel_cache_set_position (GtkPixelCache *cache, /* Reposition so all is visible */ if (view_pos.x < cache->surface_x || - view_pos.x + view_pos.width > - cache->surface_x + cache->surface_w || + view_pos.x + view_pos.width > cache->surface_x + cache->surface_w || view_pos.y < cache->surface_y || - view_pos.y + view_pos.height > - cache->surface_y + cache->surface_h) + view_pos.y + view_pos.height > cache->surface_y + cache->surface_h) { new_surf_x = cache->surface_x; if (view_pos.x < cache->surface_x) - new_surf_x = MAX (view_pos.x + view_pos.width - cache->surface_w, 0); + new_surf_x = MAX (view_pos.x + view_pos.width - cache->surface_w, 0); else if (view_pos.x + view_pos.width > - cache->surface_x + cache->surface_w) - new_surf_x = MIN (view_pos.x, canvas_rect->width - cache->surface_w); + cache->surface_x + cache->surface_w) + new_surf_x = MIN (view_pos.x, canvas_rect->width - cache->surface_w); new_surf_y = cache->surface_y; if (view_pos.y < cache->surface_y) - new_surf_y = MAX (view_pos.y + view_pos.height - cache->surface_h, 0); + new_surf_y = MAX (view_pos.y + view_pos.height - cache->surface_h, 0); else if (view_pos.y + view_pos.height > - cache->surface_y + cache->surface_h) - new_surf_y = MIN (view_pos.y, canvas_rect->height - cache->surface_h); + cache->surface_y + cache->surface_h) + new_surf_y = MIN (view_pos.y, canvas_rect->height - cache->surface_h); r.x = 0; r.y = 0; @@ -295,15 +293,15 @@ _gtk_pixel_cache_set_position (GtkPixelCache *cache, copy_region = cairo_region_create_rectangle (&r); if (cache->surface_dirty) - { - cairo_region_subtract (copy_region, cache->surface_dirty); - cairo_region_destroy (cache->surface_dirty); - cache->surface_dirty = NULL; - } + { + cairo_region_subtract (copy_region, cache->surface_dirty); + cairo_region_destroy (cache->surface_dirty); + cache->surface_dirty = NULL; + } cairo_region_translate (copy_region, - cache->surface_x - new_surf_x, - cache->surface_y - new_surf_y); + cache->surface_x - new_surf_x, + cache->surface_y - new_surf_y); cairo_region_intersect_rectangle (copy_region, &r); backing_cr = cairo_create (cache->surface); @@ -312,8 +310,8 @@ _gtk_pixel_cache_set_position (GtkPixelCache *cache, cairo_clip (backing_cr); cairo_push_group (backing_cr); cairo_set_source_surface (backing_cr, cache->surface, - cache->surface_x - new_surf_x, - cache->surface_y - new_surf_y); + cache->surface_x - new_surf_x, + cache->surface_y - new_surf_y); cairo_paint (backing_cr); cairo_pop_group_to_source (backing_cr); cairo_paint (backing_cr); @@ -327,12 +325,12 @@ _gtk_pixel_cache_set_position (GtkPixelCache *cache, } } -void -_gtk_pixel_cache_repaint (GtkPixelCache *cache, - GtkPixelCacheDrawFunc draw, - cairo_rectangle_int_t *view_rect, - cairo_rectangle_int_t *canvas_rect, - gpointer user_data) +static void +_gtk_pixel_cache_repaint (GtkPixelCache *cache, + GtkPixelCacheDrawFunc draw, + cairo_rectangle_int_t *view_rect, + cairo_rectangle_int_t *canvas_rect, + gpointer user_data) { cairo_t *backing_cr; cairo_region_t *region_dirty = cache->surface_dirty; @@ -346,12 +344,12 @@ _gtk_pixel_cache_repaint (GtkPixelCache *cache, gdk_cairo_region (backing_cr, region_dirty); cairo_clip (backing_cr); cairo_translate (backing_cr, - -cache->surface_x - canvas_rect->x - view_rect->x, - -cache->surface_y - canvas_rect->y - view_rect->y); + -cache->surface_x - canvas_rect->x - view_rect->x, + -cache->surface_y - canvas_rect->y - view_rect->y); cairo_save (backing_cr); cairo_set_source_rgba (backing_cr, - 0.0, 0, 0, 0.0); + 0.0, 0, 0, 0.0); cairo_set_operator (backing_cr, CAIRO_OPERATOR_SOURCE); cairo_paint (backing_cr); cairo_restore (backing_cr); @@ -362,20 +360,20 @@ _gtk_pixel_cache_repaint (GtkPixelCache *cache, #ifdef G_ENABLE_DEBUG if (gtk_get_debug_flags () & GTK_DEBUG_PIXEL_CACHE) - { - GdkRGBA colors[] = { - { 1, 0, 0, 0.08}, - { 0, 1, 0, 0.08}, - { 0, 0, 1, 0.08}, - { 1, 0, 1, 0.08}, - { 1, 1, 0, 0.08}, - { 0, 1, 1, 0.08}, - }; - static int current_color = 0; + { + GdkRGBA colors[] = { + { 1, 0, 0, 0.08}, + { 0, 1, 0, 0.08}, + { 0, 0, 1, 0.08}, + { 1, 0, 1, 0.08}, + { 1, 1, 0, 0.08}, + { 0, 1, 1, 0.08}, + }; + static int current_color = 0; - gdk_cairo_set_source_rgba (backing_cr, &colors[(current_color++) % G_N_ELEMENTS (colors)]); - cairo_paint (backing_cr); - } + gdk_cairo_set_source_rgba (backing_cr, &colors[(current_color++) % G_N_ELEMENTS (colors)]); + cairo_paint (backing_cr); + } #endif cairo_destroy (backing_cr); @@ -399,7 +397,7 @@ gtk_pixel_cache_blow_cache (GtkPixelCache *cache) cairo_surface_destroy (cache->surface); cache->surface = NULL; if (cache->surface_dirty) - cairo_region_destroy (cache->surface_dirty); + cairo_region_destroy (cache->surface_dirty); cache->surface_dirty = NULL; } } @@ -431,25 +429,23 @@ context_is_unscaled (cairo_t *cr) void -_gtk_pixel_cache_draw (GtkPixelCache *cache, - cairo_t *cr, - GdkWindow *window, - /* View position in widget coords */ - cairo_rectangle_int_t *view_rect, - /* Size and position of canvas in view coords */ - cairo_rectangle_int_t *canvas_rect, - GtkPixelCacheDrawFunc draw, - gpointer user_data) +_gtk_pixel_cache_draw (GtkPixelCache *cache, + cairo_t *cr, + GdkWindow *window, + cairo_rectangle_int_t *view_rect, /* View position in widget coords */ + cairo_rectangle_int_t *canvas_rect, /* Size and position of canvas in view coords */ + GtkPixelCacheDrawFunc draw, + gpointer user_data) { if (cache->timeout_tag) g_source_remove (cache->timeout_tag); cache->timeout_tag = g_timeout_add_seconds (BLOW_CACHE_TIMEOUT_SEC, - blow_cache_cb, cache); + blow_cache_cb, cache); g_source_set_name_by_id (cache->timeout_tag, "[gtk+] blow_cache_cb"); _gtk_pixel_cache_create_surface_if_needed (cache, window, - view_rect, canvas_rect); + view_rect, canvas_rect); _gtk_pixel_cache_set_position (cache, view_rect, canvas_rect); _gtk_pixel_cache_repaint (cache, draw, view_rect, canvas_rect, user_data); @@ -459,18 +455,18 @@ _gtk_pixel_cache_draw (GtkPixelCache *cache, { cairo_save (cr); cairo_set_source_surface (cr, cache->surface, - cache->surface_x + view_rect->x + canvas_rect->x, - cache->surface_y + view_rect->y + canvas_rect->y); + cache->surface_x + view_rect->x + canvas_rect->x, + cache->surface_y + view_rect->y + canvas_rect->y); cairo_rectangle (cr, view_rect->x, view_rect->y, - view_rect->width, view_rect->height); + view_rect->width, view_rect->height); cairo_fill (cr); cairo_restore (cr); } else { cairo_rectangle (cr, - view_rect->x, view_rect->y, - view_rect->width, view_rect->height); + view_rect->x, view_rect->y, + view_rect->width, view_rect->height); cairo_clip (cr); draw (cr, user_data); } diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 7bcaab66b6..3b924c612a 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -4531,7 +4531,7 @@ _gtk_style_context_get_changes (GtkStyleContext *context) return context->priv->invalidating_context; } -void +static void gtk_cairo_rectangle_transform (cairo_rectangle_int_t *dest, const cairo_rectangle_int_t *src, const cairo_matrix_t *matrix) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 4ec83b8554..6f93a597b3 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -17056,7 +17056,7 @@ event_controller_sequence_state_changed (GtkGesture *gesture, } } -EventControllerData * +static EventControllerData * _gtk_widget_has_controller (GtkWidget *widget, GtkEventController *controller) {