summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@novell.com>2008-07-18 18:27:30 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2008-07-18 18:27:30 +0000
commit0278fdcbc21f7af34403c7c025cad7e18c484e94 (patch)
tree225cf90d6729e1f1d387f9ebdfcbcd44ee00c4c9
parentcf68d46c646f807d3ec926af20915ac57c66c8d7 (diff)
downloadgtk+-0278fdcbc21f7af34403c7c025cad7e18c484e94.tar.gz
Don't do funny casts to avoid compiler warnings
2008-07-18 Federico Mena Quintero <federico@novell.com> * demos/gtk-demo/changedisplay.c (find_toplevel_at_pointer): Don't do funny casts to avoid compiler warnings. * demos/gtk-demo/textview.c (easter_egg_callback): Likewise. * gtk/gtkmain.c (rewrite_event_for_grabs, gtk_get_event_widget): Likewise. * gtk/gtkmodules.c (load_module): Likewise. * gtk/gtkselection.c (gtk_selection_convert): Likewise. * gtk/gtktipsquery.c (gtk_tips_query_event): Likewise. * gtk/queryimmodules.c (query_module): Likewise. * tests/testgtk.c (create_gridded_geometry, create_key_lookup) (find_widget_at_pointer): Likewise. Signed-off-by: Federico Mena Quintero <federico@novell.com> svn path=/trunk/; revision=20862
-rw-r--r--ChangeLog20
-rw-r--r--demos/gtk-demo/changedisplay.c6
-rw-r--r--demos/gtk-demo/textview.c5
-rw-r--r--gdk-pixbuf/ChangeLog5
-rw-r--r--gdk-pixbuf/queryloaders.c9
-rw-r--r--gtk/gtkmain.c10
-rw-r--r--gtk/gtkmodules.c9
-rw-r--r--gtk/gtkselection.c4
-rw-r--r--gtk/gtktipsquery.c6
-rw-r--r--gtk/queryimmodules.c18
-rw-r--r--tests/testgtk.c17
11 files changed, 90 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 27fb7a0d16..a85af01a7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2008-07-18 Federico Mena Quintero <federico@novell.com>
+
+ * demos/gtk-demo/changedisplay.c (find_toplevel_at_pointer): Don't
+ do funny casts to avoid compiler warnings.
+
+ * demos/gtk-demo/textview.c (easter_egg_callback): Likewise.
+
+ * gtk/gtkmain.c (rewrite_event_for_grabs, gtk_get_event_widget): Likewise.
+
+ * gtk/gtkmodules.c (load_module): Likewise.
+
+ * gtk/gtkselection.c (gtk_selection_convert): Likewise.
+
+ * gtk/gtktipsquery.c (gtk_tips_query_event): Likewise.
+
+ * gtk/queryimmodules.c (query_module): Likewise.
+
+ * tests/testgtk.c (create_gridded_geometry, create_key_lookup)
+ (find_widget_at_pointer): Likewise.
+
2008-07-08 Matthias Clasen <mclasen@redhat.com>
* modules/printbackends/cups/gtkprintbackendcups.c: Add a forgotten
diff --git a/demos/gtk-demo/changedisplay.c b/demos/gtk-demo/changedisplay.c
index 32a1e983da..facf01ca97 100644
--- a/demos/gtk-demo/changedisplay.c
+++ b/demos/gtk-demo/changedisplay.c
@@ -81,7 +81,11 @@ find_toplevel_at_pointer (GdkDisplay *display)
* to the widget that created it.
*/
if (pointer_window)
- gdk_window_get_user_data (pointer_window, (gpointer*) &widget);
+ {
+ gpointer widget_ptr;
+ gdk_window_get_user_data (pointer_window, &widget_ptr);
+ widget = widget_ptr;
+ }
return widget ? gtk_widget_get_toplevel (widget) : NULL;
}
diff --git a/demos/gtk-demo/textview.c b/demos/gtk-demo/textview.c
index 702c765bfb..4e98b17f05 100644
--- a/demos/gtk-demo/textview.c
+++ b/demos/gtk-demo/textview.c
@@ -549,6 +549,7 @@ easter_egg_callback (GtkWidget *button,
gpointer data)
{
static GtkWidget *window = NULL;
+ gpointer window_ptr;
GtkTextBuffer *buffer;
GtkWidget *view;
GtkTextIter iter;
@@ -586,8 +587,8 @@ easter_egg_callback (GtkWidget *button,
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
- g_object_add_weak_pointer (G_OBJECT (window),
- (gpointer *) &window);
+ window_ptr = &window;
+ g_object_add_weak_pointer (G_OBJECT (window), window_ptr);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 400);
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index d9ed0d27f2..0f6288276b 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-18 Federico Mena Quintero <federico@novell.com>
+
+ * queryloaders.c (query_module): Don't do funny casts to avoid
+ compiler warnings.
+
2008-07-15 Matthias Clasen <mclasen@redhat.com>
Bug 543085 – gdk_pixbuf_saturate_and_pixelate may corrupt memory
diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
index acb19fa36d..e0850f7158 100644
--- a/gdk-pixbuf/queryloaders.c
+++ b/gdk-pixbuf/queryloaders.c
@@ -153,6 +153,8 @@ query_module (const char *dir, const char *file)
GModule *module;
void (*fill_info) (GdkPixbufFormat *info);
void (*fill_vtable) (GdkPixbufModule *module);
+ gpointer fill_info_ptr;
+ gpointer fill_vtable_ptr;
if (g_path_is_absolute (file))
path = g_strdup (file);
@@ -161,8 +163,8 @@ query_module (const char *dir, const char *file)
module = g_module_open (path, 0);
if (module &&
- g_module_symbol (module, "fill_info", (gpointer *) &fill_info) &&
- g_module_symbol (module, "fill_vtable", (gpointer *) &fill_vtable)) {
+ g_module_symbol (module, "fill_info", &fill_info_ptr) &&
+ g_module_symbol (module, "fill_vtable", &fill_vtable_ptr)) {
GdkPixbufFormat *info;
GdkPixbufModule *vtable;
@@ -184,6 +186,9 @@ query_module (const char *dir, const char *file)
vtable->module = module;
+ fill_info = fill_info_ptr;
+ fill_vtable = fill_vtable_ptr;
+
(*fill_info) (info);
(*fill_vtable) (vtable);
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 47207d3a20..584265645d 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1358,6 +1358,7 @@ rewrite_event_for_grabs (GdkEvent *event)
{
GdkWindow *grab_window;
GtkWidget *event_widget, *grab_widget;
+ gpointer grab_widget_ptr;
gboolean owner_events;
GdkDisplay *display;
@@ -1390,7 +1391,8 @@ rewrite_event_for_grabs (GdkEvent *event)
}
event_widget = gtk_get_event_widget (event);
- gdk_window_get_user_data (grab_window, (void**) &grab_widget);
+ gdk_window_get_user_data (grab_window, &grab_widget_ptr);
+ grab_widget = grab_widget_ptr;
if (grab_widget &&
gtk_main_get_window_group (grab_widget) != gtk_main_get_window_group (event_widget))
@@ -2227,11 +2229,15 @@ GtkWidget*
gtk_get_event_widget (GdkEvent *event)
{
GtkWidget *widget;
+ gpointer widget_ptr;
widget = NULL;
if (event && event->any.window &&
(event->type == GDK_DESTROY || !GDK_WINDOW_DESTROYED (event->any.window)))
- gdk_window_get_user_data (event->any.window, (void**) &widget);
+ {
+ gdk_window_get_user_data (event->any.window, &widget_ptr);
+ widget = widget_ptr;
+ }
return widget;
}
diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c
index 526a5b8c3a..0cac9634f4 100644
--- a/gtk/gtkmodules.c
+++ b/gtk/gtkmodules.c
@@ -254,6 +254,7 @@ load_module (GSList *module_list,
const gchar *name)
{
GtkModuleInitFunc modinit_func;
+ gpointer modinit_func_ptr;
GtkModuleInfo *info = NULL;
GModule *module = NULL;
GSList *l;
@@ -279,8 +280,12 @@ load_module (GSList *module_list,
if (module)
{
- if (!g_module_symbol (module, "gtk_module_init", (gpointer *) &modinit_func) ||
- !modinit_func)
+ if (g_module_symbol (module, "gtk_module_init", &modinit_func_ptr))
+ modinit_func = modinit_func_ptr;
+ else
+ modinit_func = NULL;
+
+ if (!modinit_func)
g_module_close (module);
else
{
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 56c14473fc..fc222f9915 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -1067,6 +1067,7 @@ gtk_selection_convert (GtkWidget *widget,
if (owner_window != NULL)
{
GtkWidget *owner_widget;
+ gpointer owner_widget_ptr;
GtkSelectionData selection_data;
selection_data.selection = selection;
@@ -1075,7 +1076,8 @@ gtk_selection_convert (GtkWidget *widget,
selection_data.length = -1;
selection_data.display = display;
- gdk_window_get_user_data (owner_window, (gpointer *)&owner_widget);
+ gdk_window_get_user_data (owner_window, &owner_widget_ptr);
+ owner_widget = owner_widget_ptr;
if (owner_widget != NULL)
{
diff --git a/gtk/gtktipsquery.c b/gtk/gtktipsquery.c
index 52a329ee2c..e80796efeb 100644
--- a/gtk/gtktipsquery.c
+++ b/gtk/gtktipsquery.c
@@ -470,7 +470,11 @@ gtk_tips_query_event (GtkWidget *widget,
pointer_window = NULL;
event_widget = NULL;
if (pointer_window)
- gdk_window_get_user_data (pointer_window, (gpointer*) &event_widget);
+ {
+ gpointer event_widget_ptr;
+ gdk_window_get_user_data (pointer_window, &event_widget_ptr);
+ event_widget = event_widget_ptr;
+ }
gtk_tips_query_emit_widget_entered (tips_query, event_widget);
event_handled = TRUE;
break;
diff --git a/gtk/queryimmodules.c b/gtk/queryimmodules.c
index 6b87002e33..5369c7f9bd 100644
--- a/gtk/queryimmodules.c
+++ b/gtk/queryimmodules.c
@@ -94,6 +94,11 @@ query_module (const char *dir, const char *name)
void (*exit) (void);
GtkIMContext *(*create) (const gchar *context_id);
+ gpointer list_ptr;
+ gpointer init_ptr;
+ gpointer exit_ptr;
+ gpointer create_ptr;
+
GModule *module;
gchar *path;
gboolean error = FALSE;
@@ -112,15 +117,20 @@ query_module (const char *dir, const char *name)
}
if (module &&
- g_module_symbol (module, "im_module_list", (gpointer *) &list) &&
- g_module_symbol (module, "im_module_init", (gpointer *) &init) &&
- g_module_symbol (module, "im_module_exit", (gpointer *) &exit) &&
- g_module_symbol (module, "im_module_create", (gpointer *) &create))
+ g_module_symbol (module, "im_module_list", &list_ptr) &&
+ g_module_symbol (module, "im_module_init", &init_ptr) &&
+ g_module_symbol (module, "im_module_exit", &exit_ptr) &&
+ g_module_symbol (module, "im_module_create", &create_ptr))
{
const GtkIMContextInfo **contexts;
guint n_contexts;
int i;
+ list = list_ptr;
+ init = init_ptr;
+ exit = exit_ptr;
+ create = create_ptr;
+
print_escaped (path);
fputs ("\n", stdout);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 8a2bbc0de4..ccb06c8fae 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -2401,6 +2401,7 @@ static void
create_gridded_geometry (GtkWidget *widget)
{
static GtkWidget *window = NULL;
+ gpointer window_ptr;
GtkWidget *entry;
GtkWidget *label;
@@ -2424,7 +2425,8 @@ create_gridded_geometry (GtkWidget *widget)
g_signal_connect (window, "response",
G_CALLBACK (gridded_geometry_response), entry);
- g_object_add_weak_pointer (G_OBJECT (window), (gpointer) &window);
+ window_ptr = &window;
+ g_object_add_weak_pointer (G_OBJECT (window), window_ptr);
gtk_widget_show_all (window);
}
@@ -4779,6 +4781,7 @@ static void
create_key_lookup (GtkWidget *widget)
{
static GtkWidget *window = NULL;
+ gpointer window_ptr;
if (!window)
{
@@ -4826,8 +4829,9 @@ create_key_lookup (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), button, FALSE, FALSE, 0);
button = accel_button_new (accel_group, "Button 15", "<Shift><Mod4>b");
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), button, FALSE, FALSE, 0);
-
- g_object_add_weak_pointer (G_OBJECT (window), (gpointer) &window);
+
+ window_ptr = &window;
+ g_object_add_weak_pointer (G_OBJECT (window), window_ptr);
g_signal_connect (window, "response", G_CALLBACK (gtk_object_destroy), NULL);
gtk_widget_show_all (window);
@@ -12030,7 +12034,12 @@ find_widget_at_pointer (GdkDisplay *display)
pointer_window = gdk_display_get_window_at_pointer (display, NULL, NULL);
if (pointer_window)
- gdk_window_get_user_data (pointer_window, (gpointer) &widget);
+ {
+ gpointer widget_ptr;
+
+ gdk_window_get_user_data (pointer_window, &widget_ptr);
+ widget = widget_ptr;
+ }
if (widget)
{