Hello, 

This mail has been sent by the mailing list manager operating the 

    [email protected]

mailing list to the human moderators of the list.

Should the message at the bottom be allowed to be sent to the list?
If so, reply to this mail or send mail to

    
wmaker-dev-approve-aef2a4970fa7f8fda155396803c067d0-14b2430304bfb8d7414ab7dc2444a...@lists.windowmaker.info

If not, send mail to

    
wmaker-dev-reject-aef2a4970fa7f8fda155396803c067d0-b9d322e9e975dd9776a98b51b7320...@lists.windowmaker.info

Thanks.
--- Begin Message ---
C99 defines new strict aliasing rules to allow compilers to make certain
optimizations. These rules prohibit converting an XEvent to an event
struct (e.g. XShapeEvent) that is not already in the XEvent union using
pointer type punning (e.g. "(XShapeEvent *)&ev"), and vice versa. The
canonical fix seems to be to create a union between XEvent and the
extension event struct to make the aliasing explicit, so do that.
---
 src/event.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/event.c b/src/event.c
index 6f51a76..46e2ea9 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1159,16 +1159,17 @@ static void handleShapeNotify(XEvent * event)
 {
        XShapeEvent *shev = (XShapeEvent *) event;
        WWindow *wwin;
-       XEvent ev;
-
-       while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) {
-               XShapeEvent *sev = (XShapeEvent *) & ev;
-
-               if (sev->kind == ShapeBounding) {
-                       if (sev->shaped == shev->shaped) {
-                               *shev = *sev;
+       union {
+               XEvent xevent;
+               XShapeEvent xshape;
+       } ev;
+
+       while (XCheckTypedWindowEvent(dpy, shev->window, event->type, 
&ev.xevent)) {
+               if (ev.xshape.kind == ShapeBounding) {
+                       if (ev.xshape.shaped == shev->shaped) {
+                               *shev = ev.xshape;
                        } else {
-                               XPutBackEvent(dpy, &ev);
+                               XPutBackEvent(dpy, &ev.xevent);
                                break;
                        }
                }
-- 
1.7.0.4

--- End Message ---

Reply via email to