gtk+ r20862 - in trunk: . demos/gtk-demo gdk-pixbuf gtk tests



Author: federico
Date: Fri Jul 18 18:27:30 2008
New Revision: 20862
URL: http://svn.gnome.org/viewvc/gtk+?rev=20862&view=rev

Log:
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>


Modified:
   trunk/ChangeLog
   trunk/demos/gtk-demo/changedisplay.c
   trunk/demos/gtk-demo/textview.c
   trunk/gdk-pixbuf/ChangeLog
   trunk/gdk-pixbuf/queryloaders.c
   trunk/gtk/gtkmain.c
   trunk/gtk/gtkmodules.c
   trunk/gtk/gtkselection.c
   trunk/gtk/gtktipsquery.c
   trunk/gtk/queryimmodules.c
   trunk/tests/testgtk.c

Modified: trunk/demos/gtk-demo/changedisplay.c
==============================================================================
--- trunk/demos/gtk-demo/changedisplay.c	(original)
+++ trunk/demos/gtk-demo/changedisplay.c	Fri Jul 18 18:27:30 2008
@@ -81,7 +81,11 @@
    * 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;
 }

Modified: trunk/demos/gtk-demo/textview.c
==============================================================================
--- trunk/demos/gtk-demo/textview.c	(original)
+++ trunk/demos/gtk-demo/textview.c	Fri Jul 18 18:27:30 2008
@@ -549,6 +549,7 @@
                      gpointer   data)
 {
   static GtkWidget *window = NULL;
+  gpointer window_ptr;
   GtkTextBuffer *buffer;
   GtkWidget     *view;
   GtkTextIter    iter;
@@ -586,8 +587,8 @@
   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);
   

Modified: trunk/gdk-pixbuf/queryloaders.c
==============================================================================
--- trunk/gdk-pixbuf/queryloaders.c	(original)
+++ trunk/gdk-pixbuf/queryloaders.c	Fri Jul 18 18:27:30 2008
@@ -153,6 +153,8 @@
 	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 @@
 
 	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 @@
 
 		vtable->module = module;
 
+		fill_info = fill_info_ptr;
+		fill_vtable = fill_vtable_ptr;
+
 		(*fill_info) (info);
 		(*fill_vtable) (vtable);
 		

Modified: trunk/gtk/gtkmain.c
==============================================================================
--- trunk/gtk/gtkmain.c	(original)
+++ trunk/gtk/gtkmain.c	Fri Jul 18 18:27:30 2008
@@ -1358,6 +1358,7 @@
 {
   GdkWindow *grab_window;
   GtkWidget *event_widget, *grab_widget;
+  gpointer grab_widget_ptr;
   gboolean owner_events;
   GdkDisplay *display;
 
@@ -1390,7 +1391,8 @@
     }
 
   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 @@
 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;
 }

Modified: trunk/gtk/gtkmodules.c
==============================================================================
--- trunk/gtk/gtkmodules.c	(original)
+++ trunk/gtk/gtkmodules.c	Fri Jul 18 18:27:30 2008
@@ -254,6 +254,7 @@
 	     const gchar *name)
 {
   GtkModuleInitFunc modinit_func;
+  gpointer modinit_func_ptr;
   GtkModuleInfo *info = NULL;
   GModule *module = NULL;
   GSList *l;
@@ -279,8 +280,12 @@
 
 	  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
 		{

Modified: trunk/gtk/gtkselection.c
==============================================================================
--- trunk/gtk/gtkselection.c	(original)
+++ trunk/gtk/gtkselection.c	Fri Jul 18 18:27:30 2008
@@ -1067,6 +1067,7 @@
   if (owner_window != NULL)
     {
       GtkWidget *owner_widget;
+      gpointer owner_widget_ptr;
       GtkSelectionData selection_data;
       
       selection_data.selection = selection;
@@ -1075,7 +1076,8 @@
       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)
 	{

Modified: trunk/gtk/gtktipsquery.c
==============================================================================
--- trunk/gtk/gtktipsquery.c	(original)
+++ trunk/gtk/gtktipsquery.c	Fri Jul 18 18:27:30 2008
@@ -470,7 +470,11 @@
 	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;

Modified: trunk/gtk/queryimmodules.c
==============================================================================
--- trunk/gtk/queryimmodules.c	(original)
+++ trunk/gtk/queryimmodules.c	Fri Jul 18 18:27:30 2008
@@ -94,6 +94,11 @@
   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 @@
     }
 	  
   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);
 

Modified: trunk/tests/testgtk.c
==============================================================================
--- trunk/tests/testgtk.c	(original)
+++ trunk/tests/testgtk.c	Fri Jul 18 18:27:30 2008
@@ -2401,6 +2401,7 @@
 create_gridded_geometry (GtkWidget *widget)
 {
   static GtkWidget *window = NULL;
+  gpointer window_ptr;
   GtkWidget *entry;
   GtkWidget *label;
 
@@ -2424,7 +2425,8 @@
 
       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 @@
 create_key_lookup (GtkWidget *widget)
 {
   static GtkWidget *window = NULL;
+  gpointer window_ptr;
 
   if (!window)
     {
@@ -4826,8 +4829,9 @@
       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 @@
  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)
    {



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