From f266788e19ab5ee0731021cfc3d9d5e10268e596 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 17 Nov 2004 00:55:10 +0000 Subject: [PATCH] Squash strict aliasing warnings. Tue Nov 16 19:26:30 2004 Owen Taylor * gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display): Squash strict aliasing warnings. --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gdk/x11/gdkdnd-x11.c | 46 +++++++++++++++++++++++++++++------------ gdk/x11/gdkevents-x11.c | 14 ++++++++++--- gdk/x11/gdkim-x11.c | 6 +++++- gdk/x11/gdkwindow-x11.c | 16 +++++++++----- 8 files changed, 80 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4efd670cad..81f7ab6dc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Nov 16 19:44:26 2004 Owen Taylor + + * 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 * gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4efd670cad..81f7ab6dc6 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Tue Nov 16 19:44:26 2004 Owen Taylor + + * 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 * gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display): diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4efd670cad..81f7ab6dc6 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Tue Nov 16 19:44:26 2004 Owen Taylor + + * 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 * gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4efd670cad..81f7ab6dc6 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Tue Nov 16 19:44:26 2004 Owen Taylor + + * 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 * gdk/x11/gdkdnd-x11.c (_gdk_drag_get_protocol_for_display): diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index 4a7a599851..727d0f3645 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -909,6 +909,7 @@ motif_read_target_table (GdkDisplay *display) if (motif_find_drag_window (display, FALSE)) { + guchar *data; MotifTargetTableHeader *header = NULL; guchar *target_bytes = NULL; guchar *p; @@ -921,11 +922,13 @@ motif_read_target_table (GdkDisplay *display) 0, (sizeof(MotifTargetTableHeader)+3)/4, FALSE, motif_drag_targets_atom, &type, &format, &nitems, &bytes_after, - (guchar **)&header); + &data); if (gdk_error_trap_pop () || (format != 8) || (nitems < sizeof (MotifTargetTableHeader))) goto error; + header = (MotifTargetTableHeader *)data; + header->n_lists = card16_to_host (header->n_lists, 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) { gboolean retval = FALSE; + guchar *data; MotifDragReceiverInfo *info; Atom type = None; int format; @@ -1271,12 +1275,14 @@ motif_check_dest (GdkDisplay *display, motif_drag_receiver_info_atom, 0, (sizeof(*info)+3)/4, False, AnyPropertyType, &type, &format, &nitems, &after, - (guchar **)&info); + &data); if (gdk_error_trap_pop() == 0) { if (type != None) { + info = (MotifDragReceiverInfo *)data; + if ((format == 8) && (nitems == sizeof(*info))) { if ((info->protocol_version == 0) && @@ -1456,6 +1462,7 @@ motif_read_initiator_info (GdkDisplay *display, gint format; gulong nitems; gulong bytes_after; + guchar *data; MotifDragInitiatorInfo *initiator_info; GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display); @@ -1465,7 +1472,7 @@ motif_read_initiator_info (GdkDisplay *display, 0, sizeof(*initiator_info), FALSE, gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_INITIATOR_INFO"), &type, &format, &nitems, &bytes_after, - (guchar **)&initiator_info); + &data); 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; } + initiator_info = (MotifDragInitiatorInfo *)data; + motif_read_target_table (display); initiator_info->targets_index = @@ -2383,6 +2392,7 @@ xdnd_check_dest (GdkDisplay *display, Atom type = None; int format; unsigned long nitems, after; + guchar *data; Atom *version; Window *proxy_data; Window proxy; @@ -2397,10 +2407,12 @@ xdnd_check_dest (GdkDisplay *display, xdnd_proxy_atom, 0, 1, False, AnyPropertyType, &type, &format, &nitems, &after, - (guchar **)&proxy_data) == Success) + &data) == Success) { if (type != None) { + proxy_data = (Window *)data; + if ((format == 32) && (nitems == 1)) { proxy = *proxy_data; @@ -2417,9 +2429,11 @@ xdnd_check_dest (GdkDisplay *display, xdnd_aware_atom, 0, 1, False, AnyPropertyType, &type, &format, &nitems, &after, - (guchar **)&version) == Success) && + &data) == Success) && type != None) { + version = (Atom *)data; + if ((format == 32) && (nitems == 1)) { if (*version >= 3) @@ -2450,7 +2464,8 @@ xdnd_read_actions (GdkDragContext *context) Atom type; int format; gulong nitems, after; - Atom *data; + guchar *data; + Atom *atoms; gint i; @@ -2467,13 +2482,15 @@ xdnd_read_actions (GdkDragContext *context) gdk_x11_get_xatom_by_name_for_display (display, "XdndActionList"), 0, 65536, False, XA_ATOM, &type, &format, &nitems, - &after, (guchar **)&data) == Success && + &after, &data) == Success && type == XA_ATOM) { + atoms = (Atom *)data; + context->actions = 0; for (i=0; iactions |= xdnd_action_from_atom (display, data[i]); + context->actions |= xdnd_action_from_atom (display, atoms[i]); PRIVATE_DATA (context)->xdnd_have_actions = TRUE; @@ -2495,7 +2512,7 @@ xdnd_read_actions (GdkDragContext *context) } #endif /* G_ENABLE_DEBUG */ - XFree(data); + XFree(atoms); } gdk_error_trap_pop (); @@ -2644,7 +2661,8 @@ xdnd_enter_filter (GdkXEvent *xev, Atom type; int format; gulong nitems, after; - Atom *data; + guchar *data; + Atom *atoms; guint32 source_window; gboolean get_types; @@ -2708,7 +2726,7 @@ xdnd_enter_filter (GdkXEvent *xev, gdk_x11_get_xatom_by_name_for_display (display, "XdndTypeList"), 0, 65536, False, XA_ATOM, &type, &format, &nitems, - &after, (guchar **)&data); + &after, &data); if (gdk_error_trap_pop () || (format != 32) || (type != XA_ATOM)) { @@ -2716,13 +2734,15 @@ xdnd_enter_filter (GdkXEvent *xev, return GDK_FILTER_REMOVE; } + atoms = (Atom *)data; + for (i=0; itargets = g_list_append (new_context->targets, GDK_ATOM_TO_POINTER (gdk_x11_xatom_to_atom_for_display (display, - data[i]))); + atoms[i]))); - XFree(data); + XFree(atoms); } else { diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index e133f938d5..3cd7617abd 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -461,6 +461,7 @@ gdk_check_wm_desktop_changed (GdkWindow *window) if (toplevel->have_sticky) { + guchar *data; gulong *desktop; 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"), 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems, - &bytes_after, (guchar **)&desktop); + &bytes_after, &data); gdk_error_trap_pop (); if (type != None) { + desktop = (gulong *)data; toplevel->on_all_desktops = (*desktop == 0xFFFFFFFF); XFree (desktop); } @@ -495,6 +497,7 @@ gdk_check_wm_state_changed (GdkWindow *window) gint format; gulong nitems; gulong bytes_after; + guchar *data; Atom *atoms = NULL; gulong i; @@ -510,7 +513,7 @@ gdk_check_wm_state_changed (GdkWindow *window) XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"), 0, G_MAXLONG, False, XA_ATOM, &type, &format, &nitems, - &bytes_after, (guchar **)&atoms); + &bytes_after, &data); gdk_error_trap_pop (); 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 fullscreen_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_FULLSCREEN"); + atoms = (Atom *)data; + i = 0; while (i < nitems) { @@ -2460,6 +2465,7 @@ fetch_net_wm_check_window (GdkScreen *screen) gint format; gulong n_items; gulong bytes_after; + guchar *data; Window *xwindow; /* 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, gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTING_WM_CHECK"), 0, G_MAXLONG, False, XA_WINDOW, &type, &format, - &n_items, &bytes_after, (guchar **) & xwindow); + &n_items, &bytes_after, &data); if (type != XA_WINDOW) return; + xwindow = (Window *)data; + gdk_error_trap_push (); /* Find out if this WM goes away, so we can reset everything. */ diff --git a/gdk/x11/gdkim-x11.c b/gdk/x11/gdkim-x11.c index 651a16ab3b..f0189cd95a 100644 --- a/gdk/x11/gdkim-x11.c +++ b/gdk/x11/gdkim-x11.c @@ -160,11 +160,15 @@ gdk_wcstombs (const GdkWChar *src) } else { - if (XwcTextListToTextProperty (xdisplay, (wchar_t**)&src, 1, + wchar_t *tmp; + + if (XwcTextListToTextProperty (xdisplay, &tmp, 1, XTextStyle, &tpr) != Success) { return NULL; } + + src = (GdkWChar *)tmp; } /* * We must copy the string into an area allocated by glib, because diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index f5da16fcc3..8cd403c2df 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -4126,6 +4126,7 @@ gdk_window_unstick (GdkWindow *window) gint format; gulong nitems; gulong bytes_after; + guchar *data; gulong *current_desktop; 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"), 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems, - &bytes_after, (guchar **)¤t_desktop); + &bytes_after, &data); if (type == XA_CARDINAL) { + current_desktop = (gulong *)data; + xev.xclient.type = ClientMessage; xev.xclient.serial = 0; xev.xclient.send_event = True; @@ -4480,7 +4483,7 @@ gdk_window_get_mwm_hints (GdkWindow *window) { GdkDisplay *display; Atom hints_atom = None; - MotifWmHints *hints; + guchar *data; Atom type; gint format; gulong nitems; @@ -4496,12 +4499,12 @@ gdk_window_get_mwm_hints (GdkWindow *window) XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), hints_atom, 0, sizeof (MotifWmHints)/sizeof (long), False, AnyPropertyType, &type, &format, &nitems, - &bytes_after, (guchar **)&hints); + &bytes_after, &data); if (type == None) return NULL; - return hints; + return (MotifWmHints *)data; } static void @@ -4510,6 +4513,7 @@ gdk_window_set_mwm_hints (GdkWindow *window, { GdkDisplay *display; Atom hints_atom = None; + guchar *data; MotifWmHints *hints; Atom type; gint format; @@ -4526,12 +4530,14 @@ gdk_window_set_mwm_hints (GdkWindow *window, XGetWindowProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window), hints_atom, 0, sizeof (MotifWmHints)/sizeof (long), False, AnyPropertyType, &type, &format, &nitems, - &bytes_after, (guchar **)&hints); + &bytes_after, &data); if (type == None) hints = new_hints; else { + hints = (MotifWmHints *)data; + if (new_hints->flags & MWM_HINTS_FUNCTIONS) { hints->flags |= MWM_HINTS_FUNCTIONS;