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
This commit is contained in:
Federico Mena Quintero 2008-07-18 18:27:30 +00:00 committed by Federico Mena Quintero
parent cf68d46c64
commit 0278fdcbc2
11 changed files with 90 additions and 19 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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;
}

View File

@ -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
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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);

View File

@ -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)
{