From: Paul Eggert Date: Sun, 13 Mar 2011 08:31:16 +0000 (-0800) Subject: * gtkutil.c (int_gtk_range_get_value): New function, which avoids a diagnostic X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~593 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1e5524e7cfe4ec2ad1841c28495dce4ecc5f487e;p=emacs.git * gtkutil.c (int_gtk_range_get_value): New function, which avoids a diagnostic from gcc -Wbad-function-cast. (xg_set_toolkit_scroll_bar_thumb): Use it. (xg_tool_bar_callback, xg_tool_item_stale_p): Rewrite to avoid diagnostic from gcc -Wbad-function-cast. --- diff --git a/src/ChangeLog b/src/ChangeLog index 269285d32b0..454b6fba129 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,11 @@ to unsigned char * to avoid compiler diagnostic. (xg_free_frame_widgets): Make it clear that a local variable is needed only if USE_GTK_TOOLTIP. + (int_gtk_range_get_value): New function, which avoids a diagnostic + from gcc -Wbad-function-cast. + (xg_set_toolkit_scroll_bar_thumb): Use it. + (xg_tool_bar_callback, xg_tool_item_stale_p): Rewrite to avoid + diagnostic from gcc -Wbad-function-cast. * xgselect.c (xg_select): Remove unused var. diff --git a/src/gtkutil.c b/src/gtkutil.c index 04b8a64c995..b66a9a9c555 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -84,6 +84,13 @@ along with GNU Emacs. If not, see . */ #define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) +/* Get the current value of the range, truncated to an integer. */ +static int +int_gtk_range_get_value (GtkRange *range) +{ + return gtk_range_get_value (range); +} + /*********************************************************************** Display handling functions @@ -3562,7 +3569,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, changed = 1; } - if (changed || (int) gtk_range_get_value (GTK_RANGE (wscroll)) != value) + if (changed || int_gtk_range_get_value (GTK_RANGE (wscroll)) != value) { BLOCK_INPUT; @@ -3570,7 +3577,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, ignore_gtk_scrollbar to make the callback do nothing */ xg_ignore_gtk_scrollbar = 1; - if ((int) gtk_range_get_value (GTK_RANGE (wscroll)) != value) + if (int_gtk_range_get_value (GTK_RANGE (wscroll)) != value) gtk_range_set_value (GTK_RANGE (wscroll), (gdouble)value); else if (changed) gtk_adjustment_changed (adj); @@ -3666,8 +3673,8 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data) { /* The EMACS_INT cast avoids a warning. */ int idx = (int) (EMACS_INT) client_data; - int mod = (int) (EMACS_INT) g_object_get_data (G_OBJECT (w), - XG_TOOL_BAR_LAST_MODIFIER); + gpointer gmod = g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_LAST_MODIFIER); + int mod = (int) (EMACS_INT) gmod; FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); Lisp_Object key, frame; @@ -4218,9 +4225,9 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name, } else { - Pixmap old_img - = (Pixmap) g_object_get_data (G_OBJECT (wimage), - XG_TOOL_BAR_IMAGE_DATA); + gpointer gold_img = g_object_get_data (G_OBJECT (wimage), + XG_TOOL_BAR_IMAGE_DATA); + Pixmap old_img = (Pixmap) gold_img; if (old_img != img->pixmap) return 1; }