--- gail/gail.c
+++ gail/gail.c
@@ -205,8 +205,9 @@
                       if (GTK_IS_MENU_ITEM (next_focus_widget) &&
                           !focus_before_menu)
                         {
+                          void *vp_focus_before_menu = &focus_before_menu;
                           focus_before_menu = window->focus_widget;
-                          g_object_add_weak_pointer (G_OBJECT (focus_before_menu), (gpointer *)&focus_before_menu);
+                          g_object_add_weak_pointer (G_OBJECT (focus_before_menu), vp_focus_before_menu);
                         }
 
                       return TRUE;
@@ -346,8 +347,9 @@
           (GTK_IS_MENU_BAR (next_focus_widget) ||
            GTK_IS_MENU_ITEM (next_focus_widget)))
         {
+          void *vp_next_focus_widget = &next_focus_widget;
           g_source_remove (focus_notify_handler);
-          g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), (gpointer *)&next_focus_widget);
+          g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), vp_next_focus_widget);
           focus_notify_handler = 0;
           was_deselect = FALSE;
         }
@@ -360,8 +362,9 @@
       !GTK_IS_MENU_ITEM (focus_widget) && 
       !GTK_IS_MENU (focus_widget))
     {
+      void *vp_focus_before_menu = &focus_before_menu;
       focus_before_menu = focus_widget;
-      g_object_add_weak_pointer (G_OBJECT (focus_before_menu), (gpointer *)&focus_before_menu);
+      g_object_add_weak_pointer (G_OBJECT (focus_before_menu), vp_focus_before_menu);
 
     } 
   gail_focus_notify_when_idle (widget);
@@ -476,7 +479,8 @@
     }
   else
     {
-      g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), (gpointer *)&next_focus_widget);
+      void *vp_next_focus_widget = &next_focus_widget;
+      g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), vp_next_focus_widget);
       next_focus_widget = NULL;
     }
     
@@ -495,19 +499,22 @@
     {
       if (focus_widget)
         {
-          g_object_remove_weak_pointer (G_OBJECT (focus_widget), (gpointer *)&focus_widget);
+          void *vp_focus_widget = &focus_widget;
+          g_object_remove_weak_pointer (G_OBJECT (focus_widget), vp_focus_widget);
         }
       focus_widget = widget;
       if (focus_widget)
         {
-          g_object_add_weak_pointer (G_OBJECT (focus_widget), (gpointer *)&focus_widget);
+          void *vp_focus_widget = &focus_widget;
+          g_object_add_weak_pointer (G_OBJECT (focus_widget), vp_focus_widget);
           /*
            * The UI may not have been updated yet; e.g. in gtkhtml2
            * html_view_layout() is called in a idle handler
            */
           if (focus_widget == focus_before_menu)
             {
-              g_object_remove_weak_pointer (G_OBJECT (focus_before_menu), (gpointer *)&focus_before_menu);
+              void *vp_focus_before_menu = &focus_before_menu;
+              g_object_remove_weak_pointer (G_OBJECT (focus_before_menu), vp_focus_before_menu);
               focus_before_menu = NULL;
             }
         }
@@ -560,7 +567,10 @@
             }
           g_source_remove (focus_notify_handler);
           if (next_focus_widget)
-            g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), (gpointer *)&next_focus_widget);
+	    {
+	      void *vp_next_focus_widget = &next_focus_widget;
+	      g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), vp_next_focus_widget);
+	    }
         }
       else
         /*
@@ -571,8 +581,9 @@
 
   if (widget)
     {
+      void *vp_next_focus_widget = &next_focus_widget;
       next_focus_widget = widget;
-      g_object_add_weak_pointer (G_OBJECT (next_focus_widget), (gpointer *)&next_focus_widget);
+      g_object_add_weak_pointer (G_OBJECT (next_focus_widget), vp_next_focus_widget);
     }
   focus_notify_handler = g_idle_add (gail_focus_idle_handler, widget);
 }
@@ -607,9 +618,10 @@
       (GTK_IS_MENU_BAR (next_focus_widget) ||
        GTK_IS_MENU_ITEM (next_focus_widget)))
     {
+      void *vp_next_focus_widget = &next_focus_widget;
       g_source_remove (focus_notify_handler);
-      g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), (gpointer *)&next_focus_widget);
+      g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), vp_next_focus_widget);
       focus_notify_handler = 0;
       was_deselect = FALSE;
     }

--- gail/gailwindow.c
+++ gail/gailwindow.c
@@ -651,7 +650,7 @@
   int             format;
   gulong          nitems;
   gulong          bytes_after;
-  gulong         *cardinals;
+  guchar         *cardinals;
   int             error;
   int             result;
   int             desktop;
@@ -665,7 +664,7 @@
                                0, G_MAXLONG,
                                False, XA_CARDINAL,
                                &ret_type, &format, &nitems,
-                               &bytes_after, (guchar **) &cardinals);
+                               &bytes_after, &cardinals);
   error = gdk_error_trap_pop();
   /* nitems < 1 will occur if the property is not set */
   if (error != Success || result != Success || nitems < 1)
@@ -702,7 +701,7 @@
   int     format;
   gulong  nitems;
   gulong  bytes_after;
-  Window *data;
+  guchar *data;
   int     error;
   int     result;
   int     i;
@@ -721,7 +720,7 @@
                                _net_client_list_stacking,
                                0, G_MAXLONG,
                                False, XA_WINDOW, &ret_type, &format, &nitems,
-                               &bytes_after, (guchar **)&data);
+                               &bytes_after, &data);
   error = gdk_error_trap_pop ();
   /* nitems < 1 will occur if the property is not set */
   if (error != Success || result != Success || nitems < 1)
@@ -760,7 +759,7 @@
         }
     }
   free_screen_info (info);
-  info->stacked_windows = data;
+  info->stacked_windows = (Window*) data;
   info->stacked_windows_len = nitems;
   info->desktop = desktops;
   info->desktop_changed = desktops_changed;
