Squash strict aliasing warnings.

Tue Nov 16 19:26:30 2004  Owen Taylor  <otaylor@redhat.com>

        * gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display):
        Squash strict aliasing warnings.
This commit is contained in:
Owen Taylor 2004-11-17 00:55:10 +00:00 committed by Owen Taylor
parent c2669dd5bb
commit f266788e19
8 changed files with 80 additions and 22 deletions

View File

@ -1,3 +1,8 @@
Tue Nov 16 19:44:26 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c gdk/x11/gdkim-x11.c gdk/x11/gdkwindow-x11.c:
More strict aliasing warning suppressage.
Tue Nov 16 19:26:30 2004 Owen Taylor <otaylor@redhat.com> Tue Nov 16 19:26:30 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display): * gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display):

View File

@ -1,3 +1,8 @@
Tue Nov 16 19:44:26 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c gdk/x11/gdkim-x11.c gdk/x11/gdkwindow-x11.c:
More strict aliasing warning suppressage.
Tue Nov 16 19:26:30 2004 Owen Taylor <otaylor@redhat.com> Tue Nov 16 19:26:30 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display): * gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display):

View File

@ -1,3 +1,8 @@
Tue Nov 16 19:44:26 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c gdk/x11/gdkim-x11.c gdk/x11/gdkwindow-x11.c:
More strict aliasing warning suppressage.
Tue Nov 16 19:26:30 2004 Owen Taylor <otaylor@redhat.com> Tue Nov 16 19:26:30 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display): * gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display):

View File

@ -1,3 +1,8 @@
Tue Nov 16 19:44:26 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c gdk/x11/gdkim-x11.c gdk/x11/gdkwindow-x11.c:
More strict aliasing warning suppressage.
Tue Nov 16 19:26:30 2004 Owen Taylor <otaylor@redhat.com> Tue Nov 16 19:26:30 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display): * gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display):

View File

@ -909,6 +909,7 @@ motif_read_target_table (GdkDisplay *display)
if (motif_find_drag_window (display, FALSE)) if (motif_find_drag_window (display, FALSE))
{ {
guchar *data;
MotifTargetTableHeader *header = NULL; MotifTargetTableHeader *header = NULL;
guchar *target_bytes = NULL; guchar *target_bytes = NULL;
guchar *p; guchar *p;
@ -921,11 +922,13 @@ motif_read_target_table (GdkDisplay *display)
0, (sizeof(MotifTargetTableHeader)+3)/4, FALSE, 0, (sizeof(MotifTargetTableHeader)+3)/4, FALSE,
motif_drag_targets_atom, motif_drag_targets_atom,
&type, &format, &nitems, &bytes_after, &type, &format, &nitems, &bytes_after,
(guchar **)&header); &data);
if (gdk_error_trap_pop () || (format != 8) || (nitems < sizeof (MotifTargetTableHeader))) if (gdk_error_trap_pop () || (format != 8) || (nitems < sizeof (MotifTargetTableHeader)))
goto error; goto error;
header = (MotifTargetTableHeader *)data;
header->n_lists = card16_to_host (header->n_lists, header->byte_order); header->n_lists = card16_to_host (header->n_lists, header->byte_order);
header->total_size = card32_to_host (header->total_size, header->byte_order); header->total_size = card32_to_host (header->total_size, header->byte_order);
@ -1260,6 +1263,7 @@ motif_check_dest (GdkDisplay *display,
Window win) Window win)
{ {
gboolean retval = FALSE; gboolean retval = FALSE;
guchar *data;
MotifDragReceiverInfo *info; MotifDragReceiverInfo *info;
Atom type = None; Atom type = None;
int format; int format;
@ -1271,12 +1275,14 @@ motif_check_dest (GdkDisplay *display,
motif_drag_receiver_info_atom, motif_drag_receiver_info_atom,
0, (sizeof(*info)+3)/4, False, AnyPropertyType, 0, (sizeof(*info)+3)/4, False, AnyPropertyType,
&type, &format, &nitems, &after, &type, &format, &nitems, &after,
(guchar **)&info); &data);
if (gdk_error_trap_pop() == 0) if (gdk_error_trap_pop() == 0)
{ {
if (type != None) if (type != None)
{ {
info = (MotifDragReceiverInfo *)data;
if ((format == 8) && (nitems == sizeof(*info))) if ((format == 8) && (nitems == sizeof(*info)))
{ {
if ((info->protocol_version == 0) && if ((info->protocol_version == 0) &&
@ -1456,6 +1462,7 @@ motif_read_initiator_info (GdkDisplay *display,
gint format; gint format;
gulong nitems; gulong nitems;
gulong bytes_after; gulong bytes_after;
guchar *data;
MotifDragInitiatorInfo *initiator_info; MotifDragInitiatorInfo *initiator_info;
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display); GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
@ -1465,7 +1472,7 @@ motif_read_initiator_info (GdkDisplay *display,
0, sizeof(*initiator_info), FALSE, 0, sizeof(*initiator_info), FALSE,
gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_INITIATOR_INFO"), gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_INITIATOR_INFO"),
&type, &format, &nitems, &bytes_after, &type, &format, &nitems, &bytes_after,
(guchar **)&initiator_info); &data);
if (gdk_error_trap_pop () || (format != 8) || (nitems != sizeof (MotifDragInitiatorInfo)) || (bytes_after != 0)) if (gdk_error_trap_pop () || (format != 8) || (nitems != sizeof (MotifDragInitiatorInfo)) || (bytes_after != 0))
{ {
@ -1473,6 +1480,8 @@ motif_read_initiator_info (GdkDisplay *display,
return FALSE; return FALSE;
} }
initiator_info = (MotifDragInitiatorInfo *)data;
motif_read_target_table (display); motif_read_target_table (display);
initiator_info->targets_index = initiator_info->targets_index =
@ -2383,6 +2392,7 @@ xdnd_check_dest (GdkDisplay *display,
Atom type = None; Atom type = None;
int format; int format;
unsigned long nitems, after; unsigned long nitems, after;
guchar *data;
Atom *version; Atom *version;
Window *proxy_data; Window *proxy_data;
Window proxy; Window proxy;
@ -2397,10 +2407,12 @@ xdnd_check_dest (GdkDisplay *display,
xdnd_proxy_atom, 0, xdnd_proxy_atom, 0,
1, False, AnyPropertyType, 1, False, AnyPropertyType,
&type, &format, &nitems, &after, &type, &format, &nitems, &after,
(guchar **)&proxy_data) == Success) &data) == Success)
{ {
if (type != None) if (type != None)
{ {
proxy_data = (Window *)data;
if ((format == 32) && (nitems == 1)) if ((format == 32) && (nitems == 1))
{ {
proxy = *proxy_data; proxy = *proxy_data;
@ -2417,9 +2429,11 @@ xdnd_check_dest (GdkDisplay *display,
xdnd_aware_atom, 0, xdnd_aware_atom, 0,
1, False, AnyPropertyType, 1, False, AnyPropertyType,
&type, &format, &nitems, &after, &type, &format, &nitems, &after,
(guchar **)&version) == Success) && &data) == Success) &&
type != None) type != None)
{ {
version = (Atom *)data;
if ((format == 32) && (nitems == 1)) if ((format == 32) && (nitems == 1))
{ {
if (*version >= 3) if (*version >= 3)
@ -2450,7 +2464,8 @@ xdnd_read_actions (GdkDragContext *context)
Atom type; Atom type;
int format; int format;
gulong nitems, after; gulong nitems, after;
Atom *data; guchar *data;
Atom *atoms;
gint i; gint i;
@ -2467,13 +2482,15 @@ xdnd_read_actions (GdkDragContext *context)
gdk_x11_get_xatom_by_name_for_display (display, "XdndActionList"), gdk_x11_get_xatom_by_name_for_display (display, "XdndActionList"),
0, 65536, 0, 65536,
False, XA_ATOM, &type, &format, &nitems, False, XA_ATOM, &type, &format, &nitems,
&after, (guchar **)&data) == Success && &after, &data) == Success &&
type == XA_ATOM) type == XA_ATOM)
{ {
atoms = (Atom *)data;
context->actions = 0; context->actions = 0;
for (i=0; i<nitems; i++) for (i=0; i<nitems; i++)
context->actions |= xdnd_action_from_atom (display, data[i]); context->actions |= xdnd_action_from_atom (display, atoms[i]);
PRIVATE_DATA (context)->xdnd_have_actions = TRUE; PRIVATE_DATA (context)->xdnd_have_actions = TRUE;
@ -2495,7 +2512,7 @@ xdnd_read_actions (GdkDragContext *context)
} }
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */
XFree(data); XFree(atoms);
} }
gdk_error_trap_pop (); gdk_error_trap_pop ();
@ -2644,7 +2661,8 @@ xdnd_enter_filter (GdkXEvent *xev,
Atom type; Atom type;
int format; int format;
gulong nitems, after; gulong nitems, after;
Atom *data; guchar *data;
Atom *atoms;
guint32 source_window; guint32 source_window;
gboolean get_types; gboolean get_types;
@ -2708,7 +2726,7 @@ xdnd_enter_filter (GdkXEvent *xev,
gdk_x11_get_xatom_by_name_for_display (display, "XdndTypeList"), gdk_x11_get_xatom_by_name_for_display (display, "XdndTypeList"),
0, 65536, 0, 65536,
False, XA_ATOM, &type, &format, &nitems, False, XA_ATOM, &type, &format, &nitems,
&after, (guchar **)&data); &after, &data);
if (gdk_error_trap_pop () || (format != 32) || (type != XA_ATOM)) if (gdk_error_trap_pop () || (format != 32) || (type != XA_ATOM))
{ {
@ -2716,13 +2734,15 @@ xdnd_enter_filter (GdkXEvent *xev,
return GDK_FILTER_REMOVE; return GDK_FILTER_REMOVE;
} }
atoms = (Atom *)data;
for (i=0; i<nitems; i++) for (i=0; i<nitems; i++)
new_context->targets = new_context->targets =
g_list_append (new_context->targets, g_list_append (new_context->targets,
GDK_ATOM_TO_POINTER (gdk_x11_xatom_to_atom_for_display (display, GDK_ATOM_TO_POINTER (gdk_x11_xatom_to_atom_for_display (display,
data[i]))); atoms[i])));
XFree(data); XFree(atoms);
} }
else else
{ {

View File

@ -461,6 +461,7 @@ gdk_check_wm_desktop_changed (GdkWindow *window)
if (toplevel->have_sticky) if (toplevel->have_sticky)
{ {
guchar *data;
gulong *desktop; gulong *desktop;
type = None; type = None;
@ -470,11 +471,12 @@ gdk_check_wm_desktop_changed (GdkWindow *window)
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"),
0, G_MAXLONG, False, XA_CARDINAL, &type, 0, G_MAXLONG, False, XA_CARDINAL, &type,
&format, &nitems, &format, &nitems,
&bytes_after, (guchar **)&desktop); &bytes_after, &data);
gdk_error_trap_pop (); gdk_error_trap_pop ();
if (type != None) if (type != None)
{ {
desktop = (gulong *)data;
toplevel->on_all_desktops = (*desktop == 0xFFFFFFFF); toplevel->on_all_desktops = (*desktop == 0xFFFFFFFF);
XFree (desktop); XFree (desktop);
} }
@ -495,6 +497,7 @@ gdk_check_wm_state_changed (GdkWindow *window)
gint format; gint format;
gulong nitems; gulong nitems;
gulong bytes_after; gulong bytes_after;
guchar *data;
Atom *atoms = NULL; Atom *atoms = NULL;
gulong i; gulong i;
@ -510,7 +513,7 @@ gdk_check_wm_state_changed (GdkWindow *window)
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"),
0, G_MAXLONG, False, XA_ATOM, &type, &format, &nitems, 0, G_MAXLONG, False, XA_ATOM, &type, &format, &nitems,
&bytes_after, (guchar **)&atoms); &bytes_after, &data);
gdk_error_trap_pop (); gdk_error_trap_pop ();
if (type != None) if (type != None)
@ -520,6 +523,8 @@ gdk_check_wm_state_changed (GdkWindow *window)
Atom maxhorz_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_HORZ"); Atom maxhorz_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_HORZ");
Atom fullscreen_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_FULLSCREEN"); Atom fullscreen_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_FULLSCREEN");
atoms = (Atom *)data;
i = 0; i = 0;
while (i < nitems) while (i < nitems)
{ {
@ -2460,6 +2465,7 @@ fetch_net_wm_check_window (GdkScreen *screen)
gint format; gint format;
gulong n_items; gulong n_items;
gulong bytes_after; gulong bytes_after;
guchar *data;
Window *xwindow; Window *xwindow;
/* This function is very slow on every call if you are not running a /* This function is very slow on every call if you are not running a
@ -2479,11 +2485,13 @@ fetch_net_wm_check_window (GdkScreen *screen)
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), screen_x11->xroot_window, XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), screen_x11->xroot_window,
gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTING_WM_CHECK"), gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTING_WM_CHECK"),
0, G_MAXLONG, False, XA_WINDOW, &type, &format, 0, G_MAXLONG, False, XA_WINDOW, &type, &format,
&n_items, &bytes_after, (guchar **) & xwindow); &n_items, &bytes_after, &data);
if (type != XA_WINDOW) if (type != XA_WINDOW)
return; return;
xwindow = (Window *)data;
gdk_error_trap_push (); gdk_error_trap_push ();
/* Find out if this WM goes away, so we can reset everything. */ /* Find out if this WM goes away, so we can reset everything. */

View File

@ -160,11 +160,15 @@ gdk_wcstombs (const GdkWChar *src)
} }
else else
{ {
if (XwcTextListToTextProperty (xdisplay, (wchar_t**)&src, 1, wchar_t *tmp;
if (XwcTextListToTextProperty (xdisplay, &tmp, 1,
XTextStyle, &tpr) != Success) XTextStyle, &tpr) != Success)
{ {
return NULL; return NULL;
} }
src = (GdkWChar *)tmp;
} }
/* /*
* We must copy the string into an area allocated by glib, because * We must copy the string into an area allocated by glib, because

View File

@ -4126,6 +4126,7 @@ gdk_window_unstick (GdkWindow *window)
gint format; gint format;
gulong nitems; gulong nitems;
gulong bytes_after; gulong bytes_after;
guchar *data;
gulong *current_desktop; gulong *current_desktop;
GdkDisplay *display = gdk_drawable_get_display (window); GdkDisplay *display = gdk_drawable_get_display (window);
@ -4141,10 +4142,12 @@ gdk_window_unstick (GdkWindow *window)
gdk_x11_get_xatom_by_name_for_display (display, "_NET_CURRENT_DESKTOP"), gdk_x11_get_xatom_by_name_for_display (display, "_NET_CURRENT_DESKTOP"),
0, G_MAXLONG, 0, G_MAXLONG,
False, XA_CARDINAL, &type, &format, &nitems, False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, (guchar **)&current_desktop); &bytes_after, &data);
if (type == XA_CARDINAL) if (type == XA_CARDINAL)
{ {
current_desktop = (gulong *)data;
xev.xclient.type = ClientMessage; xev.xclient.type = ClientMessage;
xev.xclient.serial = 0; xev.xclient.serial = 0;
xev.xclient.send_event = True; xev.xclient.send_event = True;
@ -4480,7 +4483,7 @@ gdk_window_get_mwm_hints (GdkWindow *window)
{ {
GdkDisplay *display; GdkDisplay *display;
Atom hints_atom = None; Atom hints_atom = None;
MotifWmHints *hints; guchar *data;
Atom type; Atom type;
gint format; gint format;
gulong nitems; gulong nitems;
@ -4496,12 +4499,12 @@ gdk_window_get_mwm_hints (GdkWindow *window)
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
hints_atom, 0, sizeof (MotifWmHints)/sizeof (long), hints_atom, 0, sizeof (MotifWmHints)/sizeof (long),
False, AnyPropertyType, &type, &format, &nitems, False, AnyPropertyType, &type, &format, &nitems,
&bytes_after, (guchar **)&hints); &bytes_after, &data);
if (type == None) if (type == None)
return NULL; return NULL;
return hints; return (MotifWmHints *)data;
} }
static void static void
@ -4510,6 +4513,7 @@ gdk_window_set_mwm_hints (GdkWindow *window,
{ {
GdkDisplay *display; GdkDisplay *display;
Atom hints_atom = None; Atom hints_atom = None;
guchar *data;
MotifWmHints *hints; MotifWmHints *hints;
Atom type; Atom type;
gint format; gint format;
@ -4526,12 +4530,14 @@ gdk_window_set_mwm_hints (GdkWindow *window,
XGetWindowProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window), XGetWindowProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
hints_atom, 0, sizeof (MotifWmHints)/sizeof (long), hints_atom, 0, sizeof (MotifWmHints)/sizeof (long),
False, AnyPropertyType, &type, &format, &nitems, False, AnyPropertyType, &type, &format, &nitems,
&bytes_after, (guchar **)&hints); &bytes_after, &data);
if (type == None) if (type == None)
hints = new_hints; hints = new_hints;
else else
{ {
hints = (MotifWmHints *)data;
if (new_hints->flags & MWM_HINTS_FUNCTIONS) if (new_hints->flags & MWM_HINTS_FUNCTIONS)
{ {
hints->flags |= MWM_HINTS_FUNCTIONS; hints->flags |= MWM_HINTS_FUNCTIONS;