xserver: Branch 'master' - 29 commits

Keith Packard keithp at kemper.freedesktop.org
Mon Jul 9 22:53:57 PDT 2012


 Xext/bigreq.c                         |   13 -
 Xext/dpms.c                           |   63 ++---
 Xext/geext.c                          |   18 -
 Xext/panoramiX.c                      |   92 ++++----
 Xext/panoramiXprocs.c                 |   47 ++--
 Xext/saver.c                          |   51 ++--
 Xext/security.c                       |   40 +--
 Xext/shape.c                          |   81 ++++---
 Xext/shm.c                            |   75 +++---
 Xext/sync.c                           |  142 ++++++-------
 Xext/xcmisc.c                         |   42 ++-
 Xext/xf86bigfont.c                    |   37 +--
 Xext/xres.c                           |   87 ++++----
 Xext/xselinux_ext.c                   |   42 ++-
 Xext/xtest.c                          |   28 +-
 Xext/xvdisp.c                         |  186 +++++++++--------
 Xext/xvmain.c                         |   26 +-
 Xext/xvmc.c                           |  124 ++++++-----
 Xi/chgdctl.c                          |   25 +-
 Xi/exevents.c                         |   13 -
 Xi/extinit.c                          |    5 
 Xi/getbmap.c                          |   16 -
 Xi/getdctl.c                          |   12 -
 Xi/getfctl.c                          |   14 -
 Xi/getfocus.c                         |   12 -
 Xi/getkmap.c                          |   14 -
 Xi/getmmap.c                          |   16 -
 Xi/getprop.c                          |   14 -
 Xi/getselev.c                         |   16 -
 Xi/getvers.c                          |   19 -
 Xi/grabdev.c                          |   12 -
 Xi/grabdevb.c                         |   15 -
 Xi/grabdevk.c                         |   15 -
 Xi/gtmotion.c                         |   20 +
 Xi/listdev.c                          |   13 -
 Xi/opendev.c                          |   17 -
 Xi/queryst.c                          |   16 -
 Xi/setbmap.c                          |   14 -
 Xi/setdval.c                          |   14 -
 Xi/setmmap.c                          |   12 -
 Xi/setmode.c                          |   12 -
 Xi/xigetclientpointer.c               |   16 -
 Xi/xigrabdev.c                        |   14 -
 Xi/xipassivegrab.c                    |   18 -
 Xi/xiproperty.c                       |  109 +++++-----
 Xi/xiquerydevice.c                    |   15 -
 Xi/xiquerypointer.c                   |   21 +
 Xi/xiqueryversion.c                   |   17 -
 Xi/xiselectev.c                       |   14 -
 Xi/xisetdevfocus.c                    |   12 -
 composite/compext.c                   |   37 +--
 composite/compwindow.c                |    6 
 config/udev.c                         |    6 
 damageext/damageext.c                 |   32 +-
 dbe/dbe.c                             |   46 ++--
 dix/colormap.c                        |   40 +--
 dix/devices.c                         |  154 +++++++-------
 dix/dispatch.c                        |  259 ++++++++++++------------
 dix/dixfonts.c                        |   26 +-
 dix/enterleave.c                      |   23 +-
 dix/events.c                          |  175 ++++++++--------
 dix/extension.c                       |   22 +-
 dix/grabs.c                           |    5 
 dix/inpututils.c                      |   13 -
 dix/property.c                        |   76 +++----
 dix/registry.c                        |    4 
 dix/selection.c                       |   19 -
 dix/swaprep.c                         |   88 ++++----
 dix/swapreq.c                         |    2 
 dix/window.c                          |  190 ++++++++---------
 glx/glxcmds.c                         |  137 ++++++------
 glx/glxcmdsswap.c                     |   18 -
 glx/glxdri2.c                         |    5 
 glx/indirect_util.c                   |    8 
 glx/single2.c                         |   20 +
 glx/single2swap.c                     |   18 -
 glx/unpack.h                          |   12 -
 hw/dmx/dmx.c                          |  257 +++++++++++++----------
 hw/dmx/glxProxy/glxcmds.c             |  149 +++++++------
 hw/dmx/glxProxy/glxcmdsswap.c         |   43 ++-
 hw/dmx/glxProxy/glxsingle.c           |   56 ++---
 hw/dmx/glxProxy/glxvendor.c           |   12 -
 hw/dmx/glxProxy/unpack.h              |   12 -
 hw/kdrive/ephyr/ephyrdriext.c         |  146 ++++++-------
 hw/kdrive/ephyr/ephyrglxext.c         |   98 ++++-----
 hw/kdrive/ephyr/ephyrproxyext.c       |    2 
 hw/xfree86/common/xf86DGA.c           |  120 +++++------
 hw/xfree86/dixmods/extmod/xf86dga2.c  |  256 ++++++++++++-----------
 hw/xfree86/dixmods/extmod/xf86vmode.c |  298 ++++++++++++++-------------
 hw/xfree86/dri/xf86dri.c              |  145 ++++++-------
 hw/xfree86/dri2/dri2ext.c             |  127 ++++++-----
 hw/xquartz/applewm.c                  |    6 
 hw/xquartz/pseudoramiX.c              |   12 -
 hw/xquartz/xpr/appledri.c             |    8 
 hw/xwin/winwindowswm.c                |    4 
 include/dix.h                         |    4 
 include/misc.h                        |   14 +
 mi/miexpose.c                         |   13 -
 os/connection.c                       |    2 
 os/io.c                               |   12 -
 randr/rrcrtc.c                        |  133 ++++++------
 randr/rrdispatch.c                    |   11 -
 randr/rrmode.c                        |   15 -
 randr/rroutput.c                      |   81 +++----
 randr/rrproperty.c                    |   93 ++++----
 randr/rrscreen.c                      |  198 +++++++++---------
 randr/rrxinerama.c                    |   93 ++++----
 record/record.c                       |   49 ++--
 render/render.c                       |   22 +-
 test/input.c                          |   34 ++-
 xfixes/cursor.c                       |   41 ++-
 xfixes/region.c                       |    5 
 xfixes/select.c                       |   23 --
 xfixes/xfixes.c                       |   12 -
 xkb/xkb.c                             |  366 +++++++++++++++++-----------------
 xkb/xkbEvents.c                       |   57 ++---
 116 files changed, 3338 insertions(+), 2898 deletions(-)

New commits:
commit ad4092cf7d59a89b1b2922440eef65be5c0c5ebd
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:44 2012 -0700

    Replace padlength tables with inline functions from misc.h
    
    Adds new function padding_for_int32() and uses existing pad_to_int32()
    depending on required results.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index d916f34..3c6a591 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -466,8 +466,6 @@ Dispatch(void)
 static int VendorRelease = VENDOR_RELEASE;
 static char *VendorString = VENDOR_NAME;
 
-static const int padlength[4] = { 0, 3, 2, 1 };
-
 void
 SetVendorRelease(int release)
 {
@@ -528,7 +526,7 @@ CreateConnectionBlock(void)
     memmove(pBuf, VendorString, (int) setup.nbytesVendor);
     sizesofar += setup.nbytesVendor;
     pBuf += setup.nbytesVendor;
-    i = padlength[setup.nbytesVendor & 3];
+    i = padding_for_int32(setup.nbytesVendor);
     sizesofar += i;
     while (--i >= 0)
         *pBuf++ = 0;
diff --git a/include/misc.h b/include/misc.h
index 6bea82f..7f7f221 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -232,6 +232,20 @@ pad_to_int32(const int bytes)
     return (((bytes) + 3) & ~3);
 }
 
+/**
+ * Calculate padding needed to bring the number of bytes to an even
+ * multiple of 4.
+ * @param bytes The minimum number of bytes needed.
+ * @return The bytes of padding needed to arrive at the closest multiple of 4
+ * that is equal or higher than bytes.
+ */
+static inline int
+padding_for_int32(const int bytes)
+{
+    return ((-bytes) & 3);
+}
+
+
 extern char **xstrtokenize(const char *str, const char *separators);
 extern void FormatUInt64(uint64_t num, char *string);
 extern void FormatUInt64Hex(uint64_t num, char *string);
diff --git a/os/io.c b/os/io.c
index 8d0e5cc..e44db39 100644
--- a/os/io.c
+++ b/os/io.c
@@ -578,8 +578,6 @@ ResetCurrentRequest(ClientPtr client)
     }
 }
 
-static const int padlength[4] = { 0, 3, 2, 1 };
-
  /********************
  * FlushAllOutput()
  *    Flush all clients with output.  However, if some client still
@@ -757,7 +755,7 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
         oc->output = oco;
     }
 
-    padBytes = padlength[count & 3];
+    padBytes = padding_for_int32(count);
 
     if (ReplyCallback) {
         ReplyInfoRec replyinfo;
@@ -850,7 +848,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
     if (!oco)
         return 0;
     written = 0;
-    padsize = padlength[extraCount & 3];
+    padsize = padding_for_int32(extraCount);
     notWritten = oco->count + extraCount + padsize;
     todo = notWritten;
     while (notWritten) {
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index a427725..6a7a089 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -22,8 +22,6 @@
 
 #include "randrstr.h"
 
-static const int padlength[4] = { 0, 3, 2, 1 };
-
 static CARD16
  RR10CurrentSizeID(ScreenPtr pScreen);
 
@@ -46,8 +44,7 @@ RREditConnectionInfo(ScreenPtr pScreen)
     connSetup = (xConnSetup *) ConnectionInfo;
     vendor = (char *) connSetup + sizeof(xConnSetup);
     formats = (xPixmapFormat *) ((char *) vendor +
-                                 connSetup->nbytesVendor +
-                                 padlength[connSetup->nbytesVendor & 3]);
+                                 pad_to_int32(connSetup->nbytesVendor));
     root = (xWindowRoot *) ((char *) formats +
                             sizeof(xPixmapFormat) *
                             screenInfo.numPixmapFormats);
diff --git a/test/input.c b/test/input.c
index 90ab9ae..191c817 100644
--- a/test/input.c
+++ b/test/input.c
@@ -965,6 +965,19 @@ test_pad_to_int32(int i)
 }
 
 static void
+test_padding_for_int32(int i)
+{
+    static const int padlength[4] = { 0, 3, 2, 1 };
+    int expected_bytes = (((i + 3) / 4) * 4) - i;
+
+    assert(padding_for_int32(i) >= 0);
+    assert(padding_for_int32(i) <= 3);
+    assert(padding_for_int32(i) == expected_bytes);
+    assert(padding_for_int32(i) == padlength[i & 3]);
+    assert((padding_for_int32(i) + i) == pad_to_int32(i));
+}
+
+static void
 include_byte_padding_macros(void)
 {
     printf("Testing bits_to_bytes()\n");
@@ -996,12 +1009,12 @@ include_byte_padding_macros(void)
     test_bytes_to_int32(INT_MAX - 4);
     test_bytes_to_int32(INT_MAX - 3);
 
-    printf("Testing pad_to_int32\n");
+    printf("Testing pad_to_int32()\n");
 
     test_pad_to_int32(0);
-    test_pad_to_int32(0);
     test_pad_to_int32(1);
     test_pad_to_int32(2);
+    test_pad_to_int32(3);
     test_pad_to_int32(7);
     test_pad_to_int32(8);
     test_pad_to_int32(0xFF);
@@ -1012,6 +1025,23 @@ include_byte_padding_macros(void)
     test_pad_to_int32(0x1000000);
     test_pad_to_int32(INT_MAX - 4);
     test_pad_to_int32(INT_MAX - 3);
+
+    printf("Testing padding_for_int32()\n");
+
+    test_padding_for_int32(0);
+    test_padding_for_int32(1);
+    test_padding_for_int32(2);
+    test_padding_for_int32(3);
+    test_padding_for_int32(7);
+    test_padding_for_int32(8);
+    test_padding_for_int32(0xFF);
+    test_padding_for_int32(0x100);
+    test_padding_for_int32(0xFFFF);
+    test_padding_for_int32(0x10000);
+    test_padding_for_int32(0xFFFFFF);
+    test_padding_for_int32(0x1000000);
+    test_padding_for_int32(INT_MAX - 4);
+    test_padding_for_int32(INT_MAX - 3);
 }
 
 static void
commit 2b1c1300cc23912ee1c59f8dde938dd4d7287f4a
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:44 2012 -0700

    ephyrGLXQueryServerString: Stop making an unused copy of server_string
    
    ephyrGLXQueryServerString() carefully allocated a buffer padded to the
    word-aligned string length for sending to the client, copied the string
    to it, and then forgot to use it, potentially reading a few bytes of
    garbage past the end of the server_string buffer.
    
    Since WriteToClient already handles the necessary padding, just send
    it the actual length of the original server_string, and don't bother
    making a padded copy.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c
index dae22fc..df285cf 100644
--- a/hw/kdrive/ephyr/ephyrglxext.c
+++ b/hw/kdrive/ephyr/ephyrglxext.c
@@ -357,7 +357,7 @@ ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc)
     ClientPtr client = a_cl->client;
     xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) a_pc;
     xGLXQueryServerStringReply reply;
-    char *server_string = NULL, *buf = NULL;
+    char *server_string = NULL;
     int length = 0;
 
     EPHYR_LOG("enter\n");
@@ -377,13 +377,6 @@ ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc)
         .n = length
     };
 
-    buf = calloc(reply.length << 2, 1);
-    if (!buf) {
-        EPHYR_LOG_ERROR("failed to allocate string\n;");
-        return BadAlloc;
-    }
-    memcpy(buf, server_string, length);
-
     WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
     WriteToClient(client, (int) (reply.length << 2), server_string);
 
@@ -394,9 +387,6 @@ ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc)
     free(server_string);
     server_string = NULL;
 
-    free(buf);
-    buf = NULL;
-
     return res;
 }
 
commit 7a29f6878284e2d65e69fcd157aa9ec01d21b3c0
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:44 2012 -0700

    Initialize padding bits to 0 in ErrorConnMax()
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/os/connection.c b/os/connection.c
index 3441472..721ad65 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -892,7 +892,7 @@ ErrorConnMax(XtransConnInfo trans_conn)
 {
     int fd = _XSERVTransGetConnectionNumber(trans_conn);
     xConnSetupPrefix csp;
-    char pad[3];
+    char pad[3] = { 0, 0, 0 };
     struct iovec iov[3];
     char byteOrder = 0;
     int whichbyte = 1;
commit bed610fcae41ddfe21fa9acde599b17d1d15f5d1
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:44 2012 -0700

    Set padding bytes to 0 in WriteToClient
    
    Clear them out when needed instead of leaving whatever values were
    present in previously sent messages.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/os/io.c b/os/io.c
index b67a5f3..8d0e5cc 100644
--- a/os/io.c
+++ b/os/io.c
@@ -815,7 +815,11 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
     NewOutputPending = TRUE;
     FD_SET(oc->fd, &OutputPending);
     memmove((char *) oco->buf + oco->count, buf, count);
-    oco->count += count + padBytes;
+    oco->count += count;
+    if (padBytes) {
+        memset(oco->buf + oco->count, '\0', padBytes);
+        oco->count += padBytes;
+    }
     return count;
 }
 
commit 1622dd8ab24d2fe7b9908110eb237774d4e03568
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:44 2012 -0700

    Use C99 designated initializers in dix registry
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/dix/registry.c b/dix/registry.c
index e9c19b0..5bad0fd 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -286,7 +286,7 @@ LookupResourceName(RESTYPE resource)
 void
 dixResetRegistry(void)
 {
-    ExtensionEntry extEntry;
+    ExtensionEntry extEntry = { .name = CORE };
 
     /* Free all memory */
     while (nmajor--) {
@@ -336,8 +336,6 @@ dixResetRegistry(void)
     RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB");
 
     /* Add the core protocol */
-    memset(&extEntry, 0, sizeof(extEntry));
-    extEntry.name = CORE;
     RegisterExtensionNames(&extEntry);
 }
 
commit 9805cedf7b0f76d3b75f94e956c4cc2dcf0d8b64
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:44 2012 -0700

    Use C99 designated initializers in extension Events
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/Xext/saver.c b/Xext/saver.c
index e1e86c0..7f70bc0 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -406,7 +406,6 @@ SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced)
     ScreenSaverScreenPrivatePtr pPriv;
     ScreenSaverEventPtr pEv;
     unsigned long mask;
-    xScreenSaverNotifyEvent ev;
     int kind;
 
     UpdateCurrentTimeIf();
@@ -424,16 +423,18 @@ SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced)
     else
         kind = ScreenSaverInternal;
     for (pEv = pPriv->events; pEv; pEv = pEv->next) {
-        if (!(pEv->mask & mask))
-            continue;
-        ev.type = ScreenSaverNotify + ScreenSaverEventBase;
-        ev.state = state;
-        ev.timestamp = currentTime.milliseconds;
-        ev.root = pScreen->root->drawable.id;
-        ev.window = pScreen->screensaver.wid;
-        ev.kind = kind;
-        ev.forced = forced;
-        WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
+        if (pEv->mask & mask) {
+            xScreenSaverNotifyEvent ev = {
+                .type = ScreenSaverNotify + ScreenSaverEventBase,
+                .state = state,
+                .timestamp = currentTime.milliseconds,
+                .root = pScreen->root->drawable.id,
+                .window = pScreen->screensaver.wid,
+                .kind = kind,
+                .forced = forced
+            };
+            WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
+        }
     }
 }
 
diff --git a/Xext/security.c b/Xext/security.c
index 4144d85..50041de 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -192,10 +192,10 @@ SecurityDeleteAuthorization(pointer value, XID id)
 
     while ((pEventClient = pAuth->eventClients)) {
         /* send revocation event event */
-        xSecurityAuthorizationRevokedEvent are;
-
-        are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
-        are.authId = pAuth->id;
+        xSecurityAuthorizationRevokedEvent are = {
+            .type = SecurityEventBase + XSecurityAuthorizationRevoked,
+            .authId = pAuth->id
+        };
         WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
         FreeResource(pEventClient->resource, RT_NONE);
     }
diff --git a/Xext/shape.c b/Xext/shape.c
index ecc6c88..68cbef2 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -826,7 +826,6 @@ void
 SendShapeNotify(WindowPtr pWin, int which)
 {
     ShapeEventPtr *pHead, pShapeEvent;
-    xShapeNotifyEvent se;
     BoxRec extents;
     RegionPtr region;
     BYTE shaped;
@@ -883,15 +882,17 @@ SendShapeNotify(WindowPtr pWin, int which)
         return;
     }
     for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
-        se.type = ShapeNotify + ShapeEventBase;
-        se.kind = which;
-        se.window = pWin->drawable.id;
-        se.x = extents.x1;
-        se.y = extents.y1;
-        se.width = extents.x2 - extents.x1;
-        se.height = extents.y2 - extents.y1;
-        se.time = currentTime.milliseconds;
-        se.shaped = shaped;
+        xShapeNotifyEvent se = {
+            .type = ShapeNotify + ShapeEventBase,
+            .kind = which,
+            .window = pWin->drawable.id,
+            .x = extents.x1,
+            .y = extents.y1,
+            .width = extents.x2 - extents.x1,
+            .height = extents.y2 - extents.y1,
+            .time = currentTime.milliseconds,
+            .shaped = shaped
+        };
         WriteEventsToClient(pShapeEvent->client, 1, (xEvent *) &se);
     }
 }
diff --git a/Xext/shm.c b/Xext/shm.c
index 6c9b16d..be10a49 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -595,14 +595,14 @@ ProcShmPutImage(ClientPtr client)
                       stuff->dstX, stuff->dstY, shmdesc->addr + stuff->offset);
 
     if (stuff->sendEvent) {
-        xShmCompletionEvent ev;
-
-        ev.type = ShmCompletionCode;
-        ev.drawable = stuff->drawable;
-        ev.minorEvent = X_ShmPutImage;
-        ev.majorEvent = ShmReqCode;
-        ev.shmseg = stuff->shmseg;
-        ev.offset = stuff->offset;
+        xShmCompletionEvent ev = {
+            .type = ShmCompletionCode,
+            .drawable = stuff->drawable,
+            .minorEvent = X_ShmPutImage,
+            .majorEvent = ShmReqCode,
+            .shmseg = stuff->shmseg,
+            .offset = stuff->offset
+        };
         WriteEventsToClient(client, 1, (xEvent *) &ev);
     }
 
diff --git a/Xext/sync.c b/Xext/sync.c
index 3ad2b1b..b203c5e 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -437,9 +437,16 @@ SyncSendAlarmNotifyEvents(SyncAlarm * pAlarm)
 
     UpdateCurrentTime();
 
-    ane.type = SyncEventBase + XSyncAlarmNotify;
-    ane.kind = XSyncAlarmNotify;
-    ane.alarm = pAlarm->alarm_id;
+    ane = (xSyncAlarmNotifyEvent) {
+        .type = SyncEventBase + XSyncAlarmNotify,
+        .kind = XSyncAlarmNotify,
+        .alarm = pAlarm->alarm_id,
+        .alarm_value_hi = XSyncValueHigh32(pTrigger->test_value),
+        .alarm_value_lo = XSyncValueLow32(pTrigger->test_value),
+        .time = currentTime.milliseconds,
+        .state = pAlarm->state
+    };
+
     if (pTrigger->pSync && SYNC_COUNTER == pTrigger->pSync->type) {
         ane.counter_value_hi = XSyncValueHigh32(pCounter->value);
         ane.counter_value_lo = XSyncValueLow32(pCounter->value);
@@ -449,11 +456,6 @@ SyncSendAlarmNotifyEvents(SyncAlarm * pAlarm)
         ane.counter_value_hi = ane.counter_value_lo = 0;
     }
 
-    ane.alarm_value_hi = XSyncValueHigh32(pTrigger->test_value);
-    ane.alarm_value_lo = XSyncValueLow32(pTrigger->test_value);
-    ane.time = currentTime.milliseconds;
-    ane.state = pAlarm->state;
-
     /* send to owner */
     if (pAlarm->events)
         WriteEventsToClient(pAlarm->client, 1, (xEvent *) &ane);
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index dae9772..31b7783 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -1029,14 +1029,14 @@ ProcXvShmPutImage(ClientPtr client)
                           stuff->send_event, stuff->width, stuff->height);
 
     if ((status == Success) && stuff->send_event) {
-        xShmCompletionEvent ev;
-
-        ev.type = ShmCompletionCode;
-        ev.drawable = stuff->drawable;
-        ev.minorEvent = xv_ShmPutImage;
-        ev.majorEvent = XvReqCode;
-        ev.shmseg = stuff->shmseg;
-        ev.offset = stuff->offset;
+        xShmCompletionEvent ev = {
+            .type = ShmCompletionCode,
+            .drawable = stuff->drawable,
+            .minorEvent = xv_ShmPutImage,
+            .majorEvent = XvReqCode,
+            .shmseg = stuff->shmseg,
+            .offset = stuff->offset
+        };
         WriteEventsToClient(client, 1, (xEvent *) &ev);
     }
 
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 736114b..74872fc 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -507,19 +507,20 @@ XvdiDestroyEncoding(pointer value, XID id)
 static int
 XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
 {
-    xvEvent event;
     XvVideoNotifyPtr pn;
 
     dixLookupResourceByType((pointer *) &pn, pDraw->id, XvRTVideoNotifyList,
                             serverClient, DixReadAccess);
 
     while (pn) {
+        xvEvent event = {
+            .u.videoNotify.reason = reason,
+            .u.videoNotify.time = currentTime.milliseconds,
+            .u.videoNotify.drawable = pDraw->id,
+            .u.videoNotify.port = pPort->id
+        };
         event.u.u.type = XvEventBase + XvVideoNotify;
-        event.u.videoNotify.time = currentTime.milliseconds;
-        event.u.videoNotify.drawable = pDraw->id;
-        event.u.videoNotify.port = pPort->id;
-        event.u.videoNotify.reason = reason;
-        WriteEventsToClient(pn->client, 1, (xEventPtr) & event);
+        WriteEventsToClient(pn->client, 1, (xEventPtr) &event);
         pn = pn->next;
     }
 
@@ -530,18 +531,19 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
 int
 XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
 {
-    xvEvent event;
     XvPortNotifyPtr pn;
 
     pn = pPort->pNotify;
 
     while (pn) {
+        xvEvent event = {
+            .u.portNotify.time = currentTime.milliseconds,
+            .u.portNotify.port = pPort->id,
+            .u.portNotify.attribute = attribute,
+            .u.portNotify.value = value
+        };
         event.u.u.type = XvEventBase + XvPortNotify;
-        event.u.portNotify.time = currentTime.milliseconds;
-        event.u.portNotify.port = pPort->id;
-        event.u.portNotify.attribute = attribute;
-        event.u.portNotify.value = value;
-        WriteEventsToClient(pn->client, 1, (xEventPtr) & event);
+        WriteEventsToClient(pn->client, 1, (xEventPtr) &event);
         pn = pn->next;
     }
 
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index caef0bf..9fe69a5 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -113,7 +113,6 @@ ProcXChangeDeviceControl(ClientPtr client)
     AxisInfoPtr a;
     CARD32 *resolution;
     xDeviceEnableCtl *e;
-    devicePresenceNotify dpn;
 
     REQUEST(xChangeDeviceControlReq);
     REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@@ -211,11 +210,13 @@ ProcXChangeDeviceControl(ClientPtr client)
 
  out:
     if (ret == Success) {
-        dpn.type = DevicePresenceNotify;
-        dpn.time = currentTime.milliseconds;
-        dpn.devchange = DeviceControlChanged;
-        dpn.deviceid = dev->id;
-        dpn.control = stuff->control;
+        devicePresenceNotify dpn = {
+            .type = DevicePresenceNotify,
+            .time = currentTime.milliseconds,
+            .devchange = DeviceControlChanged,
+            .deviceid = dev->id,
+            .control = stuff->control
+        };
         SendEventToAllWindows(dev, DevicePresenceNotifyMask,
                               (xEvent *) &dpn, 1);
 
diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c
index 0f0e975..8b4ae69 100644
--- a/Xi/grabdevb.c
+++ b/Xi/grabdevb.c
@@ -137,13 +137,14 @@ ProcXGrabDeviceButton(ClientPtr client)
                                   X_GrabDeviceButton)) != Success)
         return ret;
 
-    memset(&param, 0, sizeof(param));
-    param.grabtype = XI;
-    param.ownerEvents = stuff->ownerEvents;
-    param.this_device_mode = stuff->this_device_mode;
-    param.other_devices_mode = stuff->other_devices_mode;
-    param.grabWindow = stuff->grabWindow;
-    param.modifiers = stuff->modifiers;
+    param = (GrabParameters) {
+        .grabtype = XI,
+        .ownerEvents = stuff->ownerEvents,
+        .this_device_mode = stuff->this_device_mode,
+        .other_devices_mode = stuff->other_devices_mode,
+        .grabWindow = stuff->grabWindow,
+        .modifiers = stuff->modifiers
+    };
     mask.xi = tmp[stuff->grabbed_device].mask;
 
     ret = GrabButton(client, dev, mdev, stuff->button, &param, XI, &mask);
diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c
index b755182..8694f9e 100644
--- a/Xi/grabdevk.c
+++ b/Xi/grabdevk.c
@@ -135,13 +135,14 @@ ProcXGrabDeviceKey(ClientPtr client)
                                   X_GrabDeviceKey)) != Success)
         return ret;
 
-    memset(&param, 0, sizeof(param));
-    param.grabtype = XI;
-    param.ownerEvents = stuff->ownerEvents;
-    param.this_device_mode = stuff->this_device_mode;
-    param.other_devices_mode = stuff->other_devices_mode;
-    param.grabWindow = stuff->grabWindow;
-    param.modifiers = stuff->modifiers;
+    param = (GrabParameters) {
+        .grabtype = XI,
+        .ownerEvents = stuff->ownerEvents,
+        .this_device_mode = stuff->this_device_mode,
+        .other_devices_mode = stuff->other_devices_mode,
+        .grabWindow = stuff->grabWindow,
+        .modifiers = stuff->modifiers
+    };
     mask.xi = tmp[stuff->grabbed_device].mask;
 
     ret = GrabKey(client, dev, mdev, stuff->key, &param, XI, &mask);
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 51a36d4..ca73104 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -182,30 +182,27 @@ static long XIPropHandlerID = 1;
 static void
 send_property_event(DeviceIntPtr dev, Atom property, int what)
 {
-    devicePropertyNotify event;
-    xXIPropertyEvent xi2;
-    int state;
-
-    if (what == XIPropertyDeleted)
-        state = PropertyDelete;
-    else
-        state = PropertyNewValue;
+    int state = (what == XIPropertyDeleted) ? PropertyDelete : PropertyNewValue;
+    devicePropertyNotify event = {
+        .type = DevicePropertyNotify,
+        .deviceid = dev->id,
+        .state = state,
+        .atom = property,
+        .time = currentTime.milliseconds
+    };
+    xXIPropertyEvent xi2 = {
+        .type = GenericEvent,
+        .extension = IReqCode,
+        .length = 0,
+        .evtype = XI_PropertyEvent,
+        .deviceid = dev->id,
+        .time = currentTime.milliseconds,
+        .property = property,
+        .what = what
+    };
 
-    event.type = DevicePropertyNotify;
-    event.deviceid = dev->id;
-    event.state = state;
-    event.atom = property;
-    event.time = currentTime.milliseconds;
     SendEventToAllWindows(dev, DevicePropertyNotifyMask, (xEvent *) &event, 1);
 
-    xi2.type = GenericEvent;
-    xi2.extension = IReqCode;
-    xi2.length = 0;
-    xi2.evtype = XI_PropertyEvent;
-    xi2.deviceid = dev->id;
-    xi2.time = currentTime.milliseconds;
-    xi2.property = property;
-    xi2.what = what;
     SendEventToAllWindows(dev, GetEventFilter(dev, (xEvent *) &xi2),
                           (xEvent *) &xi2, 1);
 }
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 2eddfb3..222643c 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -46,15 +46,17 @@ DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
     int i;
 
     UpdateCurrentTimeIf();
-    ev.type = DamageEventBase + XDamageNotify;
-    ev.level = pDamageExt->level;
-    ev.drawable = pDamageExt->drawable;
-    ev.damage = pDamageExt->id;
-    ev.timestamp = currentTime.milliseconds;
-    ev.geometry.x = pDrawable->x;
-    ev.geometry.y = pDrawable->y;
-    ev.geometry.width = pDrawable->width;
-    ev.geometry.height = pDrawable->height;
+    ev = (xDamageNotifyEvent) {
+        .type = DamageEventBase + XDamageNotify,
+        .level = pDamageExt->level,
+        .drawable = pDamageExt->drawable,
+        .damage = pDamageExt->id,
+        .timestamp = currentTime.milliseconds,
+        .geometry.x = pDrawable->x,
+        .geometry.y = pDrawable->y,
+        .geometry.width = pDrawable->width,
+        .geometry.height = pDrawable->height
+    };
     if (pBoxes) {
         for (i = 0; i < nBoxes; i++) {
             ev.level = pDamageExt->level;
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index e0f4cf7..909de70 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -178,12 +178,13 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
                   CARD64 msc, CARD32 sbc)
 {
     __GLXdrawable *drawable = data;
-    xGLXBufferSwapComplete2 wire;
+    xGLXBufferSwapComplete2 wire =  {
+        .type = __glXEventBase + GLX_BufferSwapComplete
+    };
 
     if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
         return;
 
-    wire.type = __glXEventBase + GLX_BufferSwapComplete;
     switch (type) {
     case DRI2_EXCHANGE_COMPLETE:
         wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 61612c3..ab172a8 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -900,15 +900,16 @@ DGAStealKeyEvent(DeviceIntPtr dev, int index, int key_code, int is_down)
     if (!pScreenPriv || !pScreenPriv->grabKeyboard)     /* no direct mode */
         return FALSE;
 
-    memset(&event, 0, sizeof(event));
-    event.header = ET_Internal;
-    event.type = ET_DGAEvent;
-    event.length = sizeof(event);
-    event.time = GetTimeInMillis();
-    event.subtype = (is_down ? ET_KeyPress : ET_KeyRelease);
-    event.detail = key_code;
-    event.dx = 0;
-    event.dy = 0;
+    event = (DGAEvent) {
+        .header = ET_Internal,
+        .type = ET_DGAEvent,
+        .length = sizeof(event),
+        .time = GetTimeInMillis(),
+        .subtype = (is_down ? ET_KeyPress : ET_KeyRelease),
+        .detail = key_code,
+        .dx = 0,
+        .dy = 0
+    };
     mieqEnqueue(dev, (InternalEvent *) &event);
 
     return TRUE;
@@ -928,15 +929,16 @@ DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy)
     if (!pScreenPriv || !pScreenPriv->grabMouse)        /* no direct mode */
         return FALSE;
 
-    memset(&event, 0, sizeof(event));
-    event.header = ET_Internal;
-    event.type = ET_DGAEvent;
-    event.length = sizeof(event);
-    event.time = GetTimeInMillis();
-    event.subtype = ET_Motion;
-    event.detail = 0;
-    event.dx = dx;
-    event.dy = dy;
+    event = (DGAEvent) {
+        .header = ET_Internal,
+        .type = ET_DGAEvent,
+        .length = sizeof(event),
+        .time = GetTimeInMillis(),
+        .subtype = ET_Motion,
+        .detail = 0,
+        .dx = dx,
+        .dy = dy
+    };
     mieqEnqueue(dev, (InternalEvent *) &event);
     return TRUE;
 }
@@ -955,15 +957,16 @@ DGAStealButtonEvent(DeviceIntPtr dev, int index, int button, int is_down)
     if (!pScreenPriv || !pScreenPriv->grabMouse)
         return FALSE;
 
-    memset(&event, 0, sizeof(event));
-    event.header = ET_Internal;
-    event.type = ET_DGAEvent;
-    event.length = sizeof(event);
-    event.time = GetTimeInMillis();
-    event.subtype = (is_down ? ET_ButtonPress : ET_ButtonRelease);
-    event.detail = button;
-    event.dx = 0;
-    event.dy = 0;
+    event = (DGAEvent) {
+        .header = ET_Internal,
+        .type = ET_DGAEvent,
+        .length = sizeof(event),
+        .time = GetTimeInMillis(),
+        .subtype = (is_down ? ET_ButtonPress : ET_ButtonRelease),
+        .detail = button,
+        .dx = 0,
+        .dy = 0
+    };
     mieqEnqueue(dev, (InternalEvent *) &event);
 
     return TRUE;
@@ -988,16 +991,15 @@ DGAProcessKeyboardEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr keybd)
     KeyClassPtr keyc = keybd->key;
     DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
     DeviceIntPtr pointer = GetMaster(keybd, POINTER_OR_FLOAT);
-    DeviceEvent ev;
-
-    memset(&ev, 0, sizeof(ev));
-    ev.header = ET_Internal;
-    ev.length = sizeof(ev);
-    ev.detail.key = event->detail;
-    ev.type = event->subtype;
-    ev.root_x = 0;
-    ev.root_y = 0;
-    ev.corestate = XkbStateFieldFromRec(&keyc->xkbInfo->state);
+    DeviceEvent ev = {
+        .header = ET_Internal,
+        .length = sizeof(ev),
+        .detail.key = event->detail,
+        .type = event->subtype,
+        .root_x = 0,
+        .root_y = 0,
+        .corestate = XkbStateFieldFromRec(&keyc->xkbInfo->state)
+    };
     ev.corestate |= pointer->button->state;
 
     UpdateDeviceState(keybd, &ev);
@@ -1006,15 +1008,15 @@ DGAProcessKeyboardEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr keybd)
      * Deliver the DGA event
      */
     if (pScreenPriv->client) {
-        dgaEvent de;
-
+        dgaEvent de = {
+            .u.event.time = event->time,
+            .u.event.dx = event->dx,
+            .u.event.dy = event->dy,
+            .u.event.screen = pScreen->myNum,
+            .u.event.state = ev.corestate
+        };
         de.u.u.type = *XDGAEventBase + GetCoreType(ev.type);
         de.u.u.detail = event->detail;
-        de.u.event.time = event->time;
-        de.u.event.dx = event->dx;
-        de.u.event.dy = event->dy;
-        de.u.event.screen = pScreen->myNum;
-        de.u.event.state = ev.corestate;
 
         /* If the DGA client has selected input, then deliver based on the usual filter */
         TryClientEvents(pScreenPriv->client, keybd, (xEvent *) &de, 1,
@@ -1039,14 +1041,14 @@ DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse)
 {
     ButtonClassPtr butc = mouse->button;
     DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
-    DeviceEvent ev;
     DeviceIntPtr master = GetMaster(mouse, MASTER_KEYBOARD);
+    DeviceEvent ev = {
+        .header = ET_Internal,
+        .length = sizeof(ev),
+        .type = event->subtype,
+        .corestate = butc ? butc->state : 0
+    };
 
-    memset(&ev, 0, sizeof(ev));
-    ev.header = ET_Internal;
-    ev.length = sizeof(ev);
-    ev.type = event->subtype;
-    ev.corestate = butc ? butc->state : 0;
     if (master && master->key)
         ev.corestate |= XkbStateFieldFromRec(&master->key->xkbInfo->state);
 
@@ -1056,18 +1058,16 @@ DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse)
      * Deliver the DGA event
      */
     if (pScreenPriv->client) {
-        dgaEvent de;
-        int coreEquiv;
-
-        coreEquiv = GetCoreType(ev.type);
-
+        int coreEquiv = GetCoreType(ev.type);
+        dgaEvent de = {
+            .u.event.time = event->time,
+            .u.event.dx = event->dx,
+            .u.event.dy = event->dy,
+            .u.event.screen = pScreen->myNum,
+            .u.event.state = ev.corestate
+        };
         de.u.u.type = *XDGAEventBase + coreEquiv;
         de.u.u.detail = event->detail;
-        de.u.event.time = event->time;
-        de.u.event.dx = event->dx;
-        de.u.event.dy = event->dy;
-        de.u.event.screen = pScreen->myNum;
-        de.u.event.state = ev.corestate;
 
         /* If the DGA client has selected input, then deliver based on the usual filter */
         TryClientEvents(pScreenPriv->client, mouse, (xEvent *) &de, 1,
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 455ff34..3d66852 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -240,7 +240,6 @@ static void
 SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
 {
     XF86VidModeScreenPrivatePtr pPriv;
-    XF86VidModeEventPtr pEv;
     unsigned long mask;
     xXF86VidModeNotifyEvent ev;
     int kind;
@@ -253,15 +252,17 @@ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
         return;
     kind = XF86VidModeModeChange;
     for (pEv = pPriv->events; pEv; pEv = pEv->next) {
-        if (!(pEv->mask & mask))
-            continue;
-        ev.type = XF86VidModeNotify + XF86VidModeEventBase;
-        ev.state = state;
-        ev.timestamp = currentTime.milliseconds;
-        ev.root = pScreen->root->drawable.id;
-        ev.kind = kind;
-        ev.forced = forced;
-        WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
+        if (pEv->mask & mask) {
+            XF86VidModeEventPtr pEv = {
+                .type = XF86VidModeNotify + XF86VidModeEventBase,
+                .state = state,
+                .timestamp = currentTime.milliseconds,
+                .root = pScreen->root->drawable.id,
+                .kind = kind,
+                .forced = forced
+            };
+            WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
+        }
     }
 }
 
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index a6be4c2..c73fe9d 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -161,11 +161,11 @@ ProcDRI2Authenticate(ClientPtr client)
 static void
 DRI2InvalidateBuffersEvent(DrawablePtr pDraw, void *priv, XID id)
 {
-    xDRI2InvalidateBuffers event;
     ClientPtr client = priv;
-
-    event.type = DRI2EventBase + DRI2_InvalidateBuffers;
-    event.drawable = id;
+    xDRI2InvalidateBuffers event = {
+        .type = DRI2EventBase + DRI2_InvalidateBuffers,
+        .drawable = id
+    };
 
     WriteEventsToClient(client, 1, (xEvent *) &event);
 }
@@ -363,17 +363,17 @@ static void
 DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc,
               CARD32 sbc)
 {
-    xDRI2BufferSwapComplete2 event;
     DrawablePtr pDrawable = data;
-
-    event.type = DRI2EventBase + DRI2_BufferSwapComplete;
-    event.event_type = type;
-    event.drawable = pDrawable->id;
-    event.ust_hi = (CARD64) ust >> 32;
-    event.ust_lo = ust & 0xffffffff;
-    event.msc_hi = (CARD64) msc >> 32;
-    event.msc_lo = msc & 0xffffffff;
-    event.sbc = sbc;
+    xDRI2BufferSwapComplete2 event = {
+        .type = DRI2EventBase + DRI2_BufferSwapComplete,
+        .event_type = type,
+        .drawable = pDrawable->id,
+        .ust_hi = (CARD64) ust >> 32,
+        .ust_lo = ust & 0xffffffff,
+        .msc_hi = (CARD64) msc >> 32,
+        .msc_lo = msc & 0xffffffff,
+        .sbc = sbc
+    };
 
     WriteEventsToClient(client, 1, (xEvent *) &event);
 }
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 138fbe1..e82d050 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -236,29 +236,21 @@ RRDeliverCrtcEvent(ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
     rrScrPriv(pScreen);
-    xRRCrtcChangeNotifyEvent ce;
     RRModePtr mode = crtc->mode;
 
-    ce.type = RRNotify + RREventBase;
-    ce.subCode = RRNotify_CrtcChange;
-    ce.timestamp = pScrPriv->lastSetTime.milliseconds;
-    ce.window = pWin->drawable.id;
-    ce.crtc = crtc->id;
-    ce.rotation = crtc->rotation;
-    if (mode) {
-        ce.mode = mode->mode.id;
-        ce.x = crtc->x;
-        ce.y = crtc->y;
-        ce.width = mode->mode.width;
-        ce.height = mode->mode.height;
-    }
-    else {
-        ce.mode = None;
-        ce.x = 0;
-        ce.y = 0;
-        ce.width = 0;
-        ce.height = 0;
-    }
+    xRRCrtcChangeNotifyEvent ce = {
+        .type = RRNotify + RREventBase,
+        .subCode = RRNotify_CrtcChange,
+        .timestamp = pScrPriv->lastSetTime.milliseconds,
+        .window = pWin->drawable.id,
+        .crtc = crtc->id,
+        .mode = mode ? mode->mode.id : None,
+        .rotation = crtc->rotation,
+        .x = mode ? crtc->x : 0,
+        .y = mode ? crtc->y : 0,
+        .width = mode ? mode->mode.width : 0,
+        .height = mode ? mode->mode.height : 0
+    };
     WriteEventsToClient(client, 1, (xEvent *) &ce);
 }
 
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 0932508..88781ba 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -305,28 +305,22 @@ RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
     rrScrPriv(pScreen);
-    xRROutputChangeNotifyEvent oe;
     RRCrtcPtr crtc = output->crtc;
-    RRModePtr mode = crtc ? crtc->mode : 0;
-
-    oe.type = RRNotify + RREventBase;
-    oe.subCode = RRNotify_OutputChange;
-    oe.timestamp = pScrPriv->lastSetTime.milliseconds;
-    oe.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
-    oe.window = pWin->drawable.id;
-    oe.output = output->id;
-    if (crtc) {
-        oe.crtc = crtc->id;
-        oe.mode = mode ? mode->mode.id : None;
-        oe.rotation = crtc->rotation;
-    }
-    else {
-        oe.crtc = None;
-        oe.mode = None;
-        oe.rotation = RR_Rotate_0;
-    }
-    oe.connection = output->connection;
-    oe.subpixelOrder = output->subpixelOrder;
+    RRModePtr mode = crtc ? crtc->mode : NULL;
+
+    xRROutputChangeNotifyEvent oe = {
+        .type = RRNotify + RREventBase,
+        .subCode = RRNotify_OutputChange,
+        .timestamp = pScrPriv->lastSetTime.milliseconds,
+        .configTimestamp = pScrPriv->lastConfigTime.milliseconds,
+        .window = pWin->drawable.id,
+        .output = output->id,
+        .crtc = crtc ? crtc->id : None,
+        .mode = mode ? mode->mode.id : None,
+        .rotation = crtc ? crtc->rotation : RR_Rotate_0,
+        .connection = output->connection,
+        .subpixelOrder = output->subpixelOrder
+    };
     WriteEventsToClient(client, 1, (xEvent *) &oe);
 }
 
diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 7ce085c..7f09092 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -65,14 +65,14 @@ RRDestroyOutputProperty(RRPropertyPtr prop)
 static void
 RRDeleteProperty(RROutputRec * output, RRPropertyRec * prop)
 {
-    xRROutputPropertyNotifyEvent event;
-
-    event.type = RREventBase + RRNotify;
-    event.subCode = RRNotify_OutputProperty;
-    event.output = output->id;
-    event.state = PropertyDelete;
-    event.atom = prop->propertyName;
-    event.timestamp = currentTime.milliseconds;
+    xRROutputPropertyNotifyEvent event = {
+        .type = RREventBase + RRNotify,
+        .subCode = RRNotify_OutputProperty,
+        .output = output->id,
+        .state = PropertyDelete,
+        .atom = prop->propertyName,
+        .timestamp = currentTime.milliseconds
+    };
 
     RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event);
 
@@ -138,7 +138,6 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
                        pointer value, Bool sendevent, Bool pending)
 {
     RRPropertyPtr prop;
-    xRROutputPropertyNotifyEvent event;
     rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen);
     int size_in_bytes;
     int total_size;
@@ -237,12 +236,14 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
         output->pendingProperties = TRUE;
 
     if (sendevent) {
-        event.type = RREventBase + RRNotify;
-        event.subCode = RRNotify_OutputProperty;
-        event.output = output->id;
-        event.state = PropertyNewValue;
-        event.atom = prop->propertyName;
-        event.timestamp = currentTime.milliseconds;
+        xRROutputPropertyNotifyEvent event = {
+            .type = RREventBase + RRNotify,
+            .subCode = RRNotify_OutputProperty,
+            .output = output->id,
+            .state = PropertyNewValue,
+            .atom = prop->propertyName,
+            .timestamp = currentTime.milliseconds
+        };
         RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event);
     }
     return Success;
@@ -682,14 +683,14 @@ ProcRRGetOutputProperty(ClientPtr client)
     reply.propertyType = prop_value->type;
 
     if (stuff->delete && (reply.bytesAfter == 0)) {
-        xRROutputPropertyNotifyEvent event;
-
-        event.type = RREventBase + RRNotify;
-        event.subCode = RRNotify_OutputProperty;
-        event.output = output->id;
-        event.state = PropertyDelete;
-        event.atom = prop->propertyName;
-        event.timestamp = currentTime.milliseconds;
+        xRROutputPropertyNotifyEvent event = {
+            .type = RREventBase + RRNotify,
+            .subCode = RRNotify_OutputProperty,
+            .output = output->id,
+            .state = PropertyDelete,
+            .atom = prop->propertyName,
+            .timestamp = currentTime.milliseconds
+        };
         RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event);
     }
 
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 774f8be..a427725 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -71,20 +71,20 @@ void
 RRSendConfigNotify(ScreenPtr pScreen)
 {
     WindowPtr pWin = pScreen->root;
-    xEvent event;
-
-    event.u.u.type = ConfigureNotify;
-    event.u.configureNotify.window = pWin->drawable.id;
-    event.u.configureNotify.aboveSibling = None;
-    event.u.configureNotify.x = 0;
-    event.u.configureNotify.y = 0;
+    xEvent event = {
+        .u.configureNotify.window = pWin->drawable.id,
+        .u.configureNotify.aboveSibling = None,
+        .u.configureNotify.x = 0,
+        .u.configureNotify.y = 0,
 
     /* XXX xinerama stuff ? */
 
-    event.u.configureNotify.width = pWin->drawable.width;
-    event.u.configureNotify.height = pWin->drawable.height;
-    event.u.configureNotify.borderWidth = wBorderWidth(pWin);
-    event.u.configureNotify.override = pWin->overrideRedirect;
+        .u.configureNotify.width = pWin->drawable.width,
+        .u.configureNotify.height = pWin->drawable.height,
+        .u.configureNotify.borderWidth = wBorderWidth(pWin),
+        .u.configureNotify.override = pWin->overrideRedirect
+    };
+    event.u.u.type = ConfigureNotify;
     DeliverEvents(pWin, &event, 1, NullWindow);
 }
 
@@ -92,19 +92,20 @@ void
 RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
 {
     rrScrPriv(pScreen);
-    xRRScreenChangeNotifyEvent se;
     RRCrtcPtr crtc = pScrPriv->numCrtcs ? pScrPriv->crtcs[0] : NULL;
     WindowPtr pRoot = pScreen->root;
 
-    se.type = RRScreenChangeNotify + RREventBase;
-    se.rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0);
-    se.timestamp = pScrPriv->lastSetTime.milliseconds;
-    se.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
-    se.root = pRoot->drawable.id;
-    se.window = pWin->drawable.id;
-    se.subpixelOrder = PictureGetSubpixelOrder(pScreen);
+    xRRScreenChangeNotifyEvent se = {
+        .type = RRScreenChangeNotify + RREventBase,
+        .rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0),
+        .timestamp = pScrPriv->lastSetTime.milliseconds,
+        .configTimestamp = pScrPriv->lastConfigTime.milliseconds,
+        .root = pRoot->drawable.id,
+        .window = pWin->drawable.id,
+        .subpixelOrder = PictureGetSubpixelOrder(pScreen),
 
-    se.sizeID = RR10CurrentSizeID(pScreen);
+        .sizeID = RR10CurrentSizeID(pScreen)
+    };
 
     if (se.rotation & (RR_Rotate_90 | RR_Rotate_270)) {
         se.widthInPixels = pScreen->height;
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 68f7b74..4eee592 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -172,14 +172,14 @@ CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
         CursorCurrent[pDev->id] = pCursor;
         for (e = cursorEvents; e; e = e->next) {
             if ((e->eventMask & XFixesDisplayCursorNotifyMask)) {
-                xXFixesCursorNotifyEvent ev;
-
-                ev.type = XFixesEventBase + XFixesCursorNotify;
-                ev.subtype = XFixesDisplayCursorNotify;
-                ev.window = e->pWindow->drawable.id;
-                ev.cursorSerial = pCursor ? pCursor->serialNumber : 0;
-                ev.timestamp = currentTime.milliseconds;
-                ev.name = pCursor ? pCursor->name : None;
+                xXFixesCursorNotifyEvent ev = {
+                    .type = XFixesEventBase + XFixesCursorNotify,
+                    .subtype = XFixesDisplayCursorNotify,
+                    .window = e->pWindow->drawable.id,
+                    .cursorSerial = pCursor ? pCursor->serialNumber : 0,
+                    .timestamp = currentTime.milliseconds,
+                    .name = pCursor ? pCursor->name : None
+                };
                 WriteEventsToClient(e->pClient, 1, (xEvent *) &ev);
             }
         }
diff --git a/xfixes/select.c b/xfixes/select.c
index a896846..ee8ed6f 100644
--- a/xfixes/select.c
+++ b/xfixes/select.c
@@ -77,19 +77,16 @@ XFixesSelectionCallback(CallbackListPtr *callbacks, pointer data, pointer args)
     }
     for (e = selectionEvents; e; e = e->next) {
         if (e->selection == selection->selection && (e->eventMask & eventMask)) {
-            xXFixesSelectionNotifyEvent ev;
-
-            memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent));
-            ev.type = XFixesEventBase + XFixesSelectionNotify;
-            ev.subtype = subtype;
-            ev.window = e->pWindow->drawable.id;
-            if (subtype == XFixesSetSelectionOwnerNotify)
-                ev.owner = selection->window;
-            else
-                ev.owner = 0;
-            ev.selection = e->selection;
-            ev.timestamp = currentTime.milliseconds;
-            ev.selectionTimestamp = selection->lastTimeChanged.milliseconds;
+            xXFixesSelectionNotifyEvent ev = {
+                .type = XFixesEventBase + XFixesSelectionNotify,
+                .subtype = subtype,
+                .window = e->pWindow->drawable.id,
+                .owner = (subtype == XFixesSetSelectionOwnerNotify) ?
+                            selection->window : 0,
+                .selection = e->selection,
+                .timestamp = currentTime.milliseconds,
+                .selectionTimestamp = selection->lastTimeChanged.milliseconds
+            };
             WriteEventsToClient(e->pClient, 1, (xEvent *) &ev);
         }
     }
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index beb09cf..87a4485 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -59,8 +59,6 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
     int i;
     int keymap_changed = 0;
     int modmap_changed = 0;
-    xEvent core_mn;
-    deviceMappingNotify xi_mn;
     CARD32 time = GetTimeInMillis();
 
     if (xkb_event == XkbNewKeyboardNotify) {
@@ -78,11 +76,6 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
     if (!keymap_changed && !modmap_changed)
         return;
 
-    core_mn.u.u.type = MappingNotify;
-    xi_mn.type = DeviceMappingNotify;
-    xi_mn.deviceid = kbd->id;
-    xi_mn.time = time;
-
     /* 0 is serverClient. */
     for (i = 1; i < currentMaxClients; i++) {
         if (!clients[i] || clients[i]->clientState != ClientStateRunning)
@@ -106,6 +99,7 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
             continue;
 
         if (keymap_changed) {
+            xEvent core_mn = { .u.u.type = MappingNotify };
             core_mn.u.mappingNotify.request = MappingKeyboard;
 
             /* Clip the keycode range to what the client knows about, so it
@@ -123,9 +117,12 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
             WriteEventsToClient(clients[i], 1, &core_mn);
         }
         if (modmap_changed) {
-            core_mn.u.mappingNotify.request = MappingModifier;
-            core_mn.u.mappingNotify.firstKeyCode = 0;
-            core_mn.u.mappingNotify.count = 0;
+            xEvent core_mn = {
+                .u.mappingNotify.request = MappingModifier,
+                .u.mappingNotify.firstKeyCode = 0,
+                .u.mappingNotify.count = 0
+            };
+            core_mn.u.u.type = MappingNotify;
             WriteEventsToClient(clients[i], 1, &core_mn);
         }
     }
@@ -134,16 +131,26 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
      * here? Clients might be upset, but that seems better than the
      * alternative of stale keymaps. -ds */
     if (keymap_changed) {
-        xi_mn.request = MappingKeyboard;
-        xi_mn.firstKeyCode = first_key;
-        xi_mn.count = num_keys;
+        deviceMappingNotify xi_mn = {
+            .type = DeviceMappingNotify,
+            .deviceid = kbd->id,
+            .request = MappingKeyboard,
+            .firstKeyCode = first_key,
+            .count = num_keys,
+            .time = time
+        };
         SendEventToAllWindows(kbd, DeviceMappingNotifyMask, (xEvent *) &xi_mn,
                               1);
     }
     if (modmap_changed) {
-        xi_mn.request = MappingModifier;
-        xi_mn.firstKeyCode = 0;
-        xi_mn.count = 0;
+        deviceMappingNotify xi_mn = {
+            .type = DeviceMappingNotify,
+            .deviceid = kbd->id,
+            .request = MappingModifier,
+            .firstKeyCode = 0,
+            .count = 0,
+            .time = time
+        };
         SendEventToAllWindows(kbd, DeviceMappingNotifyMask, (xEvent *) &xi_mn,
                               1);
     }
commit 0af79b124e1317c36d1613d28755c5a8ce612e2a
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:44 2012 -0700

    Use C99 designated initializers in dix Events
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/dix/colormap.c b/dix/colormap.c
index 36526b8..a43e279 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -450,15 +450,15 @@ FreeColormap(pointer value, XID mid)
 static int
 TellNoMap(WindowPtr pwin, Colormap * pmid)
 {
-    xEvent xE;
-
     if (wColormap(pwin) == *pmid) {
         /* This should be call to DeliverEvent */
+        xEvent xE = {
+            .u.colormap.window = pwin->drawable.id,
+            .u.colormap.colormap = None,
+            .u.colormap.new = TRUE,
+            .u.colormap.state = ColormapUninstalled
+        };
         xE.u.u.type = ColormapNotify;
-        xE.u.colormap.window = pwin->drawable.id;
-        xE.u.colormap.colormap = None;
-        xE.u.colormap.new = TRUE;
-        xE.u.colormap.state = ColormapUninstalled;
 #ifdef PANORAMIX
         if (noPanoramiXExtension || !pwin->drawable.pScreen->myNum)
 #endif
@@ -477,7 +477,6 @@ int
 TellLostMap(WindowPtr pwin, pointer value)
 {
     Colormap *pmid = (Colormap *) value;
-    xEvent xE;
 
 #ifdef PANORAMIX
     if (!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
@@ -485,11 +484,13 @@ TellLostMap(WindowPtr pwin, pointer value)
 #endif
     if (wColormap(pwin) == *pmid) {
         /* This should be call to DeliverEvent */
+        xEvent xE = {
+            .u.colormap.window = pwin->drawable.id,
+            .u.colormap.colormap = *pmid,
+            .u.colormap.new = FALSE,
+            .u.colormap.state = ColormapUninstalled
+        };
         xE.u.u.type = ColormapNotify;
-        xE.u.colormap.window = pwin->drawable.id;
-        xE.u.colormap.colormap = *pmid;
-        xE.u.colormap.new = FALSE;
-        xE.u.colormap.state = ColormapUninstalled;
         DeliverEvents(pwin, &xE, 1, (WindowPtr) NULL);
     }
 
@@ -501,7 +502,6 @@ int
 TellGainedMap(WindowPtr pwin, pointer value)
 {
     Colormap *pmid = (Colormap *) value;
-    xEvent xE;
 
 #ifdef PANORAMIX
     if (!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
@@ -509,11 +509,13 @@ TellGainedMap(WindowPtr pwin, pointer value)
 #endif
     if (wColormap(pwin) == *pmid) {
         /* This should be call to DeliverEvent */
+        xEvent xE = {
+            .u.colormap.window = pwin->drawable.id,
+            .u.colormap.colormap = *pmid,
+            .u.colormap.new = FALSE,
+            .u.colormap.state = ColormapInstalled
+        };
         xE.u.u.type = ColormapNotify;
-        xE.u.colormap.window = pwin->drawable.id;
-        xE.u.colormap.colormap = *pmid;
-        xE.u.colormap.new = FALSE;
-        xE.u.colormap.state = ColormapInstalled;
         DeliverEvents(pwin, &xE, 1, (WindowPtr) NULL);
     }
 
diff --git a/dix/devices.c b/dix/devices.c
index 77583f7..839de35 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -321,15 +321,14 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
 void
 SendDevicePresenceEvent(int deviceid, int type)
 {
-    DeviceIntRec dummyDev;
-    devicePresenceNotify ev;
-
-    memset(&dummyDev, 0, sizeof(DeviceIntRec));
-    ev.type = DevicePresenceNotify;
-    ev.time = currentTime.milliseconds;
-    ev.devchange = type;
-    ev.deviceid = deviceid;
-    dummyDev.id = XIAllDevices;
+    DeviceIntRec dummyDev = { .id =  XIAllDevices };
+    devicePresenceNotify ev = {
+        .type = DevicePresenceNotify,
+        .time = currentTime.milliseconds,
+        .devchange = type,
+        .deviceid = deviceid
+    };
+
     SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
                           (xEvent *) &ev, 1);
 }
@@ -2450,18 +2449,17 @@ RecalculateMasterButtons(DeviceIntPtr slave)
 
     if (master->button && master->button->numButtons != maxbuttons) {
         int i;
-        DeviceChangedEvent event;
-
-        memset(&event, 0, sizeof(event));
+        DeviceChangedEvent event = {
+            .header = ET_Internal,
+            .type = ET_DeviceChanged,
+            .time = GetTimeInMillis(),
+            .deviceid = master->id,
+            .flags = DEVCHANGE_POINTER_EVENT | DEVCHANGE_DEVICE_CHANGE,
+            .buttons.num_buttons = maxbuttons
+        };
 
         master->button->numButtons = maxbuttons;
 
-        event.header = ET_Internal;
-        event.type = ET_DeviceChanged;
-        event.time = GetTimeInMillis();
-        event.deviceid = master->id;
-        event.flags = DEVCHANGE_POINTER_EVENT | DEVCHANGE_DEVICE_CHANGE;
-        event.buttons.num_buttons = maxbuttons;
         memcpy(&event.buttons.names, master->button->labels, maxbuttons *
                sizeof(Atom));
 
diff --git a/dix/enterleave.c b/dix/enterleave.c
index 00083e9..431566f 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -827,12 +827,14 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
     free(xi2event);
 
     /* XI 1.x event */
-    event.deviceid = dev->id;
-    event.mode = mode;
-    event.type = (type == XI_FocusIn) ? DeviceFocusIn : DeviceFocusOut;
-    event.detail = detail;
-    event.window = pWin->drawable.id;
-    event.time = currentTime.milliseconds;
+    event = (deviceFocus) {
+        .deviceid = dev->id,
+        .mode = mode,
+        .type = (type == XI_FocusIn) ? DeviceFocusIn : DeviceFocusOut,
+        .detail = detail,
+        .window = pWin->drawable.id,
+        .time = currentTime.milliseconds
+    };
 
     DeliverEventsToWindow(dev, pWin, (xEvent *) &event, 1,
                           DeviceFocusChangeMask, NullGrab);
diff --git a/dix/events.c b/dix/events.c
index 1708710..3b40446 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2834,14 +2834,15 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
     if (win == NoneWin || win == PointerRootWin)
         return FALSE;
 
-    memset(&event, 0, sizeof(DeviceEvent));
-    event.header = ET_Internal;
-    event.type = ET_FocusIn;
-    event.length = sizeof(DeviceEvent);
-    event.time = GetTimeInMillis();
-    event.deviceid = dev->id;
-    event.sourceid = dev->id;
-    event.detail.button = 0;
+    event = (DeviceEvent) {
+        .header = ET_Internal,
+        .type = ET_FocusIn,
+        .length = sizeof(DeviceEvent),
+        .time = GetTimeInMillis(),
+        .deviceid = dev->id,
+        .sourceid = dev->id,
+        .detail.button = 0
+    };
     rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
                                     TRUE) != NULL);
     if (rc)
@@ -2871,14 +2872,15 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
         (*dev->deviceGrab.DeactivateGrab) (dev);
     }
 
-    memset(&event, 0, sizeof(DeviceEvent));
-    event.header = ET_Internal;
-    event.type = ET_Enter;
-    event.length = sizeof(DeviceEvent);
-    event.time = GetTimeInMillis();
-    event.deviceid = dev->id;
-    event.sourceid = dev->id;
-    event.detail.button = 0;
+    event = (DeviceEvent) {
+        .header = ET_Internal,
+        .type = ET_Enter,
+        .length = sizeof(DeviceEvent),
+        .time = GetTimeInMillis(),
+        .deviceid = dev->id,
+        .sourceid = dev->id,
+        .detail.button = 0
+    };
     rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
                                     TRUE) != NULL);
     if (rc)
@@ -4457,7 +4459,10 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
                     int type,
                     int mode, int detail, WindowPtr pWin, Window child)
 {
-    xEvent event;
+    xEvent event = {
+        .u.u.type = type,
+        .u.u.detail = detail
+    };
     WindowPtr focus;
     DeviceIntPtr keybd;
     GrabPtr grab = mouse->deviceGrab.grab;
@@ -4477,9 +4482,6 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
         mask = pWin->eventMask | wOtherEventMasks(pWin);
     }
 
-    memset(&event, 0, sizeof(xEvent));
-    event.u.u.type = type;
-    event.u.u.detail = detail;
     event.u.enterLeave.time = currentTime.milliseconds;
     event.u.enterLeave.rootX = mouse->spriteInfo->sprite->hot.x;
     event.u.enterLeave.rootY = mouse->spriteInfo->sprite->hot.y;
@@ -4510,16 +4512,16 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
     }
 
     if ((type == EnterNotify) && (mask & KeymapStateMask)) {
-        xKeymapEvent ke;
+        xKeymapEvent ke = {
+            .type = KeymapNotify
+        };
         ClientPtr client = grab ? rClient(grab) : wClient(pWin);
         int rc;
 
-        memset((char *) &ke.map[0], 0, 31);
         rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
         if (rc == Success)
             memcpy((char *) &ke.map[0], (char *) &keybd->key->down[1], 31);
 
-        ke.type = KeymapNotify;
         if (grab)
             TryClientEvents(rClient(grab), keybd, (xEvent *) &ke, 1,
                             mask, KeymapStateMask, grab);
@@ -4604,28 +4606,27 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
 void
 CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
 {
-    xEvent event;
-
-    memset(&event, 0, sizeof(xEvent));
+    xEvent event = {
+        .u.u.type = type,
+        .u.u.detail = detail
+    };
     event.u.focus.mode = mode;
-    event.u.u.type = type;
-    event.u.u.detail = detail;
     event.u.focus.window = pWin->drawable.id;
 
     DeliverEventsToWindow(dev, pWin, &event, 1,
                           GetEventFilter(dev, &event), NullGrab);
     if ((type == FocusIn) &&
         ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) {
-        xKeymapEvent ke;
+        xKeymapEvent ke = {
+            .type = KeymapNotify
+        };
         ClientPtr client = wClient(pWin);
         int rc;
 
-        memset((char *) &ke.map[0], 0, 31);
         rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess);
         if (rc == Success)
             memcpy((char *) &ke.map[0], (char *) &dev->key->down[1], 31);
 
-        ke.type = KeymapNotify;
         DeliverEventsToWindow(dev, pWin, (xEvent *) &ke, 1,
                               KeymapStateMask, NullGrab);
     }
@@ -5429,12 +5430,13 @@ ProcGrabKey(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xGrabKeyReq);
 
-    memset(&param, 0, sizeof(param));
-    param.grabtype = CORE;
-    param.ownerEvents = stuff->ownerEvents;
-    param.this_device_mode = stuff->keyboardMode;
-    param.other_devices_mode = stuff->pointerMode;
-    param.modifiers = stuff->modifiers;
+    param = (GrabParameters) {
+        .grabtype = CORE,
+        .ownerEvents = stuff->ownerEvents,
+        .this_device_mode = stuff->keyboardMode,
+        .other_devices_mode = stuff->pointerMode,
+        .modifiers = stuff->modifiers
+    };
 
     rc = CheckGrabValues(client, &param);
     if (rc != Success)
@@ -5535,12 +5537,13 @@ ProcGrabButton(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    memset(&param, 0, sizeof(param));
-    param.grabtype = CORE;
-    param.ownerEvents = stuff->ownerEvents;
-    param.this_device_mode = stuff->keyboardMode;
-    param.other_devices_mode = stuff->pointerMode;
-    param.modifiers = stuff->modifiers;
+    param = (GrabParameters) {
+        .grabtype = CORE,
+        .ownerEvents = stuff->ownerEvents,
+        .this_device_mode = stuff->keyboardMode,
+        .other_devices_mode = stuff->pointerMode,
+        .modifiers = stuff->modifiers
+    };
 
     mask.core = stuff->eventMask;
 
diff --git a/dix/inpututils.c b/dix/inpututils.c
index 223d547..f01e9a7 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -71,14 +71,13 @@ static void
 do_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client)
 {
     int i;
-    xEvent core_mn;
+    xEvent core_mn = { .u.u.type = MappingNotify };
     deviceMappingNotify xi_mn;
 
     /* The map in ButtonClassRec refers to button numbers, whereas the
      * protocol is zero-indexed.  Sigh. */
     memcpy(&(dev->button->map[1]), map, len);
 
-    core_mn.u.u.type = MappingNotify;
     core_mn.u.mappingNotify.request = MappingPointer;
 
     /* 0 is the server client. */
@@ -93,10 +92,12 @@ do_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client)
         WriteEventsToClient(clients[i], 1, &core_mn);
     }
 
-    xi_mn.type = DeviceMappingNotify;
-    xi_mn.request = MappingPointer;
-    xi_mn.deviceid = dev->id;
-    xi_mn.time = GetTimeInMillis();
+    xi_mn = (deviceMappingNotify) {
+        .type = DeviceMappingNotify,
+        .request = MappingPointer,
+        .deviceid = dev->id,
+        .time = GetTimeInMillis()
+    };
 
     SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) &xi_mn, 1);
 }
diff --git a/dix/property.c b/dix/property.c
index 5aa6f4a..dec4090 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -108,14 +108,13 @@ dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName,
 static void
 deliverPropertyNotifyEvent(WindowPtr pWin, int state, Atom atom)
 {
-    xEvent event;
-
-    memset(&event, 0, sizeof(xEvent));
+    xEvent event = {
+        .u.property.window = pWin->drawable.id,
+        .u.property.state = state,
+        .u.property.atom = atom,
+        .u.property.time = currentTime.milliseconds
+    };
     event.u.u.type = PropertyNotify;
-    event.u.property.window = pWin->drawable.id;
-    event.u.property.state = state;
-    event.u.property.atom = atom;
-    event.u.property.time = currentTime.milliseconds;
     DeliverEvents(pWin, &event, 1, (WindowPtr) NULL);
 }
 
diff --git a/dix/selection.c b/dix/selection.c
index 80b5893..e905b1e 100644
--- a/dix/selection.c
+++ b/dix/selection.c
@@ -174,8 +174,6 @@ ProcSetSelectionOwner(ClientPtr client)
     rc = dixLookupSelection(&pSel, stuff->selection, client, DixSetAttrAccess);
 
     if (rc == Success) {
-        xEvent event;
-
         /* If the timestamp in client's request is in the past relative
            to the time stamp indicating the last time the owner of the
            selection was set, do not set the selection, just return 
@@ -183,10 +181,12 @@ ProcSetSelectionOwner(ClientPtr client)
         if (CompareTimeStamps(time, pSel->lastTimeChanged) == EARLIER)
             return Success;
         if (pSel->client && (!pWin || (pSel->client != client))) {
+            xEvent event = {
+                .u.selectionClear.time = time.milliseconds,
+                .u.selectionClear.window = pSel->window,
+                .u.selectionClear.atom = pSel->selection
+            };
             event.u.u.type = SelectionClear;
-            event.u.selectionClear.time = time.milliseconds;
-            event.u.selectionClear.window = pSel->window;
-            event.u.selectionClear.atom = pSel->selection;
             WriteEventsToClient(pSel->client, 1, &event);
         }
     }
diff --git a/dix/swapreq.c b/dix/swapreq.c
index a896b4b..0f6d49e 100644
--- a/dix/swapreq.c
+++ b/dix/swapreq.c
@@ -283,7 +283,7 @@ SProcConvertSelection(ClientPtr client)
 int
 SProcSendEvent(ClientPtr client)
 {
-    xEvent eventT;
+    xEvent eventT = { .u.u.type = 0 };
     EventSwapPtr proc;
 
     REQUEST(xSendEventReq);
diff --git a/dix/window.c b/dix/window.c
index b660808..cdd12dc 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -641,7 +641,6 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
     WindowPtr pWin;
     WindowPtr pHead;
     ScreenPtr pScreen;
-    xEvent event;
     int idepth, ivisual;
     Bool fOK;
     DepthPtr pDepth;
@@ -828,16 +827,17 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
     }
 
     if (SubSend(pParent)) {
-        memset(&event, 0, sizeof(xEvent));
+        xEvent event = {
+            .u.createNotify.window = wid,
+            .u.createNotify.parent = pParent->drawable.id,
+            .u.createNotify.x = x,
+            .u.createNotify.y = y,
+            .u.createNotify.width = w,
+            .u.createNotify.height = h,
+            .u.createNotify.borderWidth = bw,
+            .u.createNotify.override = pWin->overrideRedirect
+        };
         event.u.u.type = CreateNotify;
-        event.u.createNotify.window = wid;
-        event.u.createNotify.parent = pParent->drawable.id;
-        event.u.createNotify.x = x;
-        event.u.createNotify.y = y;
-        event.u.createNotify.width = w;
-        event.u.createNotify.height = h;
-        event.u.createNotify.borderWidth = bw;
-        event.u.createNotify.override = pWin->overrideRedirect;
         DeliverEvents(pParent, &event, 1, NullWindow);
     }
     return pWin;
@@ -912,7 +912,6 @@ CrushTree(WindowPtr pWin)
 {
     WindowPtr pChild, pSib, pParent;
     UnrealizeWindowProcPtr UnrealizeWindow;
-    xEvent event;
 
     if (!(pChild = pWin->firstChild))
         return;
@@ -925,8 +924,7 @@ CrushTree(WindowPtr pWin)
         while (1) {
             pParent = pChild->parent;
             if (SubStrSend(pChild, pParent)) {
-                memset(&event, 0, sizeof(xEvent));
-                event.u.u.type = DestroyNotify;
+                xEvent event = { .u.u.type = DestroyNotify };
                 event.u.destroyNotify.window = pChild->drawable.id;
                 DeliverEvents(pChild, &event, 1, NullWindow);
             }
@@ -961,7 +959,6 @@ DeleteWindow(pointer value, XID wid)
 {
     WindowPtr pParent;
     WindowPtr pWin = (WindowPtr) value;
-    xEvent event;
 
     UnmapWindow(pWin, FALSE);
 
@@ -969,8 +966,7 @@ DeleteWindow(pointer value, XID wid)
 
     pParent = pWin->parent;
     if (wid && pParent && SubStrSend(pWin, pParent)) {
-        memset(&event, 0, sizeof(xEvent));
-        event.u.u.type = DestroyNotify;
+        xEvent event = { .u.u.type = DestroyNotify };
         event.u.destroyNotify.window = pWin->drawable.id;
         DeliverEvents(pWin, &event, 1, NullWindow);
     }
@@ -1355,11 +1351,13 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
                         CheckWindowOptionalNeed(pChild);
                 }
 
+                xE = (xEvent) {
+                    .u.colormap.window = pWin->drawable.id,
+                    .u.colormap.colormap = cmap,
+                    .u.colormap.new = xTrue,
+                    .u.colormap.state = IsMapInstalled(cmap, pWin)
+                };
                 xE.u.u.type = ColormapNotify;
-                xE.u.colormap.window = pWin->drawable.id;
-                xE.u.colormap.colormap = cmap;
-                xE.u.colormap.new = xTrue;
-                xE.u.colormap.state = IsMapInstalled(cmap, pWin);
                 DeliverEvents(pWin, &xE, 1, NullWindow);
             }
             break;
@@ -1746,12 +1744,12 @@ ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
             GravityTranslate(cwsx, cwsy, cwsx - dx, cwsy - dy, dw, dh,
                              pSib->winGravity, &cwsx, &cwsy);
             if (cwsx != pSib->origin.x || cwsy != pSib->origin.y) {
-                xEvent event;
-
+                xEvent event = {
+                    .u.gravity.window = pSib->drawable.id,
+                    .u.gravity.x = cwsx - wBorderWidth(pSib),
+                    .u.gravity.y = cwsy - wBorderWidth(pSib)
+                };
                 event.u.u.type = GravityNotify;
-                event.u.gravity.window = pSib->drawable.id;
-                event.u.gravity.x = cwsx - wBorderWidth(pSib);
-                event.u.gravity.y = cwsy - wBorderWidth(pSib);
                 DeliverEvents(pSib, &event, 1, NullWindow);
                 pSib->origin.x = cwsx;
                 pSib->origin.y = cwsy;
@@ -2090,7 +2088,6 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
     unsigned short w = pWin->drawable.width,
         h = pWin->drawable.height, bw = pWin->borderWidth;
     int rc, action, smode = Above;
-    xEvent event;
 
     if ((pWin->drawable.class == InputOnly) &&
         (mask & IllegalInputOnlyConfigureMask))
@@ -2179,30 +2176,25 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
 
     if ((!pWin->overrideRedirect) && (RedirectSend(pParent)
         )) {
-        memset(&event, 0, sizeof(xEvent));
+        xEvent event = {
+            .u.configureRequest.window = pWin->drawable.id,
+            .u.configureRequest.sibling = (mask & CWSibling) ? sibwid : None,
+            .u.configureRequest.x = x,
+            .u.configureRequest.y = y,
+            .u.configureRequest.width = w,
+            .u.configureRequest.height = h,
+            .u.configureRequest.borderWidth = bw,
+            .u.configureRequest.valueMask = mask,
+            .u.configureRequest.parent = pParent->drawable.id
+        };
         event.u.u.type = ConfigureRequest;
-        event.u.configureRequest.window = pWin->drawable.id;
-        if (mask & CWSibling)
-            event.u.configureRequest.sibling = sibwid;
-        else
-            event.u.configureRequest.sibling = None;
-        if (mask & CWStackMode)
-            event.u.u.detail = smode;
-        else
-            event.u.u.detail = Above;
-        event.u.configureRequest.x = x;
-        event.u.configureRequest.y = y;
+        event.u.u.detail = (mask & CWStackMode) ? smode : Above;
 #ifdef PANORAMIX
         if (!noPanoramiXExtension && (!pParent || !pParent->parent)) {
             event.u.configureRequest.x += screenInfo.screens[0]->x;
             event.u.configureRequest.y += screenInfo.screens[0]->y;
         }
 #endif
-        event.u.configureRequest.width = w;
-        event.u.configureRequest.height = h;
-        event.u.configureRequest.borderWidth = bw;
-        event.u.configureRequest.valueMask = mask;
-        event.u.configureRequest.parent = pParent->drawable.id;
         if (MaybeDeliverEventsToClient(pParent, &event, 1,
                                        SubstructureRedirectMask, client) == 1)
             return Success;
@@ -2213,13 +2205,12 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
 
         if (size_change &&
             ((pWin->eventMask | wOtherEventMasks(pWin)) & ResizeRedirectMask)) {
-            xEvent eventT;
-
-            memset(&eventT, 0, sizeof(xEvent));
+            xEvent eventT = {
+                .u.resizeRequest.window = pWin->drawable.id,
+                .u.resizeRequest.width = w,
+                .u.resizeRequest.height = h
+            };
             eventT.u.u.type = ResizeRequest;
-            eventT.u.resizeRequest.window = pWin->drawable.id;
-            eventT.u.resizeRequest.width = w;
-            eventT.u.resizeRequest.height = h;
             if (MaybeDeliverEventsToClient(pWin, &eventT, 1,
                                            ResizeRedirectMask, client) == 1) {
                 /* if event is delivered, leave the actual size alone. */
@@ -2270,25 +2261,23 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
     }
 
     if (SubStrSend(pWin, pParent)) {
-        memset(&event, 0, sizeof(xEvent));
+        xEvent event = {
+            .u.configureNotify.window = pWin->drawable.id,
+            .u.configureNotify.aboveSibling = pSib ? pSib->drawable.id : None,
+            .u.configureNotify.x = x,
+            .u.configureNotify.y = y,
+            .u.configureNotify.width = w,
+            .u.configureNotify.height = h,
+            .u.configureNotify.borderWidth = bw,
+            .u.configureNotify.override = pWin->overrideRedirect
+        };
         event.u.u.type = ConfigureNotify;
-        event.u.configureNotify.window = pWin->drawable.id;
-        if (pSib)
-            event.u.configureNotify.aboveSibling = pSib->drawable.id;
-        else
-            event.u.configureNotify.aboveSibling = None;
-        event.u.configureNotify.x = x;
-        event.u.configureNotify.y = y;
 #ifdef PANORAMIX
         if (!noPanoramiXExtension && (!pParent || !pParent->parent)) {
             event.u.configureNotify.x += screenInfo.screens[0]->x;
             event.u.configureNotify.y += screenInfo.screens[0]->y;
         }
 #endif
-        event.u.configureNotify.width = w;
-        event.u.configureNotify.height = h;
-        event.u.configureNotify.borderWidth = bw;
-        event.u.configureNotify.override = pWin->overrideRedirect;
         DeliverEvents(pWin, &event, 1, NullWindow);
     }
     if (mask & CWBorderWidth) {
@@ -2361,13 +2350,13 @@ CirculateWindow(WindowPtr pParent, int direction, ClientPtr client)
             return Success;
     }
 
-    event.u.circulate.window = pWin->drawable.id;
-    event.u.circulate.parent = pParent->drawable.id;
-    event.u.circulate.event = pParent->drawable.id;
-    if (direction == RaiseLowest)
-        event.u.circulate.place = PlaceOnTop;
-    else
-        event.u.circulate.place = PlaceOnBottom;
+    event = (xEvent) {
+        .u.circulate.window = pWin->drawable.id,
+        .u.circulate.parent = pParent->drawable.id,
+        .u.circulate.event = pParent->drawable.id,
+        .u.circulate.place = (direction == RaiseLowest) ?
+                              PlaceOnTop : PlaceOnBottom,
+    };
 
     if (RedirectSend(pParent)) {
         event.u.u.type = CirculateRequest;
@@ -2420,19 +2409,20 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent,
     if (WasMapped)
         UnmapWindow(pWin, FALSE);
 
-    memset(&event, 0, sizeof(xEvent));
+    event = (xEvent) {
+        .u.reparent.window = pWin->drawable.id,
+        .u.reparent.parent = pParent->drawable.id,
+        .u.reparent.x = x,
+        .u.reparent.y = y,
+        .u.reparent.override = pWin->overrideRedirect
+    };
     event.u.u.type = ReparentNotify;
-    event.u.reparent.window = pWin->drawable.id;
-    event.u.reparent.parent = pParent->drawable.id;
-    event.u.reparent.x = x;
-    event.u.reparent.y = y;
 #ifdef PANORAMIX
     if (!noPanoramiXExtension && !pParent->parent) {
         event.u.reparent.x += screenInfo.screens[0]->x;
         event.u.reparent.y += screenInfo.screens[0]->y;
     }
 #endif
-    event.u.reparent.override = pWin->overrideRedirect;
     DeliverEvents(pWin, &event, 1, pParent);
 
     /* take out of sibling chain */
@@ -2568,15 +2558,15 @@ MapWindow(WindowPtr pWin, ClientPtr client)
 
     pScreen = pWin->drawable.pScreen;
     if ((pParent = pWin->parent)) {
-        xEvent event;
         Bool anyMarked;
 
         if ((!pWin->overrideRedirect) && (RedirectSend(pParent)
             )) {
-            memset(&event, 0, sizeof(xEvent));
+            xEvent event = {
+                .u.mapRequest.window = pWin->drawable.id,
+                .u.mapRequest.parent = pParent->drawable.id
+            };
             event.u.u.type = MapRequest;
-            event.u.mapRequest.window = pWin->drawable.id;
-            event.u.mapRequest.parent = pParent->drawable.id;
 
             if (MaybeDeliverEventsToClient(pParent, &event, 1,
                                            SubstructureRedirectMask,
@@ -2586,10 +2576,11 @@ MapWindow(WindowPtr pWin, ClientPtr client)
 
         pWin->mapped = TRUE;
         if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
-            memset(&event, 0, sizeof(xEvent));
+            xEvent event = {
+                .u.mapNotify.window = pWin->drawable.id,
+                .u.mapNotify.override = pWin->overrideRedirect,
+            };
             event.u.u.type = MapNotify;
-            event.u.mapNotify.window = pWin->drawable.id;
-            event.u.mapNotify.override = pWin->overrideRedirect;
             DeliverEvents(pWin, &event, 1, NullWindow);
         }
 
@@ -2644,7 +2635,6 @@ MapSubwindows(WindowPtr pParent, ClientPtr client)
     ScreenPtr pScreen;
     Mask parentRedirect;
     Mask parentNotify;
-    xEvent event;
     Bool anyMarked;
     WindowPtr pLayerWin;
 
@@ -2655,10 +2645,11 @@ MapSubwindows(WindowPtr pParent, ClientPtr client)
     for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib) {
         if (!pWin->mapped) {
             if (parentRedirect && !pWin->overrideRedirect) {
-                memset(&event, 0, sizeof(xEvent));
+                xEvent event = {
+                    .u.mapRequest.window = pWin->drawable.id,
+                    .u.mapRequest.parent = pParent->drawable.id
+                };
                 event.u.u.type = MapRequest;
-                event.u.mapRequest.window = pWin->drawable.id;
-                event.u.mapRequest.parent = pParent->drawable.id;
 
                 if (MaybeDeliverEventsToClient(pParent, &event, 1,
                                                SubstructureRedirectMask,
@@ -2668,10 +2659,11 @@ MapSubwindows(WindowPtr pParent, ClientPtr client)
 
             pWin->mapped = TRUE;
             if (parentNotify || StrSend(pWin)) {
-                memset(&event, 0, sizeof(xEvent));
+                xEvent event = {
+                    .u.mapNotify.window = pWin->drawable.id,
+                    .u.mapNotify.override = pWin->overrideRedirect
+                };
                 event.u.u.type = MapNotify;
-                event.u.mapNotify.window = pWin->drawable.id;
-                event.u.mapNotify.override = pWin->overrideRedirect;
                 DeliverEvents(pWin, &event, 1, NullWindow);
             }
 
@@ -2765,7 +2757,6 @@ int
 UnmapWindow(WindowPtr pWin, Bool fromConfigure)
 {
     WindowPtr pParent;
-    xEvent event;
     Bool wasRealized = (Bool) pWin->realized;
     Bool wasViewable = (Bool) pWin->viewable;
     ScreenPtr pScreen = pWin->drawable.pScreen;
@@ -2774,10 +2765,11 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
     if ((!pWin->mapped) || (!(pParent = pWin->parent)))
         return Success;
     if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
-        memset(&event, 0, sizeof(xEvent));
+        xEvent event = {
+            .u.unmapNotify.window = pWin->drawable.id,
+            .u.unmapNotify.fromConfigure = fromConfigure
+        };
         event.u.u.type = UnmapNotify;
-        event.u.unmapNotify.window = pWin->drawable.id;
-        event.u.unmapNotify.fromConfigure = fromConfigure;
         DeliverEvents(pWin, &event, 1, NullWindow);
     }
     if (wasViewable && !fromConfigure) {
@@ -2813,7 +2805,6 @@ void
 UnmapSubwindows(WindowPtr pWin)
 {
     WindowPtr pChild, pHead;
-    xEvent event;
     Bool wasRealized = (Bool) pWin->realized;
     Bool wasViewable = (Bool) pWin->viewable;
     Bool anyMarked = FALSE;
@@ -2832,9 +2823,11 @@ UnmapSubwindows(WindowPtr pWin)
     for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) {
         if (pChild->mapped) {
             if (parentNotify || StrSend(pChild)) {
+                xEvent event = {
+                    .u.unmapNotify.window = pChild->drawable.id,
+                    .u.unmapNotify.fromConfigure = xFalse
+                };
                 event.u.u.type = UnmapNotify;
-                event.u.unmapNotify.window = pChild->drawable.id;
-                event.u.unmapNotify.fromConfigure = xFalse;
                 DeliverEvents(pChild, &event, 1, NullWindow);
             }
             if (pChild->viewable) {
@@ -3028,10 +3021,11 @@ SendVisibilityNotify(WindowPtr pWin)
     }
 #endif
 
-    memset(&event, 0, sizeof(xEvent));
+    event = (xEvent) {
+        .u.visibility.window = pWin->drawable.id,
+        .u.visibility.state = visibility
+    };
     event.u.u.type = VisibilityNotify;
-    event.u.visibility.window = pWin->drawable.id;
-    event.u.visibility.state = visibility;
     DeliverEvents(pWin, &event, 1, NullWindow);
 }
 
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 2dc465d..8b7c93f 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -349,13 +349,12 @@ miSendGraphicsExpose(ClientPtr client, RegionPtr pRgn, XID drawable,
         free(pEvent);
     }
     else {
-        xEvent event;
-
-        memset(&event, 0, sizeof(xEvent));
+        xEvent event = {
+            .u.noExposure.drawable = drawable,
+            .u.noExposure.majorEvent = major,
+            .u.noExposure.minorEvent = minor
+        };
         event.u.u.type = NoExpose;
-        event.u.noExposure.drawable = drawable;
-        event.u.noExposure.majorEvent = major;
-        event.u.noExposure.minorEvent = minor;
         WriteEventsToClient(client, 1, &event);
     }
 }
commit 483266a583b0fd8a552303f318a71502ce3ff1d2
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:43 2012 -0700

    Use C99 designated initializers in xf86 extension Replies
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index 347282c..9b7ec14 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -75,14 +75,15 @@ XDGAResetProc(ExtensionEntry * extEntry)
 static int
 ProcXDGAQueryVersion(ClientPtr client)
 {
-    xXDGAQueryVersionReply rep;
+    xXDGAQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_XDGA_MAJOR_VERSION,
+        .minorVersion = SERVER_XDGA_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xXDGAQueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_XDGA_MAJOR_VERSION;
-    rep.minorVersion = SERVER_XDGA_MINOR_VERSION;
 
     WriteToClient(client, sizeof(xXDGAQueryVersionReply), &rep);
     return Success;
@@ -92,7 +93,11 @@ static int
 ProcXDGAOpenFramebuffer(ClientPtr client)
 {
     REQUEST(xXDGAOpenFramebufferReq);
-    xXDGAOpenFramebufferReply rep;
+    xXDGAOpenFramebufferReply rep = {
+        .type = X_Reply,
+        .length = 0,
+        .sequenceNumber = client->sequence
+    };
     char *deviceName;
     int nameSize;
 
@@ -104,10 +109,6 @@ ProcXDGAOpenFramebuffer(ClientPtr client)
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     if (!DGAOpenFramebuffer(stuff->screen, &deviceName,
                             (unsigned char **) (&rep.mem1),
                             (int *) &rep.size, (int *) &rep.offset,
@@ -149,7 +150,12 @@ ProcXDGAQueryModes(ClientPtr client)
     int i, num, size;
 
     REQUEST(xXDGAQueryModesReq);
-    xXDGAQueryModesReply rep;
+    xXDGAQueryModesReply rep = {
+        .type = X_Reply,
+        .length = 0,
+        .number = 0,
+        .sequenceNumber = client->sequence
+    };
     xXDGAModeInfo info;
     XDGAModePtr mode;
 
@@ -158,11 +164,6 @@ ProcXDGAQueryModes(ClientPtr client)
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.number = 0;
-    rep.sequenceNumber = client->sequence;
-
     if (!DGAAvailable(stuff->screen)) {
         rep.number = 0;
         rep.length = 0;
@@ -262,7 +263,13 @@ static int
 ProcXDGASetMode(ClientPtr client)
 {
     REQUEST(xXDGASetModeReq);
-    xXDGASetModeReply rep;
+    xXDGASetModeReply rep = {
+        .type = X_Reply,
+        .length = 0,
+        .offset = 0,
+        .flags = 0,
+        .sequenceNumber = client->sequence
+    };
     XDGAModeRec mode;
     xXDGAModeInfo info;
     PixmapPtr pPix;
@@ -275,12 +282,6 @@ ProcXDGASetMode(ClientPtr client)
         return BadValue;
     owner = DGA_GETCLIENT(stuff->screen);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.offset = 0;
-    rep.flags = 0;
-    rep.sequenceNumber = client->sequence;
-
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
@@ -482,7 +483,11 @@ static int
 ProcXDGAGetViewportStatus(ClientPtr client)
 {
     REQUEST(xXDGAGetViewportStatusReq);
-    xXDGAGetViewportStatusReply rep;
+    xXDGAGetViewportStatusReply rep = {
+        .type = X_Reply,
+        .length = 0,
+        .sequenceNumber = client->sequence
+    };
 
     REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
 
@@ -492,10 +497,6 @@ ProcXDGAGetViewportStatus(ClientPtr client)
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     rep.status = DGAGetViewportStatus(stuff->screen);
 
     WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), &rep);
@@ -506,7 +507,11 @@ static int
 ProcXDGASync(ClientPtr client)
 {
     REQUEST(xXDGASyncReq);
-    xXDGASyncReply rep;
+    xXDGASyncReply rep = {
+        .type = X_Reply,
+        .length = 0,
+        .sequenceNumber = client->sequence
+    };
 
     REQUEST_SIZE_MATCH(xXDGASyncReq);
 
@@ -516,10 +521,6 @@ ProcXDGASync(ClientPtr client)
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     DGASync(stuff->screen);
 
     WriteToClient(client, sizeof(xXDGASyncReply), &rep);
@@ -562,18 +563,19 @@ ProcXDGAChangePixmapMode(ClientPtr client)
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     x = stuff->x;
     y = stuff->y;
 
     if (!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags))
         return BadMatch;
 
-    rep.x = x;
-    rep.y = y;
+    rep = (xXDGAChangePixmapModeReply) {
+        .type = X_Reply,
+        .length = 0,
+        .sequenceNumber = client->sequence,
+        .x = x,
+        .y = y
+    };
     WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), &rep);
 
     return Success;
@@ -616,7 +618,11 @@ static int
 ProcXF86DGAGetVideoLL(ClientPtr client)
 {
     REQUEST(xXF86DGAGetVideoLLReq);
-    xXF86DGAGetVideoLLReply rep;
+    xXF86DGAGetVideoLLReply rep = {
+        .type = X_Reply,
+        .length = 0,
+        .sequenceNumber = client->sequence
+    };
     XDGAModeRec mode;
     int num, offset, flags;
     char *name;
@@ -626,10 +632,6 @@ ProcXF86DGAGetVideoLL(ClientPtr client)
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
@@ -726,10 +728,6 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
@@ -738,8 +736,13 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
 
     DGAGetModeInfo(stuff->screen, &mode, num);
 
-    rep.width = mode.viewportWidth;
-    rep.height = mode.viewportHeight;
+    rep = (xXF86DGAGetViewPortSizeReply) {
+        .type = X_Reply,
+        .length = 0,
+        .sequenceNumber = client->sequence,
+        .width = mode.viewportWidth,
+        .height = mode.viewportHeight
+    };
 
     WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), &rep);
     return Success;
@@ -775,18 +778,18 @@ static int
 ProcXF86DGAGetVidPage(ClientPtr client)
 {
     REQUEST(xXF86DGAGetVidPageReq);
-    xXF86DGAGetVidPageReply rep;
+    xXF86DGAGetVidPageReply rep = {
+        .type = X_Reply,
+        .length = 0,
+        .sequenceNumber = client->sequence,
+        .vpage = 0               /* silently fail */
+    };
 
     REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
 
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.vpage = 0;              /* silently fail */
-
     WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), &rep);
     return Success;
 }
@@ -840,18 +843,18 @@ static int
 ProcXF86DGAQueryDirectVideo(ClientPtr client)
 {
     REQUEST(xXF86DGAQueryDirectVideoReq);
-    xXF86DGAQueryDirectVideoReply rep;
+    xXF86DGAQueryDirectVideoReply rep = {
+        .type = X_Reply,
+        .length = 0,
+        .sequenceNumber = client->sequence,
+        .flags = 0
+    };
 
     REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
 
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.flags = 0;
-
     if (DGAAvailable(stuff->screen))
         rep.flags = XF86DGADirectPresent;
 
@@ -863,7 +866,12 @@ static int
 ProcXF86DGAViewPortChanged(ClientPtr client)
 {
     REQUEST(xXF86DGAViewPortChangedReq);
-    xXF86DGAViewPortChangedReply rep;
+    xXF86DGAViewPortChangedReply rep = {
+        .type = X_Reply,
+        .length = 0,
+        .sequenceNumber = client->sequence,
+        .result = 1
+    };
 
     REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
 
@@ -876,11 +884,6 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
     if (!DGAActive(stuff->screen))
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.result = 1;
-
     WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), &rep);
     return Success;
 }
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 0435cb6..455ff34 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -282,16 +282,18 @@ SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from,
 static int
 ProcXF86VidModeQueryVersion(ClientPtr client)
 {
-    xXF86VidModeQueryVersionReply rep;
+    xXF86VidModeQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION,
+        .minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION
+    };
 
     DEBUG_P("XF86VidModeQueryVersion");
 
     REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION;
-    rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION;
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -306,8 +308,10 @@ static int
 ProcXF86VidModeGetModeLine(ClientPtr client)
 {
     REQUEST(xXF86VidModeGetModeLineReq);
-    xXF86VidModeGetModeLineReply rep;
-    xXF86OldVidModeGetModeLineReply oldrep;
+    xXF86VidModeGetModeLineReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence
+    };
     pointer mode;
     int dotClock;
     int ver;
@@ -316,7 +320,7 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
 
     ver = ClientMajorVersion(client);
     REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
-    rep.type = X_Reply;
+
     if (ver < 2) {
         rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) -
                                     SIZEOF(xGenericReply));
@@ -325,7 +329,6 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
         rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetModeLineReply) -
                                     SIZEOF(xGenericReply));
     }
-    rep.sequenceNumber = client->sequence;
 
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
@@ -379,20 +382,22 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
         swapl(&rep.privsize);
     }
     if (ver < 2) {
-        oldrep.type = rep.type;
-        oldrep.sequenceNumber = rep.sequenceNumber;
-        oldrep.length = rep.length;
-        oldrep.dotclock = rep.dotclock;
-        oldrep.hdisplay = rep.hdisplay;
-        oldrep.hsyncstart = rep.hsyncstart;
-        oldrep.hsyncend = rep.hsyncend;
-        oldrep.htotal = rep.htotal;
-        oldrep.vdisplay = rep.vdisplay;
-        oldrep.vsyncstart = rep.vsyncstart;
-        oldrep.vsyncend = rep.vsyncend;
-        oldrep.vtotal = rep.vtotal;
-        oldrep.flags = rep.flags;
-        oldrep.privsize = rep.privsize;
+        xXF86OldVidModeGetModeLineReply oldrep = {
+            .type = rep.type,
+            .sequenceNumber = rep.sequenceNumber,
+            .length = rep.length,
+            .dotclock = rep.dotclock,
+            .hdisplay = rep.hdisplay,
+            .hsyncstart = rep.hsyncstart,
+            .hsyncend = rep.hsyncend,
+            .htotal = rep.htotal,
+            .vdisplay = rep.vdisplay,
+            .vsyncstart = rep.vsyncstart,
+            .vsyncend = rep.vsyncend,
+            .vtotal = rep.vtotal,
+            .flags = rep.flags,
+            .privsize = rep.privsize
+        };
         WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply), &oldrep);
     }
     else {
@@ -406,8 +411,6 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
 {
     REQUEST(xXF86VidModeGetAllModeLinesReq);
     xXF86VidModeGetAllModeLinesReply rep;
-    xXF86VidModeModeInfo mdinf;
-    xXF86OldVidModeModeInfo oldmdinf;
     pointer mode;
     int modecount, dotClock;
     int ver;
@@ -428,16 +431,18 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
     if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
         return BadValue;
 
-    rep.type = X_Reply;
-    rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
-        SIZEOF(xGenericReply);
+    rep = (xXF86VidModeGetAllModeLinesReply) {
+        .type = X_Reply,
+        .length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
+            SIZEOF(xGenericReply),
+        .sequenceNumber = client->sequence,
+        .modecount = modecount
+    };
     if (ver < 2)
         rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
     else
         rep.length += modecount * sizeof(xXF86VidModeModeInfo);
     rep.length >>= 2;
-    rep.sequenceNumber = client->sequence;
-    rep.modecount = modecount;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -446,18 +451,20 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
     WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), &rep);
 
     do {
-        mdinf.dotclock = dotClock;
-        mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
-        mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
-        mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
-        mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
-        mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
-        mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
-        mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
-        mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
-        mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
-        mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
-        mdinf.privsize = 0;
+        xXF86VidModeModeInfo mdinf = {
+            .dotclock = dotClock,
+            .hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+            .hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+            .hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+            .htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL),
+            .hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW),
+            .vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+            .vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+            .vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+            .vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+            .flags = VidModeGetModeValue(mode, VIDMODE_FLAGS),
+            .privsize = 0
+        };
         if (client->swapped) {
             swapl(&mdinf.dotclock);
             swaps(&mdinf.hdisplay);
@@ -473,17 +480,19 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
             swapl(&mdinf.privsize);
         }
         if (ver < 2) {
-            oldmdinf.dotclock = mdinf.dotclock;
-            oldmdinf.hdisplay = mdinf.hdisplay;
-            oldmdinf.hsyncstart = mdinf.hsyncstart;
-            oldmdinf.hsyncend = mdinf.hsyncend;
-            oldmdinf.htotal = mdinf.htotal;
-            oldmdinf.vdisplay = mdinf.vdisplay;
-            oldmdinf.vsyncstart = mdinf.vsyncstart;
-            oldmdinf.vsyncend = mdinf.vsyncend;
-            oldmdinf.vtotal = mdinf.vtotal;
-            oldmdinf.flags = mdinf.flags;
-            oldmdinf.privsize = mdinf.privsize;
+            xXF86OldVidModeModeInfo oldmdinf = {
+                .dotclock = mdinf.dotclock,
+                .hdisplay = mdinf.hdisplay,
+                .hsyncstart = mdinf.hsyncstart,
+                .hsyncend = mdinf.hsyncend,
+                .htotal = mdinf.htotal,
+                .vdisplay = mdinf.vdisplay,
+                .vsyncstart = mdinf.vsyncstart,
+                .vsyncend = mdinf.vsyncend,
+                .vtotal = mdinf.vtotal,
+                .flags = mdinf.flags,
+                .privsize = mdinf.privsize
+            };
             WriteToClient(client, sizeof(xXF86OldVidModeModeInfo), &oldmdinf);
         }
         else {
@@ -1027,11 +1036,13 @@ ProcXF86VidModeValidateModeLine(ClientPtr client)
  status_reply:
     free(modetmp);
 
-    rep.type = X_Reply;
-    rep.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply)
-                                - SIZEOF(xGenericReply));
-    rep.sequenceNumber = client->sequence;
-    rep.status = status;
+    rep = (xXF86VidModeValidateModeLineReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply)
+                                 - SIZEOF(xGenericReply)),
+        .status = status
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -1186,7 +1197,10 @@ static int
 ProcXF86VidModeGetMonitor(ClientPtr client)
 {
     REQUEST(xXF86VidModeGetMonitorReq);
-    xXF86VidModeGetMonitorReply rep;
+    xXF86VidModeGetMonitorReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence
+    };
     CARD32 *hsyncdata, *vsyncdata;
     int i, nHsync, nVrefresh;
     pointer monitor;
@@ -1204,7 +1218,6 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
     nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
     nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
 
-    rep.type = X_Reply;
     if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
         rep.vendorLength = strlen((char *) (VidModeGetMonitorValue(monitor,
                                                                    VIDMODE_MON_VENDOR,
@@ -1223,7 +1236,6 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
                                                 nVrefresh) * sizeof(CARD32) +
                        pad_to_int32(rep.vendorLength) +
                        pad_to_int32(rep.modelLength));
-    rep.sequenceNumber = client->sequence;
     rep.nhsync = nHsync;
     rep.nvsync = nVrefresh;
     hsyncdata = malloc(nHsync * sizeof(CARD32));
@@ -1289,13 +1301,15 @@ ProcXF86VidModeGetViewPort(ClientPtr client)
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     VidModeGetViewPort(stuff->screen, &x, &y);
-    rep.x = x;
-    rep.y = y;
+
+    rep = (xXF86VidModeGetViewPortReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .x = x,
+        .y = y
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -1345,13 +1359,15 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
 
     numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
 
-    rep.type = X_Reply;
-    rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply)
-                                - SIZEOF(xGenericReply) + numClocks);
-    rep.sequenceNumber = client->sequence;
-    rep.clocks = numClocks;
-    rep.maxclocks = MAXCLOCKS;
-    rep.flags = 0;
+    rep = (xXF86VidModeGetDotClocksReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply)
+                                 - SIZEOF(xGenericReply) + numClocks),
+        .clocks = numClocks,
+        .maxclocks = MAXCLOCKS,
+        .flags = 0
+    };
 
     if (!ClockProg) {
         Clocks = calloc(numClocks, sizeof(int));
@@ -1423,14 +1439,16 @@ ProcXF86VidModeGetGamma(ClientPtr client)
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
     if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
         return BadValue;
-    rep.red = (CARD32) (red * 10000.);
-    rep.green = (CARD32) (green * 10000.);
-    rep.blue = (CARD32) (blue * 10000.);
+    rep = (xXF86VidModeGetGammaReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .red = (CARD32) (red * 10000.),
+        .green = (CARD32) (green * 10000.),
+        .blue = (CARD32) (blue * 10000.)
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -1502,10 +1520,12 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
             return BadValue;
         }
     }
-    rep.type = X_Reply;
-    rep.length = (length >> 1) * 3;
-    rep.sequenceNumber = client->sequence;
-    rep.size = stuff->size;
+    rep = (xXF86VidModeGetGammaRampReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = (length >> 1) * 3,
+        .size = stuff->size
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -1534,10 +1554,12 @@ ProcXF86VidModeGetGammaRampSize(ClientPtr client)
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.size = VidModeGetGammaRampSize(stuff->screen);
+    rep = (xXF86VidModeGetGammaRampSizeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .size = VidModeGetGammaRampSize(stuff->screen)
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -1551,7 +1573,12 @@ ProcXF86VidModeGetGammaRampSize(ClientPtr client)
 static int
 ProcXF86VidModeGetPermissions(ClientPtr client)
 {
-    xXF86VidModeGetPermissionsReply rep;
+    xXF86VidModeGetPermissionsReply rep =  {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .permissions = XF86VM_READ_PERMISSION
+    };
 
     REQUEST(xXF86VidModeGetPermissionsReq);
 
@@ -1560,10 +1587,6 @@ ProcXF86VidModeGetPermissions(ClientPtr client)
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.permissions = XF86VM_READ_PERMISSION;
     if (xf86GetVidModeEnabled() &&
         (xf86GetVidModeAllowNonLocal() || LocalClient(client))) {
         rep.permissions |= XF86VM_WRITE_PERMISSION;
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 43504b7..310bb5e 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -78,15 +78,16 @@ XF86DRIResetProc(ExtensionEntry * extEntry)
 static int
 ProcXF86DRIQueryVersion(register ClientPtr client)
 {
-    xXF86DRIQueryVersionReply rep;
+    xXF86DRIQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_XF86DRI_MAJOR_VERSION,
+        .minorVersion = SERVER_XF86DRI_MINOR_VERSION,
+        .patchVersion = SERVER_XF86DRI_PATCH_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION;
-    rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
-    rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -111,18 +112,20 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen],
                                         &isCapable)) {
         return BadValue;
     }
-    rep.isCapable = isCapable;
 
     if (!LocalClient(client) || client->swapped)
-        rep.isCapable = 0;
+        isCapable = 0;
+
+    rep = (xXF86DRIQueryDirectRenderingCapableReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .isCapable = isCapable
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -158,20 +161,21 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
     if (busIdString)
         busIdStringLength = strlen(busIdString);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.busIdStringLength = busIdStringLength;
-    rep.length =
-        bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
-                       SIZEOF(xGenericReply) +
-                       pad_to_int32(rep.busIdStringLength));
+    rep = (xXF86DRIOpenConnectionReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
+                                 SIZEOF(xGenericReply) +
+                                 pad_to_int32(busIdStringLength)),
+        .busIdStringLength = busIdStringLength,
 
-    rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff);
+        .hSAREALow = (CARD32) (hSAREA & 0xffffffff),
 #if defined(LONG64) && !defined(__linux__)
-    rep.hSAREAHigh = (CARD32) (hSAREA >> 32);
+        .hSAREAHigh = (CARD32) (hSAREA >> 32),
 #else
-    rep.hSAREAHigh = 0;
+        .hSAREAHigh = 0
 #endif
+    };
 
     WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
     if (busIdStringLength)
@@ -182,7 +186,12 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
 static int
 ProcXF86DRIAuthConnection(register ClientPtr client)
 {
-    xXF86DRIAuthConnectionReply rep;
+    xXF86DRIAuthConnectionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .authenticated = 1
+    };
 
     REQUEST(xXF86DRIAuthConnectionReq);
     REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
@@ -191,11 +200,6 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.authenticated = 1;
-
     if (!DRIAuthConnection(screenInfo.screens[stuff->screen], stuff->magic)) {
         ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
         rep.authenticated = 0;
@@ -222,7 +226,11 @@ ProcXF86DRICloseConnection(register ClientPtr client)
 static int
 ProcXF86DRIGetClientDriverName(register ClientPtr client)
 {
-    xXF86DRIGetClientDriverNameReply rep;
+    xXF86DRIGetClientDriverNameReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .clientDriverNameLength = 0
+    };
     char *clientDriverName;
 
     REQUEST(xXF86DRIGetClientDriverNameReq);
@@ -238,9 +246,6 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
                            (int *) &rep.ddxDriverPatchVersion,
                            &clientDriverName);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.clientDriverNameLength = 0;
     if (clientDriverName)
         rep.clientDriverNameLength = strlen(clientDriverName);
     rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
@@ -256,7 +261,11 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
 static int
 ProcXF86DRICreateContext(register ClientPtr client)
 {
-    xXF86DRICreateContextReply rep;
+    xXF86DRICreateContextReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     ScreenPtr pScreen;
 
     REQUEST(xXF86DRICreateContextReq);
@@ -266,10 +275,6 @@ ProcXF86DRICreateContext(register ClientPtr client)
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     pScreen = screenInfo.screens[stuff->screen];
 
     if (!DRICreateContext(pScreen,
@@ -302,7 +307,11 @@ ProcXF86DRIDestroyContext(register ClientPtr client)
 static int
 ProcXF86DRICreateDrawable(ClientPtr client)
 {
-    xXF86DRICreateDrawableReply rep;
+    xXF86DRICreateDrawableReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     DrawablePtr pDrawable;
     int rc;
 
@@ -313,10 +322,6 @@ ProcXF86DRICreateDrawable(ClientPtr client)
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
                            DixReadAccess);
     if (rc != Success)
@@ -361,7 +366,11 @@ ProcXF86DRIDestroyDrawable(register ClientPtr client)
 static int
 ProcXF86DRIGetDrawableInfo(register ClientPtr client)
 {
-    xXF86DRIGetDrawableInfoReply rep;
+    xXF86DRIGetDrawableInfoReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     DrawablePtr pDrawable;
     int X, Y, W, H;
     drm_clip_rect_t *pClipRects, *pClippedRects;
@@ -375,10 +384,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
                            DixReadAccess);
     if (rc != Success)
@@ -466,7 +471,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
 static int
 ProcXF86DRIGetDeviceInfo(register ClientPtr client)
 {
-    xXF86DRIGetDeviceInfoReply rep;
+    xXF86DRIGetDeviceInfoReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     drm_handle_t hFrameBuffer;
     void *pDevPrivate;
 
@@ -477,10 +486,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     if (!DRIGetDeviceInfo(screenInfo.screens[stuff->screen],
                           &hFrameBuffer,
                           (int *) &rep.framebufferOrigin,
@@ -497,7 +502,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
     rep.hFrameBufferHigh = 0;
 #endif
 
-    rep.length = 0;
     if (rep.devPrivateSize) {
         rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
                                     SIZEOF(xGenericReply) +
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 3bc3ea7..a6be4c2 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -71,17 +71,18 @@ static int
 ProcDRI2QueryVersion(ClientPtr client)
 {
     REQUEST(xDRI2QueryVersionReq);
-    xDRI2QueryVersionReply rep;
+    xDRI2QueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = dri2_major,
+        .minorVersion = dri2_minor
+    };
 
     if (client->swapped)
         swaps(&stuff->length);
 
     REQUEST_SIZE_MATCH(xDRI2QueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = dri2_major;
-    rep.minorVersion = dri2_minor;
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -99,7 +100,13 @@ static int
 ProcDRI2Connect(ClientPtr client)
 {
     REQUEST(xDRI2ConnectReq);
-    xDRI2ConnectReply rep;
+    xDRI2ConnectReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .driverNameLength = 0,
+        .deviceNameLength = 0
+    };
     DrawablePtr pDraw;
     int fd, status;
     const char *driverName;
@@ -110,12 +117,6 @@ ProcDRI2Connect(ClientPtr client)
                        &pDraw, &status))
         return status;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.driverNameLength = 0;
-    rep.deviceNameLength = 0;
-
     if (!DRI2Connect(client, pDraw->pScreen,
                      stuff->driverType, &fd, &driverName, &deviceName))
         goto fail;
@@ -146,10 +147,12 @@ ProcDRI2Authenticate(ClientPtr client)
                        &pDraw, &status))
         return status;
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.authenticated = DRI2Authenticate(client, pDraw->pScreen, stuff->magic);
+    rep = (xDRI2AuthenticateReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .authenticated = DRI2Authenticate(client, pDraw->pScreen, stuff->magic)
+    };
     WriteToClient(client, sizeof(xDRI2AuthenticateReply), &rep);
 
     return Success;
@@ -225,12 +228,14 @@ send_buffers_reply(ClientPtr client, DrawablePtr pDrawable,
         }
     }
 
-    rep.type = X_Reply;
-    rep.length = (count - skip) * sizeof(xDRI2Buffer) / 4;
-    rep.sequenceNumber = client->sequence;
-    rep.width = width;
-    rep.height = height;
-    rep.count = count - skip;
+    rep = (xDRI2GetBuffersReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = (count - skip) * sizeof(xDRI2Buffer) / 4,
+        .width = width,
+        .height = height,
+        .count = count - skip
+    };
     WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep);
 
     for (i = 0; i < count; i++) {
@@ -330,9 +335,11 @@ ProcDRI2CopyRegion(ClientPtr client)
      * that yet.
      */
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xDRI2CopyRegionReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     WriteToClient(client, sizeof(xDRI2CopyRegionReply), &rep);
 
@@ -375,7 +382,11 @@ static int
 ProcDRI2SwapBuffers(ClientPtr client)
 {
     REQUEST(xDRI2SwapBuffersReq);
-    xDRI2SwapBuffersReply rep;
+    xDRI2SwapBuffersReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     DrawablePtr pDrawable;
     CARD64 target_msc, divisor, remainder, swap_target;
     int status;
@@ -402,9 +413,6 @@ ProcDRI2SwapBuffers(ClientPtr client)
     if (status != Success)
         return BadDrawable;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
     load_swap_reply(&rep, swap_target);
 
     WriteToClient(client, sizeof(xDRI2SwapBuffersReply), &rep);
@@ -427,7 +435,11 @@ static int
 ProcDRI2GetMSC(ClientPtr client)
 {
     REQUEST(xDRI2GetMSCReq);
-    xDRI2MSCReply rep;
+    xDRI2MSCReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     DrawablePtr pDrawable;
     CARD64 ust, msc, sbc;
     int status;
@@ -442,9 +454,6 @@ ProcDRI2GetMSC(ClientPtr client)
     if (status != Success)
         return status;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
     load_msc_reply(&rep, ust, msc, sbc);
 
     WriteToClient(client, sizeof(xDRI2MSCReply), &rep);
@@ -482,11 +491,12 @@ ProcDRI2WaitMSC(ClientPtr client)
 int
 ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust, CARD64 msc, CARD64 sbc)
 {
-    xDRI2MSCReply rep;
+    xDRI2MSCReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
     load_msc_reply(&rep, ust, msc, sbc);
 
     WriteToClient(client, sizeof(xDRI2MSCReply), &rep);
@@ -614,7 +624,13 @@ static int
 SProcDRI2Connect(ClientPtr client)
 {
     REQUEST(xDRI2ConnectReq);
-    xDRI2ConnectReply rep;
+    xDRI2ConnectReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .driverNameLength = 0,
+        .deviceNameLength = 0
+    };
 
     /* If the client is swapped, it's not local.  Talk to the hand. */
 
@@ -622,12 +638,7 @@ SProcDRI2Connect(ClientPtr client)
     if (sizeof(*stuff) / 4 != client->req_len)
         return BadLength;
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
     swaps(&rep.sequenceNumber);
-    rep.length = 0;
-    rep.driverNameLength = 0;
-    rep.deviceNameLength = 0;
 
     WriteToClient(client, sizeof(xDRI2ConnectReply), &rep);
 
commit 14501fd33ee89acf9fc1d908003ed62f383d8bae
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:43 2012 -0700

    Use C99 designated initializers in Xephyr Replies
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 65e0ff8..a42be07 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -517,18 +517,19 @@ EphyrMirrorHostVisuals(ScreenPtr a_screen)
 static int
 ProcXF86DRIQueryVersion(register ClientPtr client)
 {
-    xXF86DRIQueryVersionReply rep;
+    xXF86DRIQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_XF86DRI_MAJOR_VERSION,
+        .minorVersion = SERVER_XF86DRI_MINOR_VERSION,
+        .patchVersion = SERVER_XF86DRI_PATCH_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
 
     EPHYR_LOG("enter\n");
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION;
-    rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
-    rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -556,17 +557,19 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     if (!ephyrDRIQueryDirectRenderingCapable(stuff->screen, &isCapable)) {
         return BadValue;
     }
-    rep.isCapable = isCapable;
 
     if (!LocalClient(client) || client->swapped)
-        rep.isCapable = 0;
+        isCapable = 0;
+
+    rep = (xXF86DRIQueryDirectRenderingCapableReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .isCapable = isCapable
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -604,20 +607,20 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
     if (busIdString)
         busIdStringLength = strlen(busIdString);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.busIdStringLength = busIdStringLength;
-    rep.length =
-        bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
-                       SIZEOF(xGenericReply) +
-                       pad_to_int32(busIdStringLength));
-
-    rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff);
+    rep = (xXF86DRIOpenConnectionReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
+                                 SIZEOF(xGenericReply) +
+                                 pad_to_int32(busIdStringLength)),
+        .hSAREALow = (CARD32) (hSAREA & 0xffffffff),
 #if defined(LONG64) && !defined(__linux__)
-    rep.hSAREAHigh = (CARD32) (hSAREA >> 32);
+        .hSAREAHigh = (CARD32) (hSAREA >> 32),
 #else
-    rep.hSAREAHigh = 0;
+        .hSAREAHigh = 0,
 #endif
+        .busIdStringLength = busIdStringLength
+    };
 
     WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
     if (busIdStringLength)
@@ -641,10 +644,12 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.authenticated = 1;
+    rep = (xXF86DRIAuthConnectionReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .authenticated = 1
+    };
 
     if (!ephyrDRIAuthConnection(stuff->screen, stuff->magic)) {
         ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
@@ -677,7 +682,11 @@ ProcXF86DRICloseConnection(register ClientPtr client)
 static int
 ProcXF86DRIGetClientDriverName(register ClientPtr client)
 {
-    xXF86DRIGetClientDriverNameReply rep;
+    xXF86DRIGetClientDriverNameReply rep =  {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .clientDriverNameLength = 0
+    };
     char *clientDriverName;
 
     REQUEST(xXF86DRIGetClientDriverNameReq);
@@ -694,10 +703,6 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
                                 (int *) &rep.ddxDriverMinorVersion,
                                 (int *) &rep.ddxDriverPatchVersion,
                                 &clientDriverName);
-
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.clientDriverNameLength = 0;
     if (clientDriverName)
         rep.clientDriverNameLength = strlen(clientDriverName);
     rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
@@ -714,7 +719,11 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
 static int
 ProcXF86DRICreateContext(register ClientPtr client)
 {
-    xXF86DRICreateContextReply rep;
+    xXF86DRICreateContextReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     ScreenPtr pScreen;
     VisualPtr visual;
     int i = 0;
@@ -729,10 +738,6 @@ ProcXF86DRICreateContext(register ClientPtr client)
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     pScreen = screenInfo.screens[stuff->screen];
     visual = pScreen->visuals;
 
@@ -917,7 +922,11 @@ destroyHostPeerWindow(const WindowPtr a_win)
 static int
 ProcXF86DRICreateDrawable(ClientPtr client)
 {
-    xXF86DRICreateDrawableReply rep;
+    xXF86DRICreateDrawableReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     DrawablePtr drawable = NULL;
     WindowPtr window = NULL;
     EphyrWindowPair *pair = NULL;
@@ -933,10 +942,6 @@ ProcXF86DRICreateDrawable(ClientPtr client)
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
                            DixReadAccess);
     if (rc != Success)
@@ -1025,7 +1030,11 @@ ProcXF86DRIDestroyDrawable(register ClientPtr client)
 static int
 ProcXF86DRIGetDrawableInfo(register ClientPtr client)
 {
-    xXF86DRIGetDrawableInfoReply rep;
+    xXF86DRIGetDrawableInfoReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     DrawablePtr drawable;
     WindowPtr window = NULL;
     EphyrWindowPair *pair = NULL;
@@ -1037,16 +1046,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
     REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
 
     EPHYR_LOG("enter\n");
-    memset(&rep, 0, sizeof(rep));
     if (stuff->screen >= screenInfo.numScreens) {
         client->errorValue = stuff->screen;
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
                            DixReadAccess);
     if (rc != Success || !drawable) {
@@ -1161,7 +1165,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
 static int
 ProcXF86DRIGetDeviceInfo(register ClientPtr client)
 {
-    xXF86DRIGetDeviceInfoReply rep;
+    xXF86DRIGetDeviceInfoReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     drm_handle_t hFrameBuffer;
     void *pDevPrivate;
 
@@ -1174,10 +1182,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
         return BadValue;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     if (!ephyrDRIGetDeviceInfo(stuff->screen,
                                &hFrameBuffer,
                                (int *) &rep.framebufferOrigin,
@@ -1194,7 +1198,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
     rep.hFrameBufferHigh = 0;
 #endif
 
-    rep.length = 0;
     if (rep.devPrivateSize) {
         rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
                                     SIZEOF(xGenericReply) +
diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c
index f5c4c18..dae22fc 100644
--- a/hw/kdrive/ephyr/ephyrglxext.c
+++ b/hw/kdrive/ephyr/ephyrglxext.c
@@ -159,11 +159,13 @@ ephyrGLXQueryVersion(__GLXclientState * a_cl, GLbyte * a_pc)
         goto out;
     }
     EPHYR_LOG("major:%d, minor:%d\n", major, minor);
-    reply.majorVersion = major;
-    reply.minorVersion = minor;
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXQueryVersionReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = major,
+        .minorVersion = minor
+    };
 
     if (client->swapped) {
         __glXSwapQueryVersionReply(client, &reply);
@@ -215,11 +217,13 @@ ephyrGLXGetVisualConfigsReal(__GLXclientState * a_cl,
     }
     EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);
 
-    reply.numVisuals = num_visuals;
-    reply.numProps = num_props;
-    reply.length = (num_visuals * __GLX_SIZE_CARD32 * num_props) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXGetVisualConfigsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = (num_visuals * __GLX_SIZE_CARD32 * num_props) >> 2,
+        .numVisuals = num_visuals,
+        .numProps = num_props
+    };
 
     if (a_do_swap) {
         __GLX_SWAP_SHORT(&reply.sequenceNumber);
@@ -269,11 +273,13 @@ ephyrGLXGetFBConfigsSGIXReal(__GLXclientState * a_cl,
     }
     EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props);
 
-    reply.numVisuals = num_visuals;
-    reply.numProps = num_props;
-    reply.length = props_buf_size >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXGetVisualConfigsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = props_buf_size >> 2,
+        .numVisuals = num_visuals,
+        .numProps = num_props
+    };
 
     if (a_do_swap) {
         __GLX_SWAP_SHORT(&reply.sequenceNumber);
@@ -364,10 +370,13 @@ ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc)
     }
     EPHYR_LOG("string: %s\n", server_string);
     length = strlen(server_string) + 1;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = __GLX_PAD(length) >> 2;
-    reply.n = length;
+    reply = (xGLXQueryServerStringReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = __GLX_PAD(length) >> 2,
+        .n = length
+    };
+
     buf = calloc(reply.length << 2, 1);
     if (!buf) {
         EPHYR_LOG_ERROR("failed to allocate string\n;");
@@ -522,7 +531,6 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
     EPHYR_RETURN_VAL_IF_FAIL(drawable->pScreen, BadValue);
     EPHYR_LOG("screen nummber requested:%d\n", drawable->pScreen->myNum);
 
-    memset(&reply, 0, sizeof(reply));
     if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawable->pScreen->myNum),
                                  req->context,
                                  req->oldContextTag,
@@ -530,10 +538,12 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
         EPHYR_LOG_ERROR("ephyrHostGLXMakeCurrent() failed\n");
         goto out;
     }
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = a_cl->client->sequence;
-    reply.contextTag = contextTag;
+    reply = (xGLXMakeCurrentReply) {
+        .type = X_Reply,
+        .sequenceNumber = a_cl->client->sequence,
+        .length = 0,
+        .contextTag = contextTag
+    };
     if (a_do_swap) {
         __GLX_DECLARE_SWAP_VARIABLES;
         __GLX_SWAP_SHORT(&reply.sequenceNumber);
@@ -683,15 +693,17 @@ ephyrGLXIsDirectReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
 
     EPHYR_LOG("enter\n");
 
-    memset(&reply, 0, sizeof(reply));
     if (!ephyrHostIsContextDirect(req->context, (int *) &is_direct)) {
         EPHYR_LOG_ERROR("ephyrHostIsContextDirect() failed\n");
         goto out;
     }
-    reply.isDirect = is_direct;
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXIsDirectReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .isDirect = is_direct
+    };
+
     WriteToClient(client, sz_xGLXIsDirectReply, &reply);
     res = Success;
 
commit e4e827ec36fd20b7aea608db09790f76fb87e519
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:43 2012 -0700

    Use C99 designated initializers in dmx Replies
    
    v2: fix in __glXGetVisualConfigs to not re-declare local 'reply' variable
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>
    
    Fixup for Use C99 designated initializeres in dmx Replies
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c
index 5ea133e..9df94a4 100644
--- a/hw/dmx/dmx.c
+++ b/hw/dmx/dmx.c
@@ -208,16 +208,17 @@ dmxFetchInputAttributes(unsigned int mask,
 static int
 ProcDMXQueryVersion(ClientPtr client)
 {
-    xDMXQueryVersionReply rep;
+    xDMXQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_DMX_MAJOR_VERSION,
+        .minorVersion = SERVER_DMX_MINOR_VERSION,
+        .patchVersion = SERVER_DMX_PATCH_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xDMXQueryVersionReq);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.majorVersion = SERVER_DMX_MAJOR_VERSION;
-    rep.minorVersion = SERVER_DMX_MINOR_VERSION;
-    rep.patchVersion = SERVER_DMX_PATCH_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -238,10 +239,12 @@ ProcDMXSync(ClientPtr client)
 
     dmxFlushPendingSyncs();
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = 0;
+    rep = (xDMXSyncReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = 0
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -288,10 +291,12 @@ ProcDMXForceWindowCreation(ClientPtr client)
     dmxForceWindowCreation(pWin);
  doreply:
     dmxFlushPendingSyncs();
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = 0;
+    rep = (xDMXForceWindowCreationReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = 0
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -308,10 +313,12 @@ ProcDMXGetScreenCount(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.screenCount = dmxGetNumScreens();
+    rep = (xDMXGetScreenCountReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .screenCount = dmxGetNumScreens()
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -339,27 +346,29 @@ ProcDMXGetScreenAttributes(ClientPtr client)
     if (!dmxGetScreenAttributes(stuff->physicalScreen, &attr))
         return BadValue;
 
-    rep.logicalScreen = attr.logicalScreen;
-    rep.screenWindowWidth = attr.screenWindowWidth;
-    rep.screenWindowHeight = attr.screenWindowHeight;
-    rep.screenWindowXoffset = attr.screenWindowXoffset;
-    rep.screenWindowYoffset = attr.screenWindowYoffset;
-    rep.rootWindowWidth = attr.rootWindowWidth;
-    rep.rootWindowHeight = attr.rootWindowHeight;
-    rep.rootWindowXoffset = attr.rootWindowXoffset;
-    rep.rootWindowYoffset = attr.rootWindowYoffset;
-    rep.rootWindowXorigin = attr.rootWindowXorigin;
-    rep.rootWindowYorigin = attr.rootWindowYorigin;
-
     length = attr.displayName ? strlen(attr.displayName) : 0;
     paddedLength = pad_to_int32(length);
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length =
-        bytes_to_int32((sizeof(xDMXGetScreenAttributesReply) -
-                        sizeof(xGenericReply))
-                       + paddedLength);
-    rep.displayNameLength = length;
+
+    rep = (xDMXGetScreenAttributesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length =
+            bytes_to_int32((sizeof(xDMXGetScreenAttributesReply) -
+                            sizeof(xGenericReply))
+                           + paddedLength),
+        .displayNameLength = length,
+        .logicalScreen = attr.logicalScreen,
+        .screenWindowWidth = attr.screenWindowWidth,
+        .screenWindowHeight = attr.screenWindowHeight,
+        .screenWindowXoffset = attr.screenWindowXoffset,
+        .screenWindowYoffset = attr.screenWindowYoffset,
+        .rootWindowWidth = attr.rootWindowWidth,
+        .rootWindowHeight = attr.rootWindowHeight,
+        .rootWindowXoffset = attr.rootWindowXoffset,
+        .rootWindowYoffset = attr.rootWindowYoffset,
+        .rootWindowXorigin = attr.rootWindowXorigin,
+        .rootWindowYorigin = attr.rootWindowYorigin
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -442,11 +451,13 @@ ProcDMXChangeScreensAttributes(ClientPtr client)
         return status;
 
  noxinerama:
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
-    rep.errorScreen = errorScreen;
+    rep = (xDMXChangeScreensAttributesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = status,
+        .errorScreen = errorScreen
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -491,11 +502,13 @@ ProcDMXAddScreen(ClientPtr client)
 
     free(name);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
-    rep.physicalScreen = stuff->physicalScreen;
+    rep = (xDMXAddScreenReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = status,
+        .physicalScreen = stuff->physicalScreen
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -517,10 +530,12 @@ ProcDMXRemoveScreen(ClientPtr client)
 
     status = dmxDetachScreen(stuff->physicalScreen);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
+    rep = (xDMXRemoveScreenReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = status
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -636,10 +651,12 @@ ProcDMXGetWindowAttributes(ClientPtr client)
         return BadWindow;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = count * 6;
-    rep.screenCount = count;
+    rep = (xDMXGetWindowAttributesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = count * 6,
+        .screenCount = count
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -688,14 +705,15 @@ ProcDMXGetDesktopAttributes(ClientPtr client)
 
     dmxGetDesktopAttributes(&attr);
 
-    rep.width = attr.width;
-    rep.height = attr.height;
-    rep.shiftX = attr.shiftX;
-    rep.shiftY = attr.shiftY;
-
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
+    rep = (xDMXGetDesktopAttributesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .width = attr.width,
+        .height = attr.height,
+        .shiftX = attr.shiftX,
+        .shiftY = attr.shiftY
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -739,10 +757,12 @@ ProcDMXChangeDesktopAttributes(ClientPtr client)
         return status;
 
  noxinerama:
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
+    rep = (xDMXChangeDesktopAttributesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = status
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -759,10 +779,12 @@ ProcDMXGetInputCount(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xDMXGetInputCountReq);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.inputCount = dmxGetInputCount();
+    rep = (xDMXGetInputCountReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .inputCount = dmxGetInputCount()
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -785,19 +807,24 @@ ProcDMXGetInputAttributes(ClientPtr client)
 
     if (dmxGetInputAttributes(stuff->deviceId, &attr))
         return BadValue;
-    rep.inputType = attr.inputType;
-    rep.physicalScreen = attr.physicalScreen;
-    rep.physicalId = attr.physicalId;
-    rep.isCore = attr.isCore;
-    rep.sendsCore = attr.sendsCore;
-    rep.detached = attr.detached;
 
     length = attr.name ? strlen(attr.name) : 0;
     paddedLength = pad_to_int32(length);
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = bytes_to_int32(paddedLength);
-    rep.nameLength = length;
+
+    rep = (xDMXGetInputAttributesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(paddedLength),
+
+        .inputType = attr.inputType,
+        .physicalScreen = attr.physicalScreen,
+        .physicalId = attr.physicalId,
+        .nameLength = length,
+        .isCore = attr.isCore,
+        .sendsCore = attr.sendsCore,
+        .detached = attr.detached
+    };
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -849,11 +876,13 @@ ProcDMXAddInput(ClientPtr client)
     if (status)
         return status;
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
-    rep.physicalId = id;
+    rep = (xDMXAddInputReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = status,
+        .physicalId = id
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -878,10 +907,12 @@ ProcDMXRemoveInput(ClientPtr client)
     if (status)
         return status;
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
+    rep = (xDMXRemoveInputReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = status
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index 32684fa..91011d1 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -454,12 +454,12 @@ __glXQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc)
     ClientPtr client = cl->client;
     xGLXQueryMaxSwapBarriersSGIXReq *req =
         (xGLXQueryMaxSwapBarriersSGIXReq *) pc;
-    xGLXQueryMaxSwapBarriersSGIXReply reply;
-
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = 0;
-    reply.max = QueryMaxSwapBarriersSGIX(req->screen);
+    xGLXQueryMaxSwapBarriersSGIXReply reply = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .max = QueryMaxSwapBarriersSGIX(req->screen)
+    };
 
     if (client->swapped) {
         __glXSwapQueryMaxSwapBarriersSGIXReply(client, &reply);
@@ -793,7 +793,11 @@ MakeCurrent(__GLXclientState * cl,
     ClientPtr client = cl->client;
     DrawablePtr pDraw = NULL;
     DrawablePtr pReadDraw = NULL;
-    xGLXMakeCurrentReadSGIReply new_reply;
+    xGLXMakeCurrentReadSGIReply new_reply = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     xGLXMakeCurrentReq *be_req;
     xGLXMakeCurrentReply be_reply;
     xGLXMakeContextCurrentReq *be_new_req;
@@ -1197,9 +1201,6 @@ MakeCurrent(__GLXclientState * cl,
     else {
         new_reply.contextTag = 0;
     }
-    new_reply.length = 0;
-    new_reply.type = X_Reply;
-    new_reply.sequenceNumber = client->sequence;
 
 #ifdef PANORAMIX
     if (!noPanoramiXExtension) {
@@ -1438,10 +1439,12 @@ __glXIsDirect(__GLXclientState * cl, GLbyte * pc)
         return __glXBadContext;
     }
 
-    reply.isDirect = 0;
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXIsDirectReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .isDirect = 0
+    };
 
     if (client->swapped) {
         __glXSwapIsDirectReply(client, &reply);
@@ -1459,18 +1462,19 @@ __glXQueryVersion(__GLXclientState * cl, GLbyte * pc)
     ClientPtr client = cl->client;
 
 /*    xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; */
-    xGLXQueryVersionReply reply;
 
+    xGLXQueryVersionReply reply = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
     /*
      ** Server should take into consideration the version numbers sent by the
      ** client if it wants to work with older clients; however, in this
      ** implementation the server just returns its version number.
      */
-    reply.majorVersion = __glXVersionMajor;
-    reply.minorVersion = __glXVersionMinor;
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+        .majorVersion = __glXVersionMajor,
+        .minorVersion = __glXVersionMinor
+    };
 
     if (client->swapped) {
         __glXSwapQueryVersionReply(client, &reply);
@@ -1680,12 +1684,14 @@ __glXGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
     }
     pGlxScreen = &__glXActiveScreens[screen];
 
-    reply.numVisuals = pGlxScreen->numGLXVisuals;
-    reply.numProps = __GLX_TOTAL_CONFIG;
-    reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
-                    __GLX_TOTAL_CONFIG) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXGetVisualConfigsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .numVisuals = pGlxScreen->numGLXVisuals,
+        .numProps = __GLX_TOTAL_CONFIG,
+        .length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
+                    __GLX_TOTAL_CONFIG) >> 2
+    };
 
     WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
 
@@ -2625,10 +2631,12 @@ __glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
 #endif
 
     length = len;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = len;
-    reply.n = numbytes;
+    reply = (xGLXQueryExtensionsStringReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = len,
+        .n = numbytes
+    };
 
     if (client->swapped) {
         glxSwapQueryExtensionsStringReply(client, &reply, be_buf);
@@ -2706,10 +2714,12 @@ __glXQueryServerString(__GLXclientState * cl, GLbyte * pc)
 #endif
 
     length = len;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = length;
-    reply.n = numbytes;
+    reply = (xGLXQueryServerStringReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = length,
+        .n = numbytes
+    };
 
     if (client->swapped) {
         glxSwapQueryServerStringReply(client, &reply, be_buf);
@@ -2863,11 +2873,13 @@ __glXGetFBConfigs(__GLXclientState * cl, GLbyte * pc)
     pGlxScreen = &__glXActiveScreens[screen];
     numFBConfigs = __glXNumFBConfigs;
 
-    reply.numFBConfigs = numFBConfigs;
-    reply.numAttribs = numAttribs;
-    reply.length = (numFBConfigs * 2 * numAttribs * __GLX_SIZE_CARD32) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXGetFBConfigsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = (numFBConfigs * 2 * numAttribs * __GLX_SIZE_CARD32) >> 2,
+        .numFBConfigs = numFBConfigs,
+        .numAttribs = numAttribs
+    };
 
     if (client->swapped) {
         __GLX_DECLARE_SWAP_VARIABLES;
@@ -3195,10 +3207,12 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)
 
     nProps = 3;
 
-    reply.length = nProps << 1;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.n = nProps;
+    reply = (xGLXQueryContextReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = nProps << 1,
+        .n = nProps
+    };
 
     nReplyBytes = reply.length << 2;
     sendBuf = (int *) malloc(nReplyBytes);
@@ -3245,10 +3259,12 @@ __glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc)
 
     nProps = 4;
 
-    reply.length = nProps << 1;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.n = nProps;
+    reply = (xGLXQueryContextInfoEXTReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = nProps << 1,
+        .n = nProps
+    };
 
     nReplyBytes = reply.length << 2;
     sendBuf = (int *) malloc(nReplyBytes);
diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c
index a11c919..ac79cda 100644
--- a/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/hw/dmx/glxProxy/glxcmdsswap.c
@@ -293,12 +293,14 @@ __glXSwapGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
     }
     pGlxScreen = &__glXActiveScreens[screen];
 
-    reply.numVisuals = pGlxScreen->numGLXVisuals;
-    reply.numProps = __GLX_TOTAL_CONFIG;
-    reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
-                    __GLX_TOTAL_CONFIG) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXGetVisualConfigsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
+                   __GLX_TOTAL_CONFIG) >> 2,
+        .numVisuals = pGlxScreen->numGLXVisuals,
+        .numProps = __GLX_TOTAL_CONFIG
+    };
 
     __GLX_SWAP_SHORT(&reply.sequenceNumber);
     __GLX_SWAP_INT(&reply.length);
diff --git a/hw/dmx/glxProxy/glxsingle.c b/hw/dmx/glxProxy/glxsingle.c
index 2253060..8784200 100644
--- a/hw/dmx/glxProxy/glxsingle.c
+++ b/hw/dmx/glxProxy/glxsingle.c
@@ -269,13 +269,15 @@ __glXForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
     /*
      * send the reply to the client
      */
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = be_reply.length;
-    reply.retval = be_reply.retval;
-    reply.size = be_reply.size;
-    reply.pad3 = be_reply.pad3;
-    reply.pad4 = be_reply.pad4;
+    reply = (xGLXSingleReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = be_reply.length,
+        .retval = be_reply.retval,
+        .size = be_reply.size,
+        .pad3 = be_reply.pad3,
+        .pad4 = be_reply.pad4
+    };
 
     if (client->swapped) {
         SendSwappedReply(client, &reply, be_buf, be_buf_size);
@@ -371,13 +373,15 @@ __glXForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
     /*
      * send the reply to the client
      */
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = be_reply.length;
-    reply.retval = be_reply.retval;
-    reply.size = be_reply.size;
-    reply.pad3 = be_reply.pad3;
-    reply.pad4 = be_reply.pad4;
+    reply = (xGLXSingleReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = be_reply.length,
+        .retval = be_reply.retval,
+        .size = be_reply.size,
+        .pad3 = be_reply.pad3,
+        .pad4 = be_reply.pad4
+    };
 
     if (client->swapped) {
         SendSwappedReply(client, &reply, be_buf, be_buf_size);
@@ -1004,9 +1008,11 @@ __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
 
     }                           /* of if buf_size > 0 */
 
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = buf_size >> 2;
+    reply = (xGLXReadPixelsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = buf_size >> 2
+    };
 
     if (client->swapped) {
         __GLX_SWAP_SHORT(&reply.sequenceNumber);
commit bd6f948c41865c2c9d3fba1000bf5f7458d3afc1
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:43 2012 -0700

    Use C99 designated initializers in randr Replies
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index c91c7fd..138fbe1 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -900,11 +900,13 @@ ProcRRGetCrtcInfo(ClientPtr client)
 
     mode = crtc->mode;
 
-    rep.type = X_Reply;
-    rep.status = RRSetConfigSuccess;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.timestamp = pScrPriv->lastSetTime.milliseconds;
+    rep = (xRRGetCrtcInfoReply) {
+        .type = X_Reply,
+        .status = RRSetConfigSuccess,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .timestamp = pScrPriv->lastSetTime.milliseconds
+    };
     if (pScrPriv->rrGetPanning &&
         pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) &&
         (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
@@ -1171,11 +1173,13 @@ ProcRRSetCrtcConfig(ClientPtr client)
  sendReply:
     free(outputs);
 
-    rep.type = X_Reply;
-    rep.status = status;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
+    rep = (xRRSetCrtcConfigReply) {
+        .type = X_Reply,
+        .status = status,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .newTimestamp = pScrPriv->lastSetTime.milliseconds
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -1211,12 +1215,13 @@ ProcRRGetPanning(ClientPtr client)
     if (!pScrPriv)
         return RRErrorBase + BadRRCrtc;
 
-    memset(&rep, 0, sizeof(rep));
-    rep.type = X_Reply;
-    rep.status = RRSetConfigSuccess;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 1;
-    rep.timestamp = pScrPriv->lastSetTime.milliseconds;
+    rep = (xRRGetPanningReply) {
+        .type = X_Reply,
+        .status = RRSetConfigSuccess,
+        .sequenceNumber = client->sequence,
+        .length = 1,
+        .timestamp = pScrPriv->lastSetTime.milliseconds
+    };
 
     if (pScrPriv->rrGetPanning &&
         pScrPriv->rrGetPanning(pScreen, crtc, &total, &tracking, border)) {
@@ -1310,11 +1315,13 @@ ProcRRSetPanning(ClientPtr client)
     status = RRSetConfigSuccess;
 
  sendReply:
-    rep.type = X_Reply;
-    rep.status = status;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
+    rep = (xRRSetPanningReply) {
+        .type = X_Reply,
+        .status = status,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .newTimestamp = pScrPriv->lastSetTime.milliseconds
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -1339,10 +1346,12 @@ ProcRRGetCrtcGammaSize(ClientPtr client)
     if (!RRCrtcGammaGet(crtc))
         return RRErrorBase + BadRRCrtc;
 
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = 0;
-    reply.size = crtc->gammaSize;
+    reply = (xRRGetCrtcGammaSizeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .size = crtc->gammaSize
+    };
     if (client->swapped) {
         swaps(&reply.sequenceNumber);
         swapl(&reply.length);
@@ -1376,10 +1385,12 @@ ProcRRGetCrtcGamma(ClientPtr client)
             return BadAlloc;
     }
 
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = bytes_to_int32(len);
-    reply.size = crtc->gammaSize;
+    reply = (xRRGetCrtcGammaReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(len),
+        .size = crtc->gammaSize
+    };
     if (client->swapped) {
         swaps(&reply.sequenceNumber);
         swapl(&reply.length);
diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index d071787..7fbc9f0 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -35,16 +35,17 @@ RRClientKnowsRates(ClientPtr pClient)
 static int
 ProcRRQueryVersion(ClientPtr client)
 {
-    xRRQueryVersionReply rep = { 0 };
+    xRRQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     REQUEST(xRRQueryVersionReq);
     rrClientPriv(client);
 
     REQUEST_SIZE_MATCH(xRRQueryVersionReq);
     pRRClient->major_version = stuff->majorVersion;
     pRRClient->minor_version = stuff->minorVersion;
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
 
     if (version_compare(stuff->majorVersion, stuff->minorVersion,
                         SERVER_RANDR_MAJOR_VERSION,
diff --git a/randr/rrmode.c b/randr/rrmode.c
index 7e17d7d..56e5977 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -282,7 +282,7 @@ int
 ProcRRCreateMode(ClientPtr client)
 {
     REQUEST(xRRCreateModeReq);
-    xRRCreateModeReply rep = { 0 };
+    xRRCreateModeReply rep;
     WindowPtr pWin;
     ScreenPtr pScreen;
     xRRModeInfo *modeInfo;
@@ -310,11 +310,12 @@ ProcRRCreateMode(ClientPtr client)
     if (!mode)
         return error;
 
-    rep.type = X_Reply;
-    rep.pad0 = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.mode = mode->mode.id;
+    rep = (xRRCreateModeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .mode = mode->mode.id
+	};
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 3662a5a..0932508 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -425,22 +425,23 @@ ProcRRGetOutputInfo(ClientPtr client)
     pScreen = output->pScreen;
     pScrPriv = rrGetScrPriv(pScreen);
 
-    rep.type = X_Reply;
-    rep.status = RRSetConfigSuccess;
-    rep.sequenceNumber = client->sequence;
-    rep.length = bytes_to_int32(OutputInfoExtra);
-    rep.timestamp = pScrPriv->lastSetTime.milliseconds;
-    rep.crtc = output->crtc ? output->crtc->id : None;
-    rep.mmWidth = output->mmWidth;
-    rep.mmHeight = output->mmHeight;
-    rep.connection = output->connection;
-    rep.subpixelOrder = output->subpixelOrder;
-    rep.nCrtcs = output->numCrtcs;
-    rep.nModes = output->numModes + output->numUserModes;
-    rep.nPreferred = output->numPreferred;
-    rep.nClones = output->numClones;
-    rep.nameLength = output->nameLength;
-
+    rep = (xRRGetOutputInfoReply) {
+        .type = X_Reply,
+        .status = RRSetConfigSuccess,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(OutputInfoExtra),
+        .timestamp = pScrPriv->lastSetTime.milliseconds,
+        .crtc = output->crtc ? output->crtc->id : None,
+        .mmWidth = output->mmWidth,
+        .mmHeight = output->mmHeight,
+        .connection = output->connection,
+        .subpixelOrder = output->subpixelOrder,
+        .nCrtcs = output->numCrtcs,
+        .nModes = output->numModes + output->numUserModes,
+        .nPreferred = output->numPreferred,
+        .nClones = output->numClones,
+        .nameLength = output->nameLength
+    };
     extraLen = ((output->numCrtcs +
                  output->numModes + output->numUserModes +
                  output->numClones + bytes_to_int32(rep.nameLength)) << 2);
@@ -573,10 +574,11 @@ ProcRRGetOutputPrimary(ClientPtr client)
     if (pScrPriv)
         primary = pScrPriv->primaryOutput;
 
-    memset(&rep, 0, sizeof(rep));
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.output = primary ? primary->id : None;
+    rep = (xRRGetOutputPrimaryReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .output = primary ? primary->id : None
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index b0a1cf9..7ce085c 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -394,10 +394,12 @@ ProcRRListOutputProperties(ClientPtr client)
         if (!(pAtoms = (Atom *) malloc(numProps * sizeof(Atom))))
             return BadAlloc;
 
-    rep.type = X_Reply;
-    rep.length = bytes_to_int32(numProps * sizeof(Atom));
-    rep.sequenceNumber = client->sequence;
-    rep.nAtoms = numProps;
+    rep = (xRRListOutputPropertiesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(numProps * sizeof(Atom)),
+        .nAtoms = numProps
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -440,12 +442,16 @@ ProcRRQueryOutputProperty(ClientPtr client)
         if (!extra)
             return BadAlloc;
     }
-    rep.type = X_Reply;
-    rep.length = prop->num_valid;
-    rep.sequenceNumber = client->sequence;
-    rep.pending = prop->is_pending;
-    rep.range = prop->range;
-    rep.immutable = prop->immutable;
+
+    rep = (xRRQueryOutputPropertyReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = prop->num_valid,
+        .pending = prop->is_pending,
+        .range = prop->range,
+        .immutable = prop->immutable
+    };
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -596,8 +602,10 @@ ProcRRGetOutputProperty(ClientPtr client)
         if (prop->propertyName == stuff->property)
             break;
 
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xRRGetOutputPropertyReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence
+    };
     if (!prop) {
         reply.nItems = 0;
         reply.length = 0;
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 6fd24e0..774f8be 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -203,10 +203,12 @@ ProcRRGetScreenSizeRange(ClientPtr client)
     pScreen = pWin->drawable.pScreen;
     pScrPriv = rrGetScrPriv(pScreen);
 
-    rep.type = X_Reply;
-    rep.pad = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
+    rep = (xRRGetScreenSizeRangeReply) {
+        .type = X_Reply,
+        .pad = 0,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     if (pScrPriv) {
         if (!RRGetInfo(pScreen, FALSE))
@@ -481,7 +483,6 @@ rrGetScreenResources(ClientPtr client, Bool query)
 
     pScreen = pWin->drawable.pScreen;
     pScrPriv = rrGetScrPriv(pScreen);
-    rep.pad = 0;
 
     if (query && pScrPriv)
         if (!RRGetInfo(pScreen, query))
@@ -491,15 +492,17 @@ rrGetScreenResources(ClientPtr client, Bool query)
         return rrGetMultiScreenResources(client, query, pScreen);
 
     if (!pScrPriv) {
-        rep.type = X_Reply;
-        rep.sequenceNumber = client->sequence;
-        rep.length = 0;
-        rep.timestamp = currentTime.milliseconds;
-        rep.configTimestamp = currentTime.milliseconds;
-        rep.nCrtcs = 0;
-        rep.nOutputs = 0;
-        rep.nModes = 0;
-        rep.nbytesNames = 0;
+        rep = (xRRGetScreenResourcesReply) {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .timestamp = currentTime.milliseconds,
+            .configTimestamp = currentTime.milliseconds,
+            .nCrtcs = 0,
+            .nOutputs = 0,
+            .nModes = 0,
+            .nbytesNames = 0
+        };
         extra = NULL;
         extraLen = 0;
     }
@@ -511,15 +514,18 @@ rrGetScreenResources(ClientPtr client, Bool query)
         if (!modes)
             return BadAlloc;
 
-        rep.type = X_Reply;
-        rep.sequenceNumber = client->sequence;
-        rep.length = 0;
-        rep.timestamp = pScrPriv->lastSetTime.milliseconds;
-        rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
-        rep.nCrtcs = pScrPriv->numCrtcs;
-        rep.nOutputs = pScrPriv->numOutputs;
-        rep.nModes = num_modes;
-        rep.nbytesNames = 0;
+        rep = (xRRGetScreenResourcesReply) {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .timestamp = pScrPriv->lastSetTime.milliseconds,
+            .configTimestamp = pScrPriv->lastConfigTime.milliseconds,
+            .nCrtcs = pScrPriv->numCrtcs,
+            .nOutputs = pScrPriv->numOutputs,
+            .nModes = num_modes,
+            .nbytesNames = 0
+        };
+
 
         for (i = 0; i < num_modes; i++)
             rep.nbytesNames += modes[i]->mode.nameLength;
@@ -744,7 +750,6 @@ ProcRRGetScreenInfo(ClientPtr client)
 
     pScreen = pWin->drawable.pScreen;
     pScrPriv = rrGetScrPriv(pScreen);
-    rep.pad = 0;
 
     if (pScrPriv)
         if (!RRGetInfo(pScreen, TRUE))
@@ -753,18 +758,20 @@ ProcRRGetScreenInfo(ClientPtr client)
     output = RRFirstOutput(pScreen);
 
     if (!pScrPriv || !output) {
-        rep.type = X_Reply;
-        rep.setOfRotations = RR_Rotate_0;
-        rep.sequenceNumber = client->sequence;
-        rep.length = 0;
-        rep.root = pWin->drawable.pScreen->root->drawable.id;
-        rep.timestamp = currentTime.milliseconds;
-        rep.configTimestamp = currentTime.milliseconds;
-        rep.nSizes = 0;
-        rep.sizeID = 0;
-        rep.rotation = RR_Rotate_0;
-        rep.rate = 0;
-        rep.nrateEnts = 0;
+        rep = (xRRGetScreenInfoReply) {
+            .type = X_Reply,
+            .setOfRotations = RR_Rotate_0,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .root = pWin->drawable.pScreen->root->drawable.id,
+            .timestamp = currentTime.milliseconds,
+            .configTimestamp = currentTime.milliseconds,
+            .nSizes = 0,
+            .sizeID = 0,
+            .rotation = RR_Rotate_0,
+            .rate = 0,
+            .nrateEnts = 0
+        };
         extra = 0;
         extraLen = 0;
     }
@@ -781,18 +788,20 @@ ProcRRGetScreenInfo(ClientPtr client)
         if (!pData)
             return BadAlloc;
 
-        rep.type = X_Reply;
-        rep.setOfRotations = output->crtc->rotations;
-        rep.sequenceNumber = client->sequence;
-        rep.length = 0;
-        rep.root = pWin->drawable.pScreen->root->drawable.id;
-        rep.timestamp = pScrPriv->lastSetTime.milliseconds;
-        rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
-        rep.rotation = output->crtc->rotation;
-        rep.nSizes = pData->nsize;
-        rep.nrateEnts = pData->nrefresh + pData->nsize;
-        rep.sizeID = pData->size;
-        rep.rate = pData->refresh;
+        rep = (xRRGetScreenInfoReply) {
+            .type = X_Reply,
+            .setOfRotations = output->crtc->rotations,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .root = pWin->drawable.pScreen->root->drawable.id,
+            .timestamp = pScrPriv->lastSetTime.milliseconds,
+            .configTimestamp = pScrPriv->lastConfigTime.milliseconds,
+            .rotation = output->crtc->rotation,
+            .nSizes = pData->nsize,
+            .nrateEnts = pData->nrefresh + pData->nsize,
+            .sizeID = pData->size,
+            .rate = pData->refresh
+        };
 
         extraLen = rep.nSizes * sizeof(xScreenSizes);
         if (has_rate)
@@ -1078,14 +1087,17 @@ ProcRRSetScreenConfig(ClientPtr client)
 
     free(pData);
 
-    rep.type = X_Reply;
-    rep.status = status;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
-    rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
-    rep.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds;
-    rep.root = pDraw->pScreen->root->drawable.id;
+    rep = (xRRSetScreenConfigReply) {
+        .type = X_Reply,
+        .status = status,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+
+        .newTimestamp = pScrPriv->lastSetTime.milliseconds,
+        .newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds,
+        .root = pDraw->pScreen->root->drawable.id,
+        /* .subpixelOrder = ?? */
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index da3942f..87d6a73 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -89,14 +89,15 @@ static int SProcRRXineramaDispatch(ClientPtr client);
 int
 ProcRRXineramaQueryVersion(ClientPtr client)
 {
-    xPanoramiXQueryVersionReply rep;
+    xPanoramiXQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION,
+        .minorVersion = SERVER_RRXINERAMA_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION;
-    rep.minorVersion = SERVER_RRXINERAMA_MINOR_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -130,11 +131,13 @@ ProcRRXineramaGetState(ClientPtr client)
         active = TRUE;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.state = active;
-    rep.window = stuff->window;
+    rep = (xPanoramiXGetStateReply) {
+        .type = X_Reply,
+        .state = active,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .window = stuff->window
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -184,11 +187,13 @@ ProcRRXineramaGetScreenCount(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen);
-    rep.window = stuff->window;
+    rep = (xPanoramiXGetScreenCountReply)  {
+        .type = X_Reply,
+        .ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen),
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .window = stuff->window
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -215,13 +220,15 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
     pScreen = pWin->drawable.pScreen;
     pRoot = pScreen->root;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.width = pRoot->drawable.width;
-    rep.height = pRoot->drawable.height;
-    rep.window = stuff->window;
-    rep.screen = stuff->screen;
+    rep = (xPanoramiXGetScreenSizeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .width = pRoot->drawable.width,
+        .height = pRoot->drawable.height,
+        .window = stuff->window,
+        .screen = stuff->screen
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -241,11 +248,12 @@ ProcRRXineramaIsActive(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
 
-    memset(&rep, 0, sizeof(xXineramaIsActiveReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN]);
+    rep = (xXineramaIsActiveReply) {
+        .type = X_Reply,
+        .length = 0,
+        .sequenceNumber = client->sequence,
+        .state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN])
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -308,10 +316,12 @@ ProcRRXineramaQueryScreens(ClientPtr client)
         n = RRXineramaScreenCount(pScreen);
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.number = n;
-    rep.length = bytes_to_int32(n * sz_XineramaScreenInfo);
+    rep = (xXineramaQueryScreensReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(n * sz_XineramaScreenInfo),
+        .number = n
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
commit a406bd07593edb69285cf2fd91a6af4a5d956817
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:43 2012 -0700

    Use C99 designated initializers in xkb Replies
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/xkb/xkb.c b/xkb/xkb.c
index b21815c..ad837c8 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -181,13 +181,14 @@ ProcXkbUseExtension(ClientPtr client)
              stuff->wantedMinor, SERVER_XKB_MAJOR_VERSION,
              SERVER_XKB_MINOR_VERSION);
     }
-    memset(&rep, 0, sizeof(xkbUseExtensionReply));
-    rep.type = X_Reply;
-    rep.supported = supported;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.serverMajor = SERVER_XKB_MAJOR_VERSION;
-    rep.serverMinor = SERVER_XKB_MINOR_VERSION;
+    rep = (xkbUseExtensionReply) {
+        .type = X_Reply,
+        .supported = supported,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .serverMajor = SERVER_XKB_MAJOR_VERSION,
+        .serverMinor = SERVER_XKB_MINOR_VERSION
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.serverMajor);
@@ -577,21 +578,22 @@ ProcXkbGetState(ClientPtr client)
     CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
 
     xkb = &dev->key->xkbInfo->state;
-    memset(&rep, 0, sizeof(xkbGetStateReply));
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.deviceID = dev->id;
-    rep.mods = XkbStateFieldFromRec(xkb) & 0xff;
-    rep.baseMods = xkb->base_mods;
-    rep.lockedMods = xkb->locked_mods;
-    rep.latchedMods = xkb->latched_mods;
-    rep.group = xkb->group;
-    rep.baseGroup = xkb->base_group;
-    rep.latchedGroup = xkb->latched_group;
-    rep.lockedGroup = xkb->locked_group;
-    rep.compatState = xkb->compat_state;
-    rep.ptrBtnState = xkb->ptr_buttons;
+    rep = (xkbGetStateReply) {
+        .type = X_Reply,
+        .deviceID = dev->id,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .mods = XkbStateFieldFromRec(xkb) & 0xff,
+        .baseMods = xkb->base_mods,
+        .latchedMods = xkb->latched_mods,
+        .lockedMods = xkb->locked_mods,
+        .group = xkb->group,
+        .lockedGroup = xkb->locked_group,
+        .baseGroup = xkb->base_group,
+        .latchedGroup = xkb->latched_group,
+        .compatState = xkb->compat_state,
+        .ptrBtnState = xkb->ptr_buttons
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.ptrBtnState);
@@ -688,36 +690,38 @@ ProcXkbGetControls(ClientPtr client)
     CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
 
     xkb = dev->key->xkbInfo->desc->ctrls;
-    rep.type = X_Reply;
-    rep.length = bytes_to_int32(SIZEOF(xkbGetControlsReply) -
-                                SIZEOF(xGenericReply));
-    rep.sequenceNumber = client->sequence;
-    rep.deviceID = ((DeviceIntPtr) dev)->id;
-    rep.numGroups = xkb->num_groups;
-    rep.groupsWrap = xkb->groups_wrap;
-    rep.internalMods = xkb->internal.mask;
-    rep.ignoreLockMods = xkb->ignore_lock.mask;
-    rep.internalRealMods = xkb->internal.real_mods;
-    rep.ignoreLockRealMods = xkb->ignore_lock.real_mods;
-    rep.internalVMods = xkb->internal.vmods;
-    rep.ignoreLockVMods = xkb->ignore_lock.vmods;
-    rep.enabledCtrls = xkb->enabled_ctrls;
-    rep.repeatDelay = xkb->repeat_delay;
-    rep.repeatInterval = xkb->repeat_interval;
-    rep.slowKeysDelay = xkb->slow_keys_delay;
-    rep.debounceDelay = xkb->debounce_delay;
-    rep.mkDelay = xkb->mk_delay;
-    rep.mkInterval = xkb->mk_interval;
-    rep.mkTimeToMax = xkb->mk_time_to_max;
-    rep.mkMaxSpeed = xkb->mk_max_speed;
-    rep.mkCurve = xkb->mk_curve;
-    rep.mkDfltBtn = xkb->mk_dflt_btn;
-    rep.axTimeout = xkb->ax_timeout;
-    rep.axtCtrlsMask = xkb->axt_ctrls_mask;
-    rep.axtCtrlsValues = xkb->axt_ctrls_values;
-    rep.axtOptsMask = xkb->axt_opts_mask;
-    rep.axtOptsValues = xkb->axt_opts_values;
-    rep.axOptions = xkb->ax_options;
+    rep = (xkbGetControlsReply) {
+        .type = X_Reply,
+        .deviceID = ((DeviceIntPtr) dev)->id,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(SIZEOF(xkbGetControlsReply) -
+                                 SIZEOF(xGenericReply)),
+        .mkDfltBtn = xkb->mk_dflt_btn,
+        .numGroups = xkb->num_groups,
+        .groupsWrap = xkb->groups_wrap,
+        .internalMods = xkb->internal.mask,
+        .ignoreLockMods = xkb->ignore_lock.mask,
+        .internalRealMods = xkb->internal.real_mods,
+        .ignoreLockRealMods = xkb->ignore_lock.real_mods,
+        .internalVMods = xkb->internal.vmods,
+        .ignoreLockVMods = xkb->ignore_lock.vmods,
+        .repeatDelay = xkb->repeat_delay,
+        .repeatInterval = xkb->repeat_interval,
+        .slowKeysDelay = xkb->slow_keys_delay,
+        .debounceDelay = xkb->debounce_delay,
+        .mkDelay = xkb->mk_delay,
+        .mkInterval = xkb->mk_interval,
+        .mkTimeToMax = xkb->mk_time_to_max,
+        .mkMaxSpeed = xkb->mk_max_speed,
+        .mkCurve = xkb->mk_curve,
+        .axOptions = xkb->ax_options,
+        .axTimeout = xkb->ax_timeout,
+        .axtOptsMask = xkb->axt_opts_mask,
+        .axtOptsValues = xkb->axt_opts_values,
+        .axtCtrlsMask = xkb->axt_ctrls_mask,
+        .axtCtrlsValues = xkb->axt_ctrls_values,
+        .enabledCtrls = xkb->enabled_ctrls,
+    };
     memcpy(rep.perKeyRepeat, xkb->per_key_repeat, XkbPerKeyBitArraySize);
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -1459,14 +1463,16 @@ ProcXkbGetMap(ClientPtr client)
     CHK_MASK_LEGAL(0x03, stuff->partial, XkbAllMapComponentsMask);
 
     xkb = dev->key->xkbInfo->desc;
-    memset(&rep, 0, sizeof(xkbGetMapReply));
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2;
-    rep.deviceID = dev->id;
-    rep.present = stuff->partial | stuff->full;
-    rep.minKeyCode = xkb->min_key_code;
-    rep.maxKeyCode = xkb->max_key_code;
+    rep = (xkbGetMapReply) {
+        .type = X_Reply,
+        .deviceID = dev->id,
+        .sequenceNumber = client->sequence,
+        .length = (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2,
+        .present = stuff->partial | stuff->full,
+        .minKeyCode = xkb->min_key_code,
+        .maxKeyCode = xkb->max_key_code
+    };
+
     if (stuff->full & XkbKeyTypesMask) {
         rep.firstType = 0;
         rep.nTypes = xkb->map->num_types;
@@ -2771,12 +2777,14 @@ ProcXkbGetCompatMap(ClientPtr client)
     xkb = dev->key->xkbInfo->desc;
     compat = xkb->compat;
 
-    rep.type = X_Reply;
-    rep.deviceID = dev->id;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.firstSI = stuff->firstSI;
-    rep.nSI = stuff->nSI;
+    rep = (xkbGetCompatMapReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .deviceID = dev->id,
+        .firstSI = stuff->firstSI,
+        .nSI = stuff->nSI
+    };
     if (stuff->getAllSI) {
         rep.firstSI = 0;
         rep.nSI = compat->num_si;
@@ -3034,11 +3042,13 @@ ProcXkbGetIndicatorState(ClientPtr client)
     if (!sli)
         return BadAlloc;
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.deviceID = dev->id;
-    rep.state = sli->effectiveState;
+    rep = (xkbGetIndicatorStateReply) {
+        .type = X_Reply,
+        .deviceID = dev->id,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .state = sli->effectiveState
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -3145,11 +3155,13 @@ ProcXkbGetIndicatorMap(ClientPtr client)
     xkb = dev->key->xkbInfo->desc;
     leds = xkb->indicators;
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.deviceID = dev->id;
-    rep.which = stuff->which;
+    rep = (xkbGetIndicatorMapReply) {
+        .type = X_Reply,
+        .deviceID = dev->id,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .which = stuff->which
+    };
     XkbComputeGetIndicatorMapReplySize(leds, &rep);
     return XkbSendIndicatorMap(client, leds, &rep);
 }
@@ -3300,11 +3312,13 @@ ProcXkbGetNamedIndicator(ClientPtr client)
         }
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.deviceID = dev->id;
-    rep.indicator = stuff->indicator;
+    rep = (xkbGetNamedIndicatorReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .deviceID = dev->id,
+        .indicator = stuff->indicator
+    };
     if (map != NULL) {
         rep.found = TRUE;
         rep.on = ((sli->effectiveState & (1 << i)) != 0);
@@ -3880,22 +3894,18 @@ ProcXkbGetNames(ClientPtr client)
     CHK_MASK_LEGAL(0x01, stuff->which, XkbAllNamesMask);
 
     xkb = dev->key->xkbInfo->desc;
-    memset(&rep, 0, sizeof(xkbGetNamesReply));
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.deviceID = dev->id;
-    rep.which = stuff->which;
-    rep.nTypes = xkb->map->num_types;
-    rep.firstKey = xkb->min_key_code;
-    rep.nKeys = XkbNumKeys(xkb);
-    if (xkb->names != NULL) {
-        rep.nKeyAliases = xkb->names->num_key_aliases;
-        rep.nRadioGroups = xkb->names->num_rg;
-    }
-    else {
-        rep.nKeyAliases = rep.nRadioGroups = 0;
-    }
+    rep = (xkbGetNamesReply) {
+        .type = X_Reply,
+        .deviceID = dev->id,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .which = stuff->which,
+        .nTypes = xkb->map->num_types,
+        .firstKey = xkb->min_key_code,
+        .nKeys = XkbNumKeys(xkb),
+        .nKeyAliases = xkb->names ? xkb->names->num_key_aliases : 0,
+        .nRadioGroups = xkb->names ? xkb->names->num_rg : 0
+    };
     XkbComputeGetNamesReplySize(xkb, &rep);
     return XkbSendNames(client, xkb, &rep);
 }
@@ -4933,10 +4943,12 @@ ProcXkbGetGeometry(ClientPtr client)
     CHK_ATOM_OR_NONE(stuff->name);
 
     geom = XkbLookupNamedGeometry(dev, stuff->name, &shouldFree);
-    rep.type = X_Reply;
-    rep.deviceID = dev->id;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
+    rep = (xkbGetGeometryReply) {
+        .type = X_Reply,
+        .deviceID = dev->id,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     status = XkbComputeGetGeometryReplySize(geom, &rep, stuff->name);
     if (status != Success)
         return status;
@@ -5483,10 +5495,6 @@ ProcXkbPerClientFlags(ClientPtr client)
     CHK_MASK_MATCH(0x02, stuff->change, stuff->value);
 
     interest = XkbFindClientResource((DevicePtr) dev, client);
-    memset(&rep, 0, sizeof(xkbPerClientFlagsReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
     if (stuff->change) {
         client->xkbClientFlags &= ~stuff->change;
         client->xkbClientFlags |= stuff->value;
@@ -5522,15 +5530,16 @@ ProcXkbPerClientFlags(ClientPtr client)
             interest->autoCtrlValues |= stuff->autoCtrlValues & affect;
         }
     }
-    rep.supported = XkbPCF_AllFlagsMask;
-    rep.value = client->xkbClientFlags & XkbPCF_AllFlagsMask;
-    if (interest) {
-        rep.autoCtrls = interest->autoCtrls;
-        rep.autoCtrlValues = interest->autoCtrlValues;
-    }
-    else {
-        rep.autoCtrls = rep.autoCtrlValues = 0;
-    }
+
+    rep = (xkbPerClientFlagsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .supported = XkbPCF_AllFlagsMask,
+        .value = client->xkbClientFlags & XkbPCF_AllFlagsMask,
+        .autoCtrls = interest ? interest->autoCtrls : 0,
+        .autoCtrlValues =  interest ? interest->autoCtrlValues : 0,
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.supported);
@@ -5642,18 +5651,19 @@ ProcXkbListComponents(ClientPtr client)
         list.pool = NULL;
         return status;
     }
-    memset(&rep, 0, sizeof(xkbListComponentsReply));
-    rep.type = X_Reply;
-    rep.deviceID = dev->id;
-    rep.sequenceNumber = client->sequence;
-    rep.length = XkbPaddedSize(list.nPool) / 4;
-    rep.nKeymaps = 0;
-    rep.nKeycodes = list.nFound[_XkbListKeycodes];
-    rep.nTypes = list.nFound[_XkbListTypes];
-    rep.nCompatMaps = list.nFound[_XkbListCompat];
-    rep.nSymbols = list.nFound[_XkbListSymbols];
-    rep.nGeometries = list.nFound[_XkbListGeometry];
-    rep.extra = 0;
+    rep = (xkbListComponentsReply) {
+        .type = X_Reply,
+        .deviceID = dev->id,
+        .sequenceNumber = client->sequence,
+        .length = XkbPaddedSize(list.nPool) / 4,
+        .nKeymaps = 0,
+        .nKeycodes = list.nFound[_XkbListKeycodes],
+        .nTypes = list.nFound[_XkbListTypes],
+        .nCompatMaps = list.nFound[_XkbListCompat],
+        .nSymbols = list.nFound[_XkbListSymbols],
+        .nGeometries = list.nFound[_XkbListGeometry],
+        .extra = 0
+    };
     if (list.nTotal > list.maxRtrn)
         rep.extra = (list.nTotal - list.maxRtrn);
     if (client->swapped) {
@@ -6254,37 +6264,29 @@ ProcXkbGetDeviceInfo(ClientPtr client)
         wanted &= ~XkbXI_IndicatorsMask;
 
     nameLen = XkbSizeCountedString(dev->name);
-    memset((char *) &rep, 0, SIZEOF(xkbGetDeviceInfoReply));
-    rep.type = X_Reply;
-    rep.deviceID = dev->id;
-    rep.sequenceNumber = client->sequence;
-    rep.length = nameLen / 4;
-    rep.present = wanted;
-    rep.supported = XkbXI_AllDeviceFeaturesMask;
-    rep.unsupported = 0;
-    rep.firstBtnWanted = rep.nBtnsWanted = 0;
-    rep.firstBtnRtrn = rep.nBtnsRtrn = 0;
-    if (dev->button)
-        rep.totalBtns = dev->button->numButtons;
-    else
-        rep.totalBtns = 0;
-    rep.devType = dev->xinput_type;
-    rep.hasOwnState = (dev->key && dev->key->xkbInfo);
-    rep.nDeviceLedFBs = 0;
-    if (dev->kbdfeed)
-        rep.dfltKbdFB = dev->kbdfeed->ctrl.id;
-    else
-        rep.dfltKbdFB = XkbXINone;
-    if (dev->leds)
-        rep.dfltLedFB = dev->leds->ctrl.id;
-    else
-        rep.dfltLedFB = XkbXINone;
+    rep = (xkbGetDeviceInfoReply) {
+        .type = X_Reply,
+        .deviceID = dev->id,
+        .sequenceNumber = client->sequence,
+        .length = nameLen / 4,
+        .present = wanted,
+        .supported = XkbXI_AllDeviceFeaturesMask,
+        .unsupported = 0,
+        .nDeviceLedFBs = 0,
+        .firstBtnWanted = 0,
+        .nBtnsWanted = 0,
+        .firstBtnRtrn = 0,
+        .nBtnsRtrn = 0,
+        .totalBtns = dev->button ? dev->button->numButtons : 0,
+        .hasOwnState = (dev->key && dev->key->xkbInfo),
+        .dfltKbdFB = dev->kbdfeed ? dev->kbdfeed->ctrl.id : XkbXINone,
+        .dfltLedFB = dev->leds ? dev->leds->ctrl.id : XkbXINone,
+        .devType = dev->xinput_type
+    };
 
     ledClass = stuff->ledClass;
     ledID = stuff->ledID;
 
-    rep.firstBtnWanted = rep.nBtnsWanted = 0;
-    rep.firstBtnRtrn = rep.nBtnsRtrn = 0;
     if (wanted & XkbXI_ButtonActionsMask) {
         if (stuff->allBtns) {
             stuff->firstBtn = 0;
@@ -6746,13 +6748,15 @@ ProcXkbSetDebuggingFlags(ClientPtr client)
     xkbDebugFlags = newFlags;
     xkbDebugCtrls = newCtrls;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.currentFlags = newFlags;
-    rep.currentCtrls = newCtrls;
-    rep.supportedFlags = ~0;
-    rep.supportedCtrls = ~0;
+    rep = (xkbSetDebuggingFlagsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .currentFlags = newFlags,
+        .currentCtrls = newCtrls,
+        .supportedFlags = ~0,
+        .supportedCtrls = ~0
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.currentFlags);
commit 26efa09d0c7ee2f6a18547205c84be75376e688b
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:43 2012 -0700

    Use C99 designated initializers in glx Replies
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index c1c836f..c1f4e22 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -651,17 +651,17 @@ DoMakeCurrent(__GLXclientState * cl,
 
     StopUsingContext(prevglxc);
 
+    reply = (xGLXMakeCurrentReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .contextTag = 0
+    };
+
     if (glxc) {
         StartUsingContext(cl, glxc);
         reply.contextTag = glxc->id;
     }
-    else {
-        reply.contextTag = 0;
-    }
-
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
 
     if (client->swapped) {
         __glXSwapMakeCurrentReply(client, &reply);
@@ -722,10 +722,12 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
     if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
         return err;
 
-    reply.isDirect = glxc->isDirect;
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXIsDirectReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .isDirect = glxc->isDirect
+    };
 
     if (client->swapped) {
         __glXSwapIsDirectReply(client, &reply);
@@ -757,11 +759,13 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc)
      ** client if it wants to work with older clients; however, in this
      ** implementation the server just returns its version number.
      */
-    reply.majorVersion = glxMajorVersion;
-    reply.minorVersion = glxMinorVersion;
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXQueryVersionReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = glxMajorVersion,
+        .minorVersion = glxMinorVersion
+    };
 
     if (client->swapped) {
         __glXSwapQueryVersionReply(client, &reply);
@@ -935,12 +939,14 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
     if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
         return err;
 
-    reply.numVisuals = pGlxScreen->numVisuals;
-    reply.numProps = GLX_VIS_CONFIG_TOTAL;
-    reply.length =
-        (reply.numVisuals * __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXGetVisualConfigsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = (pGlxScreen->numVisuals *
+                   __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2,
+        .numVisuals = pGlxScreen->numVisuals,
+        .numProps = GLX_VIS_CONFIG_TOTAL
+    };
 
     if (client->swapped) {
         __GLX_SWAP_SHORT(&reply.sequenceNumber);
@@ -1039,11 +1045,13 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
     if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err))
         return err;
 
-    reply.numFBConfigs = pGlxScreen->numFBConfigs;
-    reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS;
-    reply.length = (__GLX_FBCONFIG_ATTRIBS_LENGTH * reply.numFBConfigs);
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGLXGetFBConfigsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = __GLX_FBCONFIG_ATTRIBS_LENGTH * pGlxScreen->numFBConfigs,
+        .numFBConfigs = pGlxScreen->numFBConfigs,
+        .numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS
+    };
 
     if (client->swapped) {
         __GLX_SWAP_SHORT(&reply.sequenceNumber);
@@ -1663,10 +1671,12 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
         return err;
 
     nProps = 3;
-    reply.length = nProps << 1;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.n = nProps;
+    reply = (xGLXQueryContextInfoEXTReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = nProps << 1,
+        .n = nProps
+    };
 
     nReplyBytes = reply.length << 2;
     sendBuf = (int *) malloc((size_t) nReplyBytes);
@@ -1870,10 +1880,12 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
         return error;
 
     numAttribs = 3;
-    reply.length = numAttribs << 1;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.numAttribs = numAttribs;
+    reply = (xGLXGetDrawableAttributesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = numAttribs << 1,
+        .numAttribs = numAttribs
+    };
 
     attributes[0] = GLX_TEXTURE_TARGET_EXT;
     attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
@@ -2309,10 +2321,12 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
 
     n = strlen(pGlxScreen->GLXextensions) + 1;
     length = __GLX_PAD(n) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = length;
-    reply.n = n;
+    reply = (xGLXQueryExtensionsStringReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = length,
+        .n = n
+    };
 
     /* Allocate buffer to make sure it's a multiple of 4 bytes big. */
     buf = calloc(length, 4);
@@ -2370,10 +2384,12 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
 
     n = strlen(ptr) + 1;
     length = __GLX_PAD(n) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = length;
-    reply.n = n;
+    reply = (xGLXQueryServerStringReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = length,
+        .n = n
+    };
 
     buf = calloc(length, 4);
     if (buf == NULL) {
diff --git a/glx/single2.c b/glx/single2.c
index 4d8ea4e..9597d29 100644
--- a/glx/single2.c
+++ b/glx/single2.c
@@ -193,12 +193,14 @@ __glXDisp_RenderMode(__GLXclientState * cl, GLbyte * pc)
      */
  noChangeAllowed:;
     client = cl->client;
-    reply.length = nitems;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.retval = retval;
-    reply.size = nitems;
-    reply.newMode = newMode;
+    reply = (xGLXRenderModeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = nitems,
+        .retval = retval,
+        .size = nitems,
+        .newMode = newMode
+    };
     WriteToClient(client, sz_xGLXRenderModeReply, &reply);
     if (retBytes) {
         WriteToClient(client, retBytes, retBuffer);
diff --git a/glx/single2swap.c b/glx/single2swap.c
index 9da2afd..1ca5328 100644
--- a/glx/single2swap.c
+++ b/glx/single2swap.c
@@ -205,12 +205,14 @@ __glXDispSwap_RenderMode(__GLXclientState * cl, GLbyte * pc)
      */
  noChangeAllowed:;
     client = cl->client;
-    reply.length = nitems;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.retval = retval;
-    reply.size = nitems;
-    reply.newMode = newMode;
+    reply = (xGLXRenderModeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = nitems,
+        .retval = retval,
+        .size = nitems,
+        .newMode = newMode
+    };
     __GLX_SWAP_SHORT(&reply.sequenceNumber);
     __GLX_SWAP_INT(&reply.length);
     __GLX_SWAP_INT(&reply.retval);
commit cc5f09c86f7bea23b7546c3491b2c52ce8100a71
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:43 2012 -0700

    Use C99 designated initializers in various extension Replies
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/composite/compext.c b/composite/compext.c
index be25b27..eea1a58 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -107,14 +107,15 @@ static int
 ProcCompositeQueryVersion(ClientPtr client)
 {
     CompositeClientPtr pCompositeClient = GetCompositeClient(client);
-    xCompositeQueryVersionReply rep;
+    xCompositeQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     REQUEST(xCompositeQueryVersionReq);
 
     REQUEST_SIZE_MATCH(xCompositeQueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
     if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) {
         rep.majorVersion = stuff->majorVersion;
         rep.minorVersion = stuff->minorVersion;
@@ -311,10 +312,12 @@ ProcCompositeGetOverlayWindow(ClientPtr client)
         return rc;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.overlayWin = cs->pOverlayWin->drawable.id;
+    rep = (xCompositeGetOverlayWindowReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .overlayWin = cs->pOverlayWin->drawable.id
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -842,10 +845,12 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
 
     cs = GetCompScreen(screenInfo.screens[0]);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.overlayWin = cs->pOverlayWin->drawable.id;
+    rep = (xCompositeGetOverlayWindowReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .overlayWin = cs->pOverlayWin->drawable.id
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 70d2eee..2eddfb3 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -126,14 +126,16 @@ static int
 ProcDamageQueryVersion(ClientPtr client)
 {
     DamageClientPtr pDamageClient = GetDamageClient(client);
-    xDamageQueryVersionReply rep;
+    xDamageQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     REQUEST(xDamageQueryVersionReq);
 
     REQUEST_SIZE_MATCH(xDamageQueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+
     if (stuff->majorVersion < SERVER_DAMAGE_MAJOR_VERSION) {
         rep.majorVersion = stuff->majorVersion;
         rep.minorVersion = stuff->minorVersion;
diff --git a/dbe/dbe.c b/dbe/dbe.c
index d8010ff..8f3d1b0 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -118,16 +118,16 @@ static int
 ProcDbeGetVersion(ClientPtr client)
 {
     /* REQUEST(xDbeGetVersionReq); */
-    xDbeGetVersionReply rep;
+    xDbeGetVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = DBE_MAJOR_VERSION,
+        .minorVersion = DBE_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xDbeGetVersionReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = DBE_MAJOR_VERSION;
-    rep.minorVersion = DBE_MINOR_VERSION;
-
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
     }
@@ -667,10 +667,12 @@ ProcDbeGetVisualInfo(ClientPtr client)
         length += pScrVisInfo[i].count * sizeof(xDbeVisInfo);
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = bytes_to_int32(length);
-    rep.m = count;
+    rep = (xDbeGetVisualInfoReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(length),
+        .m = count
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -755,7 +757,11 @@ static int
 ProcDbeGetBackBufferAttributes(ClientPtr client)
 {
     REQUEST(xDbeGetBackBufferAttributesReq);
-    xDbeGetBackBufferAttributesReply rep;
+    xDbeGetBackBufferAttributesReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     DbeWindowPrivPtr pDbeWindowPriv;
     int rc;
 
@@ -771,10 +777,6 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
         rep.attributes = None;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
diff --git a/record/record.c b/record/record.c
index 54a0e68..67569d9 100644
--- a/record/record.c
+++ b/record/record.c
@@ -1816,14 +1816,15 @@ static int
 ProcRecordQueryVersion(ClientPtr client)
 {
     /* REQUEST(xRecordQueryVersionReq); */
-    xRecordQueryVersionReply rep;
+    xRecordQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_RECORD_MAJOR_VERSION,
+        .minorVersion = SERVER_RECORD_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xRecordQueryVersionReq);
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.majorVersion = SERVER_RECORD_MAJOR_VERSION;
-    rep.minorVersion = SERVER_RECORD_MINOR_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.majorVersion);
@@ -2231,12 +2232,14 @@ ProcRecordGetContext(ClientPtr client)
 
     /* write the reply header */
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = length;
-    rep.enabled = pContext->pRecordingClient != NULL;
-    rep.elementHeader = pContext->elemHeaders;
-    rep.nClients = nClients;
+    rep = (xRecordGetContextReply) {
+        .type = X_Reply,
+        .enabled = pContext->pRecordingClient != NULL,
+        .sequenceNumber = client->sequence,
+        .length = length,
+        .elementHeader = pContext->elemHeaders,
+        .nClients = nClients
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
diff --git a/render/render.c b/render/render.c
index 3bf0702..5301811 100644
--- a/render/render.c
+++ b/render/render.c
@@ -267,7 +267,11 @@ static int
 ProcRenderQueryVersion(ClientPtr client)
 {
     RenderClientPtr pRenderClient = GetRenderClient(client);
-    xRenderQueryVersionReply rep;
+    xRenderQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     REQUEST(xRenderQueryVersionReq);
 
@@ -275,10 +279,6 @@ ProcRenderQueryVersion(ClientPtr client)
     pRenderClient->minor_version = stuff->minorVersion;
 
     REQUEST_SIZE_MATCH(xRenderQueryVersionReq);
-    memset(&rep, 0, sizeof(xRenderQueryVersionReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
 
     if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
         (SERVER_RENDER_MAJOR_VERSION * 1000 + SERVER_RENDER_MINOR_VERSION)) {
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 402456d..68f7b74 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -474,11 +474,13 @@ ProcXFixesGetCursorName(ClientPtr client)
         str = "";
     len = strlen(str);
 
-    reply.type = X_Reply;
-    reply.length = bytes_to_int32(len);
-    reply.sequenceNumber = client->sequence;
-    reply.atom = pCursor->name;
-    reply.nbytes = len;
+    reply = (xXFixesGetCursorNameReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(len),
+        .atom = pCursor->name,
+        .nbytes = len
+    };
     if (client->swapped) {
         swaps(&reply.sequenceNumber);
         swapl(&reply.length);
diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
index 54f84f4..c6dd19e 100644
--- a/xfixes/xfixes.c
+++ b/xfixes/xfixes.c
@@ -61,15 +61,15 @@ static int
 ProcXFixesQueryVersion(ClientPtr client)
 {
     XFixesClientPtr pXFixesClient = GetXFixesClient(client);
-    xXFixesQueryVersionReply rep;
+    xXFixesQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     REQUEST(xXFixesQueryVersionReq);
 
     REQUEST_SIZE_MATCH(xXFixesQueryVersionReq);
-    memset(&rep, 0, sizeof(xXFixesQueryVersionReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
 
     if (version_compare(stuff->majorVersion, stuff->minorVersion,
                         SERVER_XFIXES_MAJOR_VERSION,
commit 2f5caeaddb3616dc9ff57d784f7feba589c536e7
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:43 2012 -0700

    Use C99 designated initializers in Xinput Replies
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index 0de5f2b..caef0bf 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -123,10 +123,12 @@ ProcXChangeDeviceControl(ClientPtr client)
     if (ret != Success)
         goto out;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_ChangeDeviceControl;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xChangeDeviceControlReply) {
+        .repType = X_Reply,
+        .RepType = X_ChangeDeviceControl,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     switch (stuff->control) {
     case DEVICE_RESOLUTION:
diff --git a/Xi/getbmap.c b/Xi/getbmap.c
index 2712fcd..49b8688 100644
--- a/Xi/getbmap.c
+++ b/Xi/getbmap.c
@@ -92,11 +92,13 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
     REQUEST(xGetDeviceButtonMappingReq);
     REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
 
-    rep.repType = X_Reply;
-    rep.RepType = X_GetDeviceButtonMapping;
-    rep.nElts = 0;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xGetDeviceButtonMappingReply) {
+        .repType = X_Reply,
+        .RepType = X_GetDeviceButtonMapping,
+        .sequenceNumber = client->sequence,
+        .nElts = 0,
+        .length = 0
+    };
 
     rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
     if (rc != Success)
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 27775e2..6f73e09 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -182,10 +182,12 @@ ProcXGetDeviceControl(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_GetDeviceControl;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xGetDeviceControlReply) {
+        .repType = X_Reply,
+        .RepType = X_GetDeviceControl,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     switch (stuff->control) {
     case DEVICE_RESOLUTION:
diff --git a/Xi/getfctl.c b/Xi/getfctl.c
index 5f97cc3..599b2ef 100644
--- a/Xi/getfctl.c
+++ b/Xi/getfctl.c
@@ -295,11 +295,13 @@ ProcXGetFeedbackControl(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_GetFeedbackControl;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.num_feedbacks = 0;
+    rep = (xGetFeedbackControlReply) {
+        .repType = X_Reply,
+        .RepType = X_GetFeedbackControl,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .num_feedbacks = 0
+    };
 
     for (k = dev->kbdfeed; k; k = k->next) {
         rep.num_feedbacks++;
diff --git a/Xi/getfocus.c b/Xi/getfocus.c
index 54c176f..40546cb 100644
--- a/Xi/getfocus.c
+++ b/Xi/getfocus.c
@@ -99,10 +99,12 @@ ProcXGetDeviceFocus(ClientPtr client)
     if (!dev->focus)
         return BadDevice;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_GetDeviceFocus;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xGetDeviceFocusReply) {
+        .repType = X_Reply,
+        .RepType = X_GetDeviceFocus,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     focus = dev->focus;
 
diff --git a/Xi/getkmap.c b/Xi/getkmap.c
index 3536879..87c1977 100644
--- a/Xi/getkmap.c
+++ b/Xi/getkmap.c
@@ -119,11 +119,13 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
     if (!syms)
         return BadAlloc;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_GetDeviceKeyMapping;
-    rep.sequenceNumber = client->sequence;
-    rep.keySymsPerKeyCode = syms->mapWidth;
-    rep.length = (syms->mapWidth * stuff->count);       /* KeySyms are 4 bytes */
+    rep = (xGetDeviceKeyMappingReply) {
+        .repType = X_Reply,
+        .RepType = X_GetDeviceKeyMapping,
+        .sequenceNumber = client->sequence,
+        .keySymsPerKeyCode = syms->mapWidth,
+        .length = (syms->mapWidth * stuff->count) /* KeySyms are 4 bytes */
+    };
     WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
 
     client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
diff --git a/Xi/getmmap.c b/Xi/getmmap.c
index 97d4c0d..f07f2bb 100644
--- a/Xi/getmmap.c
+++ b/Xi/getmmap.c
@@ -101,12 +101,14 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
     if (ret != Success)
         return ret;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_GetDeviceModifierMapping;
-    rep.numKeyPerModifier = max_keys_per_mod;
-    rep.sequenceNumber = client->sequence;
+    rep = (xGetDeviceModifierMappingReply) {
+        .repType = X_Reply,
+        .RepType = X_GetDeviceModifierMapping,
+        .sequenceNumber = client->sequence,
+        .numKeyPerModifier = max_keys_per_mod,
     /* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
-    rep.length = max_keys_per_mod << 1;
+        .length = max_keys_per_mod << 1
+    };
 
     WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
     WriteToClient(client, max_keys_per_mod * 8, modkeymap);
diff --git a/Xi/getprop.c b/Xi/getprop.c
index b5af13a..4d6ce63 100644
--- a/Xi/getprop.c
+++ b/Xi/getprop.c
@@ -101,11 +101,13 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
     REQUEST(xGetDeviceDontPropagateListReq);
     REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
 
-    rep.repType = X_Reply;
-    rep.RepType = X_GetDeviceDontPropagateList;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.count = 0;
+    rep = (xGetDeviceDontPropagateListReply) {
+        .repType = X_Reply,
+        .RepType = X_GetDeviceDontPropagateList,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .count = 0
+    };
 
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
     if (rc != Success)
diff --git a/Xi/getselev.c b/Xi/getselev.c
index 4fcc902..60a46c2 100644
--- a/Xi/getselev.c
+++ b/Xi/getselev.c
@@ -102,12 +102,14 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
     REQUEST(xGetSelectedExtensionEventsReq);
     REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
 
-    rep.repType = X_Reply;
-    rep.RepType = X_GetSelectedExtensionEvents;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.this_client_count = 0;
-    rep.all_clients_count = 0;
+    rep = (xGetSelectedExtensionEventsReply) {
+        .repType = X_Reply,
+        .RepType = X_GetSelectedExtensionEvents,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .this_client_count = 0,
+        .all_clients_count = 0
+    };
 
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
     if (rc != Success)
diff --git a/Xi/getvers.c b/Xi/getvers.c
index b380344..829e695 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -98,14 +98,15 @@ ProcXGetExtensionVersion(ClientPtr client)
                                         stuff->nbytes))
         return BadLength;
 
-    memset(&rep, 0, sizeof(xGetExtensionVersionReply));
-    rep.repType = X_Reply;
-    rep.RepType = X_GetExtensionVersion;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.present = TRUE;
-    rep.major_version = XIVersion.major_version;
-    rep.minor_version = XIVersion.minor_version;
+    rep = (xGetExtensionVersionReply) {
+        .repType = X_Reply,
+        .RepType = X_GetExtensionVersion,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .major_version = XIVersion.major_version,
+        .minor_version = XIVersion.minor_version,
+        .present = TRUE
+    };
 
     WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep);
 
diff --git a/Xi/grabdev.c b/Xi/grabdev.c
index bdc0c4b..443ef56 100644
--- a/Xi/grabdev.c
+++ b/Xi/grabdev.c
@@ -113,10 +113,12 @@ ProcXGrabDevice(ClientPtr client)
         bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
         return BadLength;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_GrabDevice;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
+    rep = (xGrabDeviceReply) {
+        .repType = X_Reply,
+        .RepType = X_GrabDevice,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+    };
 
     rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
     if (rc != Success)
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 2249b86..4642b19 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -110,13 +110,15 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
     if (dev->valuator->motionHintWindow)
         MaybeStopDeviceHint(dev, client);
     axes = v->numAxes;
-    rep.repType = X_Reply;
-    rep.RepType = X_GetDeviceMotionEvents;
-    rep.sequenceNumber = client->sequence;
-    rep.nEvents = 0;
-    rep.axes = axes;
-    rep.mode = Absolute;        /* XXX we don't do relative at the moment */
-    rep.length = 0;
+    rep = (xGetDeviceMotionEventsReply) {
+        .repType = X_Reply,
+        .RepType = X_GetDeviceMotionEvents,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .nEvents = 0,
+        .axes = axes,
+        .mode = Absolute        /* XXX we don't do relative at the moment */
+    };
     start = ClientTimeToServerTime(stuff->start);
     stop = ClientTimeToServerTime(stuff->stop);
     if (CompareTimeStamps(start, stop) == LATER ||
diff --git a/Xi/listdev.c b/Xi/listdev.c
index 1fff738..014c61d 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -342,11 +342,12 @@ ProcXListInputDevices(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xListInputDevicesReq);
 
-    memset(&rep, 0, sizeof(xListInputDevicesReply));
-    rep.repType = X_Reply;
-    rep.RepType = X_ListInputDevices;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xListInputDevicesReply) {
+        .repType = X_Reply,
+        .RepType = X_ListInputDevices,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     /* allocate space for saving skip value */
     skip = calloc(sizeof(Bool), inputInfo.numDevices);
diff --git a/Xi/opendev.c b/Xi/opendev.c
index 486ac14..6708bad 100644
--- a/Xi/opendev.c
+++ b/Xi/opendev.c
@@ -117,10 +117,6 @@ ProcXOpenDevice(ClientPtr client)
     if (status != Success)
         return status;
 
-    memset(&rep, 0, sizeof(xOpenDeviceReply));
-    rep.repType = X_Reply;
-    rep.RepType = X_OpenDevice;
-    rep.sequenceNumber = client->sequence;
     if (dev->key != NULL) {
         evbase[j].class = KeyClass;
         evbase[j++].event_type_base = event_base[KeyClass];
@@ -148,8 +144,13 @@ ProcXOpenDevice(ClientPtr client)
     }
     evbase[j].class = OtherClass;
     evbase[j++].event_type_base = event_base[OtherClass];
-    rep.length = bytes_to_int32(j * sizeof(xInputClassInfo));
-    rep.num_classes = j;
+    rep = (xOpenDeviceReply) {
+        .repType = X_Reply,
+        .RepType = X_OpenDevice,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(j * sizeof(xInputClassInfo)),
+        .num_classes = j
+    };
     WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep);
     WriteToClient(client, j * sizeof(xInputClassInfo), evbase);
     return Success;
diff --git a/Xi/queryst.c b/Xi/queryst.c
index de19974..04a652b 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -87,11 +87,6 @@ ProcXQueryDeviceState(ClientPtr client)
     REQUEST(xQueryDeviceStateReq);
     REQUEST_SIZE_MATCH(xQueryDeviceStateReq);
 
-    rep.repType = X_Reply;
-    rep.RepType = X_QueryDeviceState;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
     if (rc != Success && rc != BadAccess)
         return rc;
@@ -163,8 +158,13 @@ ProcXQueryDeviceState(ClientPtr client)
         }
     }
 
-    rep.num_classes = num_classes;
-    rep.length = bytes_to_int32(total_length);
+    rep = (xQueryDeviceStateReply) {
+        .repType = X_Reply,
+        .RepType = X_QueryDeviceState,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(total_length),
+        .num_classes = num_classes
+    };
     WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
     if (total_length > 0)
         WriteToClient(client, total_length, savbuf);
diff --git a/Xi/setbmap.c b/Xi/setbmap.c
index 296b439..9479655 100644
--- a/Xi/setbmap.c
+++ b/Xi/setbmap.c
@@ -100,11 +100,13 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
     if (ret != Success)
         return ret;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_SetDeviceButtonMapping;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.status = MappingSuccess;
+    rep = (xSetDeviceButtonMappingReply) {
+        .repType = X_Reply,
+        .RepType = X_SetDeviceButtonMapping,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = MappingSuccess
+    };
 
     ret =
         ApplyPointerMapping(dev, (CARD8 *) &stuff[1], stuff->map_length,
diff --git a/Xi/setdval.c b/Xi/setdval.c
index 8c3816d..4c9c99f 100644
--- a/Xi/setdval.c
+++ b/Xi/setdval.c
@@ -92,11 +92,13 @@ ProcXSetDeviceValuators(ClientPtr client)
     REQUEST(xSetDeviceValuatorsReq);
     REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq);
 
-    rep.repType = X_Reply;
-    rep.RepType = X_SetDeviceValuators;
-    rep.length = 0;
-    rep.status = Success;
-    rep.sequenceNumber = client->sequence;
+    rep = (xSetDeviceValuatorsReply) {
+        .repType = X_Reply,
+        .RepType = X_SetDeviceValuators,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = Success
+    };
 
     if (stuff->length != bytes_to_int32(sizeof(xSetDeviceValuatorsReq)) +
         stuff->num_valuators)
diff --git a/Xi/setmmap.c b/Xi/setmmap.c
index e70038e..1320cfe 100644
--- a/Xi/setmmap.c
+++ b/Xi/setmmap.c
@@ -98,10 +98,12 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
         (stuff->numKeyPerModifier << 1))
         return BadLength;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_SetDeviceModifierMapping;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xSetDeviceModifierMappingReply) {
+        .repType = X_Reply,
+        .RepType = X_SetDeviceModifierMapping,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
     if (ret != Success)
diff --git a/Xi/setmode.c b/Xi/setmode.c
index f212d83..5356552 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.c
@@ -92,10 +92,12 @@ ProcXSetDeviceMode(ClientPtr client)
     REQUEST(xSetDeviceModeReq);
     REQUEST_SIZE_MATCH(xSetDeviceModeReq);
 
-    rep.repType = X_Reply;
-    rep.RepType = X_SetDeviceMode;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xSetDeviceModeReply) {
+        .repType = X_Reply,
+        .RepType = X_SetDeviceMode,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
     if (rc != Success)
diff --git a/Xi/xigetclientpointer.c b/Xi/xigetclientpointer.c
index 8a5f54f..3c90d58 100644
--- a/Xi/xigetclientpointer.c
+++ b/Xi/xigetclientpointer.c
@@ -75,12 +75,14 @@ ProcXIGetClientPointer(ClientPtr client)
     else
         winclient = client;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_XIGetClientPointer;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.set = (winclient->clientPtr != NULL);
-    rep.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0;
+    rep = (xXIGetClientPointerReply) {
+        .repType = X_Reply,
+        .RepType = X_XIGetClientPointer,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .set = (winclient->clientPtr != NULL),
+        .deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0
+    };
 
     WriteReplyToClient(client, sizeof(xXIGetClientPointerReply), &rep);
     return Success;
diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c
index 095fcfa..09186e8 100644
--- a/Xi/xigrabdev.c
+++ b/Xi/xigrabdev.c
@@ -104,11 +104,13 @@ ProcXIGrabDevice(ClientPtr client)
     if (ret != Success)
         return ret;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_XIGrabDevice;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.status = status;
+    rep = (xXIGrabDeviceReply) {
+        .repType = X_Reply,
+        .RepType = X_XIGrabDevice,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = status
+    };
 
     WriteReplyToClient(client, sizeof(rep), &rep);
     return ret;
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 5e4fa4e..ddab53d 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -78,7 +78,13 @@ int
 ProcXIPassiveGrabDevice(ClientPtr client)
 {
     DeviceIntPtr dev, mod_dev;
-    xXIPassiveGrabDeviceReply rep;
+    xXIPassiveGrabDeviceReply rep = {
+        .repType = X_Reply,
+        .RepType = X_XIPassiveGrabDevice,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .num_modifiers = 0
+    };
     int i, ret = Success;
     uint32_t *modifiers;
     xXIGrabModifierInfo *modifiers_failed;
@@ -137,12 +143,6 @@ ProcXIPassiveGrabDevice(ClientPtr client)
     xi2mask_set_one_mask(mask.xi2mask, stuff->deviceid,
                          (unsigned char *) &stuff[1], mask_len * 4);
 
-    rep.repType = X_Reply;
-    rep.RepType = X_XIPassiveGrabDevice;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.num_modifiers = 0;
-
     memset(&param, 0, sizeof(param));
     param.grabtype = XI2;
     param.ownerEvents = stuff->owner_events;
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index ab86963..51a36d4 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -864,11 +864,13 @@ ProcXListDeviceProperties(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_ListDeviceProperties;
-    rep.length = natoms;
-    rep.sequenceNumber = client->sequence;
-    rep.nAtoms = natoms;
+    rep = (xListDevicePropertiesReply) {
+        .repType = X_Reply,
+        .RepType = X_ListDeviceProperties,
+        .sequenceNumber = client->sequence,
+        .length = natoms,
+        .nAtoms = natoms
+    };
 
     WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep);
     if (natoms) {
@@ -958,15 +960,17 @@ ProcXGetDeviceProperty(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    reply.repType = X_Reply;
-    reply.RepType = X_GetDeviceProperty;
-    reply.sequenceNumber = client->sequence;
-    reply.deviceid = dev->id;
-    reply.nItems = nitems;
-    reply.format = format;
-    reply.bytesAfter = bytes_after;
-    reply.propertyType = type;
-    reply.length = bytes_to_int32(length);
+    reply = (xGetDevicePropertyReply) {
+        .repType = X_Reply,
+        .RepType = X_GetDeviceProperty,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(length),
+        .propertyType = type,
+        .bytesAfter = bytes_after,
+        .nItems = nitems,
+        .format = format,
+        .deviceid = dev->id
+    };
 
     if (stuff->delete && (reply.bytesAfter == 0))
         send_property_event(dev, stuff->property, XIPropertyDeleted);
@@ -1100,11 +1104,13 @@ ProcXIListProperties(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_XIListProperties;
-    rep.length = natoms;
-    rep.sequenceNumber = client->sequence;
-    rep.num_properties = natoms;
+    rep = (xXIListPropertiesReply) {
+        .repType = X_Reply,
+        .RepType = X_XIListProperties,
+        .sequenceNumber = client->sequence,
+        .length = natoms,
+        .num_properties = natoms
+    };
 
     WriteReplyToClient(client, sizeof(xXIListPropertiesReply), &rep);
     if (natoms) {
@@ -1194,14 +1200,16 @@ ProcXIGetProperty(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    reply.repType = X_Reply;
-    reply.RepType = X_XIGetProperty;
-    reply.sequenceNumber = client->sequence;
-    reply.num_items = nitems;
-    reply.format = format;
-    reply.bytes_after = bytes_after;
-    reply.type = type;
-    reply.length = bytes_to_int32(length);
+    reply = (xXIGetPropertyReply) {
+        .repType = X_Reply,
+        .RepType = X_XIGetProperty,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(length),
+        .type = type,
+        .bytes_after = bytes_after,
+        .num_items = nitems,
+        .format = format
+    };
 
     if (length && stuff->delete && (reply.bytes_after == 0))
         send_property_event(dev, stuff->property, XIPropertyDeleted);
diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index af7ea53..85c1dd8 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -107,12 +107,13 @@ ProcXIQueryDevice(ClientPtr client)
         return BadAlloc;
     }
 
-    memset(&rep, 0, sizeof(xXIQueryDeviceReply));
-    rep.repType = X_Reply;
-    rep.RepType = X_XIQueryDevice;
-    rep.sequenceNumber = client->sequence;
-    rep.length = len / 4;
-    rep.num_devices = 0;
+    rep = (xXIQueryDeviceReply) {
+        .repType = X_Reply,
+        .RepType = X_XIQueryDevice,
+        .sequenceNumber = client->sequence,
+        .length = len / 4,
+        .num_devices = 0
+    };
 
     ptr = info;
     if (dev) {
diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index e09a1f6..7e6852d 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -121,15 +121,16 @@ ProcXIQueryPointer(ClientPtr client)
 
     pSprite = pDev->spriteInfo->sprite;
 
-    memset(&rep, 0, sizeof(rep));
-    rep.repType = X_Reply;
-    rep.RepType = X_XIQueryPointer;
-    rep.length = 6;
-    rep.sequenceNumber = client->sequence;
-    rep.root = (GetCurrentRootWindow(pDev))->drawable.id;
-    rep.root_x = FP1616(pSprite->hot.x, 0);
-    rep.root_y = FP1616(pSprite->hot.y, 0);
-    rep.child = None;
+    rep = (xXIQueryPointerReply) {
+        .repType = X_Reply,
+        .RepType = X_XIQueryPointer,
+        .sequenceNumber = client->sequence,
+        .length = 6,
+        .root = (GetCurrentRootWindow(pDev))->drawable.id,
+        .root_x = FP1616(pSprite->hot.x, 0),
+        .root_y = FP1616(pSprite->hot.y, 0),
+        .child = None
+    };
 
     if (kbd) {
         state = &kbd->key->xkbInfo->state;
diff --git a/Xi/xiqueryversion.c b/Xi/xiqueryversion.c
index 0d4962f..b807a53 100644
--- a/Xi/xiqueryversion.c
+++ b/Xi/xiqueryversion.c
@@ -93,13 +93,14 @@ ProcXIQueryVersion(ClientPtr client)
         pXIClient->minor_version = minor;
     }
 
-    memset(&rep, 0, sizeof(xXIQueryVersionReply));
-    rep.repType = X_Reply;
-    rep.RepType = X_XIQueryVersion;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.major_version = major;
-    rep.minor_version = minor;
+    rep = (xXIQueryVersionReply) {
+        .repType = X_Reply,
+        .RepType = X_XIQueryVersion,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .major_version = major,
+        .minor_version = minor
+    };
 
     WriteReplyToClient(client, sizeof(xXIQueryVersionReply), &rep);
 
diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index 6dd2c1c..0e45cb8 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -260,11 +260,13 @@ ProcXIGetSelectedEvents(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    reply.repType = X_Reply;
-    reply.RepType = X_XIGetSelectedEvents;
-    reply.length = 0;
-    reply.sequenceNumber = client->sequence;
-    reply.num_masks = 0;
+    reply = (xXIGetSelectedEventsReply) {
+        .repType = X_Reply,
+        .RepType = X_XIGetSelectedEvents,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .num_masks = 0
+    };
 
     masks = wOtherInputMasks(win);
     if (masks) {
diff --git a/Xi/xisetdevfocus.c b/Xi/xisetdevfocus.c
index 55e5c35..372ec24 100644
--- a/Xi/xisetdevfocus.c
+++ b/Xi/xisetdevfocus.c
@@ -97,10 +97,12 @@ ProcXIGetFocus(ClientPtr client)
     if (!dev->focus)
         return BadDevice;
 
-    rep.repType = X_Reply;
-    rep.RepType = X_XIGetFocus;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xXIGetFocusReply) {
+        .repType = X_Reply,
+        .RepType = X_XIGetFocus,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     if (dev->focus->win == NoneWin)
         rep.focus = None;
commit 6a721e3af5e11bae1d59ca551a02470f35d9e844
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:43 2012 -0700

    Use C99 designated initializers in Xext Replies
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/Xext/bigreq.c b/Xext/bigreq.c
index 9bb1c86..d61ff3c 100644
--- a/Xext/bigreq.c
+++ b/Xext/bigreq.c
@@ -55,11 +55,12 @@ ProcBigReqDispatch(ClientPtr client)
         return BadRequest;
     REQUEST_SIZE_MATCH(xBigReqEnableReq);
     client->big_requests = TRUE;
-    memset(&rep, 0, sizeof(xBigReqEnableReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.max_request_size = maxBigRequestSize;
+    rep = (xBigReqEnableReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .max_request_size = maxBigRequestSize
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.max_request_size);
diff --git a/Xext/dpms.c b/Xext/dpms.c
index 35be966..8ec32ea 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -45,15 +45,16 @@ static int
 ProcDPMSGetVersion(ClientPtr client)
 {
     /* REQUEST(xDPMSGetVersionReq); */
-    xDPMSGetVersionReply rep;
+    xDPMSGetVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = DPMSMajorVersion,
+        .minorVersion = DPMSMinorVersion
+    };
 
     REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = DPMSMajorVersion;
-    rep.minorVersion = DPMSMinorVersion;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.majorVersion);
@@ -67,15 +68,15 @@ static int
 ProcDPMSCapable(ClientPtr client)
 {
     /* REQUEST(xDPMSCapableReq); */
-    xDPMSCapableReply rep;
+    xDPMSCapableReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .capable = DPMSCapableFlag
+    };
 
     REQUEST_SIZE_MATCH(xDPMSCapableReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.capable = DPMSCapableFlag;
-
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
     }
@@ -87,17 +88,17 @@ static int
 ProcDPMSGetTimeouts(ClientPtr client)
 {
     /* REQUEST(xDPMSGetTimeoutsReq); */
-    xDPMSGetTimeoutsReply rep;
+    xDPMSGetTimeoutsReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .standby = DPMSStandbyTime / MILLI_PER_SECOND,
+        .suspend = DPMSSuspendTime / MILLI_PER_SECOND,
+        .off = DPMSOffTime / MILLI_PER_SECOND
+    };
 
     REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.standby = DPMSStandbyTime / MILLI_PER_SECOND;
-    rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND;
-    rep.off = DPMSOffTime / MILLI_PER_SECOND;
-
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.standby);
@@ -188,16 +189,16 @@ static int
 ProcDPMSInfo(ClientPtr client)
 {
     /* REQUEST(xDPMSInfoReq); */
-    xDPMSInfoReply rep;
+    xDPMSInfoReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .power_level = DPMSPowerLevel,
+        .state = DPMSEnabled
+    };
 
     REQUEST_SIZE_MATCH(xDPMSInfoReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.power_level = DPMSPowerLevel;
-    rep.state = DPMSEnabled;
-
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.power_level);
diff --git a/Xext/geext.c b/Xext/geext.c
index 7bdd873..fc16b8a 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -65,14 +65,16 @@ ProcGEQueryVersion(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xGEQueryVersionReq);
 
-    rep.repType = X_Reply;
-    rep.RepType = X_GEQueryVersion;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
-    /* return the supported version by the server */
-    rep.majorVersion = SERVER_GE_MAJOR_VERSION;
-    rep.minorVersion = SERVER_GE_MINOR_VERSION;
+    rep = (xGEQueryVersionReply) {
+        .repType = X_Reply,
+        .RepType = X_GEQueryVersion,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+
+        /* return the supported version by the server */
+        .majorVersion = SERVER_GE_MAJOR_VERSION,
+        .minorVersion = SERVER_GE_MINOR_VERSION
+    };
 
     /* Remember version the client requested */
     pGEClient->major_version = stuff->majorVersion;
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 98c612a..bb253c3 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -904,14 +904,15 @@ int
 ProcPanoramiXQueryVersion(ClientPtr client)
 {
     /* REQUEST(xPanoramiXQueryVersionReq); */
-    xPanoramiXQueryVersionReply rep;
+    xPanoramiXQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_PANORAMIX_MAJOR_VERSION,
+        .minorVersion = SERVER_PANORAMIX_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION;
-    rep.minorVersion = SERVER_PANORAMIX_MINOR_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -935,11 +936,13 @@ ProcPanoramiXGetState(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.state = !noPanoramiXExtension;
-    rep.window = stuff->window;
+    rep = (xPanoramiXGetStateReply) {
+        .type = X_Reply,
+        .state = !noPanoramiXExtension,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .window = stuff->window
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -963,11 +966,13 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.ScreenCount = PanoramiXNumScreens;
-    rep.window = stuff->window;
+    rep = (xPanoramiXGetScreenCountReply) {
+        .type = X_Reply,
+        .ScreenCount = PanoramiXNumScreens,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .window = stuff->window
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -993,14 +998,16 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xPanoramiXGetScreenSizeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
     /* screen dimensions */
-    rep.width = screenInfo.screens[stuff->screen]->width;
-    rep.height = screenInfo.screens[stuff->screen]->height;
-    rep.window = stuff->window;
-    rep.screen = stuff->screen;
+        .width = screenInfo.screens[stuff->screen]->width,
+        .height = screenInfo.screens[stuff->screen]->height,
+        .window = stuff->window,
+        .screen = stuff->screen
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -1021,18 +1028,18 @@ ProcXineramaIsActive(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xXineramaIsActiveReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
 #if 1
-    {
         /* The following hack fools clients into thinking that Xinerama
          * is disabled even though it is not. */
-        rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack;
-    }
+        .state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack
 #else
-    rep.state = !noPanoramiXExtension;
+        .state = !noPanoramiXExtension;
 #endif
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -1046,14 +1053,15 @@ int
 ProcXineramaQueryScreens(ClientPtr client)
 {
     /* REQUEST(xXineramaQueryScreensReq); */
-    xXineramaQueryScreensReply rep;
+    xXineramaQueryScreensReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(rep.number * sz_XineramaScreenInfo),
+        .number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens
+    };
 
     REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
-    rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index bdabfbf..576844c 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -566,14 +566,18 @@ PanoramiXGetGeometry(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.root = screenInfo.screens[0]->root->drawable.id;
-    rep.depth = pDraw->depth;
-    rep.width = pDraw->width;
-    rep.height = pDraw->height;
-    rep.x = rep.y = rep.borderWidth = 0;
+    rep = (xGetGeometryReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .root = screenInfo.screens[0]->root->drawable.id,
+        .depth = pDraw->depth,
+        .width = pDraw->width,
+        .height = pDraw->height,
+        .x = 0,
+        .y = 0,
+        .borderWidth = 0
+    };
 
     if (stuff->id == rep.root) {
         xWindowRoot *root = (xWindowRoot *)
@@ -617,11 +621,13 @@ PanoramiXTranslateCoords(ClientPtr client)
     rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
     if (rc != Success)
         return rc;
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.sameScreen = xTrue;
-    rep.child = None;
+    rep = (xTranslateCoordsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .sameScreen = xTrue,
+        .child = None
+    };
 
     if ((pWin == screenInfo.screens[0]->root) ||
         (pWin->drawable.id == screenInfo.screens[0]->screensaver.wid)) {
@@ -1954,10 +1960,12 @@ PanoramiXGetImage(ClientPtr client)
             return rc;
     }
 
-    xgi.visual = wVisual(((WindowPtr) pDraw));
-    xgi.type = X_Reply;
-    xgi.sequenceNumber = client->sequence;
-    xgi.depth = pDraw->depth;
+    xgi = (xGetImageReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .visual = wVisual(((WindowPtr) pDraw)),
+        .depth = pDraw->depth
+    };
     if (format == ZPixmap) {
         widthBytesLine = PixmapBytePad(w, pDraw->depth);
         length = widthBytesLine * h;
diff --git a/Xext/saver.c b/Xext/saver.c
index 60c02ff..e1e86c0 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -634,14 +634,16 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
 static int
 ProcScreenSaverQueryVersion(ClientPtr client)
 {
-    xScreenSaverQueryVersionReply rep;
+    xScreenSaverQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_SAVER_MAJOR_VERSION,
+        .minorVersion = SERVER_SAVER_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_SAVER_MAJOR_VERSION;
-    rep.minorVersion = SERVER_SAVER_MINOR_VERSION;
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -677,10 +679,12 @@ ProcScreenSaverQueryInfo(ClientPtr client)
     UpdateCurrentTime();
     lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.window = pSaver->wid;
+    rep = (xScreenSaverQueryInfoReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .window = pSaver->wid
+    };
     if (screenIsSaved != SCREEN_SAVER_OFF) {
         rep.state = ScreenSaverOn;
         if (ScreenSaverTime)
diff --git a/Xext/security.c b/Xext/security.c
index fd63571..4144d85 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -338,14 +338,16 @@ static int
 ProcSecurityQueryVersion(ClientPtr client)
 {
     /* REQUEST(xSecurityQueryVersionReq); */
-    xSecurityQueryVersionReply rep;
+    xSecurityQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_SECURITY_MAJOR_VERSION,
+        .minorVersion = SERVER_SECURITY_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
-    rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.majorVersion);
@@ -527,11 +529,13 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
 
     /* tell client the auth id and data */
 
-    rep.type = X_Reply;
-    rep.length = bytes_to_int32(authdata_len);
-    rep.sequenceNumber = client->sequence;
-    rep.authId = authId;
-    rep.dataLength = authdata_len;
+    rep = (xSecurityGenerateAuthorizationReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(authdata_len),
+        .authId = authId,
+        .dataLength = authdata_len
+    };
 
     if (client->swapped) {
         swapl(&rep.length);
diff --git a/Xext/shape.c b/Xext/shape.c
index 7724e7b..ecc6c88 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -204,15 +204,16 @@ CreateClipShape(WindowPtr pWin)
 static int
 ProcShapeQueryVersion(ClientPtr client)
 {
-    xShapeQueryVersionReply rep;
+    xShapeQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_SHAPE_MAJOR_VERSION,
+        .minorVersion = SERVER_SHAPE_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
-    memset(&rep, 0, sizeof(xShapeQueryVersionReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION;
-    rep.minorVersion = SERVER_SHAPE_MINOR_VERSION;
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -631,12 +632,13 @@ ProcShapeQueryExtents(ClientPtr client)
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
     if (rc != Success)
         return rc;
-    memset(&rep, 0, sizeof(xShapeQueryExtentsReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.boundingShaped = (wBoundingShape(pWin) != 0);
-    rep.clipShaped = (wClipShape(pWin) != 0);
+    rep = (xShapeQueryExtentsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .boundingShaped = (wBoundingShape(pWin) != 0),
+        .clipShaped = (wClipShape(pWin) != 0)
+    };
     if ((region = wBoundingShape(pWin))) {
         /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
         pExtents = RegionExtents(region);
@@ -920,10 +922,12 @@ ProcShapeInputSelected(ClientPtr client)
             }
         }
     }
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.enabled = enabled;
+    rep = (xShapeInputSelectedReply) {
+        .type = X_Reply,
+        .enabled = enabled,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -1001,11 +1005,13 @@ ProcShapeGetRectangles(ClientPtr client)
             rects[i].height = box->y2 - box->y1;
         }
     }
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = bytes_to_int32(nrects * sizeof(xRectangle));
-    rep.ordering = YXBanded;
-    rep.nrects = nrects;
+    rep = (xShapeGetRectanglesReply) {
+        .type = X_Reply,
+        .ordering = YXBanded,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(nrects * sizeof(xRectangle)),
+        .nrects = nrects
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
diff --git a/Xext/shm.c b/Xext/shm.c
index a732170..6c9b16d 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -285,19 +285,20 @@ ShmRegisterFbFuncs(ScreenPtr pScreen)
 static int
 ProcShmQueryVersion(ClientPtr client)
 {
-    xShmQueryVersionReply rep;
+    xShmQueryVersionReply rep = {
+        .type = X_Reply,
+        .sharedPixmaps = sharedPixmaps,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_SHM_MAJOR_VERSION,
+        .minorVersion = SERVER_SHM_MINOR_VERSION,
+        .uid = geteuid(),
+        .gid = getegid(),
+        .pixmapFormat = sharedPixmaps ? ZPixmap : 0
+    };
 
     REQUEST_SIZE_MATCH(xShmQueryVersionReq);
-    memset(&rep, 0, sizeof(xShmQueryVersionReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.sharedPixmaps = sharedPixmaps;
-    rep.pixmapFormat = sharedPixmaps ? ZPixmap : 0;
-    rep.majorVersion = SERVER_SHM_MAJOR_VERSION;
-    rep.minorVersion = SERVER_SHM_MINOR_VERSION;
-    rep.uid = geteuid();
-    rep.gid = getegid();
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -656,11 +657,13 @@ ProcShmGetImage(ClientPtr client)
             return BadMatch;
         visual = None;
     }
-    xgi.type = X_Reply;
-    xgi.length = 0;
-    xgi.sequenceNumber = client->sequence;
-    xgi.visual = visual;
-    xgi.depth = pDraw->depth;
+    xgi = (xShmGetImageReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .visual = visual,
+        .depth = pDraw->depth
+    };
     if (stuff->format == ZPixmap) {
         length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
     }
@@ -832,11 +835,13 @@ ProcPanoramiXShmGetImage(ClientPtr client)
         }
     }
 
-    xgi.visual = wVisual(((WindowPtr) pDraw));
-    xgi.type = X_Reply;
-    xgi.length = 0;
-    xgi.sequenceNumber = client->sequence;
-    xgi.depth = pDraw->depth;
+    xgi = (xShmGetImageReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .visual = wVisual(((WindowPtr) pDraw)),
+        .depth = pDraw->depth
+    };
 
     if (format == ZPixmap) {
         widthBytesLine = PixmapBytePad(w, pDraw->depth);
diff --git a/Xext/sync.c b/Xext/sync.c
index fc712cd..3ad2b1b 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -1185,17 +1185,16 @@ FreeAlarmClient(void *value, XID id)
 static int
 ProcSyncInitialize(ClientPtr client)
 {
-    xSyncInitializeReply rep;
+    xSyncInitializeReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_SYNC_MAJOR_VERSION,
+        .minorVersion = SERVER_SYNC_MINOR_VERSION,
+    };
 
     REQUEST_SIZE_MATCH(xSyncInitializeReq);
 
-    memset(&rep, 0, sizeof(xSyncInitializeReply));
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SERVER_SYNC_MAJOR_VERSION;
-    rep.minorVersion = SERVER_SYNC_MINOR_VERSION;
-    rep.length = 0;
-
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
     }
@@ -1209,17 +1208,17 @@ ProcSyncInitialize(ClientPtr client)
 static int
 ProcSyncListSystemCounters(ClientPtr client)
 {
-    xSyncListSystemCountersReply rep;
+    xSyncListSystemCountersReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .nCounters = 0,
+    };
     SysCounterInfo *psci;
     int len = 0;
     xSyncSystemCounter *list = NULL, *walklist = NULL;
 
     REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.nCounters = 0;
-
     xorg_list_for_each_entry(psci, &SysCounterList, entry) {
         /* pad to 4 byte boundary */
         len += pad_to_int32(sz_xSyncSystemCounter + strlen(psci->name));
@@ -1329,10 +1328,12 @@ ProcSyncGetPriority(ClientPtr client)
             return rc;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.priority = priorityclient->priority;
+    rep = (xSyncGetPriorityReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .priority = priorityclient->priority
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -1606,19 +1607,20 @@ ProcSyncQueryCounter(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-
     /* if system counter, ask it what the current value is */
-
     if (IsSystemCounter(pCounter)) {
         (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
                                                   &pCounter->value);
     }
 
-    rep.value_hi = XSyncValueHigh32(pCounter->value);
-    rep.value_lo = XSyncValueLow32(pCounter->value);
+    rep = (xSyncQueryCounterReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .value_hi = XSyncValueHigh32(pCounter->value),
+        .value_lo = XSyncValueLow32(pCounter->value)
+    };
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -1772,32 +1774,33 @@ ProcSyncQueryAlarm(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length =
-        bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply));
-    rep.sequenceNumber = client->sequence;
-
     pTrigger = &pAlarm->trigger;
-    rep.counter = (pTrigger->pSync) ? pTrigger->pSync->id : None;
+    rep = (xSyncQueryAlarmReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length =
+          bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)),
+        .counter = (pTrigger->pSync) ? pTrigger->pSync->id : None,
 
 #if 0  /* XXX unclear what to do, depends on whether relative value-types
         * are "consumed" immediately and are considered absolute from then
         * on.
         */
-    rep.value_type = pTrigger->value_type;
-    rep.wait_value_hi = XSyncValueHigh32(pTrigger->wait_value);
-    rep.wait_value_lo = XSyncValueLow32(pTrigger->wait_value);
+        .value_type = pTrigger->value_type,
+        .wait_value_hi = XSyncValueHigh32(pTrigger->wait_value),
+        .wait_value_lo = XSyncValueLow32(pTrigger->wait_value),
 #else
-    rep.value_type = XSyncAbsolute;
-    rep.wait_value_hi = XSyncValueHigh32(pTrigger->test_value);
-    rep.wait_value_lo = XSyncValueLow32(pTrigger->test_value);
+        .value_type = XSyncAbsolute,
+        .wait_value_hi = XSyncValueHigh32(pTrigger->test_value),
+        .wait_value_lo = XSyncValueLow32(pTrigger->test_value),
 #endif
 
-    rep.test_type = pTrigger->test_type;
-    rep.delta_hi = XSyncValueHigh32(pAlarm->delta);
-    rep.delta_lo = XSyncValueLow32(pAlarm->delta);
-    rep.events = pAlarm->events;
-    rep.state = pAlarm->state;
+        .test_type = pTrigger->test_type,
+        .delta_hi = XSyncValueHigh32(pAlarm->delta),
+        .delta_lo = XSyncValueLow32(pAlarm->delta),
+        .events = pAlarm->events,
+        .state = pAlarm->state
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
@@ -1956,11 +1959,13 @@ ProcSyncQueryFence(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xSyncQueryFenceReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
 
-    rep.triggered = pFence->funcs.CheckTriggered(pFence);
+        .triggered = pFence->funcs.CheckTriggered(pFence)
+    };
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c
index 943b424..9e4ea89 100644
--- a/Xext/xcmisc.c
+++ b/Xext/xcmisc.c
@@ -45,14 +45,16 @@ from The Open Group.
 static int
 ProcXCMiscGetVersion(ClientPtr client)
 {
-    xXCMiscGetVersionReply rep;
+    xXCMiscGetVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = XCMiscMajorVersion,
+        .minorVersion = XCMiscMinorVersion
+    };
 
     REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = XCMiscMajorVersion;
-    rep.minorVersion = XCMiscMinorVersion;
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.majorVersion);
@@ -70,11 +72,13 @@ ProcXCMiscGetXIDRange(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq);
     GetXIDRange(client->index, FALSE, &min_id, &max_id);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.start_id = min_id;
-    rep.count = max_id - min_id + 1;
+    rep = (xXCMiscGetXIDRangeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .start_id = min_id,
+        .count = max_id - min_id + 1
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.start_id);
@@ -102,10 +106,12 @@ ProcXCMiscGetXIDList(ClientPtr client)
         return BadAlloc;
     }
     count = GetXIDList(client, stuff->count, pids);
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = count;
-    rep.count = count;
+    rep = (xXCMiscGetXIDListReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = count,
+        .count = count
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index a902861..d91ff95 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -277,25 +277,23 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
     xXF86BigfontQueryVersionReply reply;
 
     REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
-    reply.type = X_Reply;
-    reply.length = 0;
-    reply.sequenceNumber = client->sequence;
-    reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION;
-    reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION;
-    reply.uid = geteuid();
-    reply.gid = getegid();
+    reply = (xXF86BigfontQueryVersionReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION,
+        .minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
+        .uid = geteuid(),
+        .gid = getegid(),
 #ifdef HAS_SHM
-    reply.signature = signature;
+        .signature = signature,
+        .capabilities = (LocalClient(client) && !client->swapped)
+                         ? XF86Bigfont_CAP_LocalShm : 0
 #else
-    reply.signature = 0;        /* This is redundant. Avoids uninitialized memory. */
+        .signature = 0,
+        .capabilities = 0
 #endif
-    reply.capabilities =
-#ifdef HAS_SHM
-        (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
-#else
-        0
-#endif
-        ;                       /* may add more bits here in future versions */
+    };
     if (client->swapped) {
         char tmp;
 
diff --git a/Xext/xres.c b/Xext/xres.c
index d207dce..25d4417 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -194,15 +194,16 @@ static int
 ProcXResQueryVersion(ClientPtr client)
 {
     REQUEST(xXResQueryVersionReq);
-    xXResQueryVersionReply rep;
+    xXResQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .server_major = SERVER_XRES_MAJOR_VERSION,
+        .server_minor = SERVER_XRES_MINOR_VERSION
+    };
 
     REQUEST_SIZE_MATCH(xXResQueryVersionReq);
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.server_major = SERVER_XRES_MAJOR_VERSION;
-    rep.server_minor = SERVER_XRES_MINOR_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -233,10 +234,12 @@ ProcXResQueryClients(ClientPtr client)
         }
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num_clients = num_clients;
-    rep.length = bytes_to_int32(rep.num_clients * sz_xXResClient);
+    rep = (xXResQueryClientsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(num_clients * sz_xXResClient),
+        .num_clients = num_clients
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -300,10 +303,12 @@ ProcXResQueryClientResources(ClientPtr client)
             num_types++;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num_types = num_types;
-    rep.length = bytes_to_int32(rep.num_types * sz_xXResType);
+    rep = (xXResQueryClientResourcesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(num_types * sz_xXResType),
+        .num_types = num_types
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -470,15 +475,17 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
                               (pointer)(&bytes));
 #endif
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.bytes = bytes;
+    rep = (xXResQueryClientPixmapBytesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .bytes = bytes,
 #ifdef _XSERVER64
-    rep.bytes_overflow = bytes >> 32;
+        .bytes_overflow = bytes >> 32
 #else
-    rep.bytes_overflow = 0;
+        .bytes_overflow = 0
 #endif
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -650,7 +657,6 @@ ProcXResQueryClientIds (ClientPtr client)
 {
     REQUEST(xXResQueryClientIdsReq);
 
-    xXResQueryClientIdsReply  rep;
     xXResClientIdSpec        *specs = (void*) ((char*) stuff + sizeof(*stuff));
     int                       rc;
     ConstructClientIdCtx      ctx;
@@ -664,12 +670,14 @@ ProcXResQueryClientIds (ClientPtr client)
     rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx);
 
     if (rc == Success) {
-        rep.type = X_Reply;
-        rep.sequenceNumber = client->sequence;
+        xXResQueryClientIdsReply  rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(ctx.resultBytes),
+            .numIds = ctx.numIds
+        };
 
         assert((ctx.resultBytes & 3) == 0);
-        rep.length = bytes_to_int32(ctx.resultBytes);
-        rep.numIds = ctx.numIds;
 
         if (client->swapped) {
             swaps (&rep.sequenceNumber);
@@ -1028,7 +1036,6 @@ ProcXResQueryResourceBytes (ClientPtr client)
 {
     REQUEST(xXResQueryResourceBytesReq);
 
-    xXResQueryResourceBytesReply rep;
     int                          rc;
     ConstructResourceBytesCtx    ctx;
 
@@ -1046,10 +1053,12 @@ ProcXResQueryResourceBytes (ClientPtr client)
     rc = ConstructResourceBytes(stuff->client, &ctx);
 
     if (rc == Success) {
-        rep.type = X_Reply;
-        rep.sequenceNumber = client->sequence;
-        rep.numSizes = ctx.numSizes;
-        rep.length = bytes_to_int32(ctx.resultBytes);
+        xXResQueryResourceBytesReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(ctx.resultBytes),
+            .numSizes = ctx.numSizes
+        };
 
         if (client->swapped) {
             swaps (&rep.sequenceNumber);
diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index 8817591..d22c2f1 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -63,13 +63,13 @@ SELinuxCopyContext(char *ptr, unsigned len)
 static int
 ProcSELinuxQueryVersion(ClientPtr client)
 {
-    SELinuxQueryVersionReply rep;
-
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.server_major = SELINUX_MAJOR_VERSION;
-    rep.server_minor = SELINUX_MINOR_VERSION;
+    SELinuxQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .server_major = SELINUX_MAJOR_VERSION,
+        .server_minor = SELINUX_MINOR_VERSION
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -93,10 +93,12 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
         len = strlen(ctx) + 1;
     }
 
-    rep.type = X_Reply;
-    rep.length = bytes_to_int32(len);
-    rep.sequenceNumber = client->sequence;
-    rep.context_len = len;
+    rep = (SELinuxGetContextReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(len),
+        .context_len = len
+    };
 
     if (client->swapped) {
         swapl(&rep.length);
@@ -372,10 +374,12 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
     }
 
     /* Send reply to client */
-    rep.type = X_Reply;
-    rep.length = size;
-    rep.sequenceNumber = client->sequence;
-    rep.count = count;
+    rep = (SELinuxListItemsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = size,
+        .count = count
+    };
 
     if (client->swapped) {
         swapl(&rep.length);
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 6112c0b..c7b087b 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -88,14 +88,16 @@ static int XTestSwapFakeInput(ClientPtr /* client */ ,
 static int
 ProcXTestGetVersion(ClientPtr client)
 {
-    xXTestGetVersionReply rep;
+    xXTestGetVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = XTestMajorVersion,
+        .minorVersion = XTestMinorVersion
+    };
 
     REQUEST_SIZE_MATCH(xXTestGetVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.majorVersion = XTestMajorVersion;
-    rep.minorVersion = XTestMinorVersion;
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swaps(&rep.minorVersion);
@@ -134,10 +136,12 @@ ProcXTestCompareCursor(ClientPtr client)
             return rc;
         }
     }
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.same = (wCursor(pWin) == pCursor);
+    rep = (xXTestCompareCursorReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .same = (wCursor(pWin) == pCursor)
+    };
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
     }
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index 8730267..dae9772 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -302,17 +302,17 @@ SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
 static int
 ProcXvQueryExtension(ClientPtr client)
 {
-    xvQueryExtensionReply rep;
+    xvQueryExtensionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .version = XvVersion,
+        .revision = XvRevision
+    };
 
     /* REQUEST(xvQueryExtensionReq); */
     REQUEST_SIZE_MATCH(xvQueryExtensionReq);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.version = XvVersion;
-    rep.revision = XvRevision;
-
     _WriteQueryExtensionReply(client, &rep);
 
     return Success;
@@ -343,10 +343,12 @@ ProcXvQueryAdaptors(ClientPtr client)
     pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                           XvGetScreenKey());
     if (!pxvs) {
-        rep.type = X_Reply;
-        rep.sequenceNumber = client->sequence;
-        rep.num_adaptors = 0;
-        rep.length = 0;
+        rep = (xvQueryAdaptorsReply) {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .num_adaptors = 0
+        };
 
         _WriteQueryAdaptorsReply(client, &rep);
 
@@ -355,9 +357,11 @@ ProcXvQueryAdaptors(ClientPtr client)
 
     (*pxvs->ddQueryAdaptors) (pScreen, &pxvs->pAdaptors, &pxvs->nAdaptors);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num_adaptors = pxvs->nAdaptors;
+    rep = (xvQueryAdaptorsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .num_adaptors = pxvs->nAdaptors
+    };
 
     /* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */
 
@@ -429,9 +433,11 @@ ProcXvQueryEncodings(ClientPtr client)
         return status;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num_encodings = pPort->pAdaptor->nEncodings;
+    rep = (xvQueryEncodingsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .num_encodings = pPort->pAdaptor->nEncodings
+    };
 
     /* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */
 
@@ -662,11 +668,12 @@ ProcXvGrabPort(ClientPtr client)
     if (status != Success) {
         return status;
     }
-
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.result = result;
+    rep = (xvGrabPortReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .result = result
+    };
 
     _WriteGrabPortReply(client, &rep);
 
@@ -777,10 +784,12 @@ ProcXvGetPortAttribute(ClientPtr client)
         return status;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.value = value;
+    rep = (xvGetPortAttributeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .value = value
+    };
 
     _WriteGetPortAttributeReply(client, &rep);
 
@@ -805,17 +814,18 @@ ProcXvQueryBestSize(ClientPtr client)
         return status;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-
     (*pPort->pAdaptor->ddQueryBestSize) (client, pPort, stuff->motion,
                                          stuff->vid_w, stuff->vid_h,
                                          stuff->drw_w, stuff->drw_h,
                                          &actual_width, &actual_height);
 
-    rep.actual_width = actual_width;
-    rep.actual_height = actual_height;
+    rep = (xvQueryBestSizeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .actual_width = actual_width,
+        .actual_height = actual_height
+    };
 
     _WriteQueryBestSizeReply(client, &rep);
 
@@ -841,10 +851,12 @@ ProcXvQueryPortAttributes(ClientPtr client)
         return status;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num_attributes = pPort->pAdaptor->nAttributes;
-    rep.text_size = 0;
+    rep = (xvQueryPortAttributesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .num_attributes = pPort->pAdaptor->nAttributes,
+        .text_size = 0
+    };
 
     for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
          i < pPort->pAdaptor->nAttributes; i++, pAtt++) {
@@ -1089,13 +1101,15 @@ ProcXvQueryImageAttributes(ClientPtr client)
                                                        &width, &height, offsets,
                                                        pitches);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = planeLength = num_planes << 1;
-    rep.num_planes = num_planes;
-    rep.width = width;
-    rep.height = height;
-    rep.data_size = size;
+    rep = (xvQueryImageAttributesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = planeLength = num_planes << 1,
+        .num_planes = num_planes,
+        .width = width,
+        .height = height,
+        .data_size = size
+    };
 
     _WriteQueryImageAttributesReply(client, &rep);
     if (client->swapped)
@@ -1122,11 +1136,13 @@ ProcXvListImageFormats(ClientPtr client)
 
     VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num_formats = pPort->pAdaptor->nImages;
-    rep.length =
-        bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo);
+    rep = (xvListImageFormatsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .num_formats = pPort->pAdaptor->nImages,
+        .length =
+            bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo)
+    };
 
     _WriteListImageFormatsReply(client, &rep);
 
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index b008bfe..d74302b 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -109,15 +109,17 @@ XvMCDestroySubpictureRes(pointer data, XID id)
 static int
 ProcXvMCQueryVersion(ClientPtr client)
 {
-    xvmcQueryVersionReply rep;
+    xvmcQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .major = SERVER_XVMC_MAJOR_VERSION,
+        .minor = SERVER_XVMC_MINOR_VERSION
+    };
 
     /* REQUEST(xvmcQueryVersionReq); */
     REQUEST_SIZE_MATCH(xvmcQueryVersionReq);
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.major = SERVER_XVMC_MAJOR_VERSION;
-    rep.minor = SERVER_XVMC_MINOR_VERSION;
+
     WriteToClient(client, sizeof(xvmcQueryVersionReply), &rep);
     return Success;
 }
@@ -151,10 +153,12 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
         }
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num = (adaptor) ? adaptor->num_surfaces : 0;
-    rep.length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo));
+    rep = (xvmcListSurfaceTypesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .num = (adaptor) ? adaptor->num_surfaces : 0,
+        .length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo)),
+    };
 
     WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
 
@@ -247,12 +251,14 @@ ProcXvMCCreateContext(ClientPtr client)
         return result;
     }
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.width_actual = pContext->width;
-    rep.height_actual = pContext->height;
-    rep.flags_return = pContext->flags;
-    rep.length = dwords;
+    rep = (xvmcCreateContextReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = dwords,
+        .width_actual = pContext->width,
+        .height_actual = pContext->height,
+        .flags_return = pContext->flags
+    };
 
     WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
     if (dwords)
@@ -320,10 +326,11 @@ ProcXvMCCreateSurface(ClientPtr client)
         free(pSurface);
         return result;
     }
-
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = dwords;
+    rep = (xvmcCreateSurfaceReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = dwords
+    };
 
     WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
     if (dwords)
@@ -435,18 +442,19 @@ ProcXvMCCreateSubpicture(ClientPtr client)
         free(pSubpicture);
         return result;
     }
-
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.width_actual = pSubpicture->width;
-    rep.height_actual = pSubpicture->height;
-    rep.num_palette_entries = pSubpicture->num_palette_entries;
-    rep.entry_bytes = pSubpicture->entry_bytes;
-    rep.component_order[0] = pSubpicture->component_order[0];
-    rep.component_order[1] = pSubpicture->component_order[1];
-    rep.component_order[2] = pSubpicture->component_order[2];
-    rep.component_order[3] = pSubpicture->component_order[3];
-    rep.length = dwords;
+    rep = (xvmcCreateSubpictureReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = dwords,
+        .width_actual = pSubpicture->width,
+        .height_actual = pSubpicture->height,
+        .num_palette_entries = pSubpicture->num_palette_entries,
+        .entry_bytes = pSubpicture->entry_bytes,
+        .component_order[0] = pSubpicture->component_order[0],
+        .component_order[1] = pSubpicture->component_order[1],
+        .component_order[2] = pSubpicture->component_order[2],
+        .component_order[3] = pSubpicture->component_order[3]
+    };
 
     WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
     if (dwords)
@@ -525,9 +533,11 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
     if (!surface)
         return BadMatch;
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.num = 0;
+    rep = (xvmcListSubpictureTypesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .num = 0
+    };
     if (surface->compatible_subpictures)
         rep.num = surface->compatible_subpictures->num_xvimages;
 
@@ -595,13 +605,16 @@ ProcXvMCGetDRInfo(ClientPtr client)
     pScreen = pPort->pAdaptor->pScreen;
     pScreenPriv = XVMC_GET_PRIVATE(pScreen);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.major = pScreenPriv->major;
-    rep.minor = pScreenPriv->minor;
-    rep.patchLevel = pScreenPriv->patchLevel;
-    rep.nameLen = bytes_to_int32(strlen(pScreenPriv->clientDriverName) + 1);
-    rep.busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1);
+    rep = (xvmcGetDRInfoReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .major = pScreenPriv->major,
+        .minor = pScreenPriv->minor,
+        .patchLevel = pScreenPriv->patchLevel,
+        .nameLen = bytes_to_int32(strlen(pScreenPriv->clientDriverName) + 1),
+        .busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1),
+        .isLocal = 1
+    };
 
     rep.length = rep.nameLen + rep.busIDLen;
     rep.nameLen <<= 2;
@@ -612,7 +625,6 @@ ProcXvMCGetDRInfo(ClientPtr client)
      * segment she prepared for us.
      */
 
-    rep.isLocal = 1;
 #ifdef HAS_XVMCSHM
     patternP = (CARD32 *) shmat(stuff->shmKey, NULL, SHM_RDONLY);
     if (-1 != (long) patternP) {
commit d792ac125a0462a04a930af543cbc732f8cdab7d
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:43 2012 -0700

    Use C99 designated initializers in dix Replies
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/dix/devices.c b/dix/devices.c
index 4d1086f..77583f7 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1666,9 +1666,11 @@ ProcSetModifierMapping(ClientPtr client)
                             bytes_to_int32(sizeof(xSetModifierMappingReq))))
         return BadLength;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xSetModifierMappingReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
 
     rc = change_modmap(client, PickKeyboard(client), (KeyCode *) &stuff[1],
                        stuff->numKeyPerModifier);
@@ -1696,12 +1698,13 @@ ProcGetModifierMapping(ClientPtr client)
     generate_modkeymap(client, PickKeyboard(client), &modkeymap,
                        &max_keys_per_mod);
 
-    memset(&rep, 0, sizeof(xGetModifierMappingReply));
-    rep.type = X_Reply;
-    rep.numKeyPerModifier = max_keys_per_mod;
-    rep.sequenceNumber = client->sequence;
+    rep = (xGetModifierMappingReply) {
+        .type = X_Reply,
+        .numKeyPerModifier = max_keys_per_mod,
+        .sequenceNumber = client->sequence,
     /* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
-    rep.length = max_keys_per_mod << 1;
+        .length = max_keys_per_mod << 1
+    };
 
     WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep);
     WriteToClient(client, max_keys_per_mod * 8, modkeymap);
@@ -1785,10 +1788,13 @@ ProcSetPointerMapping(ClientPtr client)
     if (client->req_len !=
         bytes_to_int32(sizeof(xSetPointerMappingReq) + stuff->nElts))
         return BadLength;
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.success = MappingSuccess;
+
+    rep = (xSetPointerMappingReply) {
+        .type = X_Reply,
+        .success = MappingSuccess,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     map = (BYTE *) &stuff[1];
 
     /* So we're bounded here by the number of core buttons.  This check
@@ -1857,12 +1863,13 @@ ProcGetKeyboardMapping(ClientPtr client)
     if (!syms)
         return BadAlloc;
 
-    memset(&rep, 0, sizeof(xGetKeyboardMappingReply));
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.keySymsPerKeyCode = syms->mapWidth;
-    /* length is a count of 4 byte quantities and KeySyms are 4 bytes */
-    rep.length = syms->mapWidth * stuff->count;
+    rep = (xGetKeyboardMappingReply) {
+        .type = X_Reply,
+        .keySymsPerKeyCode = syms->mapWidth,
+        .sequenceNumber = client->sequence,
+        /* length is a count of 4 byte quantities and KeySyms are 4 bytes */
+        .length = syms->mapWidth * stuff->count
+    };
     WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep);
     client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
     WriteSwappedDataToClient(client,
@@ -1892,10 +1899,12 @@ ProcGetPointerMapping(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.nElts = (butc) ? butc->numButtons : 0;
-    rep.length = ((unsigned) rep.nElts + (4 - 1)) / 4;
+    rep = (xGetPointerMappingReply) {
+        .type = X_Reply,
+        .nElts = (butc) ? butc->numButtons : 0,
+        .sequenceNumber = client->sequence,
+        .length = ((unsigned) rep.nElts + (4 - 1)) / 4
+    };
     WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep);
     if (butc)
         WriteToClient(client, (int) rep.nElts, &butc->map[1]);
@@ -2144,15 +2153,17 @@ ProcGetKeyboardControl(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length = 5;
-    rep.sequenceNumber = client->sequence;
-    rep.globalAutoRepeat = ctrl->autoRepeat;
-    rep.keyClickPercent = ctrl->click;
-    rep.bellPercent = ctrl->bell;
-    rep.bellPitch = ctrl->bell_pitch;
-    rep.bellDuration = ctrl->bell_duration;
-    rep.ledMask = ctrl->leds;
+    rep = (xGetKeyboardControlReply) {
+        .type = X_Reply,
+        .globalAutoRepeat = ctrl->autoRepeat,
+        .sequenceNumber = client->sequence,
+        .length = 5,
+        .ledMask = ctrl->leds,
+        .keyClickPercent = ctrl->click,
+        .bellPercent = ctrl->bell,
+        .bellPitch = ctrl->bell_pitch,
+        .bellDuration = ctrl->bell_duration
+    };
     for (i = 0; i < 32; i++)
         rep.map[i] = ctrl->autoRepeats[i];
     WriteReplyToClient(client, sizeof(xGetKeyboardControlReply), &rep);
@@ -2287,12 +2298,14 @@ ProcGetPointerControl(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.threshold = ctrl->threshold;
-    rep.accelNumerator = ctrl->num;
-    rep.accelDenominator = ctrl->den;
+    rep = (xGetPointerControlReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .accelNumerator = ctrl->num,
+        .accelDenominator = ctrl->den,
+        .threshold = ctrl->threshold
+    };
     WriteReplyToClient(client, sizeof(xGenericReply), &rep);
     return Success;
 }
@@ -2336,8 +2349,10 @@ ProcGetMotionEvents(ClientPtr client)
 
     if (mouse->valuator->motionHintWindow)
         MaybeStopHint(mouse, client);
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
+    rep = (xGetMotionEventsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence
+    };
     nEvents = 0;
     start = ClientTimeToServerTime(stuff->start);
     stop = ClientTimeToServerTime(stuff->stop);
@@ -2385,10 +2400,11 @@ ProcQueryKeymap(ClientPtr client)
     CARD8 *down = keybd->key->down;
 
     REQUEST_SIZE_MATCH(xReq);
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 2;
-    memset(rep.map, 0, 32);
+    rep = (xQueryKeymapReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 2
+    };
 
     rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
     /* If rc is Success, we're allowed to copy out the keymap.
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 5982a49..d916f34 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -926,10 +926,9 @@ GetGeometry(ClientPtr client, xGetGeometryReply * rep)
 int
 ProcGetGeometry(ClientPtr client)
 {
-    xGetGeometryReply rep;
+    xGetGeometryReply rep = { .type = X_Reply };
     int status;
 
-    memset(&rep, 0, sizeof(xGetGeometryReply));
     if ((status = GetGeometry(client, &rep)) != Success)
         return status;
 
@@ -951,14 +950,13 @@ ProcQueryTree(ClientPtr client)
     rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess);
     if (rc != Success)
         return rc;
-    memset(&reply, 0, sizeof(xQueryTreeReply));
-    reply.type = X_Reply;
-    reply.root = pWin->drawable.pScreen->root->drawable.id;
-    reply.sequenceNumber = client->sequence;
-    if (pWin->parent)
-        reply.parent = pWin->parent->drawable.id;
-    else
-        reply.parent = (Window) None;
+
+    reply = (xQueryTreeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .root = pWin->drawable.pScreen->root->drawable.id,
+        .parent = (pWin->parent) ? pWin->parent->drawable.id : (Window) None
+    };
     pHead = RealChildHead(pWin);
     for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
         numChildren++;
@@ -1003,13 +1001,12 @@ ProcInternAtom(ClientPtr client)
     tchar = (char *) &stuff[1];
     atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists);
     if (atom != BAD_RESOURCE) {
-        xInternAtomReply reply;
-
-        memset(&reply, 0, sizeof(xInternAtomReply));
-        reply.type = X_Reply;
-        reply.length = 0;
-        reply.sequenceNumber = client->sequence;
-        reply.atom = atom;
+        xInternAtomReply reply = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .atom = atom
+        };
         WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
         return Success;
     }
@@ -1021,19 +1018,19 @@ int
 ProcGetAtomName(ClientPtr client)
 {
     const char *str;
-    xGetAtomNameReply reply;
-    int len;
 
     REQUEST(xResourceReq);
 
     REQUEST_SIZE_MATCH(xResourceReq);
     if ((str = NameForAtom(stuff->id))) {
-        len = strlen(str);
-        memset(&reply, 0, sizeof(xGetAtomNameReply));
-        reply.type = X_Reply;
-        reply.length = bytes_to_int32(len);
-        reply.sequenceNumber = client->sequence;
-        reply.nameLength = len;
+        int len = strlen(str);
+        xGetAtomNameReply reply = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(len),
+            .nameLength = len
+        };
+
         WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
         WriteToClient(client, len, str);
         return Success;
@@ -1123,10 +1120,12 @@ ProcTranslateCoords(ClientPtr client)
     rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixGetAttrAccess);
     if (rc != Success)
         return rc;
-    memset(&rep, 0, sizeof(xTranslateCoordsReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+
+    rep = (xTranslateCoordsReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     if (!SAME_SCREENS(pWin->drawable, pDst->drawable)) {
         rep.sameScreen = xFalse;
         rep.child = None;
@@ -1288,17 +1287,19 @@ ProcQueryTextExtents(ClientPtr client)
     }
     if (!QueryTextExtents(pFont, length, (unsigned char *) &stuff[1], &info))
         return BadAlloc;
-    reply.type = X_Reply;
-    reply.length = 0;
-    reply.sequenceNumber = client->sequence;
-    reply.drawDirection = info.drawDirection;
-    reply.fontAscent = info.fontAscent;
-    reply.fontDescent = info.fontDescent;
-    reply.overallAscent = info.overallAscent;
-    reply.overallDescent = info.overallDescent;
-    reply.overallWidth = info.overallWidth;
-    reply.overallLeft = info.overallLeft;
-    reply.overallRight = info.overallRight;
+    reply = (xQueryTextExtentsReply) {
+        .type = X_Reply,
+        .drawDirection = info.drawDirection,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .fontAscent = info.fontAscent,
+        .fontDescent = info.fontDescent,
+        .overallAscent = info.overallAscent,
+        .overallDescent = info.overallDescent,
+        .overallWidth = info.overallWidth,
+        .overallLeft = info.overallLeft,
+        .overallRight = info.overallRight
+    };
     WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply);
     return Success;
 }
@@ -2466,7 +2467,6 @@ ProcAllocColor(ClientPtr client)
 {
     ColormapPtr pmap;
     int rc;
-    xAllocColorReply acr;
 
     REQUEST(xAllocColorReq);
 
@@ -2474,13 +2474,15 @@ ProcAllocColor(ClientPtr client)
     rc = dixLookupResourceByType((pointer *) &pmap, stuff->cmap, RT_COLORMAP,
                                  client, DixAddAccess);
     if (rc == Success) {
-        acr.type = X_Reply;
-        acr.length = 0;
-        acr.sequenceNumber = client->sequence;
-        acr.red = stuff->red;
-        acr.green = stuff->green;
-        acr.blue = stuff->blue;
-        acr.pixel = 0;
+        xAllocColorReply acr = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .red = stuff->red,
+            .green = stuff->green,
+            .blue = stuff->blue,
+            .pixel = 0
+        };
         if ((rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
                              &acr.pixel, client->index)))
             return rc;
@@ -2509,12 +2511,11 @@ ProcAllocNamedColor(ClientPtr client)
     rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
                                  client, DixAddAccess);
     if (rc == Success) {
-        xAllocNamedColorReply ancr;
-
-        ancr.type = X_Reply;
-        ancr.length = 0;
-        ancr.sequenceNumber = client->sequence;
-
+        xAllocNamedColorReply ancr = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0
+        };
         if (OsLookupColor
             (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
              &ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) {
@@ -2555,7 +2556,6 @@ ProcAllocColorCells(ClientPtr client)
     rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
                                  client, DixAddAccess);
     if (rc == Success) {
-        xAllocColorCellsReply accr;
         int npixels, nmasks;
         long length;
         Pixel *ppixels, *pmasks;
@@ -2585,11 +2585,13 @@ ProcAllocColorCells(ClientPtr client)
         if (noPanoramiXExtension || !pcmp->pScreen->myNum)
 #endif
         {
-            accr.type = X_Reply;
-            accr.length = bytes_to_int32(length);
-            accr.sequenceNumber = client->sequence;
-            accr.nPixels = npixels;
-            accr.nMasks = nmasks;
+            xAllocColorCellsReply accr = {
+                .type = X_Reply,
+                .sequenceNumber = client->sequence,
+                .length = bytes_to_int32(length),
+                .nPixels = npixels,
+                .nMasks = nmasks
+            };
             WriteReplyToClient(client, sizeof(xAllocColorCellsReply), &accr);
             client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
             WriteSwappedDataToClient(client, length, ppixels);
@@ -2629,9 +2631,11 @@ ProcAllocColorPlanes(ClientPtr client)
             client->errorValue = stuff->contiguous;
             return BadValue;
         }
-        acpr.type = X_Reply;
-        acpr.sequenceNumber = client->sequence;
-        acpr.nPixels = npixels;
+        acpr = (xAllocColorPlanesReply) {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .nPixels = npixels
+        };
         length = (long) npixels *sizeof(Pixel);
 
         ppixels = malloc(length);
@@ -2769,11 +2773,12 @@ ProcQueryColors(ClientPtr client)
             free(prgbs);
             return rc;
         }
-        memset(&qcr, 0, sizeof(xQueryColorsReply));
-        qcr.type = X_Reply;
-        qcr.length = bytes_to_int32(count * sizeof(xrgb));
-        qcr.sequenceNumber = client->sequence;
-        qcr.nColors = count;
+        qcr = (xQueryColorsReply) {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = bytes_to_int32(count * sizeof(xrgb)),
+            .nColors = count
+        };
         WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
         if (count) {
             client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
@@ -2806,16 +2811,17 @@ ProcLookupColor(ClientPtr client)
         if (OsLookupColor
             (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
              &exactRed, &exactGreen, &exactBlue)) {
-            xLookupColorReply lcr;
-            lcr.type = X_Reply;
-            lcr.length = 0;
-            lcr.sequenceNumber = client->sequence;
-            lcr.exactRed = exactRed;
-            lcr.exactGreen = exactGreen;
-            lcr.exactBlue = exactBlue;
-            lcr.screenRed = exactRed;
-            lcr.screenGreen = exactGreen;
-            lcr.screenBlue = exactBlue;
+            xLookupColorReply lcr = {
+                .type = X_Reply,
+                .sequenceNumber = client->sequence,
+                .length = 0,
+                .exactRed = exactRed,
+                .exactGreen = exactGreen,
+                .exactBlue = exactBlue,
+                .screenRed = exactRed,
+                .screenGreen = exactGreen,
+                .screenBlue = exactBlue
+            };
             (*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
                                             &lcr.screenGreen,
                                             &lcr.screenBlue, pcmp->pVisual);
@@ -2995,12 +3001,13 @@ ProcQueryBestSize(ClientPtr client)
         return rc;
     (*pScreen->QueryBestSize) (stuff->class, &stuff->width,
                                &stuff->height, pScreen);
-    memset(&reply, 0, sizeof(xQueryBestSizeReply));
-    reply.type = X_Reply;
-    reply.length = 0;
-    reply.sequenceNumber = client->sequence;
-    reply.width = stuff->width;
-    reply.height = stuff->height;
+    reply = (xQueryBestSizeReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .width = stuff->width,
+        .height = stuff->height
+    };
     WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply);
     return Success;
 }
@@ -3080,13 +3087,15 @@ ProcGetScreenSaver(ClientPtr client)
             return rc;
     }
 
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
-    rep.timeout = ScreenSaverTime / MILLI_PER_SECOND;
-    rep.interval = ScreenSaverInterval / MILLI_PER_SECOND;
-    rep.preferBlanking = ScreenSaverBlanking;
-    rep.allowExposures = ScreenSaverAllowExposures;
+    rep = (xGetScreenSaverReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .timeout = ScreenSaverTime / MILLI_PER_SECOND,
+        .interval = ScreenSaverInterval / MILLI_PER_SECOND,
+        .preferBlanking = ScreenSaverBlanking,
+        .allowExposures = ScreenSaverAllowExposures
+    };
     WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep);
     return Success;
 }
@@ -3128,11 +3137,14 @@ ProcListHosts(ClientPtr client)
     result = GetHosts(&pdata, &nHosts, &len, &enabled);
     if (result != Success)
         return result;
-    reply.type = X_Reply;
-    reply.enabled = enabled;
-    reply.sequenceNumber = client->sequence;
-    reply.nHosts = nHosts;
-    reply.length = bytes_to_int32(len);
+
+    reply = (xListHostsReply) {
+        .type = X_Reply,
+        .enabled = enabled,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(len),
+        .nHosts = nHosts
+    };
     WriteReplyToClient(client, sizeof(xListHostsReply), &reply);
     if (nHosts) {
         client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
@@ -3247,10 +3259,12 @@ ProcGetFontPath(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = bytes_to_int32(stringLens + numpaths);
-    reply.nPaths = numpaths;
+    reply = (xGetFontPathReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(stringLens + numpaths),
+        .nPaths = numpaths
+    };
 
     WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply);
     if (stringLens || numpaths)
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index d1f6326..ad21860 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -753,11 +753,12 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
     for (i = 0; i < nnames; i++)
         stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
 
-    memset(&reply, 0, sizeof(xListFontsReply));
-    reply.type = X_Reply;
-    reply.length = bytes_to_int32(stringLens + nnames);
-    reply.nFonts = nnames;
-    reply.sequenceNumber = client->sequence;
+    reply = (xListFontsReply) {
+        .type = X_Reply,
+        .length = bytes_to_int32(stringLens + nnames),
+        .nFonts = nnames,
+        .sequenceNumber = client->sequence
+    };
 
     bufptr = bufferStart = malloc(reply.length << 2);
 
@@ -1030,11 +1031,12 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
     }
  finish:
     length = sizeof(xListFontsWithInfoReply);
-    memset((char *) &finalReply, 0, sizeof(xListFontsWithInfoReply));
-    finalReply.type = X_Reply;
-    finalReply.sequenceNumber = client->sequence;
-    finalReply.length = bytes_to_int32(sizeof(xListFontsWithInfoReply)
-                                       - sizeof(xGenericReply));
+    finalReply = (xListFontsWithInfoReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(sizeof(xListFontsWithInfoReply)
+                                 - sizeof(xGenericReply))
+    };
     WriteSwappedDataToClient(client, length, &finalReply);
  bail:
     ClientWakeup(client);
diff --git a/dix/events.c b/dix/events.c
index c5eceec..1708710 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4767,17 +4767,20 @@ ProcGetInputFocus(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    memset(&rep, 0, sizeof(xGetInputFocusReply));
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequenceNumber = client->sequence;
+    rep = (xGetInputFocusReply) {
+        .type = X_Reply,
+        .length = 0,
+        .sequenceNumber = client->sequence,
+        .revertTo = focus->revert
+    };
+
     if (focus->win == NoneWin)
         rep.focus = None;
     else if (focus->win == PointerRootWin)
         rep.focus = PointerRoot;
     else
         rep.focus = focus->win->drawable.id;
-    rep.revertTo = focus->revert;
+
     WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep);
     return Success;
 }
@@ -4840,11 +4843,12 @@ ProcGrabPointer(ClientPtr client)
     if (oldCursor && status == GrabSuccess)
         FreeCursor(oldCursor, (Cursor) 0);
 
-    memset(&rep, 0, sizeof(xGrabPointerReply));
-    rep.type = X_Reply;
-    rep.status = status;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
+    rep = (xGrabPointerReply) {
+        .type = X_Reply,
+        .status = status,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep);
     return Success;
 }
@@ -5080,11 +5084,12 @@ ProcGrabKeyboard(ClientPtr client)
     if (result != Success)
         return result;
 
-    memset(&rep, 0, sizeof(xGrabKeyboardReply));
-    rep.type = X_Reply;
-    rep.status = status;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
+    rep = (xGrabKeyboardReply) {
+        .type = X_Reply,
+        .status = status,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep);
     return Success;
 }
@@ -5147,15 +5152,16 @@ ProcQueryPointer(ClientPtr client)
     pSprite = mouse->spriteInfo->sprite;
     if (mouse->valuator->motionHintWindow)
         MaybeStopHint(mouse, client);
-    memset(&rep, 0, sizeof(xQueryPointerReply));
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.mask = event_get_corestate(mouse, keyboard);
-    rep.length = 0;
-    rep.root = (GetCurrentRootWindow(mouse))->drawable.id;
-    rep.rootX = pSprite->hot.x;
-    rep.rootY = pSprite->hot.y;
-    rep.child = None;
+    rep = (xQueryPointerReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .mask = event_get_corestate(mouse, keyboard),
+        .root = (GetCurrentRootWindow(mouse))->drawable.id,
+        .rootX = pSprite->hot.x,
+        .rootY = pSprite->hot.y,
+        .child = None
+    };
     if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
         rep.sameScreen = xTrue;
         rep.winX = pSprite->hot.x - pWin->drawable.x;
diff --git a/dix/extension.c b/dix/extension.c
index 3cdfb51..6380db3 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -252,11 +252,12 @@ ProcQueryExtension(ClientPtr client)
 
     REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes);
 
-    memset(&reply, 0, sizeof(xQueryExtensionReply));
-    reply.type = X_Reply;
-    reply.length = 0;
-    reply.major_opcode = 0;
-    reply.sequenceNumber = client->sequence;
+    reply = (xQueryExtensionReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .major_opcode = 0
+    };
 
     if (!NumExtensions)
         reply.present = xFalse;
@@ -284,11 +285,12 @@ ProcListExtensions(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xReq);
 
-    memset(&reply, 0, sizeof(xListExtensionsReply));
-    reply.type = X_Reply;
-    reply.nExtensions = 0;
-    reply.length = 0;
-    reply.sequenceNumber = client->sequence;
+    reply = (xListExtensionsReply) {
+        .type = X_Reply,
+        .nExtensions = 0,
+        .sequenceNumber = client->sequence,
+        .length = 0
+    };
     buffer = NULL;
 
     if (NumExtensions) {
diff --git a/dix/property.c b/dix/property.c
index 5ef97ee..5aa6f4a 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -415,15 +415,15 @@ DeleteAllWindowProperties(WindowPtr pWin)
 static int
 NullPropertyReply(ClientPtr client, ATOM propertyType, int format)
 {
-    xGetPropertyReply reply;
-    memset(&reply, 0, sizeof(xGetPropertyReply));
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.nItems = 0;
-    reply.length = 0;
-    reply.bytesAfter = 0;
-    reply.propertyType = propertyType;
-    reply.format = format;
+    xGetPropertyReply reply = {
+        .type = X_Reply,
+        .format = format,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .propertyType = propertyType,
+        .bytesAfter = 0,
+        .nItems = 0
+    };
     WriteReplyToClient(client, sizeof(xGenericReply), &reply);
     return Success;
 }
@@ -484,14 +484,15 @@ ProcGetProperty(ClientPtr client)
 
     if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType))
         ) {
-        memset(&reply, 0, sizeof(xGetPropertyReply));
-        reply.type = X_Reply;
-        reply.sequenceNumber = client->sequence;
-        reply.bytesAfter = pProp->size;
-        reply.format = pProp->format;
-        reply.length = 0;
-        reply.nItems = 0;
-        reply.propertyType = pProp->type;
+        reply = (xGetPropertyReply) {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .bytesAfter = pProp->size,
+            .format = pProp->format,
+            .length = 0,
+            .nItems = 0,
+            .propertyType = pProp->type
+        };
         WriteReplyToClient(client, sizeof(xGenericReply), &reply);
         return Success;
     }
@@ -512,14 +513,15 @@ ProcGetProperty(ClientPtr client)
 
     len = min(n - ind, 4 * stuff->longLength);
 
-    memset(&reply, 0, sizeof(xGetPropertyReply));
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.bytesAfter = n - (ind + len);
-    reply.format = pProp->format;
-    reply.length = bytes_to_int32(len);
-    reply.nItems = len / (pProp->format / 8);
-    reply.propertyType = pProp->type;
+    reply = (xGetPropertyReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .bytesAfter = n - (ind + len),
+        .format = pProp->format,
+        .length = bytes_to_int32(len),
+        .nItems = len / (pProp->format / 8),
+        .propertyType = pProp->type
+    };
 
     if (stuff->delete && (reply.bytesAfter == 0))
         deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
@@ -594,10 +596,12 @@ ProcListProperties(ClientPtr client)
         }
     }
 
-    xlpr.type = X_Reply;
-    xlpr.nProperties = numProps;
-    xlpr.length = bytes_to_int32(numProps * sizeof(Atom));
-    xlpr.sequenceNumber = client->sequence;
+    xlpr = (xListPropertiesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = bytes_to_int32(numProps * sizeof(Atom)),
+        .nProperties = numProps
+    };
     WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
     if (numProps) {
         client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
diff --git a/dix/selection.c b/dix/selection.c
index dfdcfdc..80b5893 100644
--- a/dix/selection.c
+++ b/dix/selection.c
@@ -238,10 +238,11 @@ ProcGetSelectionOwner(ClientPtr client)
         return BadAtom;
     }
 
-    memset(&reply, 0, sizeof(xGetSelectionOwnerReply));
-    reply.type = X_Reply;
-    reply.length = 0;
-    reply.sequenceNumber = client->sequence;
+    reply = (xGetSelectionOwnerReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+    };
 
     rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess);
     if (rc == Success)
commit 69fa5630b5902aaad267fc67d0da4ca93625886a
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:43 2012 -0700

    Use C99 designated initializers in SendErrorToClient
    
    Let the compiler worry about 0-filling the rest of the fields,
    instead of memsetting the whole struct and then going back to
    overwrite some of the fields.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 787f87f..5982a49 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3625,14 +3625,13 @@ void
 SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
                   XID resId, int errorCode)
 {
-    xError rep;
-
-    memset(&rep, 0, sizeof(xError));
-    rep.type = X_Error;
-    rep.errorCode = errorCode;
-    rep.majorCode = majorCode;
-    rep.minorCode = minorCode;
-    rep.resourceID = resId;
+    xError rep = {
+        .type = X_Error,
+        .errorCode = errorCode,
+        .resourceID = resId,
+        .minorCode = minorCode,
+        .majorCode = majorCode
+    };
 
     WriteEventsToClient(client, 1, (xEvent *) &rep);
 }
commit cdf5bcd420e5bcf4a4a24a275d3133a4e16ce41e
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    Use calloc to zero fill buffers being allocated for replies & events
    
    Ensures padding bytes are zero-filled
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/Xext/sync.c b/Xext/sync.c
index 6dc4c5e..fc712cd 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -475,7 +475,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait ** ppAwait,
 
     if (client->clientGone)
         return;
-    pev = pEvents = malloc(num_events * sizeof(xSyncCounterNotifyEvent));
+    pev = pEvents = calloc(num_events, sizeof(xSyncCounterNotifyEvent));
     if (!pEvents)
         return;
     UpdateCurrentTime();
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index 3a1e1b2..a902861 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -554,7 +554,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
                ? nUniqCharInfos * sizeof(xCharInfo)
                + (nCharInfos + 1) / 2 * 2 * sizeof(CARD16)
                : 0);
-        xXF86BigfontQueryFontReply *reply = malloc(rlength);
+        xXF86BigfontQueryFontReply *reply = calloc(1, rlength);
         char *p;
 
         if (!reply) {
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 9cb9e73..c1c836f 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2315,7 +2315,7 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
     reply.n = n;
 
     /* Allocate buffer to make sure it's a multiple of 4 bytes big. */
-    buf = (char *) malloc(length << 2);
+    buf = calloc(length, 4);
     if (buf == NULL)
         return BadAlloc;
     memcpy(buf, pGlxScreen->GLXextensions, n);
@@ -2375,7 +2375,7 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
     reply.length = length;
     reply.n = n;
 
-    buf = (char *) malloc(length << 2);
+    buf = calloc(length, 4);
     if (buf == NULL) {
         return BadAlloc;
     }
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 2fdf9e9..0435cb6 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -1354,7 +1354,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
     rep.flags = 0;
 
     if (!ClockProg) {
-        Clocks = malloc(numClocks * sizeof(int));
+        Clocks = calloc(numClocks, sizeof(int));
         if (!Clocks)
             return BadValue;
         if (!VidModeGetClocks(stuff->screen, Clocks)) {
diff --git a/mi/miexpose.c b/mi/miexpose.c
index dbb29ca..2dc465d 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -327,7 +327,7 @@ miSendGraphicsExpose(ClientPtr client, RegionPtr pRgn, XID drawable,
 
         numRects = RegionNumRects(pRgn);
         pBox = RegionRects(pRgn);
-        if (!(pEvent = malloc(numRects * sizeof(xEvent))))
+        if (!(pEvent = calloc(numRects, sizeof(xEvent))))
             return;
         pe = pEvent;
 
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index ee29f37..c91c7fd 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -1526,7 +1526,7 @@ ProcRRGetCrtcTransform(ClientPtr client)
     nextra = (transform_filter_length(pending) +
               transform_filter_length(current));
 
-    reply = malloc(sizeof(xRRGetCrtcTransformReply) + nextra);
+    reply = calloc(1, sizeof(xRRGetCrtcTransformReply) + nextra);
     if (!reply)
         return BadAlloc;
 
diff --git a/render/render.c b/render/render.c
index be7d21e..3bf0702 100644
--- a/render/render.c
+++ b/render/render.c
@@ -531,7 +531,7 @@ ProcRenderQueryPictIndexValues(ClientPtr client)
     num = pFormat->index.nvalues;
     rlength = (sizeof(xRenderQueryPictIndexValuesReply) +
                num * sizeof(xIndexValue));
-    reply = (xRenderQueryPictIndexValuesReply *) malloc(rlength);
+    reply = (xRenderQueryPictIndexValuesReply *) calloc(1, rlength);
     if (!reply)
         return BadAlloc;
 
@@ -1688,7 +1688,7 @@ ProcRenderQueryFilters(ClientPtr client)
     }
     len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName);
     total_bytes = sizeof(xRenderQueryFiltersReply) + (len << 2);
-    reply = (xRenderQueryFiltersReply *) malloc(total_bytes);
+    reply = (xRenderQueryFiltersReply *) calloc(1, total_bytes);
     if (!reply)
         return BadAlloc;
     aliases = (INT16 *) (reply + 1);
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 79530f9..402456d 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -380,7 +380,8 @@ ProcXFixesGetCursorImage(ClientPtr client)
     width = pCursor->bits->width;
     height = pCursor->bits->height;
     npixels = width * height;
-    rep = malloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32));
+    rep = calloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32),
+                 1);
     if (!rep)
         return BadAlloc;
 
@@ -529,8 +530,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
     name = pCursor->name ? NameForAtom(pCursor->name) : "";
     nbytes = strlen(name);
     nbytesRound = pad_to_int32(nbytes);
-    rep = malloc(sizeof(xXFixesGetCursorImageAndNameReply) +
-                 npixels * sizeof(CARD32) + nbytesRound);
+    rep = calloc(sizeof(xXFixesGetCursorImageAndNameReply) +
+                 npixels * sizeof(CARD32) + nbytesRound, 1);
     if (!rep)
         return BadAlloc;
 
diff --git a/xfixes/region.c b/xfixes/region.c
index 89675e5..0e9ca44 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -557,7 +557,8 @@ ProcXFixesFetchRegion(ClientPtr client)
     pBox = RegionRects(pRegion);
     nBox = RegionNumRects(pRegion);
 
-    reply = malloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle));
+    reply = calloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle),
+                   1);
     if (!reply)
         return BadAlloc;
     reply->type = X_Reply;
commit ef0f701c9245b0373eb0c7a84dd804af4738bb29
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    xf86dga2.c & xf86vmode.c: Move REQUEST_SIZE_MATCH checks before using stuff
    
    Seems silly waiting to check if the client failed to send us enough bytes
    until after we've already tried using them.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index 1ed6a50..347282c 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -96,13 +96,14 @@ ProcXDGAOpenFramebuffer(ClientPtr client)
     char *deviceName;
     int nameSize;
 
+    REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
-    REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -129,14 +130,14 @@ ProcXDGACloseFramebuffer(ClientPtr client)
 {
     REQUEST(xXDGACloseFramebufferReq);
 
+    REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
-    REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
-
     DGACloseFramebuffer(stuff->screen);
 
     return Success;
@@ -152,10 +153,11 @@ ProcXDGAQueryModes(ClientPtr client)
     xXDGAModeInfo info;
     XDGAModePtr mode;
 
+    REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.number = 0;
@@ -267,11 +269,12 @@ ProcXDGASetMode(ClientPtr client)
     ClientPtr owner;
     int size;
 
+    REQUEST_SIZE_MATCH(xXDGASetModeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
     owner = DGA_GETCLIENT(stuff->screen);
 
-    REQUEST_SIZE_MATCH(xXDGASetModeReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.offset = 0;
@@ -357,14 +360,14 @@ ProcXDGASetViewport(ClientPtr client)
 {
     REQUEST(xXDGASetViewportReq);
 
+    REQUEST_SIZE_MATCH(xXDGASetViewportReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGASetViewportReq);
-
     DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags);
 
     return Success;
@@ -378,14 +381,14 @@ ProcXDGAInstallColormap(ClientPtr client)
 
     REQUEST(xXDGAInstallColormapReq);
 
+    REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
-
     rc = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, RT_COLORMAP,
                                  client, DixInstallAccess);
     if (rc != Success)
@@ -399,14 +402,14 @@ ProcXDGASelectInput(ClientPtr client)
 {
     REQUEST(xXDGASelectInputReq);
 
+    REQUEST_SIZE_MATCH(xXDGASelectInputReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGASelectInputReq);
-
     if (DGA_GETCLIENT(stuff->screen) == client)
         DGASelectInput(stuff->screen, client, stuff->mask);
 
@@ -418,14 +421,14 @@ ProcXDGAFillRectangle(ClientPtr client)
 {
     REQUEST(xXDGAFillRectangleReq);
 
+    REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
-
     if (Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
                                stuff->width, stuff->height, stuff->color))
         return BadMatch;
@@ -438,14 +441,14 @@ ProcXDGACopyArea(ClientPtr client)
 {
     REQUEST(xXDGACopyAreaReq);
 
+    REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
-
     if (Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
                                stuff->width, stuff->height, stuff->dstx,
                                stuff->dsty))
@@ -459,14 +462,14 @@ ProcXDGACopyTransparentArea(ClientPtr client)
 {
     REQUEST(xXDGACopyTransparentAreaReq);
 
+    REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
-
     if (Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
                                     stuff->width, stuff->height, stuff->dstx,
                                     stuff->dsty, stuff->key))
@@ -481,13 +484,14 @@ ProcXDGAGetViewportStatus(ClientPtr client)
     REQUEST(xXDGAGetViewportStatusReq);
     xXDGAGetViewportStatusReply rep;
 
+    REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -504,13 +508,14 @@ ProcXDGASync(ClientPtr client)
     REQUEST(xXDGASyncReq);
     xXDGASyncReply rep;
 
+    REQUEST_SIZE_MATCH(xXDGASyncReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGASyncReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -549,13 +554,14 @@ ProcXDGAChangePixmapMode(ClientPtr client)
     xXDGAChangePixmapModeReply rep;
     int x, y;
 
+    REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -579,14 +585,14 @@ ProcXDGACreateColormap(ClientPtr client)
     REQUEST(xXDGACreateColormapReq);
     int result;
 
+    REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
-
     if (!stuff->mode)
         return BadValue;
 
@@ -615,10 +621,11 @@ ProcXF86DGAGetVideoLL(ClientPtr client)
     int num, offset, flags;
     char *name;
 
+    REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -655,9 +662,10 @@ ProcXF86DGADirectVideo(ClientPtr client)
 
     REQUEST(xXF86DGADirectVideoReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
-    REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
 
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
@@ -713,10 +721,11 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
     REQUEST(xXF86DGAGetViewPortSizeReq);
     xXF86DGAGetViewPortSizeReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -741,14 +750,14 @@ ProcXF86DGASetViewPort(ClientPtr client)
 {
     REQUEST(xXF86DGASetViewPortReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
-
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
@@ -768,10 +777,11 @@ ProcXF86DGAGetVidPage(ClientPtr client)
     REQUEST(xXF86DGAGetVidPageReq);
     xXF86DGAGetVidPageReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -786,11 +796,11 @@ ProcXF86DGASetVidPage(ClientPtr client)
 {
     REQUEST(xXF86DGASetVidPageReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
-
     /* silently fail */
 
     return Success;
@@ -804,14 +814,14 @@ ProcXF86DGAInstallColormap(ClientPtr client)
 
     REQUEST(xXF86DGAInstallColormapReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
-
     if (!DGAActive(stuff->screen))
         return DGAErrorBase + XF86DGADirectNotActivated;
 
@@ -832,10 +842,11 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client)
     REQUEST(xXF86DGAQueryDirectVideoReq);
     xXF86DGAQueryDirectVideoReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -854,14 +865,14 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
     REQUEST(xXF86DGAViewPortChangedReq);
     xXF86DGAViewPortChangedReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
-
     if (!DGAActive(stuff->screen))
         return DGAErrorBase + XF86DGADirectNotActivated;
 
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index bac5f11..2fdf9e9 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -1481,14 +1481,14 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
 
     REQUEST(xXF86VidModeGetGammaRampReq);
 
+    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
-
     length = (stuff->size + 1) & ~1;
 
     if (stuff->size) {
@@ -1529,11 +1529,11 @@ ProcXF86VidModeGetGammaRampSize(ClientPtr client)
 
     REQUEST(xXF86VidModeGetGammaRampSizeReq);
 
+    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
-
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -1555,11 +1555,11 @@ ProcXF86VidModeGetPermissions(ClientPtr client)
 
     REQUEST(xXF86VidModeGetPermissionsReq);
 
+    REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
-
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
commit 2e739a8870d91fbac7f536ffa8f6d2cee0f66cec
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    ProcRRListOutputProperties: skip atom walk if the list is empty
    
    pAtoms is only allocated if numProps was non-zero, so move the walk
    through the property list to copy atoms to it inside the if (numProps)
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index e8f0578..b0a1cf9 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -378,7 +378,7 @@ int
 ProcRRListOutputProperties(ClientPtr client)
 {
     REQUEST(xRRListOutputPropertiesReq);
-    Atom *pAtoms = NULL, *temppAtoms;
+    Atom *pAtoms = NULL;
     xRRListOutputPropertiesReply rep;
     int numProps = 0;
     RROutputPtr output;
@@ -403,12 +403,14 @@ ProcRRListOutputProperties(ClientPtr client)
         swapl(&rep.length);
         swaps(&rep.nAtoms);
     }
-    temppAtoms = pAtoms;
-    for (prop = output->properties; prop; prop = prop->next)
-        *temppAtoms++ = prop->propertyName;
-
     WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep);
+
     if (numProps) {
+        /* Copy property name atoms to reply buffer */
+        Atom *temppAtoms = pAtoms;
+        for (prop = output->properties; prop; prop = prop->next)
+            *temppAtoms++ = prop->propertyName;
+
         client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
         WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
         free(pAtoms);
commit 15bc13c8d088e05f14c7262348e0066929c29251
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    ProcRRGetScreenInfo: swap configTimestamp as well
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 236794a..6fd24e0 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -854,6 +854,7 @@ ProcRRGetScreenInfo(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
         swapl(&rep.timestamp);
+        swapl(&rep.configTimestamp);
         swaps(&rep.rotation);
         swaps(&rep.nSizes);
         swaps(&rep.sizeID);
commit 3a013b8816bc0bb765c99e8a2bf2ea536dc62c3b
Author: Jaroslav Šmíd <jardasmid at gmail.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    Bug 51375: Xorg doesn't set status for RRGetOutputInfo
    
    https://bugs.freedesktop.org/show_bug.cgi?id=51375
    https://bugs.freedesktop.org/attachment.cgi?id=63397
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/randr/rroutput.c b/randr/rroutput.c
index fd03aab..3662a5a 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -426,6 +426,7 @@ ProcRRGetOutputInfo(ClientPtr client)
     pScrPriv = rrGetScrPriv(pScreen);
 
     rep.type = X_Reply;
+    rep.status = RRSetConfigSuccess;
     rep.sequenceNumber = client->sequence;
     rep.length = bytes_to_int32(OutputInfoExtra);
     rep.timestamp = pScrPriv->lastSetTime.milliseconds;
commit 5b86c072d1d586ce040d8831a05cf97ff8b17821
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    Use temporary variables instead of parts of reply structures
    
    When passing variable pointers to functions or otherwise doing long
    sequences to compute values for replies, create & use some new
    temporary variables, to allow for simpler initialization of reply
    structures in the following patches.
    
    Move memsets & other initializations to group with the rest of the
    filling in of the reply structure, now that they're not needed so
    early in the code path.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/Xext/shm.c b/Xext/shm.c
index aa3feae..a732170 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -616,6 +616,7 @@ ProcShmGetImage(ClientPtr client)
     Mask plane = 0;
     xShmGetImageReply xgi;
     ShmDescPtr shmdesc;
+    VisualID visual = None;
     int rc;
 
     REQUEST(xShmGetImageReq);
@@ -646,18 +647,19 @@ ProcShmGetImage(ClientPtr client)
                stuff->y + (int) stuff->height >
                wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
             return BadMatch;
-        xgi.visual = wVisual(((WindowPtr) pDraw));
+        visual = wVisual(((WindowPtr) pDraw));
     }
     else {
         if (stuff->x < 0 ||
             stuff->x + (int) stuff->width > pDraw->width ||
             stuff->y < 0 || stuff->y + (int) stuff->height > pDraw->height)
             return BadMatch;
-        xgi.visual = None;
+        visual = None;
     }
     xgi.type = X_Reply;
     xgi.length = 0;
     xgi.sequenceNumber = client->sequence;
+    xgi.visual = visual;
     xgi.depth = pDraw->depth;
     if (stuff->format == ZPixmap) {
         length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 4231cb0..787f87f 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -2801,17 +2801,21 @@ ProcLookupColor(ClientPtr client)
     rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
                                  client, DixReadAccess);
     if (rc == Success) {
-        xLookupColorReply lcr;
+        CARD16 exactRed, exactGreen, exactBlue;
 
         if (OsLookupColor
             (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
-             &lcr.exactRed, &lcr.exactGreen, &lcr.exactBlue)) {
+             &exactRed, &exactGreen, &exactBlue)) {
+            xLookupColorReply lcr;
             lcr.type = X_Reply;
             lcr.length = 0;
             lcr.sequenceNumber = client->sequence;
-            lcr.screenRed = lcr.exactRed;
-            lcr.screenGreen = lcr.exactGreen;
-            lcr.screenBlue = lcr.exactBlue;
+            lcr.exactRed = exactRed;
+            lcr.exactGreen = exactGreen;
+            lcr.exactBlue = exactBlue;
+            lcr.screenRed = exactRed;
+            lcr.screenGreen = exactGreen;
+            lcr.screenBlue = exactBlue;
             (*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
                                             &lcr.screenGreen,
                                             &lcr.screenBlue, pcmp->pVisual);
@@ -3109,6 +3113,7 @@ ProcListHosts(ClientPtr client)
 {
     xListHostsReply reply;
     int len, nHosts, result;
+    BOOL enabled;
     pointer pdata;
 
     /* REQUEST(xListHostsReq); */
@@ -3120,10 +3125,11 @@ ProcListHosts(ClientPtr client)
     if (result != Success)
         return result;
 
-    result = GetHosts(&pdata, &nHosts, &len, &reply.enabled);
+    result = GetHosts(&pdata, &nHosts, &len, &enabled);
     if (result != Success)
         return result;
     reply.type = X_Reply;
+    reply.enabled = enabled;
     reply.sequenceNumber = client->sequence;
     reply.nHosts = nHosts;
     reply.length = bytes_to_int32(len);
diff --git a/dix/events.c b/dix/events.c
index 6e4385a..c5eceec 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4797,6 +4797,7 @@ ProcGrabPointer(ClientPtr client)
     GrabMask mask;
     WindowPtr confineTo;
     CursorPtr oldCursor;
+    BYTE status;
 
     REQUEST(xGrabPointerReq);
     int rc;
@@ -4818,7 +4819,6 @@ ProcGrabPointer(ClientPtr client)
             return rc;
     }
 
-    memset(&rep, 0, sizeof(xGrabPointerReply));
     oldCursor = NullCursor;
     grab = device->deviceGrab.grab;
 
@@ -4833,14 +4833,16 @@ ProcGrabPointer(ClientPtr client)
 
     rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode,
                     stuff->grabWindow, stuff->ownerEvents, stuff->time,
-                    &mask, CORE, stuff->cursor, stuff->confineTo, &rep.status);
+                    &mask, CORE, stuff->cursor, stuff->confineTo, &status);
     if (rc != Success)
         return rc;
 
-    if (oldCursor && rep.status == GrabSuccess)
+    if (oldCursor && status == GrabSuccess)
         FreeCursor(oldCursor, (Cursor) 0);
 
+    memset(&rep, 0, sizeof(xGrabPointerReply));
     rep.type = X_Reply;
+    rep.status = status;
     rep.sequenceNumber = client->sequence;
     rep.length = 0;
     WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep);
@@ -5059,6 +5061,7 @@ int
 ProcGrabKeyboard(ClientPtr client)
 {
     xGrabKeyboardReply rep;
+    BYTE status;
 
     REQUEST(xGrabKeyboardReq);
     int result;
@@ -5067,17 +5070,19 @@ ProcGrabKeyboard(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xGrabKeyboardReq);
 
-    memset(&rep, 0, sizeof(xGrabKeyboardReply));
     mask.core = KeyPressMask | KeyReleaseMask;
 
     result = GrabDevice(client, keyboard, stuff->pointerMode,
                         stuff->keyboardMode, stuff->grabWindow,
                         stuff->ownerEvents, stuff->time, &mask, CORE, None,
-                        None, &rep.status);
+                        None, &status);
 
     if (result != Success)
         return result;
+
+    memset(&rep, 0, sizeof(xGrabKeyboardReply));
     rep.type = X_Reply;
+    rep.status = status;
     rep.sequenceNumber = client->sequence;
     rep.length = 0;
     WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep);
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index aefbcfb..65e0ff8 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -586,6 +586,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
     xXF86DRIOpenConnectionReply rep;
     drm_handle_t hSAREA;
     char *busIdString = NULL;
+    CARD32 busIdStringLength = 0;
 
     REQUEST(xXF86DRIOpenConnectionReq);
     REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
@@ -600,15 +601,16 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
         return BadValue;
     }
 
+    if (busIdString)
+        busIdStringLength = strlen(busIdString);
+
     rep.type = X_Reply;
     rep.sequenceNumber = client->sequence;
-    rep.busIdStringLength = 0;
-    if (busIdString)
-        rep.busIdStringLength = strlen(busIdString);
+    rep.busIdStringLength = busIdStringLength;
     rep.length =
         bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
                        SIZEOF(xGenericReply) +
-                       pad_to_int32(rep.busIdStringLength));
+                       pad_to_int32(busIdStringLength));
 
     rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff);
 #if defined(LONG64) && !defined(__linux__)
@@ -618,8 +620,8 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
 #endif
 
     WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
-    if (rep.busIdStringLength)
-        WriteToClient(client, rep.busIdStringLength, busIdString);
+    if (busIdStringLength)
+        WriteToClient(client, busIdStringLength, busIdString);
     free(busIdString);
     EPHYR_LOG("leave\n");
     return Success;
diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c
index 1287e04..f5c4c18 100644
--- a/hw/kdrive/ephyr/ephyrglxext.c
+++ b/hw/kdrive/ephyr/ephyrglxext.c
@@ -512,6 +512,7 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
     xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
     xGLXMakeCurrentReply reply;
     DrawablePtr drawable = NULL;
+    GLXContextTag contextTag = 0;
     int rc = 0;
 
     EPHYR_LOG("enter\n");
@@ -525,13 +526,14 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
     if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawable->pScreen->myNum),
                                  req->context,
                                  req->oldContextTag,
-                                 (int *) &reply.contextTag)) {
+                                 (int *) &contextTag)) {
         EPHYR_LOG_ERROR("ephyrHostGLXMakeCurrent() failed\n");
         goto out;
     }
     reply.length = 0;
     reply.type = X_Reply;
     reply.sequenceNumber = a_cl->client->sequence;
+    reply.contextTag = contextTag;
     if (a_do_swap) {
         __GLX_DECLARE_SWAP_VARIABLES;
         __GLX_SWAP_SHORT(&reply.sequenceNumber);
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index ee7b213..43504b7 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -141,6 +141,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
     xXF86DRIOpenConnectionReply rep;
     drm_handle_t hSAREA;
     char *busIdString;
+    CARD32 busIdStringLength = 0;
 
     REQUEST(xXF86DRIOpenConnectionReq);
     REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
@@ -154,11 +155,12 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
         return BadValue;
     }
 
+    if (busIdString)
+        busIdStringLength = strlen(busIdString);
+
     rep.type = X_Reply;
     rep.sequenceNumber = client->sequence;
-    rep.busIdStringLength = 0;
-    if (busIdString)
-        rep.busIdStringLength = strlen(busIdString);
+    rep.busIdStringLength = busIdStringLength;
     rep.length =
         bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
                        SIZEOF(xGenericReply) +
@@ -172,8 +174,8 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
 #endif
 
     WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
-    if (rep.busIdStringLength)
-        WriteToClient(client, rep.busIdStringLength, busIdString);
+    if (busIdStringLength)
+        WriteToClient(client, busIdStringLength, busIdString);
     return Success;
 }
 
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 7616e7c..ee29f37 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -999,6 +999,7 @@ ProcRRSetCrtcConfig(ClientPtr client)
     TimeStamp time;
     Rotation rotation;
     int ret, i, j;
+    CARD8 status;
 
     REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
     numOutputs = (stuff->length - bytes_to_int32(SIZEOF(xRRSetCrtcConfigReq)));
@@ -1077,7 +1078,7 @@ ProcRRSetCrtcConfig(ClientPtr client)
 
     if (!pScrPriv) {
         time = currentTime;
-        rep.status = RRSetConfigFailed;
+        status = RRSetConfigFailed;
         goto sendReply;
     }
 
@@ -1161,17 +1162,17 @@ ProcRRSetCrtcConfig(ClientPtr client)
 
     if (!RRCrtcSet(crtc, mode, stuff->x, stuff->y,
                    rotation, numOutputs, outputs)) {
-        rep.status = RRSetConfigFailed;
+        status = RRSetConfigFailed;
         goto sendReply;
     }
-    rep.status = RRSetConfigSuccess;
+    status = RRSetConfigSuccess;
     pScrPriv->lastSetTime = time;
 
  sendReply:
     free(outputs);
 
     rep.type = X_Reply;
-    /* rep.status has already been filled in */
+    rep.status = status;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
     rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
@@ -1266,6 +1267,7 @@ ProcRRSetPanning(ClientPtr client)
     BoxRec total;
     BoxRec tracking;
     INT16 border[4];
+    CARD8 status;
 
     REQUEST_SIZE_MATCH(xRRSetPanningReq);
     VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
@@ -1278,7 +1280,7 @@ ProcRRSetPanning(ClientPtr client)
 
     if (!pScrPriv) {
         time = currentTime;
-        rep.status = RRSetConfigFailed;
+        status = RRSetConfigFailed;
         goto sendReply;
     }
 
@@ -1305,10 +1307,11 @@ ProcRRSetPanning(ClientPtr client)
 
     pScrPriv->lastSetTime = time;
 
-    rep.status = RRSetConfigSuccess;
+    status = RRSetConfigSuccess;
 
  sendReply:
     rep.type = X_Reply;
+    rep.status = status;
     rep.sequenceNumber = client->sequence;
     rep.length = 0;
     rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index ec07bb1..236794a 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -882,6 +882,7 @@ ProcRRSetScreenConfig(ClientPtr client)
     Rotation rotation;
     int rate;
     Bool has_rate;
+    CARD8 status;
     RROutputPtr output;
     RRCrtcPtr crtc;
     RRModePtr mode;
@@ -912,7 +913,7 @@ ProcRRSetScreenConfig(ClientPtr client)
 
     if (!pScrPriv) {
         time = currentTime;
-        rep.status = RRSetConfigFailed;
+        status = RRSetConfigFailed;
         goto sendReply;
     }
     if (!RRGetInfo(pScreen, FALSE))
@@ -921,7 +922,7 @@ ProcRRSetScreenConfig(ClientPtr client)
     output = RRFirstOutput(pScreen);
     if (!output) {
         time = currentTime;
-        rep.status = RRSetConfigFailed;
+        status = RRSetConfigFailed;
         goto sendReply;
     }
 
@@ -937,7 +938,7 @@ ProcRRSetScreenConfig(ClientPtr client)
      * stop working after several hours have passed (freedesktop bug #6502).
      */
     if (stuff->configTimestamp != pScrPriv->lastConfigTime.milliseconds) {
-        rep.status = RRSetConfigInvalidConfigTime;
+        status = RRSetConfigInvalidConfigTime;
         goto sendReply;
     }
 
@@ -1016,7 +1017,7 @@ ProcRRSetScreenConfig(ClientPtr client)
      * the last set-time
      */
     if (CompareTimeStamps(time, pScrPriv->lastSetTime) < 0) {
-        rep.status = RRSetConfigInvalidTime;
+        status = RRSetConfigInvalidTime;
         goto sendReply;
     }
 
@@ -1048,24 +1049,24 @@ ProcRRSetScreenConfig(ClientPtr client)
         for (c = 0; c < pScrPriv->numCrtcs; c++) {
             if (!RRCrtcSet(pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0,
                            0, NULL)) {
-                rep.status = RRSetConfigFailed;
+                status = RRSetConfigFailed;
                 /* XXX recover from failure */
                 goto sendReply;
             }
         }
         if (!RRScreenSizeSet(pScreen, width, height,
                              pScreen->mmWidth, pScreen->mmHeight)) {
-            rep.status = RRSetConfigFailed;
+            status = RRSetConfigFailed;
             /* XXX recover from failure */
             goto sendReply;
         }
     }
 
     if (!RRCrtcSet(crtc, mode, 0, 0, stuff->rotation, 1, &output))
-        rep.status = RRSetConfigFailed;
+        status = RRSetConfigFailed;
     else {
         pScrPriv->lastSetTime = time;
-        rep.status = RRSetConfigSuccess;
+        status = RRSetConfigSuccess;
     }
 
     /*
@@ -1077,7 +1078,7 @@ ProcRRSetScreenConfig(ClientPtr client)
     free(pData);
 
     rep.type = X_Reply;
-    /* rep.status has already been filled in */
+    rep.status = status;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
 
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index 269a63f..da3942f 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -299,16 +299,19 @@ ProcRRXineramaQueryScreens(ClientPtr client)
 {
     xXineramaQueryScreensReply rep;
     ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN];
+    int n = 0;
 
     REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
 
-    if (RRXineramaScreenActive(pScreen))
+    if (RRXineramaScreenActive(pScreen)) {
         RRGetInfo(pScreen, FALSE);
+        n = RRXineramaScreenCount(pScreen);
+    }
 
     rep.type = X_Reply;
     rep.sequenceNumber = client->sequence;
-    rep.number = RRXineramaScreenCount(pScreen);
-    rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
+    rep.number = n;
+    rep.length = bytes_to_int32(n * sz_XineramaScreenInfo);
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -316,7 +319,7 @@ ProcRRXineramaQueryScreens(ClientPtr client)
     }
     WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
 
-    if (rep.number) {
+    if (n) {
         rrScrPriv(pScreen);
         int i;
         int has_primary = 0;
diff --git a/record/record.c b/record/record.c
index a3ee4dd..54a0e68 100644
--- a/record/record.c
+++ b/record/record.c
@@ -2135,6 +2135,7 @@ ProcRecordGetContext(ClientPtr client)
     GetContextRangeInfoPtr pri;
     int i;
     int err;
+    CARD32 nClients, length;
 
     REQUEST_SIZE_MATCH(xRecordGetContextReq);
     VERIFY_CONTEXT(pContext, stuff->context, client);
@@ -2218,12 +2219,12 @@ ProcRecordGetContext(ClientPtr client)
 
     /* calculate number of clients and reply length */
 
-    rep.nClients = 0;
-    rep.length = 0;
+    nClients = 0;
+    length = 0;
     for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
          pRCAP; pRCAP = pRCAP->pNextRCAP, pri++) {
-        rep.nClients += pRCAP->numClients;
-        rep.length += pRCAP->numClients *
+        nClients += pRCAP->numClients;
+        length += pRCAP->numClients *
             (bytes_to_int32(sizeof(xRecordClientInfo)) +
              pri->nRanges * bytes_to_int32(sizeof(xRecordRange)));
     }
@@ -2232,8 +2233,10 @@ ProcRecordGetContext(ClientPtr client)
 
     rep.type = X_Reply;
     rep.sequenceNumber = client->sequence;
+    rep.length = length;
     rep.enabled = pContext->pRecordingClient != NULL;
     rep.elementHeader = pContext->elemHeaders;
+    rep.nClients = nClients;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
commit c2fb1a7b2ab58d70b38ee03ab2fdeb4e7183a356
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    ProcQueryKeymap: rework logic around permission to copy key states
    
    Always initialize to zero, and then if permission is granted, copy
    the current key state maps, instead of always copying and then
    zeroing out if permission was denied.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/dix/devices.c b/dix/devices.c
index c042681..4d1086f 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2388,17 +2388,19 @@ ProcQueryKeymap(ClientPtr client)
     rep.type = X_Reply;
     rep.sequenceNumber = client->sequence;
     rep.length = 2;
+    memset(rep.map, 0, 32);
 
     rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
-    if (rc != Success && rc != BadAccess)
+    /* If rc is Success, we're allowed to copy out the keymap.
+     * If it's BadAccess, we leave it empty & lie to the client.
+     */
+    if (rc == Success) {
+        for (i = 0; i < 32; i++)
+            rep.map[i] = down[i];
+    }
+    else if (rc != BadAccess)
         return rc;
 
-    for (i = 0; i < 32; i++)
-        rep.map[i] = down[i];
-
-    if (rc == BadAccess)
-        memset(rep.map, 0, 32);
-
     WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep);
 
     return Success;
commit dccb0858d71341e1258800b37d1bb78c0115838d
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    Core events: invert check for permission to copy key states
    
    Always initialize to zero, and then if permission is granted, copy
    the current key state maps.   Use memcpy instead of memmove for the
    copy, since we're always copying to a newly allocated event on the
    stack, so guaranteed not to overlap with the device map structure.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/dix/events.c b/dix/events.c
index 7933749..6e4385a 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4512,11 +4512,12 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
     if ((type == EnterNotify) && (mask & KeymapStateMask)) {
         xKeymapEvent ke;
         ClientPtr client = grab ? rClient(grab) : wClient(pWin);
+        int rc;
 
-        if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess))
-            memset((char *) &ke.map[0], 0, 31);
-        else
-            memmove((char *) &ke.map[0], (char *) &keybd->key->down[1], 31);
+        memset((char *) &ke.map[0], 0, 31);
+        rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
+        if (rc == Success)
+            memcpy((char *) &ke.map[0], (char *) &keybd->key->down[1], 31);
 
         ke.type = KeymapNotify;
         if (grab)
@@ -4617,11 +4618,12 @@ CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
         ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) {
         xKeymapEvent ke;
         ClientPtr client = wClient(pWin);
+        int rc;
 
-        if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess))
-            memset((char *) &ke.map[0], 0, 31);
-        else
-            memmove((char *) &ke.map[0], (char *) &dev->key->down[1], 31);
+        memset((char *) &ke.map[0], 0, 31);
+        rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess);
+        if (rc == Success)
+            memcpy((char *) &ke.map[0], (char *) &dev->key->down[1], 31);
 
         ke.type = KeymapNotify;
         DeliverEventsToWindow(dev, pWin, (xEvent *) &ke, 1,
commit db69212df8a0bf09140368356d2d430c54afe346
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    Rework reply initialization in ProcGetProperty & NullPropertyReply
    
    Don't need to pass an empty reply to NullPropertyReply, let it make
    it's own.   Move reply initialization code in remaining replies in
    ProcGetProperty to group with the rest of the fields.   (Prepares
    for coming C99 designated initializer conversion.)
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/dix/property.c b/dix/property.c
index b1b8312..5ef97ee 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -413,15 +413,18 @@ DeleteAllWindowProperties(WindowPtr pWin)
 }
 
 static int
-NullPropertyReply(ClientPtr client,
-                  ATOM propertyType, int format, xGetPropertyReply * reply)
+NullPropertyReply(ClientPtr client, ATOM propertyType, int format)
 {
-    reply->nItems = 0;
-    reply->length = 0;
-    reply->bytesAfter = 0;
-    reply->propertyType = propertyType;
-    reply->format = format;
-    WriteReplyToClient(client, sizeof(xGenericReply), reply);
+    xGetPropertyReply reply;
+    memset(&reply, 0, sizeof(xGetPropertyReply));
+    reply.type = X_Reply;
+    reply.sequenceNumber = client->sequence;
+    reply.nItems = 0;
+    reply.length = 0;
+    reply.bytesAfter = 0;
+    reply.propertyType = propertyType;
+    reply.format = format;
+    WriteReplyToClient(client, sizeof(xGenericReply), &reply);
     return Success;
 }
 
@@ -470,13 +473,9 @@ ProcGetProperty(ClientPtr client)
         return BadAtom;
     }
 
-    memset(&reply, 0, sizeof(xGetPropertyReply));
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-
     rc = dixLookupProperty(&pProp, pWin, stuff->property, client, prop_mode);
     if (rc == BadMatch)
-        return NullPropertyReply(client, None, 0, &reply);
+        return NullPropertyReply(client, None, 0);
     else if (rc != Success)
         return rc;
 
@@ -485,6 +484,9 @@ ProcGetProperty(ClientPtr client)
 
     if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType))
         ) {
+        memset(&reply, 0, sizeof(xGetPropertyReply));
+        reply.type = X_Reply;
+        reply.sequenceNumber = client->sequence;
         reply.bytesAfter = pProp->size;
         reply.format = pProp->format;
         reply.length = 0;
@@ -510,6 +512,9 @@ ProcGetProperty(ClientPtr client)
 
     len = min(n - ind, 4 * stuff->longLength);
 
+    memset(&reply, 0, sizeof(xGetPropertyReply));
+    reply.type = X_Reply;
+    reply.sequenceNumber = client->sequence;
     reply.bytesAfter = n - (ind + len);
     reply.format = pProp->format;
     reply.length = bytes_to_int32(len);
commit 6be74a9080e30fc502421cd438cd0c73fb8eb0b0
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    Fix more poorly indented/wrapped comments & code
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/Xext/shm.c b/Xext/shm.c
index 1cdb401..aa3feae 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -630,7 +630,7 @@ ProcShmGetImage(ClientPtr client)
         return rc;
     VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
     if (pDraw->type == DRAWABLE_WINDOW) {
-        if (                    /* check for being viewable */
+        if (   /* check for being viewable */
                !((WindowPtr) pDraw)->realized ||
                /* check for being on screen */
                pDraw->x + stuff->x < 0 ||
diff --git a/Xext/sync.c b/Xext/sync.c
index 532bbf9..6dc4c5e 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -444,7 +444,8 @@ SyncSendAlarmNotifyEvents(SyncAlarm * pAlarm)
         ane.counter_value_hi = XSyncValueHigh32(pCounter->value);
         ane.counter_value_lo = XSyncValueLow32(pCounter->value);
     }
-    else {                      /* XXX what else can we do if there's no counter? */
+    else {
+        /* XXX what else can we do if there's no counter? */
         ane.counter_value_hi = ane.counter_value_lo = 0;
     }
 
@@ -1779,10 +1780,10 @@ ProcSyncQueryAlarm(ClientPtr client)
     pTrigger = &pAlarm->trigger;
     rep.counter = (pTrigger->pSync) ? pTrigger->pSync->id : None;
 
-#if 0                           /* XXX unclear what to do, depends on whether relative value-types
-                                 * are "consumed" immediately and are considered absolute from then
-                                 * on.
-                                 */
+#if 0  /* XXX unclear what to do, depends on whether relative value-types
+        * are "consumed" immediately and are considered absolute from then
+        * on.
+        */
     rep.value_type = pTrigger->value_type;
     rep.wait_value_hi = XSyncValueHigh32(pTrigger->wait_value);
     rep.wait_value_lo = XSyncValueLow32(pTrigger->wait_value);
diff --git a/Xi/exevents.c b/Xi/exevents.c
index e99bf6c..9f6ec84 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1266,7 +1266,7 @@ ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
         else
             ti->listeners[0].state = LISTENER_HAS_ACCEPTED;
     }
-    else {                      /* this is the very first ownership event for a grab */
+    else {  /* this is the very first ownership event for a grab */
         DeliverTouchEvents(dev, ti, (InternalEvent *) ev, ev->resource);
     }
 }
@@ -2312,12 +2312,11 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
 
     check = (mask & exclusivemasks);
     if (wOtherInputMasks(pWin)) {
-        if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) {      /* It is illegal for two different
-                                                                         * clients to select on any of the
-                                                                         * events for maskcheck. However,
-                                                                         * it is OK, for some client to
-                                                                         * continue selecting on one of those
-                                                                         * events.  */
+        if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) {
+            /* It is illegal for two different clients to select on any of
+             * the events for maskcheck. However, it is OK, for some client
+             * to continue selecting on one of those events.
+             */
             for (others = wOtherInputMasks(pWin)->inputClients; others;
                  others = others->next) {
                 if (!SameClient(others, client) && (check &
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 94f46f7..bcea410 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -438,8 +438,9 @@ SProcIDispatch(ClientPtr client)
 
 static void
 SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
-                                        /* All we look at is the type field */
-{                               /* This is common to all replies    */
+{
+    /* All we look at is the type field */
+    /* This is common to all replies    */
     if (rep->RepType == X_GetExtensionVersion)
         SRepXGetExtensionVersion(client, len,
                                  (xGetExtensionVersionReply *) rep);
diff --git a/composite/compwindow.c b/composite/compwindow.c
index d0bcd18..0be7a1b 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -208,7 +208,8 @@ updateOverlayWindow(ScreenPtr pScreen)
         return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
     }
 
-    /* Let's be on the safe side and not assume an overlay window is always allocated. */
+    /* Let's be on the safe side and not assume an overlay window is
+       always allocated. */
     return Success;
 }
 
@@ -678,7 +679,8 @@ compWindowUpdateAutomatic(WindowPtr pWin)
     /*
      * And paint
      */
-    CompositePicture(PictOpSrc, pSrcPicture, 0, pDstPicture, 0, 0,      /* src_x, src_y */
+    CompositePicture(PictOpSrc, pSrcPicture, 0, pDstPicture,
+                     0, 0,      /* src_x, src_y */
                      0, 0,      /* msk_x, msk_y */
                      pSrcPixmap->screen_x - pParent->drawable.x,
                      pSrcPixmap->screen_y - pParent->drawable.y,
diff --git a/config/udev.c b/config/udev.c
index 5297b90..03aca28 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -331,9 +331,11 @@ config_udev_pre_init(void)
 
     udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input",
                                                     NULL);
-    udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); /* For Wacom serial devices */
+    /* For Wacom serial devices */
+    udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL);
 #ifdef CONFIG_UDEV_KMS
-    udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "drm", NULL); /* For output GPU devices */
+    /* For output GPU devices */
+    udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "drm", NULL);
 #endif
 
 #ifdef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG
diff --git a/dix/colormap.c b/dix/colormap.c
index 1030628..36526b8 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -576,7 +576,7 @@ CopyFree(int channel, int client, ColormapPtr pmapSrc, ColormapPtr pmapDst)
     int nalloc;
 
     switch (channel) {
-    default:                   /* so compiler can see that everything gets initialized */
+    default:         /* so compiler can see that everything gets initialized */
     case REDMAP:
         ppix = (pmapSrc->clientPixelsRed)[client];
         npix = (pmapSrc->numPixelsRed)[client];
@@ -653,7 +653,7 @@ FreeCell(ColormapPtr pmap, Pixel i, int channel)
     int *pCount;
 
     switch (channel) {
-    default:                   /* so compiler can see that everything gets initialized */
+    default:         /* so compiler can see that everything gets initialized */
     case PSEUDOMAP:
     case REDMAP:
         pent = (EntryPtr) & pmap->red[i];
@@ -2146,7 +2146,7 @@ FreeCo(ColormapPtr pmap, int client, int color, int npixIn, Pixel * ppixIn,
         ppixClient = pmap->clientPixelsBlue[client];
         npixClient = pmap->numPixelsBlue[client];
         break;
-    default:                   /* so compiler can see that everything gets initialized */
+    default:        /* so compiler can see that everything gets initialized */
     case PSEUDOMAP:
         cmask = ~((Pixel) 0);
         rgbbad = 0;
diff --git a/dix/enterleave.c b/dix/enterleave.c
index 761ab3b..00083e9 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -1246,7 +1246,8 @@ HasOtherPointer(WindowPtr win, DeviceIntPtr exclude)
  * Assumption: Neither A nor B are valid windows.
  */
 static void
-CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, WindowPtr A,   /* PointerRootWin or NoneWin */
+CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
+                               WindowPtr A,     /* PointerRootWin or NoneWin */
                                WindowPtr B,     /* NoneWin or PointerRootWin */
                                int mode)
 {
@@ -1290,7 +1291,8 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, WindowPtr A,   /* PointerRootWi
  * Assumption: A is a valid window and not PointerRoot or None.
  */
 static void
-CoreFocusToPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, WindowPtr B,        /* PointerRootWin or NoneWin */
+CoreFocusToPointerRootOrNone(DeviceIntPtr dev, WindowPtr A,
+                             WindowPtr B,        /* PointerRootWin or NoneWin */
                              int mode)
 {
     WindowPtr root;
@@ -1336,7 +1338,8 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, WindowPtr B,
  * Assumption: B is a valid window and not PointerRoot or None.
  */
 static void
-CoreFocusFromPointerRootOrNone(DeviceIntPtr dev, WindowPtr A,   /* PointerRootWin or NoneWin */
+CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
+                               WindowPtr A,   /* PointerRootWin or NoneWin */
                                WindowPtr B, int mode)
 {
     WindowPtr root;
diff --git a/dix/events.c b/dix/events.c
index dbfe9d9..7933749 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -698,9 +698,10 @@ ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py)
 }
 
 static void
-CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents, Bool confineToScreen, /* unused if PanoramiX on */
-                ScreenPtr pScreen)
-{                               /* unused if PanoramiX on */
+CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents,
+                Bool confineToScreen, /* unused if PanoramiX on */
+                ScreenPtr pScreen)    /* unused if PanoramiX on */
+{
     HotSpot new;
     SpritePtr pSprite = pDev->spriteInfo->sprite;
 
diff --git a/dix/grabs.c b/dix/grabs.c
index 2f05f57..55bf64f 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -205,7 +205,10 @@ AllocGrab(void)
 }
 
 GrabPtr
-CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice, WindowPtr window, enum InputLevel grabtype, GrabMask *mask, GrabParameters *param, int type, KeyCode keybut,        /* key or button */
+CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice,
+           WindowPtr window, enum InputLevel grabtype, GrabMask *mask,
+           GrabParameters *param, int type,
+           KeyCode keybut,        /* key or button */
            WindowPtr confineTo, CursorPtr cursor)
 {
     GrabPtr grab;
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index bd23dc2..bac5f11 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -262,8 +262,10 @@ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
         ev.kind = kind;
         ev.forced = forced;
         WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
-}} static void
+    }
+}
 
+static void
 SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from,
                         xXF86VidModeNotifyEvent * to)
 {
commit 789d64e19a3b3d98b88bc80f677e0c37bfb5c631
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sun May 13 00:03:35 2012 -0700

    Remove unneccesary casts from WriteToClient calls
    
    Casting return to (void) was used to tell lint that you intended
    to ignore the return value, so it didn't warn you about it.
    
    Casting the third argument to (char *) was used as the most generic
    pointer type in the days before compilers supported C89 (void *)
    (except for a couple places it's used for byte-sized pointer math).
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/Xext/bigreq.c b/Xext/bigreq.c
index 49355c4..9bb1c86 100644
--- a/Xext/bigreq.c
+++ b/Xext/bigreq.c
@@ -64,7 +64,7 @@ ProcBigReqDispatch(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swapl(&rep.max_request_size);
     }
-    WriteToClient(client, sizeof(xBigReqEnableReply), (char *) &rep);
+    WriteToClient(client, sizeof(xBigReqEnableReply), &rep);
     return Success;
 }
 
diff --git a/Xext/dpms.c b/Xext/dpms.c
index 348c872..35be966 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -59,7 +59,7 @@ ProcDPMSGetVersion(ClientPtr client)
         swaps(&rep.majorVersion);
         swaps(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep);
     return Success;
 }
 
@@ -79,7 +79,7 @@ ProcDPMSCapable(ClientPtr client)
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
     }
-    WriteToClient(client, sizeof(xDPMSCapableReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDPMSCapableReply), &rep);
     return Success;
 }
 
@@ -104,7 +104,7 @@ ProcDPMSGetTimeouts(ClientPtr client)
         swaps(&rep.suspend);
         swaps(&rep.off);
     }
-    WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep);
     return Success;
 }
 
@@ -202,7 +202,7 @@ ProcDPMSInfo(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swaps(&rep.power_level);
     }
-    WriteToClient(client, sizeof(xDPMSInfoReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDPMSInfoReply), &rep);
     return Success;
 }
 
diff --git a/Xext/geext.c b/Xext/geext.c
index 0702823..7bdd873 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -85,7 +85,7 @@ ProcGEQueryVersion(ClientPtr client)
         swaps(&rep.minorVersion);
     }
 
-    WriteToClient(client, sizeof(xGEQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xGEQueryVersionReply), &rep);
     return Success;
 }
 
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index de62a35..98c612a 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -918,7 +918,7 @@ ProcPanoramiXQueryVersion(ClientPtr client)
         swaps(&rep.majorVersion);
         swaps(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep);
     return Success;
 }
 
@@ -945,7 +945,7 @@ ProcPanoramiXGetState(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.window);
     }
-    WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *) &rep);
+    WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep);
     return Success;
 
 }
@@ -973,7 +973,7 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.window);
     }
-    WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *) &rep);
+    WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), &rep);
     return Success;
 }
 
@@ -1009,7 +1009,7 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
         swapl(&rep.window);
         swapl(&rep.screen);
     }
-    WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *) &rep);
+    WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep);
     return Success;
 }
 
@@ -1038,7 +1038,7 @@ ProcXineramaIsActive(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.state);
     }
-    WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXineramaIsActiveReply), &rep);
     return Success;
 }
 
@@ -1059,7 +1059,7 @@ ProcXineramaQueryScreens(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.number);
     }
-    WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
 
     if (!noPanoramiXExtension) {
         xXineramaScreenInfo scratch;
@@ -1077,7 +1077,7 @@ ProcXineramaQueryScreens(ClientPtr client)
                 swaps(&scratch.width);
                 swaps(&scratch.height);
             }
-            WriteToClient(client, sz_XineramaScreenInfo, (char *) &scratch);
+            WriteToClient(client, sz_XineramaScreenInfo, &scratch);
         }
     }
 
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 12d6163..bdabfbf 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -2003,7 +2003,7 @@ PanoramiXGetImage(ClientPtr client)
                                  format, planemask, pBuf, widthBytesLine,
                                  isRoot);
 
-            (void) WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
+            WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
             linesDone += nlines;
         }
     }
@@ -2020,8 +2020,7 @@ PanoramiXGetImage(ClientPtr client)
                                          nlines, format, plane, pBuf,
                                          widthBytesLine, isRoot);
 
-                    (void) WriteToClient(client,
-                                         (int) (nlines * widthBytesLine), pBuf);
+                    WriteToClient(client, (int)(nlines * widthBytesLine), pBuf);
 
                     linesDone += nlines;
                 }
diff --git a/Xext/saver.c b/Xext/saver.c
index 61fc044..60c02ff 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -646,7 +646,7 @@ ProcScreenSaverQueryVersion(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
     }
-    WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), &rep);
     return Success;
 }
 
@@ -717,7 +717,7 @@ ProcScreenSaverQueryInfo(ClientPtr client)
         swapl(&rep.idle);
         swapl(&rep.eventMask);
     }
-    WriteToClient(client, sizeof(xScreenSaverQueryInfoReply), (char *) &rep);
+    WriteToClient(client, sizeof(xScreenSaverQueryInfoReply), &rep);
     return Success;
 }
 
diff --git a/Xext/security.c b/Xext/security.c
index 3699510..fd63571 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -351,8 +351,7 @@ ProcSecurityQueryVersion(ClientPtr client)
         swaps(&rep.majorVersion);
         swaps(&rep.minorVersion);
     }
-    (void) WriteToClient(client, SIZEOF(xSecurityQueryVersionReply),
-                         (char *) &rep);
+    WriteToClient(client, SIZEOF(xSecurityQueryVersionReply), &rep);
     return Success;
 }                               /* ProcSecurityQueryVersion */
 
@@ -541,8 +540,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
         swaps(&rep.dataLength);
     }
 
-    WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply),
-                  (char *) &rep);
+    WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply), &rep);
     WriteToClient(client, authdata_len, pAuthdata);
 
     SecurityAudit
diff --git a/Xext/shape.c b/Xext/shape.c
index cc5214a..7724e7b 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -219,7 +219,7 @@ ProcShapeQueryVersion(ClientPtr client)
         swaps(&rep.majorVersion);
         swaps(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xShapeQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xShapeQueryVersionReply), &rep);
     return Success;
 }
 
@@ -679,7 +679,7 @@ ProcShapeQueryExtents(ClientPtr client)
         swaps(&rep.widthClipShape);
         swaps(&rep.heightClipShape);
     }
-    WriteToClient(client, sizeof(xShapeQueryExtentsReply), (char *) &rep);
+    WriteToClient(client, sizeof(xShapeQueryExtentsReply), &rep);
     return Success;
 }
 
@@ -928,7 +928,7 @@ ProcShapeInputSelected(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
     }
-    WriteToClient(client, sizeof(xShapeInputSelectedReply), (char *) &rep);
+    WriteToClient(client, sizeof(xShapeInputSelectedReply), &rep);
     return Success;
 }
 
@@ -1012,8 +1012,8 @@ ProcShapeGetRectangles(ClientPtr client)
         swapl(&rep.nrects);
         SwapShorts((short *) rects, (unsigned long) nrects * 4);
     }
-    WriteToClient(client, sizeof(rep), (char *) &rep);
-    WriteToClient(client, nrects * sizeof(xRectangle), (char *) rects);
+    WriteToClient(client, sizeof(rep), &rep);
+    WriteToClient(client, nrects * sizeof(xRectangle), rects);
     free(rects);
     return Success;
 }
diff --git a/Xext/shm.c b/Xext/shm.c
index e9c4a4e..1cdb401 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -306,7 +306,7 @@ ProcShmQueryVersion(ClientPtr client)
         swaps(&rep.uid);
         swaps(&rep.gid);
     }
-    WriteToClient(client, sizeof(xShmQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xShmQueryVersionReply), &rep);
     return Success;
 }
 
@@ -702,7 +702,7 @@ ProcShmGetImage(ClientPtr client)
         swapl(&xgi.visual);
         swapl(&xgi.size);
     }
-    WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi);
+    WriteToClient(client, sizeof(xShmGetImageReply), &xgi);
 
     return Success;
 }
@@ -877,7 +877,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
         swapl(&xgi.visual);
         swapl(&xgi.size);
     }
-    WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi);
+    WriteToClient(client, sizeof(xShmGetImageReply), &xgi);
 
     return Success;
 }
diff --git a/Xext/sync.c b/Xext/sync.c
index 91968e4..532bbf9 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -1198,7 +1198,7 @@ ProcSyncInitialize(ClientPtr client)
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
     }
-    WriteToClient(client, sizeof(rep), (char *) &rep);
+    WriteToClient(client, sizeof(rep), &rep);
     return Success;
 }
 
@@ -1263,9 +1263,9 @@ ProcSyncListSystemCounters(ClientPtr client)
                                                         namelen));
     }
 
-    WriteToClient(client, sizeof(rep), (char *) &rep);
+    WriteToClient(client, sizeof(rep), &rep);
     if (len) {
-        WriteToClient(client, len, (char *) list);
+        WriteToClient(client, len, list);
         free(list);
     }
 
@@ -1338,7 +1338,7 @@ ProcSyncGetPriority(ClientPtr client)
         swapl(&rep.priority);
     }
 
-    WriteToClient(client, sizeof(xSyncGetPriorityReply), (char *) &rep);
+    WriteToClient(client, sizeof(xSyncGetPriorityReply), &rep);
 
     return Success;
 }
@@ -1624,7 +1624,7 @@ ProcSyncQueryCounter(ClientPtr client)
         swapl(&rep.value_hi);
         swapl(&rep.value_lo);
     }
-    WriteToClient(client, sizeof(xSyncQueryCounterReply), (char *) &rep);
+    WriteToClient(client, sizeof(xSyncQueryCounterReply), &rep);
     return Success;
 }
 
@@ -1809,7 +1809,7 @@ ProcSyncQueryAlarm(ClientPtr client)
         swapl(&rep.delta_lo);
     }
 
-    WriteToClient(client, sizeof(xSyncQueryAlarmReply), (char *) &rep);
+    WriteToClient(client, sizeof(xSyncQueryAlarmReply), &rep);
     return Success;
 }
 
@@ -1966,7 +1966,7 @@ ProcSyncQueryFence(ClientPtr client)
         swapl(&rep.length);
     }
 
-    WriteToClient(client, sizeof(xSyncQueryFenceReply), (char *) &rep);
+    WriteToClient(client, sizeof(xSyncQueryFenceReply), &rep);
     return client->noClientException;
 }
 
diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c
index 99a6ece..943b424 100644
--- a/Xext/xcmisc.c
+++ b/Xext/xcmisc.c
@@ -58,7 +58,7 @@ ProcXCMiscGetVersion(ClientPtr client)
         swaps(&rep.majorVersion);
         swaps(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep);
     return Success;
 }
 
@@ -80,7 +80,7 @@ ProcXCMiscGetXIDRange(ClientPtr client)
         swapl(&rep.start_id);
         swapl(&rep.count);
     }
-    WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep);
     return Success;
 }
 
@@ -111,7 +111,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.count);
     }
-    WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep);
     if (count) {
         client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
         WriteSwappedDataToClient(client, count * sizeof(XID), pids);
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index 9de7856..3a1e1b2 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -307,8 +307,7 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
         swapl(&reply.gid);
         swapl(&reply.signature);
     }
-    WriteToClient(client,
-                  sizeof(xXF86BigfontQueryVersionReply), (char *) &reply);
+    WriteToClient(client, sizeof(xXF86BigfontQueryVersionReply), &reply);
     return Success;
 }
 
@@ -644,7 +643,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
                 }
             }
         }
-        WriteToClient(client, rlength, (char *) reply);
+        WriteToClient(client, rlength, reply);
         free(reply);
         if (nCharInfos > 0) {
             if (shmid == -1)
diff --git a/Xext/xres.c b/Xext/xres.c
index dbefeeb..d207dce 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -209,7 +209,7 @@ ProcXResQueryVersion(ClientPtr client)
         swaps(&rep.server_major);
         swaps(&rep.server_minor);
     }
-    WriteToClient(client, sizeof(xXResQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXResQueryVersionReply), &rep);
     return Success;
 }
 
@@ -242,7 +242,7 @@ ProcXResQueryClients(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.num_clients);
     }
-    WriteToClient(client, sizeof(xXResQueryClientsReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXResQueryClientsReply), &rep);
 
     if (num_clients) {
         xXResClient scratch;
@@ -255,7 +255,7 @@ ProcXResQueryClients(ClientPtr client)
                 swapl(&scratch.resource_base);
                 swapl(&scratch.resource_mask);
             }
-            WriteToClient(client, sz_xXResClient, (char *) &scratch);
+            WriteToClient(client, sz_xXResClient, &scratch);
         }
     }
 
@@ -310,8 +310,7 @@ ProcXResQueryClientResources(ClientPtr client)
         swapl(&rep.num_types);
     }
 
-    WriteToClient(client, sizeof(xXResQueryClientResourcesReply),
-                  (char *) &rep);
+    WriteToClient(client, sizeof(xXResQueryClientResourcesReply), &rep);
 
     if (num_types) {
         xXResType scratch;
@@ -337,7 +336,7 @@ ProcXResQueryClientResources(ClientPtr client)
                 swapl(&scratch.resource_type);
                 swapl(&scratch.count);
             }
-            WriteToClient(client, sz_xXResType, (char *) &scratch);
+            WriteToClient(client, sz_xXResType, &scratch);
         }
     }
 
@@ -486,8 +485,7 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
         swapl(&rep.bytes);
         swapl(&rep.bytes_overflow);
     }
-    WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply),
-                  (char *) &rep);
+    WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply), &rep);
 
     return Success;
 }
@@ -679,7 +677,7 @@ ProcXResQueryClientIds (ClientPtr client)
             swapl (&rep.numIds);
         }
 
-        WriteToClient(client,sizeof(rep),(char*)&rep);
+        WriteToClient(client, sizeof(rep), &rep);
         WriteFragmentsToClient(client, &ctx.response);
     }
 
@@ -1061,7 +1059,7 @@ ProcXResQueryResourceBytes (ClientPtr client)
             SwapXResQueryResourceBytes(&ctx.response);
         }
 
-        WriteToClient(client,sizeof(rep),(char*)&rep);
+        WriteToClient(client, sizeof(rep), &rep);
         WriteFragmentsToClient(client, &ctx.response);
     }
 
diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index 342abb1..8817591 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -76,7 +76,7 @@ ProcSELinuxQueryVersion(ClientPtr client)
         swaps(&rep.server_major);
         swaps(&rep.server_minor);
     }
-    WriteToClient(client, sizeof(rep), (char *) &rep);
+    WriteToClient(client, sizeof(rep), &rep);
     return Success;
 }
 
@@ -104,7 +104,7 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
         swapl(&rep.context_len);
     }
 
-    WriteToClient(client, sizeof(SELinuxGetContextReply), (char *) &rep);
+    WriteToClient(client, sizeof(SELinuxGetContextReply), &rep);
     WriteToClient(client, len, ctx);
     freecon(ctx);
     return Success;
@@ -383,8 +383,8 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
         swapl(&rep.count);
     }
 
-    WriteToClient(client, sizeof(SELinuxListItemsReply), (char *) &rep);
-    WriteToClient(client, size * 4, (char *) buf);
+    WriteToClient(client, sizeof(SELinuxListItemsReply), &rep);
+    WriteToClient(client, size * 4, buf);
 
     /* Free stuff and return */
     rc = Success;
diff --git a/Xext/xtest.c b/Xext/xtest.c
index e659b41..6112c0b 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -100,7 +100,7 @@ ProcXTestGetVersion(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swaps(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xXTestGetVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXTestGetVersionReply), &rep);
     return Success;
 }
 
@@ -141,7 +141,7 @@ ProcXTestCompareCursor(ClientPtr client)
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
     }
-    WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXTestCompareCursorReply), &rep);
     return Success;
 }
 
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index 8abd51c..8730267 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -62,7 +62,7 @@ SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep)
     swaps(&rep->version);
     swaps(&rep->revision);
 
-    (void) WriteToClient(client, sz_xvQueryExtensionReply, (char *) rep);
+    WriteToClient(client, sz_xvQueryExtensionReply, rep);
 
     return Success;
 }
@@ -74,7 +74,7 @@ SWriteQueryAdaptorsReply(ClientPtr client, xvQueryAdaptorsReply * rep)
     swapl(&rep->length);
     swaps(&rep->num_adaptors);
 
-    (void) WriteToClient(client, sz_xvQueryAdaptorsReply, (char *) rep);
+    WriteToClient(client, sz_xvQueryAdaptorsReply, rep);
 
     return Success;
 }
@@ -86,7 +86,7 @@ SWriteQueryEncodingsReply(ClientPtr client, xvQueryEncodingsReply * rep)
     swapl(&rep->length);
     swaps(&rep->num_encodings);
 
-    (void) WriteToClient(client, sz_xvQueryEncodingsReply, (char *) rep);
+    WriteToClient(client, sz_xvQueryEncodingsReply, rep);
 
     return Success;
 }
@@ -99,7 +99,7 @@ SWriteAdaptorInfo(ClientPtr client, xvAdaptorInfo * pAdaptor)
     swaps(&pAdaptor->num_ports);
     swaps(&pAdaptor->num_formats);
 
-    (void) WriteToClient(client, sz_xvAdaptorInfo, (char *) pAdaptor);
+    WriteToClient(client, sz_xvAdaptorInfo, pAdaptor);
 
     return Success;
 }
@@ -114,7 +114,7 @@ SWriteEncodingInfo(ClientPtr client, xvEncodingInfo * pEncoding)
     swaps(&pEncoding->height);
     swapl(&pEncoding->rate.numerator);
     swapl(&pEncoding->rate.denominator);
-    (void) WriteToClient(client, sz_xvEncodingInfo, (char *) pEncoding);
+    WriteToClient(client, sz_xvEncodingInfo, pEncoding);
 
     return Success;
 }
@@ -123,7 +123,7 @@ static int
 SWriteFormat(ClientPtr client, xvFormat * pFormat)
 {
     swapl(&pFormat->visual);
-    (void) WriteToClient(client, sz_xvFormat, (char *) pFormat);
+    WriteToClient(client, sz_xvFormat, pFormat);
 
     return Success;
 }
@@ -135,7 +135,7 @@ SWriteAttributeInfo(ClientPtr client, xvAttributeInfo * pAtt)
     swapl(&pAtt->size);
     swapl(&pAtt->min);
     swapl(&pAtt->max);
-    (void) WriteToClient(client, sz_xvAttributeInfo, (char *) pAtt);
+    WriteToClient(client, sz_xvAttributeInfo, pAtt);
 
     return Success;
 }
@@ -157,7 +157,7 @@ SWriteImageFormatInfo(ClientPtr client, xvImageFormatInfo * pImage)
     swapl(&pImage->vert_u_period);
     swapl(&pImage->vert_v_period);
 
-    (void) WriteToClient(client, sz_xvImageFormatInfo, (char *) pImage);
+    WriteToClient(client, sz_xvImageFormatInfo, pImage);
 
     return Success;
 }
@@ -168,7 +168,7 @@ SWriteGrabPortReply(ClientPtr client, xvGrabPortReply * rep)
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
 
-    (void) WriteToClient(client, sz_xvGrabPortReply, (char *) rep);
+    WriteToClient(client, sz_xvGrabPortReply, rep);
 
     return Success;
 }
@@ -180,7 +180,7 @@ SWriteGetPortAttributeReply(ClientPtr client, xvGetPortAttributeReply * rep)
     swapl(&rep->length);
     swapl(&rep->value);
 
-    (void) WriteToClient(client, sz_xvGetPortAttributeReply, (char *) rep);
+    WriteToClient(client, sz_xvGetPortAttributeReply, rep);
 
     return Success;
 }
@@ -193,7 +193,7 @@ SWriteQueryBestSizeReply(ClientPtr client, xvQueryBestSizeReply * rep)
     swaps(&rep->actual_width);
     swaps(&rep->actual_height);
 
-    (void) WriteToClient(client, sz_xvQueryBestSizeReply, (char *) rep);
+    WriteToClient(client, sz_xvQueryBestSizeReply, rep);
 
     return Success;
 }
@@ -207,7 +207,7 @@ SWriteQueryPortAttributesReply(ClientPtr client,
     swapl(&rep->num_attributes);
     swapl(&rep->text_size);
 
-    (void) WriteToClient(client, sz_xvQueryPortAttributesReply, (char *) rep);
+    WriteToClient(client, sz_xvQueryPortAttributesReply, rep);
 
     return Success;
 }
@@ -223,7 +223,7 @@ SWriteQueryImageAttributesReply(ClientPtr client,
     swaps(&rep->width);
     swaps(&rep->height);
 
-    (void) WriteToClient(client, sz_xvQueryImageAttributesReply, (char *) rep);
+    WriteToClient(client, sz_xvQueryImageAttributesReply, rep);
 
     return Success;
 }
@@ -235,66 +235,66 @@ SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
     swapl(&rep->length);
     swapl(&rep->num_formats);
 
-    (void) WriteToClient(client, sz_xvListImageFormatsReply, (char *) rep);
+    WriteToClient(client, sz_xvListImageFormatsReply, rep);
 
     return Success;
 }
 
 #define _WriteQueryAdaptorsReply(_c,_d) \
   if ((_c)->swapped) SWriteQueryAdaptorsReply(_c, _d); \
-  else WriteToClient(_c, sz_xvQueryAdaptorsReply, (char*)_d)
+  else WriteToClient(_c, sz_xvQueryAdaptorsReply, _d)
 
 #define _WriteQueryExtensionReply(_c,_d) \
   if ((_c)->swapped) SWriteQueryExtensionReply(_c, _d); \
-  else WriteToClient(_c, sz_xvQueryExtensionReply, (char*)_d)
+  else WriteToClient(_c, sz_xvQueryExtensionReply, _d)
 
 #define _WriteQueryEncodingsReply(_c,_d) \
   if ((_c)->swapped) SWriteQueryEncodingsReply(_c, _d); \
-  else WriteToClient(_c, sz_xvQueryEncodingsReply, (char*)_d)
+  else WriteToClient(_c, sz_xvQueryEncodingsReply, _d)
 
 #define _WriteAdaptorInfo(_c,_d) \
   if ((_c)->swapped) SWriteAdaptorInfo(_c, _d); \
-  else WriteToClient(_c, sz_xvAdaptorInfo, (char*)_d)
+  else WriteToClient(_c, sz_xvAdaptorInfo, _d)
 
 #define _WriteAttributeInfo(_c,_d) \
   if ((_c)->swapped) SWriteAttributeInfo(_c, _d); \
-  else WriteToClient(_c, sz_xvAttributeInfo, (char*)_d)
+  else WriteToClient(_c, sz_xvAttributeInfo, _d)
 
 #define _WriteEncodingInfo(_c,_d) \
   if ((_c)->swapped) SWriteEncodingInfo(_c, _d); \
-  else WriteToClient(_c, sz_xvEncodingInfo, (char*)_d)
+  else WriteToClient(_c, sz_xvEncodingInfo, _d)
 
 #define _WriteFormat(_c,_d) \
   if ((_c)->swapped) SWriteFormat(_c, _d); \
-  else WriteToClient(_c, sz_xvFormat, (char*)_d)
+  else WriteToClient(_c, sz_xvFormat, _d)
 
 #define _WriteGrabPortReply(_c,_d) \
   if ((_c)->swapped) SWriteGrabPortReply(_c, _d); \
-  else WriteToClient(_c, sz_xvGrabPortReply, (char*)_d)
+  else WriteToClient(_c, sz_xvGrabPortReply, _d)
 
 #define _WriteGetPortAttributeReply(_c,_d) \
   if ((_c)->swapped) SWriteGetPortAttributeReply(_c, _d); \
-  else WriteToClient(_c, sz_xvGetPortAttributeReply, (char*)_d)
+  else WriteToClient(_c, sz_xvGetPortAttributeReply, _d)
 
 #define _WriteQueryBestSizeReply(_c,_d) \
   if ((_c)->swapped) SWriteQueryBestSizeReply(_c, _d); \
-  else WriteToClient(_c, sz_xvQueryBestSizeReply,(char*) _d)
+  else WriteToClient(_c, sz_xvQueryBestSizeReply, _d)
 
 #define _WriteQueryPortAttributesReply(_c,_d) \
   if ((_c)->swapped) SWriteQueryPortAttributesReply(_c, _d); \
-  else WriteToClient(_c, sz_xvQueryPortAttributesReply,(char*) _d)
+  else WriteToClient(_c, sz_xvQueryPortAttributesReply, _d)
 
 #define _WriteQueryImageAttributesReply(_c,_d) \
   if ((_c)->swapped) SWriteQueryImageAttributesReply(_c, _d); \
-  else WriteToClient(_c, sz_xvQueryImageAttributesReply,(char*) _d)
+  else WriteToClient(_c, sz_xvQueryImageAttributesReply, _d)
 
 #define _WriteListImageFormatsReply(_c,_d) \
   if ((_c)->swapped) SWriteListImageFormatsReply(_c, _d); \
-  else WriteToClient(_c, sz_xvListImageFormatsReply,(char*) _d)
+  else WriteToClient(_c, sz_xvListImageFormatsReply, _d)
 
 #define _WriteImageFormatInfo(_c,_d) \
   if ((_c)->swapped) SWriteImageFormatInfo(_c, _d); \
-  else WriteToClient(_c, sz_xvImageFormatInfo, (char*)_d)
+  else WriteToClient(_c, sz_xvImageFormatInfo, _d)
 
 #define _AllocatePort(_i,_p) \
   ((_p)->id != _i) ? (* (_p)->pAdaptor->ddAllocatePort)(_i,_p,&_p) : Success
@@ -1100,7 +1100,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
     _WriteQueryImageAttributesReply(client, &rep);
     if (client->swapped)
         SwapLongs((CARD32 *) offsets, planeLength);
-    WriteToClient(client, planeLength << 2, (char *) offsets);
+    WriteToClient(client, planeLength << 2, offsets);
 
     free(offsets);
 
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index 4aaff4d..b008bfe 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -118,7 +118,7 @@ ProcXvMCQueryVersion(ClientPtr client)
     rep.length = 0;
     rep.major = SERVER_XVMC_MAJOR_VERSION;
     rep.minor = SERVER_XVMC_MINOR_VERSION;
-    WriteToClient(client, sizeof(xvmcQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xvmcQueryVersionReply), &rep);
     return Success;
 }
 
@@ -156,7 +156,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
     rep.num = (adaptor) ? adaptor->num_surfaces : 0;
     rep.length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo));
 
-    WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), (char *) &rep);
+    WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
 
     for (i = 0; i < rep.num; i++) {
         surface = adaptor->surfaces[i];
@@ -168,7 +168,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
         info.subpicture_max_height = surface->subpicture_max_height;
         info.mc_type = surface->mc_type;
         info.flags = surface->flags;
-        WriteToClient(client, sizeof(xvmcSurfaceInfo), (char *) &info);
+        WriteToClient(client, sizeof(xvmcSurfaceInfo), &info);
     }
 
     return Success;
@@ -254,9 +254,9 @@ ProcXvMCCreateContext(ClientPtr client)
     rep.flags_return = pContext->flags;
     rep.length = dwords;
 
-    WriteToClient(client, sizeof(xvmcCreateContextReply), (char *) &rep);
+    WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
     if (dwords)
-        WriteToClient(client, dwords << 2, (char *) data);
+        WriteToClient(client, dwords << 2, data);
     AddResource(pContext->context_id, XvMCRTContext, pContext);
 
     free(data);
@@ -325,9 +325,9 @@ ProcXvMCCreateSurface(ClientPtr client)
     rep.sequenceNumber = client->sequence;
     rep.length = dwords;
 
-    WriteToClient(client, sizeof(xvmcCreateSurfaceReply), (char *) &rep);
+    WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
     if (dwords)
-        WriteToClient(client, dwords << 2, (char *) data);
+        WriteToClient(client, dwords << 2, data);
     AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
 
     free(data);
@@ -448,9 +448,9 @@ ProcXvMCCreateSubpicture(ClientPtr client)
     rep.component_order[3] = pSubpicture->component_order[3];
     rep.length = dwords;
 
-    WriteToClient(client, sizeof(xvmcCreateSubpictureReply), (char *) &rep);
+    WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
     if (dwords)
-        WriteToClient(client, dwords << 2, (char *) data);
+        WriteToClient(client, dwords << 2, data);
     AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
 
     free(data);
@@ -533,7 +533,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
 
     rep.length = bytes_to_int32(rep.num * sizeof(xvImageFormatInfo));
 
-    WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), (char *) &rep);
+    WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep);
 
     for (i = 0; i < rep.num; i++) {
         pImage = NULL;
@@ -569,7 +569,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
         info.vert_v_period = pImage->vert_v_period;
         memcpy(&info.comp_order, pImage->component_order, 32);
         info.scanline_order = pImage->scanline_order;
-        WriteToClient(client, sizeof(xvImageFormatInfo), (char *) &info);
+        WriteToClient(client, sizeof(xvImageFormatInfo), &info);
     }
 
     return Success;
@@ -634,7 +634,7 @@ ProcXvMCGetDRInfo(ClientPtr client)
     }
 #endif                          /* HAS_XVMCSHM */
 
-    WriteToClient(client, sizeof(xvmcGetDRInfoReply), (char *) &rep);
+    WriteToClient(client, sizeof(xvmcGetDRInfoReply), &rep);
     if (rep.length) {
         WriteToClient(client, rep.nameLen, pScreenPriv->clientDriverName);
         WriteToClient(client, rep.busIDLen, pScreenPriv->busID);
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index ff5d69a..0de5f2b 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -236,5 +236,5 @@ SRepXChangeDeviceControl(ClientPtr client, int size,
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/getbmap.c b/Xi/getbmap.c
index a0ec1a6..2712fcd 100644
--- a/Xi/getbmap.c
+++ b/Xi/getbmap.c
@@ -109,7 +109,7 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
     rep.nElts = b->numButtons;
     rep.length = bytes_to_int32(rep.nElts);
     WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
-    (void) WriteToClient(client, rep.nElts, (char *) &b->map[1]);
+    WriteToClient(client, rep.nElts, &b->map[1]);
     return Success;
 }
 
@@ -126,5 +126,5 @@ SRepXGetDeviceButtonMapping(ClientPtr client, int size,
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 4d66a4d..27775e2 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -158,7 +158,7 @@ SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
 
 /***********************************************************************
diff --git a/Xi/getfctl.c b/Xi/getfctl.c
index 2772c0c..5f97cc3 100644
--- a/Xi/getfctl.c
+++ b/Xi/getfctl.c
@@ -265,7 +265,7 @@ SRepXGetFeedbackControl(ClientPtr client, int size,
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
     swaps(&rep->num_feedbacks);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
 
 /***********************************************************************
diff --git a/Xi/getfocus.c b/Xi/getfocus.c
index ba36e37..54c176f 100644
--- a/Xi/getfocus.c
+++ b/Xi/getfocus.c
@@ -135,5 +135,5 @@ SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep)
     swapl(&rep->length);
     swapl(&rep->focus);
     swapl(&rep->time);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/getkmap.c b/Xi/getkmap.c
index 006be62..3536879 100644
--- a/Xi/getkmap.c
+++ b/Xi/getkmap.c
@@ -150,5 +150,5 @@ SRepXGetDeviceKeyMapping(ClientPtr client, int size,
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/getmmap.c b/Xi/getmmap.c
index 3f84243..97d4c0d 100644
--- a/Xi/getmmap.c
+++ b/Xi/getmmap.c
@@ -109,7 +109,7 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
     rep.length = max_keys_per_mod << 1;
 
     WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
-    WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
+    WriteToClient(client, max_keys_per_mod * 8, modkeymap);
 
     free(modkeymap);
 
@@ -129,5 +129,5 @@ SRepXGetDeviceModifierMapping(ClientPtr client, int size,
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/getprop.c b/Xi/getprop.c
index b7b9e6b..b5af13a 100644
--- a/Xi/getprop.c
+++ b/Xi/getprop.c
@@ -178,5 +178,5 @@ SRepXGetDeviceDontPropagateList(ClientPtr client, int size,
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
     swaps(&rep->count);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/getselev.c b/Xi/getselev.c
index 253c87f..4fcc902 100644
--- a/Xi/getselev.c
+++ b/Xi/getselev.c
@@ -170,5 +170,5 @@ SRepXGetSelectedExtensionEvents(ClientPtr client, int size,
     swapl(&rep->length);
     swaps(&rep->this_client_count);
     swaps(&rep->all_clients_count);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/getvers.c b/Xi/getvers.c
index eb52c5b..b380344 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -127,5 +127,5 @@ SRepXGetExtensionVersion(ClientPtr client, int size,
     swapl(&rep->length);
     swaps(&rep->major_version);
     swaps(&rep->minor_version);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/grabdev.c b/Xi/grabdev.c
index c904a97..bdc0c4b 100644
--- a/Xi/grabdev.c
+++ b/Xi/grabdev.c
@@ -211,5 +211,5 @@ SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep)
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 48bc79a..2249b86 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -147,7 +147,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
                 bufptr++;
             }
         }
-        WriteToClient(client, length * 4, (char *) coords);
+        WriteToClient(client, length * 4, coords);
     }
     free(coords);
     return Success;
@@ -167,5 +167,5 @@ SRepXGetDeviceMotionEvents(ClientPtr client, int size,
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
     swapl(&rep->nEvents);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/listdev.c b/Xi/listdev.c
index a02112f..1fff738 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -417,5 +417,5 @@ SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/opendev.c b/Xi/opendev.c
index e7c00a2..486ac14 100644
--- a/Xi/opendev.c
+++ b/Xi/opendev.c
@@ -151,7 +151,7 @@ ProcXOpenDevice(ClientPtr client)
     rep.length = bytes_to_int32(j * sizeof(xInputClassInfo));
     rep.num_classes = j;
     WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep);
-    WriteToClient(client, j * sizeof(xInputClassInfo), (char *) evbase);
+    WriteToClient(client, j * sizeof(xInputClassInfo), evbase);
     return Success;
 }
 
@@ -167,5 +167,5 @@ SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep)
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/queryst.c b/Xi/queryst.c
index ffb6de0..de19974 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -184,5 +184,5 @@ SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/setbmap.c b/Xi/setbmap.c
index 110f5e9..296b439 100644
--- a/Xi/setbmap.c
+++ b/Xi/setbmap.c
@@ -134,5 +134,5 @@ SRepXSetDeviceButtonMapping(ClientPtr client, int size,
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/setdval.c b/Xi/setdval.c
index 542f20d..8c3816d 100644
--- a/Xi/setdval.c
+++ b/Xi/setdval.c
@@ -138,5 +138,5 @@ SRepXSetDeviceValuators(ClientPtr client, int size,
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/setmmap.c b/Xi/setmmap.c
index 36845d7..e70038e 100644
--- a/Xi/setmmap.c
+++ b/Xi/setmmap.c
@@ -140,5 +140,5 @@ SRepXSetDeviceModifierMapping(ClientPtr client, int size,
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/setmode.c b/Xi/setmode.c
index a7bf1ea..f212d83 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.c
@@ -137,5 +137,5 @@ SRepXSetDeviceMode(ClientPtr client, int size, xSetDeviceModeReply * rep)
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/xigetclientpointer.c b/Xi/xigetclientpointer.c
index 07dbf18..8a5f54f 100644
--- a/Xi/xigetclientpointer.c
+++ b/Xi/xigetclientpointer.c
@@ -100,5 +100,5 @@ SRepXIGetClientPointer(ClientPtr client, int size,
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
     swaps(&rep->deviceid);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c
index 8d2cf0b..095fcfa 100644
--- a/Xi/xigrabdev.c
+++ b/Xi/xigrabdev.c
@@ -156,5 +156,5 @@ SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep)
 {
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 7130328..5e4fa4e 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -224,7 +224,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
 
     WriteReplyToClient(client, sizeof(rep), &rep);
     if (rep.num_modifiers)
-        WriteToClient(client, rep.length * 4, (char *) modifiers_failed);
+        WriteToClient(client, rep.length * 4, modifiers_failed);
 
     free(modifiers_failed);
  out:
@@ -240,7 +240,7 @@ SRepXIPassiveGrabDevice(ClientPtr client, int size,
     swapl(&rep->length);
     swaps(&rep->num_modifiers);
 
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
 
 int
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 5f46b54..ab86963 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -1063,7 +1063,7 @@ SRepXListDeviceProperties(ClientPtr client, int size,
     swapl(&rep->length);
     swaps(&rep->nAtoms);
     /* properties will be swapped later, see ProcXListDeviceProperties */
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
 
 void
@@ -1076,7 +1076,7 @@ SRepXGetDeviceProperty(ClientPtr client, int size,
     swapl(&rep->bytesAfter);
     swapl(&rep->nItems);
     /* data will be swapped, see ProcXGetDeviceProperty */
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
 
 /* XI2 Request/reply handling */
@@ -1300,7 +1300,7 @@ SRepXIListProperties(ClientPtr client, int size, xXIListPropertiesReply * rep)
     swapl(&rep->length);
     swaps(&rep->num_properties);
     /* properties will be swapped later, see ProcXIListProperties */
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
 
 void
@@ -1312,5 +1312,5 @@ SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep)
     swapl(&rep->bytes_after);
     swapl(&rep->num_items);
     /* data will be swapped, see ProcXIGetProperty */
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index 15c8b2a..af7ea53 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -162,7 +162,7 @@ SRepXIQueryDevice(ClientPtr client, int size, xXIQueryDeviceReply * rep)
 
     /* Device info is already swapped, see ProcXIQueryDevice */
 
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
 
 /**
diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index 169436e..e09a1f6 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -219,5 +219,5 @@ SRepXIQueryPointer(ClientPtr client, int size, xXIQueryPointerReply * rep)
     swapl(&rep->win_y);
     swaps(&rep->buttons_len);
 
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/xiqueryversion.c b/Xi/xiqueryversion.c
index 6081c41..0d4962f 100644
--- a/Xi/xiqueryversion.c
+++ b/Xi/xiqueryversion.c
@@ -126,5 +126,5 @@ SRepXIQueryVersion(ClientPtr client, int size, xXIQueryVersionReply * rep)
     swapl(&rep->length);
     swaps(&rep->major_version);
     swaps(&rep->minor_version);
-    WriteToClient(client, size, (char *) rep);
+    WriteToClient(client, size, rep);
 }
diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index e7e719d..6dd2c1c 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -335,5 +335,5 @@ SRepXIGetSelectedEvents(ClientPtr client,
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
     swaps(&rep->num_masks);
-    WriteToClient(client, len, (char *) rep);
+    WriteToClient(client, len, rep);
 }
diff --git a/Xi/xisetdevfocus.c b/Xi/xisetdevfocus.c
index b52c9cc..55e5c35 100644
--- a/Xi/xisetdevfocus.c
+++ b/Xi/xisetdevfocus.c
@@ -121,5 +121,5 @@ SRepXIGetFocus(ClientPtr client, int len, xXIGetFocusReply * rep)
     swaps(&rep->sequenceNumber);
     swapl(&rep->length);
     swapl(&rep->focus);
-    WriteToClient(client, len, (char *) rep);
+    WriteToClient(client, len, rep);
 }
diff --git a/composite/compext.c b/composite/compext.c
index 1d4d8bf..be25b27 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -131,7 +131,7 @@ ProcCompositeQueryVersion(ClientPtr client)
         swapl(&rep.majorVersion);
         swapl(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xCompositeQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xCompositeQueryVersionReply), &rep);
     return Success;
 }
 
@@ -321,8 +321,7 @@ ProcCompositeGetOverlayWindow(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.overlayWin);
     }
-    (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply,
-                         (char *) &rep);
+    WriteToClient(client, sz_xCompositeGetOverlayWindowReply, &rep);
 
     return Success;
 }
@@ -853,8 +852,7 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.overlayWin);
     }
-    (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply,
-                         (char *) &rep);
+    WriteToClient(client, sz_xCompositeGetOverlayWindowReply, &rep);
 
     return Success;
 }
diff --git a/damageext/damageext.c b/damageext/damageext.c
index f21f71c..70d2eee 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -154,7 +154,7 @@ ProcDamageQueryVersion(ClientPtr client)
         swapl(&rep.majorVersion);
         swapl(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xDamageQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDamageQueryVersionReply), &rep);
     return Success;
 }
 
diff --git a/dbe/dbe.c b/dbe/dbe.c
index ca7f3e2..d8010ff 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -132,7 +132,7 @@ ProcDbeGetVersion(ClientPtr client)
         swaps(&rep.sequenceNumber);
     }
 
-    WriteToClient(client, sizeof(xDbeGetVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDbeGetVersionReply), &rep);
 
     return Success;
 
@@ -679,7 +679,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
     }
 
     /* Send off reply. */
-    WriteToClient(client, sizeof(xDbeGetVisualInfoReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDbeGetVisualInfoReply), &rep);
 
     for (i = 0; i < count; i++) {
         CARD32 data32;
@@ -693,7 +693,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
             swapl(&data32);
         }
 
-        WriteToClient(client, sizeof(CARD32), (char *) &data32);
+        WriteToClient(client, sizeof(CARD32), &data32);
 
         /* Now send off visual info items. */
         for (j = 0; j < pScrVisInfo[i].count; j++) {
@@ -717,8 +717,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
             }
 
             /* Write visualID(32), depth(8), perfLevel(8), and pad(16). */
-            WriteToClient(client, 2 * sizeof(CARD32),
-                          (char *) &visInfo.visualID);
+            WriteToClient(client, 2 * sizeof(CARD32), &visInfo.visualID);
         }
     }
 
@@ -782,8 +781,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
         swapl(&rep.attributes);
     }
 
-    WriteToClient(client, sizeof(xDbeGetBackBufferAttributesReply),
-                  (char *) &rep);
+    WriteToClient(client, sizeof(xDbeGetBackBufferAttributesReply), &rep);
     return Success;
 
 }                               /* ProcDbeGetbackBufferAttributes() */
diff --git a/dix/devices.c b/dix/devices.c
index 70fb273..c042681 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1704,7 +1704,7 @@ ProcGetModifierMapping(ClientPtr client)
     rep.length = max_keys_per_mod << 1;
 
     WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep);
-    (void) WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
+    WriteToClient(client, max_keys_per_mod * 8, modkeymap);
 
     free(modkeymap);
 
@@ -1898,7 +1898,7 @@ ProcGetPointerMapping(ClientPtr client)
     rep.length = ((unsigned) rep.nElts + (4 - 1)) / 4;
     WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep);
     if (butc)
-        WriteToClient(client, (int) rep.nElts, (char *) &butc->map[1]);
+        WriteToClient(client, (int) rep.nElts, &butc->map[1]);
     return Success;
 }
 
diff --git a/dix/dispatch.c b/dix/dispatch.c
index bcce22f..4231cb0 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1035,7 +1035,7 @@ ProcGetAtomName(ClientPtr client)
         reply.sequenceNumber = client->sequence;
         reply.nameLength = len;
         WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
-        (void) WriteToClient(client, len, str);
+        WriteToClient(client, len, str);
         return Success;
     }
     else {
@@ -2143,8 +2143,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
                               BitsPerPixel(pDraw->depth), ClientOrder(client));
 
 /* Don't split me, gcc pukes when you do */
-                (void) WriteToClient(client,
-                                     (int) (nlines * widthBytesLine), pBuf);
+                WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
             }
             linesDone += nlines;
         }
@@ -2179,9 +2178,8 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
                                       1, ClientOrder(client));
 
 /* Don't split me, gcc pukes when you do */
-                        (void) WriteToClient(client,
-                                             (int) (nlines * widthBytesLine),
-                                             pBuf);
+                        WriteToClient(client, (int) (nlines * widthBytesLine),
+				      pBuf);
                     }
                     linesDone += nlines;
                 }
@@ -3250,8 +3248,7 @@ ProcGetFontPath(ClientPtr client)
 
     WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply);
     if (stringLens || numpaths)
-        (void) WriteToClient(client, stringLens + numpaths,
-                             (char *) bufferStart);
+        WriteToClient(client, stringLens + numpaths, bufferStart);
     return Success;
 }
 
@@ -3523,8 +3520,8 @@ SendConnSetup(ClientPtr client, const char *reason)
         if (client->swapped)
             WriteSConnSetupPrefix(client, &csp);
         else
-            (void) WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp);
-        (void) WriteToClient(client, (int) csp.lengthReason, reason);
+            WriteToClient(client, sz_xConnSetupPrefix, &csp);
+        WriteToClient(client, (int) csp.lengthReason, reason);
         return client->noClientException = -1;
     }
 
@@ -3577,10 +3574,9 @@ SendConnSetup(ClientPtr client, const char *reason)
                              lConnectionInfo);
     }
     else {
-        (void) WriteToClient(client, sizeof(xConnSetupPrefix),
-                             (char *) lconnSetupPrefix);
-        (void) WriteToClient(client, (int) (lconnSetupPrefix->length << 2),
-                             lConnectionInfo);
+        WriteToClient(client, sizeof(xConnSetupPrefix), lconnSetupPrefix);
+        WriteToClient(client, (int) (lconnSetupPrefix->length << 2),
+		      lConnectionInfo);
     }
     client->clientState = ClientStateRunning;
     if (ClientStateCallback) {
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index dd93311..d1f6326 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -782,7 +782,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
     reply.length = bytes_to_int32(stringLens + nnames);
     client->pSwapReplyFunc = ReplySwapVector[X_ListFonts];
     WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply);
-    (void) WriteToClient(client, stringLens + nnames, bufferStart);
+    WriteToClient(client, stringLens + nnames, bufferStart);
     free(bufferStart);
 
  bail:
@@ -1020,7 +1020,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
                 pFP++;
             }
             WriteSwappedDataToClient(client, length, reply);
-            (void) WriteToClient(client, namelen, name);
+            WriteToClient(client, namelen, name);
             if (pFontInfo == &fontInfo) {
                 free(fontInfo.props);
                 free(fontInfo.isStringProp);
diff --git a/dix/events.c b/dix/events.c
index 89877a1..dbfe9d9 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -5898,14 +5898,14 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
             (*EventSwapVector[eventFrom->u.u.type & 0177])
                 (eventFrom, eventTo);
 
-            WriteToClient(pClient, eventlength, (char *) eventTo);
+            WriteToClient(pClient, eventlength, eventTo);
         }
     }
     else {
         /* only one GenericEvent, remember? that means either count is 1 and
          * eventlength is arbitrary or eventlength is 32 and count doesn't
          * matter. And we're all set. Woohoo. */
-        WriteToClient(pClient, count * eventlength, (char *) events);
+        WriteToClient(pClient, count * eventlength, events);
     }
 }
 
diff --git a/dix/swaprep.c b/dix/swaprep.c
index 9440c4e..559fe27 100644
--- a/dix/swaprep.c
+++ b/dix/swaprep.c
@@ -80,7 +80,7 @@ Swap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
     {
         swapl(&pbuf[i]);
     }
-    (void) WriteToClient(pClient, size << 2, (char *) pbuf);
+    WriteToClient(pClient, size << 2, pbuf);
 }
 
 /**
@@ -123,7 +123,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
             from++;
             to++;
         }
-        (void) WriteToClient(pClient, nbytes, (char *) pbufT);
+        WriteToClient(pClient, nbytes, pbufT);
     }
 
     if (pbufT != tmpbuf)
@@ -170,7 +170,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
             from++;
             to++;
         }
-        (void) WriteToClient(pClient, nbytes, (char *) pbufT);
+        WriteToClient(pClient, nbytes, pbufT);
     }
 
     if (pbufT != tmpbuf)
@@ -182,7 +182,7 @@ void
 SGenericReply(ClientPtr pClient, int size, xGenericReply * pRep)
 {
     swaps(&pRep->sequenceNumber);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 /* Extra-large reply */
@@ -200,7 +200,7 @@ SGetWindowAttributesReply(ClientPtr pClient, int size,
     swapl(&pRep->allEventMasks);
     swapl(&pRep->yourEventMask);
     swaps(&pRep->doNotPropagateMask);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -213,7 +213,7 @@ SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply * pRep)
     swaps(&pRep->width);
     swaps(&pRep->height);
     swaps(&pRep->borderWidth);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -224,7 +224,7 @@ SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply * pRep)
     swapl(&pRep->root);
     swapl(&pRep->parent);
     swaps(&pRep->nChildren);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -232,7 +232,7 @@ SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply * pRep)
 {
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->atom);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -241,7 +241,7 @@ SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply * pRep)
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
     swaps(&pRep->nameLength);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -252,7 +252,7 @@ SGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply * pRep)
     swapl(&pRep->propertyType);
     swapl(&pRep->bytesAfter);
     swapl(&pRep->nItems);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -261,7 +261,7 @@ SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply * pRep)
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
     swaps(&pRep->nProperties);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -270,7 +270,7 @@ SGetSelectionOwnerReply(ClientPtr pClient, int size,
 {
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->owner);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -284,7 +284,7 @@ SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply * pRep)
     swaps(&pRep->winX);
     swaps(&pRep->winY);
     swaps(&pRep->mask);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 static void
@@ -307,7 +307,7 @@ SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord * pRep)
         SwapTimecoord(pRepT);
         pRepT++;
     }
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 
 }
 
@@ -317,7 +317,7 @@ SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply * pRep)
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
     swapl(&pRep->nEvents);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -327,7 +327,7 @@ STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply * pRep)
     swapl(&pRep->child);
     swaps(&pRep->dstX);
     swaps(&pRep->dstY);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -335,7 +335,7 @@ SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply * pRep)
 {
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->focus);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 /* extra long reply */
@@ -344,7 +344,7 @@ SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply * pRep)
 {
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 static void
@@ -405,7 +405,7 @@ void
 SQueryFontReply(ClientPtr pClient, int size, xQueryFontReply * pRep)
 {
     SwapFont(pRep, TRUE);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -420,7 +420,7 @@ SQueryTextExtentsReply(ClientPtr pClient, int size,
     swapl(&pRep->overallWidth);
     swapl(&pRep->overallLeft);
     swapl(&pRep->overallRight);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -429,7 +429,7 @@ SListFontsReply(ClientPtr pClient, int size, xListFontsReply * pRep)
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
     swaps(&pRep->nFonts);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -437,7 +437,7 @@ SListFontsWithInfoReply(ClientPtr pClient, int size,
                         xListFontsWithInfoReply * pRep)
 {
     SwapFont((xQueryFontReply *) pRep, FALSE);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -446,7 +446,7 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
     swaps(&pRep->nPaths);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -455,7 +455,7 @@ SGetImageReply(ClientPtr pClient, int size, xGetImageReply * pRep)
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
     swapl(&pRep->visual);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
     /* Fortunately, image doesn't need swapping */
 }
 
@@ -466,7 +466,7 @@ SListInstalledColormapsReply(ClientPtr pClient, int size,
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
     swaps(&pRep->nColormaps);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -477,7 +477,7 @@ SAllocColorReply(ClientPtr pClient, int size, xAllocColorReply * pRep)
     swaps(&pRep->green);
     swaps(&pRep->blue);
     swapl(&pRep->pixel);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -491,7 +491,7 @@ SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply * pRep)
     swaps(&pRep->screenRed);
     swaps(&pRep->screenGreen);
     swaps(&pRep->screenBlue);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -501,7 +501,7 @@ SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply * pRep)
     swapl(&pRep->length);
     swaps(&pRep->nPixels);
     swaps(&pRep->nMasks);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -514,7 +514,7 @@ SAllocColorPlanesReply(ClientPtr pClient, int size,
     swapl(&pRep->redMask);
     swapl(&pRep->greenMask);
     swapl(&pRep->blueMask);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 static void
@@ -537,7 +537,7 @@ SQColorsExtend(ClientPtr pClient, int size, xrgb * prgb)
         SwapRGB(prgbT);
         prgbT++;
     }
-    (void) WriteToClient(pClient, size, (char *) prgb);
+    WriteToClient(pClient, size, prgb);
 }
 
 void
@@ -546,7 +546,7 @@ SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply * pRep)
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
     swaps(&pRep->nColors);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -559,7 +559,7 @@ SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply * pRep)
     swaps(&pRep->screenRed);
     swaps(&pRep->screenGreen);
     swaps(&pRep->screenBlue);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -568,7 +568,7 @@ SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply * pRep)
     swaps(&pRep->sequenceNumber);
     swaps(&pRep->width);
     swaps(&pRep->height);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -576,7 +576,7 @@ SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply * pRep)
 {
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -585,7 +585,7 @@ SGetKeyboardMappingReply(ClientPtr pClient, int size,
 {
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -594,7 +594,7 @@ SGetPointerMappingReply(ClientPtr pClient, int size,
 {
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -603,7 +603,7 @@ SGetModifierMappingReply(ClientPtr pClient, int size,
 {
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -615,7 +615,7 @@ SGetKeyboardControlReply(ClientPtr pClient, int size,
     swapl(&pRep->ledMask);
     swaps(&pRep->bellPitch);
     swaps(&pRep->bellDuration);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -626,7 +626,7 @@ SGetPointerControlReply(ClientPtr pClient, int size,
     swaps(&pRep->accelNumerator);
     swaps(&pRep->accelDenominator);
     swaps(&pRep->threshold);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -635,7 +635,7 @@ SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply * pRep)
     swaps(&pRep->sequenceNumber);
     swaps(&pRep->timeout);
     swaps(&pRep->interval);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -651,7 +651,7 @@ SLHostsExtend(ClientPtr pClient, int size, char *buf)
         swaps(&host->length);
         bufT += sizeof(xHostEntry) + pad_to_int32(len);
     }
-    (void) WriteToClient(pClient, size, buf);
+    WriteToClient(pClient, size, buf);
 }
 
 void
@@ -660,7 +660,7 @@ SListHostsReply(ClientPtr pClient, int size, xListHostsReply * pRep)
     swaps(&pRep->sequenceNumber);
     swapl(&pRep->length);
     swaps(&pRep->nHosts);
-    (void) WriteToClient(pClient, size, (char *) pRep);
+    WriteToClient(pClient, size, pRep);
 }
 
 void
@@ -1140,7 +1140,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
         return;
     }
     SwapConnSetupInfo(pInfo, pInfoTBase);
-    (void) WriteToClient(pClient, (int) size, (char *) pInfoTBase);
+    WriteToClient(pClient, (int) size, pInfoTBase);
     free(pInfoTBase);
 }
 
@@ -1160,7 +1160,7 @@ WriteSConnSetupPrefix(ClientPtr pClient, xConnSetupPrefix * pcsp)
     xConnSetupPrefix cspT;
 
     SwapConnSetupPrefix(pcsp, &cspT);
-    (void) WriteToClient(pClient, sizeof(cspT), (char *) &cspT);
+    WriteToClient(pClient, sizeof(cspT), &cspT);
 }
 
 /*
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index d054219..9cb9e73 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -667,7 +667,7 @@ DoMakeCurrent(__GLXclientState * cl,
         __glXSwapMakeCurrentReply(client, &reply);
     }
     else {
-        WriteToClient(client, sz_xGLXMakeCurrentReply, (char *) &reply);
+        WriteToClient(client, sz_xGLXMakeCurrentReply, &reply);
     }
     return Success;
 }
@@ -731,7 +731,7 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
         __glXSwapIsDirectReply(client, &reply);
     }
     else {
-        WriteToClient(client, sz_xGLXIsDirectReply, (char *) &reply);
+        WriteToClient(client, sz_xGLXIsDirectReply, &reply);
     }
 
     return Success;
@@ -767,7 +767,7 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc)
         __glXSwapQueryVersionReply(client, &reply);
     }
     else {
-        WriteToClient(client, sz_xGLXQueryVersionReply, (char *) &reply);
+        WriteToClient(client, sz_xGLXQueryVersionReply, &reply);
     }
     return Success;
 }
@@ -949,7 +949,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
         __GLX_SWAP_INT(&reply.numProps);
     }
 
-    WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+    WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
 
     for (i = 0; i < pGlxScreen->numVisuals; i++) {
         modes = pGlxScreen->visuals[i];
@@ -1006,7 +1006,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
         if (client->swapped) {
             __GLX_SWAP_INT_ARRAY(buf, p);
         }
-        WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *) buf);
+        WriteToClient(client, __GLX_SIZE_CARD32 * p, buf);
     }
     return Success;
 }
@@ -1052,7 +1052,7 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
         __GLX_SWAP_INT(&reply.numAttribs);
     }
 
-    WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *) &reply);
+    WriteToClient(client, sz_xGLXGetFBConfigsReply, &reply);
 
     for (modes = pGlxScreen->fbconfigs; modes != NULL; modes = modes->next) {
         p = 0;
@@ -1685,8 +1685,8 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
         __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
     }
     else {
-        WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) &reply);
-        WriteToClient(client, nReplyBytes, (char *) sendBuf);
+        WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
+        WriteToClient(client, nReplyBytes, sendBuf);
     }
     free((char *) sendBuf);
 
@@ -1887,10 +1887,8 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
         __glXSwapGetDrawableAttributesReply(client, &reply, attributes);
     }
     else {
-        WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
-                      (char *) &reply);
-        WriteToClient(client, reply.length * sizeof(CARD32),
-                      (char *) attributes);
+        WriteToClient(client, sz_xGLXGetDrawableAttributesReply, &reply);
+        WriteToClient(client, reply.length * sizeof(CARD32), attributes);
     }
 
     return Success;
@@ -2326,9 +2324,8 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
         glxSwapQueryExtensionsStringReply(client, &reply, buf);
     }
     else {
-        WriteToClient(client, sz_xGLXQueryExtensionsStringReply,
-                      (char *) &reply);
-        WriteToClient(client, (int) (length << 2), (char *) buf);
+        WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply);
+        WriteToClient(client, (int) (length << 2), buf);
     }
 
     free(buf);
@@ -2388,7 +2385,7 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
         glxSwapQueryServerStringReply(client, &reply, buf);
     }
     else {
-        WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) &reply);
+        WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
         WriteToClient(client, (int) (length << 2), buf);
     }
 
diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c
index e8520d6..43f88d3 100644
--- a/glx/glxcmdsswap.c
+++ b/glx/glxcmdsswap.c
@@ -840,7 +840,7 @@ __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReply * reply)
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->contextTag);
-    WriteToClient(client, sz_xGLXMakeCurrentReply, (char *) reply);
+    WriteToClient(client, sz_xGLXMakeCurrentReply, reply);
 }
 
 void
@@ -849,7 +849,7 @@ __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply)
     __GLX_DECLARE_SWAP_VARIABLES;
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
-    WriteToClient(client, sz_xGLXIsDirectReply, (char *) reply);
+    WriteToClient(client, sz_xGLXIsDirectReply, reply);
 }
 
 void
@@ -860,7 +860,7 @@ __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply * reply)
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->majorVersion);
     __GLX_SWAP_INT(&reply->minorVersion);
-    WriteToClient(client, sz_xGLXQueryVersionReply, (char *) reply);
+    WriteToClient(client, sz_xGLXQueryVersionReply, reply);
 }
 
 void
@@ -875,7 +875,7 @@ glxSwapQueryExtensionsStringReply(ClientPtr client,
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->n);
-    WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *) reply);
+    WriteToClient(client, sz_xGLXQueryExtensionsStringReply, reply);
     __GLX_SWAP_INT_ARRAY((int *) buf, length);
     WriteToClient(client, length << 2, buf);
 }
@@ -890,7 +890,7 @@ glxSwapQueryServerStringReply(ClientPtr client,
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->n);
-    WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) reply);
+    WriteToClient(client, sz_xGLXQueryServerStringReply, reply);
     /** no swap is needed for an array of chars **/
     /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
     WriteToClient(client, length << 2, buf);
@@ -908,9 +908,9 @@ __glXSwapQueryContextInfoEXTReply(ClientPtr client,
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->n);
-    WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) reply);
+    WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, reply);
     __GLX_SWAP_INT_ARRAY((int *) buf, length);
-    WriteToClient(client, length << 2, (char *) buf);
+    WriteToClient(client, length << 2, buf);
 }
 
 void
@@ -925,9 +925,9 @@ __glXSwapGetDrawableAttributesReply(ClientPtr client,
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->numAttribs);
-    WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *) reply);
+    WriteToClient(client, sz_xGLXGetDrawableAttributesReply, reply);
     __GLX_SWAP_INT_ARRAY((int *) buf, length);
-    WriteToClient(client, length << 2, (char *) buf);
+    WriteToClient(client, length << 2, buf);
 }
 
 /************************************************************************/
diff --git a/glx/indirect_util.c b/glx/indirect_util.c
index a54f70a..a30b1f8 100644
--- a/glx/indirect_util.c
+++ b/glx/indirect_util.c
@@ -138,10 +138,10 @@ __glXSendReply(ClientPtr client, const void *data, size_t elements,
      */
 
     (void) memcpy(&__glXReply.pad3, data, 8);
-    WriteToClient(client, sz_xGLXSingleReply, (char *) &__glXReply);
+    WriteToClient(client, sz_xGLXSingleReply, &__glXReply);
 
     if (reply_ints != 0) {
-        WriteToClient(client, reply_ints * 4, (char *) data);
+        WriteToClient(client, reply_ints * 4, data);
     }
 }
 
@@ -184,10 +184,10 @@ __glXSendReplySwap(ClientPtr client, const void *data, size_t elements,
      */
 
     (void) memcpy(&__glXReply.pad3, data, 8);
-    WriteToClient(client, sz_xGLXSingleReply, (char *) &__glXReply);
+    WriteToClient(client, sz_xGLXSingleReply, &__glXReply);
 
     if (reply_ints != 0) {
-        WriteToClient(client, reply_ints * 4, (char *) data);
+        WriteToClient(client, reply_ints * 4, data);
     }
 }
 
diff --git a/glx/single2.c b/glx/single2.c
index 42cccc1..4d8ea4e 100644
--- a/glx/single2.c
+++ b/glx/single2.c
@@ -199,9 +199,9 @@ __glXDisp_RenderMode(__GLXclientState * cl, GLbyte * pc)
     reply.retval = retval;
     reply.size = nitems;
     reply.newMode = newMode;
-    WriteToClient(client, sz_xGLXRenderModeReply, (char *) &reply);
+    WriteToClient(client, sz_xGLXRenderModeReply, &reply);
     if (retBytes) {
-        WriteToClient(client, retBytes, (char *) retBuffer);
+        WriteToClient(client, retBytes, retBuffer);
     }
     return Success;
 }
@@ -384,7 +384,7 @@ DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap)
     }
 
     __GLX_SEND_HEADER();
-    WriteToClient(client, length, (char *) string);
+    WriteToClient(client, length, string);
     free(buf);
 
     return Success;
diff --git a/glx/single2swap.c b/glx/single2swap.c
index e6bb585..9da2afd 100644
--- a/glx/single2swap.c
+++ b/glx/single2swap.c
@@ -216,9 +216,9 @@ __glXDispSwap_RenderMode(__GLXclientState * cl, GLbyte * pc)
     __GLX_SWAP_INT(&reply.retval);
     __GLX_SWAP_INT(&reply.size);
     __GLX_SWAP_INT(&reply.newMode);
-    WriteToClient(client, sz_xGLXRenderModeReply, (char *) &reply);
+    WriteToClient(client, sz_xGLXRenderModeReply, &reply);
     if (retBytes) {
-        WriteToClient(client, retBytes, (char *) retBuffer);
+        WriteToClient(client, retBytes, retBuffer);
     }
     return Success;
 }
diff --git a/glx/unpack.h b/glx/unpack.h
index 0a088fc..52fba74 100644
--- a/glx/unpack.h
+++ b/glx/unpack.h
@@ -63,7 +63,7 @@ extern xGLXSingleReply __glXReply;
   	__glXReply.sequenceNumber = client->sequence;
 
 #define __GLX_SEND_HEADER() \
-	WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply);
+	WriteToClient (client, sz_xGLXSingleReply, &__glXReply);
 
 #define __GLX_PUT_RETVAL(a) \
   	__glXReply.retval = (a);
@@ -116,19 +116,19 @@ extern xGLXSingleReply __glXReply;
   	*(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer
 
 #define __GLX_SEND_BYTE_ARRAY(len) \
-	WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer)
+	WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), answer)
 
 #define __GLX_SEND_SHORT_ARRAY(len) \
-	WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer)
+	WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), answer)
 
 #define __GLX_SEND_INT_ARRAY(len) \
-	WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer)
+	WriteToClient(client, (len)*__GLX_SIZE_INT32, answer)
 
 #define __GLX_SEND_FLOAT_ARRAY(len) \
-	WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer)
+	WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, answer)
 
 #define __GLX_SEND_DOUBLE_ARRAY(len) \
-	WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer)
+	WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, answer)
 
 #define __GLX_SEND_VOID_ARRAY(len)  __GLX_SEND_BYTE_ARRAY(len)
 #define __GLX_SEND_UBYTE_ARRAY(len)  __GLX_SEND_BYTE_ARRAY(len)
diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c
index a226c5d..5ea133e 100644
--- a/hw/dmx/dmx.c
+++ b/hw/dmx/dmx.c
@@ -225,7 +225,7 @@ ProcDMXQueryVersion(ClientPtr client)
         swapl(&rep.minorVersion);
         swapl(&rep.patchVersion);
     }
-    WriteToClient(client, sizeof(xDMXQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXQueryVersionReply), &rep);
     return Success;
 }
 
@@ -247,7 +247,7 @@ ProcDMXSync(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.status);
     }
-    WriteToClient(client, sizeof(xDMXSyncReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXSyncReply), &rep);
     return Success;
 }
 
@@ -297,7 +297,7 @@ ProcDMXForceWindowCreation(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.status);
     }
-    WriteToClient(client, sizeof(xDMXForceWindowCreationReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXForceWindowCreationReply), &rep);
     return Success;
 }
 
@@ -317,7 +317,7 @@ ProcDMXGetScreenCount(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.screenCount);
     }
-    WriteToClient(client, sizeof(xDMXGetScreenCountReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXGetScreenCountReply), &rep);
     return Success;
 }
 
@@ -377,9 +377,9 @@ ProcDMXGetScreenAttributes(ClientPtr client)
         swaps(&rep.rootWindowXorigin);
         swaps(&rep.rootWindowYorigin);
     }
-    WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), &rep);
     if (length)
-        WriteToClient(client, length, (char *) attr.displayName);
+        WriteToClient(client, length, attr.displayName);
     return Success;
 }
 
@@ -453,8 +453,7 @@ ProcDMXChangeScreensAttributes(ClientPtr client)
         swapl(&rep.status);
         swapl(&rep.errorScreen);
     }
-    WriteToClient(client,
-                  sizeof(xDMXChangeScreensAttributesReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXChangeScreensAttributesReply), &rep);
     return Success;
 }
 
@@ -503,7 +502,7 @@ ProcDMXAddScreen(ClientPtr client)
         swapl(&rep.status);
         swapl(&rep.physicalScreen);
     }
-    WriteToClient(client, sizeof(xDMXAddScreenReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXAddScreenReply), &rep);
     return Success;
 }
 
@@ -527,7 +526,7 @@ ProcDMXRemoveScreen(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.status);
     }
-    WriteToClient(client, sizeof(xDMXRemoveScreenReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXRemoveScreenReply), &rep);
     return Success;
 }
 
@@ -663,12 +662,12 @@ ProcDMXGetWindowAttributes(ClientPtr client)
 
     dmxFlushPendingSyncs();
 
-    WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), &rep);
     if (count) {
-        WriteToClient(client, count * sizeof(*screens), (char *) screens);
-        WriteToClient(client, count * sizeof(*windows), (char *) windows);
-        WriteToClient(client, count * sizeof(*pos), (char *) pos);
-        WriteToClient(client, count * sizeof(*vis), (char *) vis);
+        WriteToClient(client, count * sizeof(*screens), screens);
+        WriteToClient(client, count * sizeof(*windows), windows);
+        WriteToClient(client, count * sizeof(*pos), pos);
+        WriteToClient(client, count * sizeof(*vis), vis);
     }
 
     free(vis);
@@ -706,7 +705,7 @@ ProcDMXGetDesktopAttributes(ClientPtr client)
         swaps(&rep.shiftX);
         swaps(&rep.shiftY);
     }
-    WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), &rep);
     return Success;
 }
 
@@ -749,8 +748,7 @@ ProcDMXChangeDesktopAttributes(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.status);
     }
-    WriteToClient(client,
-                  sizeof(xDMXChangeDesktopAttributesReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXChangeDesktopAttributesReply), &rep);
     return Success;
 }
 
@@ -770,7 +768,7 @@ ProcDMXGetInputCount(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.inputCount);
     }
-    WriteToClient(client, sizeof(xDMXGetInputCountReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXGetInputCountReply), &rep);
     return Success;
 }
 
@@ -808,9 +806,9 @@ ProcDMXGetInputAttributes(ClientPtr client)
         swapl(&rep.physicalId);
         swapl(&rep.nameLength);
     }
-    WriteToClient(client, sizeof(xDMXGetInputAttributesReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXGetInputAttributesReply), &rep);
     if (length)
-        WriteToClient(client, length, (char *) attr.name);
+        WriteToClient(client, length, attr.name);
     return Success;
 }
 
@@ -862,7 +860,7 @@ ProcDMXAddInput(ClientPtr client)
         swapl(&rep.status);
         swapl(&rep.physicalId);
     }
-    WriteToClient(client, sizeof(xDMXAddInputReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXAddInputReply), &rep);
     return Success;
 }
 
@@ -889,7 +887,7 @@ ProcDMXRemoveInput(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.status);
     }
-    WriteToClient(client, sizeof(xDMXRemoveInputReply), (char *) &rep);
+    WriteToClient(client, sizeof(xDMXRemoveInputReply), &rep);
     return Success;
 }
 
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index 49c6ef1..32684fa 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -465,8 +465,7 @@ __glXQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc)
         __glXSwapQueryMaxSwapBarriersSGIXReply(client, &reply);
     }
     else {
-        WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply,
-                      (char *) &reply);
+        WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, &reply);
     }
 
     return Success;
@@ -1388,8 +1387,7 @@ MakeCurrent(__GLXclientState * cl,
         __glXSwapMakeCurrentReply(client, &new_reply);
     }
     else {
-        WriteToClient(client, sz_xGLXMakeContextCurrentReply,
-                      (char *) &new_reply);
+        WriteToClient(client, sz_xGLXMakeContextCurrentReply, &new_reply);
     }
 
     return Success;
@@ -1449,7 +1447,7 @@ __glXIsDirect(__GLXclientState * cl, GLbyte * pc)
         __glXSwapIsDirectReply(client, &reply);
     }
     else {
-        WriteToClient(client, sz_xGLXIsDirectReply, (char *) &reply);
+        WriteToClient(client, sz_xGLXIsDirectReply, &reply);
     }
 
     return Success;
@@ -1478,7 +1476,7 @@ __glXQueryVersion(__GLXclientState * cl, GLbyte * pc)
         __glXSwapQueryVersionReply(client, &reply);
     }
     else {
-        WriteToClient(client, sz_xGLXQueryVersionReply, (char *) &reply);
+        WriteToClient(client, sz_xGLXQueryVersionReply, &reply);
     }
     return Success;
 }
@@ -1689,7 +1687,7 @@ __glXGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
     reply.type = X_Reply;
     reply.sequenceNumber = client->sequence;
 
-    WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+    WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
 
     for (i = 0; i < pGlxScreen->numVisuals; i++) {
         pGlxVisual = &pGlxScreen->pGlxVisual[i];
@@ -1743,8 +1741,7 @@ __glXGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
         buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
         buf[p++] = pGlxVisual->visualSelectGroup;
 
-        WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
-                      (char *) buf);
+        WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, buf);
     }
     return Success;
 }
@@ -2637,9 +2634,8 @@ __glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
         glxSwapQueryExtensionsStringReply(client, &reply, be_buf);
     }
     else {
-        WriteToClient(client, sz_xGLXQueryExtensionsStringReply,
-                      (char *) &reply);
-        WriteToClient(client, (int) (length << 2), (char *) be_buf);
+        WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply);
+        WriteToClient(client, (int) (length << 2), be_buf);
     }
 
     return Success;
@@ -2719,7 +2715,7 @@ __glXQueryServerString(__GLXclientState * cl, GLbyte * pc)
         glxSwapQueryServerStringReply(client, &reply, be_buf);
     }
     else {
-        WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) &reply);
+        WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
         WriteToClient(client, (int) (length << 2), be_buf);
     }
 
@@ -2880,7 +2876,7 @@ __glXGetFBConfigs(__GLXclientState * cl, GLbyte * pc)
         __GLX_SWAP_INT(&reply.numFBConfigs);
         __GLX_SWAP_INT(&reply.numAttribs);
     }
-    WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *) &reply);
+    WriteToClient(client, sz_xGLXGetFBConfigsReply, &reply);
 
     for (i = 0; i < numFBConfigs; i++) {
         int associatedVisualId = 0;
@@ -3021,7 +3017,7 @@ __glXGetFBConfigs(__GLXclientState * cl, GLbyte * pc)
             __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
             __GLX_SWAP_INT_ARRAY((int *) buf, 2 * numAttribs);
         }
-        WriteToClient(client, 2 * numAttribs * __GLX_SIZE_CARD32, (char *) buf);
+        WriteToClient(client, 2 * numAttribs * __GLX_SIZE_CARD32, buf);
     }
     return Success;
 }
@@ -3218,8 +3214,8 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)
         __glXSwapQueryContextReply(client, &reply, sendBuf);
     }
     else {
-        WriteToClient(client, sz_xGLXQueryContextReply, (char *) &reply);
-        WriteToClient(client, nReplyBytes, (char *) sendBuf);
+        WriteToClient(client, sz_xGLXQueryContextReply, &reply);
+        WriteToClient(client, nReplyBytes, sendBuf);
     }
     free((char *) sendBuf);
 
@@ -3270,8 +3266,8 @@ __glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc)
         __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
     }
     else {
-        WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) &reply);
-        WriteToClient(client, nReplyBytes, (char *) sendBuf);
+        WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
+        WriteToClient(client, nReplyBytes, sendBuf);
     }
     free((char *) sendBuf);
 
@@ -3606,9 +3602,8 @@ __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
         __glXSwapGetDrawableAttributesReply(client, &reply, (int *) attribs);
     }
     else {
-        WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
-                      (char *) &reply);
-        WriteToClient(client, attribs_size, (char *) attribs);
+        WriteToClient(client, sz_xGLXGetDrawableAttributesReply, &reply);
+        WriteToClient(client, attribs_size, attribs);
     }
 
     free(attribs);
diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c
index ec0e83d..a11c919 100644
--- a/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/hw/dmx/glxProxy/glxcmdsswap.c
@@ -304,7 +304,7 @@ __glXSwapGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
     __GLX_SWAP_INT(&reply.length);
     __GLX_SWAP_INT(&reply.numVisuals);
     __GLX_SWAP_INT(&reply.numProps);
-    WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+    WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
 
     for (i = 0; i < pGlxScreen->numVisuals; i++) {
         pGlxVisual = &pGlxScreen->pGlxVisual[i];
@@ -353,8 +353,7 @@ __glXSwapGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
         buf[p++] = pGlxVisual->transparentIndex;
 
         __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
-        WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
-                      (char *) buf);
+        WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, buf);
     }
     return Success;
 }
@@ -508,7 +507,7 @@ __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply * reply)
     __GLX_SWAP_INT(&reply->writeType);
     __GLX_SWAP_INT(&reply->readVid);
     __GLX_SWAP_INT(&reply->readType);
-    WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, (char *) reply);
+    WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, reply);
 }
 
 void
@@ -517,7 +516,7 @@ __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply)
     __GLX_DECLARE_SWAP_VARIABLES;
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
-    WriteToClient(client, sz_xGLXIsDirectReply, (char *) reply);
+    WriteToClient(client, sz_xGLXIsDirectReply, reply);
 }
 
 void
@@ -528,7 +527,7 @@ __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply * reply)
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->majorVersion);
     __GLX_SWAP_INT(&reply->minorVersion);
-    WriteToClient(client, sz_xGLXQueryVersionReply, (char *) reply);
+    WriteToClient(client, sz_xGLXQueryVersionReply, reply);
 }
 
 void
@@ -543,7 +542,7 @@ glxSwapQueryExtensionsStringReply(ClientPtr client,
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->n);
-    WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *) reply);
+    WriteToClient(client, sz_xGLXQueryExtensionsStringReply, reply);
     __GLX_SWAP_INT_ARRAY((int *) buf, length);
     WriteToClient(client, length << 2, buf);
 }
@@ -558,7 +557,7 @@ glxSwapQueryServerStringReply(ClientPtr client,
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->n);
-    WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) reply);
+    WriteToClient(client, sz_xGLXQueryServerStringReply, reply);
     /** no swap is needed for an array of chars **/
     /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
     WriteToClient(client, length << 2, buf);
@@ -576,9 +575,9 @@ __glXSwapQueryContextInfoEXTReply(ClientPtr client,
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->n);
-    WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) reply);
+    WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, reply);
     __GLX_SWAP_INT_ARRAY((int *) buf, length);
-    WriteToClient(client, length << 2, (char *) buf);
+    WriteToClient(client, length << 2, buf);
 }
 
 void
@@ -592,9 +591,9 @@ __glXSwapQueryContextReply(ClientPtr client,
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->n);
-    WriteToClient(client, sz_xGLXQueryContextReply, (char *) reply);
+    WriteToClient(client, sz_xGLXQueryContextReply, reply);
     __GLX_SWAP_INT_ARRAY((int *) buf, length);
-    WriteToClient(client, length << 2, (char *) buf);
+    WriteToClient(client, length << 2, buf);
 }
 
 void
@@ -608,8 +607,8 @@ __glXSwapGetDrawableAttributesReply(ClientPtr client,
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->numAttribs);
     __GLX_SWAP_INT_ARRAY(buf, reply->length);
-    WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *) reply);
-    WriteToClient(client, reply->length << 2, (char *) buf);
+    WriteToClient(client, sz_xGLXGetDrawableAttributesReply, reply);
+    WriteToClient(client, reply->length << 2, buf);
 }
 
 void
@@ -621,7 +620,7 @@ __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
     __GLX_SWAP_SHORT(&reply->sequenceNumber);
     __GLX_SWAP_INT(&reply->length);
     __GLX_SWAP_INT(&reply->max);
-    WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, (char *) reply);
+    WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, reply);
 }
 
 /************************************************************************/
diff --git a/hw/dmx/glxProxy/glxsingle.c b/hw/dmx/glxProxy/glxsingle.c
index 63786cf..2253060 100644
--- a/hw/dmx/glxProxy/glxsingle.c
+++ b/hw/dmx/glxProxy/glxsingle.c
@@ -147,9 +147,9 @@ SendSwappedReply(ClientPtr client,
 
     }
 
-    WriteToClient(client, sizeof(xGLXSingleReply), (char *) reply);
+    WriteToClient(client, sizeof(xGLXSingleReply), reply);
     if (buf_size > 0)
-        WriteToClient(client, buf_size, (char *) buf);
+        WriteToClient(client, buf_size, buf);
 
 }
 
@@ -281,9 +281,9 @@ __glXForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
         SendSwappedReply(client, &reply, be_buf, be_buf_size);
     }
     else {
-        WriteToClient(client, sizeof(xGLXSingleReply), (char *) &reply);
+        WriteToClient(client, sizeof(xGLXSingleReply), &reply);
         if (be_buf_size > 0)
-            WriteToClient(client, be_buf_size, (char *) be_buf);
+            WriteToClient(client, be_buf_size, be_buf);
     }
 
     if (be_buf_size > 0)
@@ -383,9 +383,9 @@ __glXForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
         SendSwappedReply(client, &reply, be_buf, be_buf_size);
     }
     else {
-        WriteToClient(client, sizeof(xGLXSingleReply), (char *) &reply);
+        WriteToClient(client, sizeof(xGLXSingleReply), &reply);
         if (be_buf_size > 0)
-            WriteToClient(client, be_buf_size, (char *) be_buf);
+            WriteToClient(client, be_buf_size, be_buf);
     }
 
     if (be_buf_size > 0)
@@ -1013,9 +1013,9 @@ __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
         __GLX_SWAP_INT(&reply.length);
     }
 
-    WriteToClient(client, sizeof(xGLXReadPixelsReply), (char *) &reply);
+    WriteToClient(client, sizeof(xGLXReadPixelsReply), &reply);
     if (buf_size > 0) {
-        WriteToClient(client, buf_size, (char *) buf);
+        WriteToClient(client, buf_size, buf);
         free(buf);
     }
 
diff --git a/hw/dmx/glxProxy/glxvendor.c b/hw/dmx/glxProxy/glxvendor.c
index 963c92e..e5c8da1 100644
--- a/hw/dmx/glxProxy/glxvendor.c
+++ b/hw/dmx/glxProxy/glxvendor.c
@@ -138,9 +138,9 @@ SendSwappedReply(ClientPtr client,
 
     }
 
-    WriteToClient(client, sizeof(xGLXVendorPrivReply), (char *) reply);
+    WriteToClient(client, sizeof(xGLXVendorPrivReply), reply);
     if (buf_size > 0)
-        WriteToClient(client, buf_size, (char *) buf);
+        WriteToClient(client, buf_size, buf);
 
 }
 
@@ -265,9 +265,9 @@ __glXVForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
         SendSwappedReply(client, &reply, be_buf, be_buf_size);
     }
     else {
-        WriteToClient(client, sizeof(xGLXVendorPrivReply), (char *) &reply);
+        WriteToClient(client, sizeof(xGLXVendorPrivReply), &reply);
         if (be_buf_size > 0)
-            WriteToClient(client, be_buf_size, (char *) be_buf);
+            WriteToClient(client, be_buf_size, be_buf);
     }
 
     if (be_buf_size > 0)
@@ -364,9 +364,9 @@ __glXVForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
         SendSwappedReply(client, &reply, be_buf, be_buf_size);
     }
     else {
-        WriteToClient(client, sizeof(xGLXVendorPrivReply), (char *) &reply);
+        WriteToClient(client, sizeof(xGLXVendorPrivReply), &reply);
         if (be_buf_size > 0)
-            WriteToClient(client, be_buf_size, (char *) be_buf);
+            WriteToClient(client, be_buf_size, be_buf);
     }
 
     if (be_buf_size > 0)
diff --git a/hw/dmx/glxProxy/unpack.h b/hw/dmx/glxProxy/unpack.h
index b4b7358..45c27c6 100644
--- a/hw/dmx/glxProxy/unpack.h
+++ b/hw/dmx/glxProxy/unpack.h
@@ -59,7 +59,7 @@ extern xGLXSingleReply __glXReply;
   	__glXReply.sequenceNumber = client->sequence;
 
 #define __GLX_SEND_HEADER() \
-	WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply);
+	WriteToClient (client, sz_xGLXSingleReply, &__glXReply);
 
 #define __GLX_PUT_RETVAL(a) \
   	__glXReply.retval = (a);
@@ -112,19 +112,19 @@ extern xGLXSingleReply __glXReply;
   	*(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer
 
 #define __GLX_SEND_BYTE_ARRAY(len) \
-	WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer)
+	WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), answer)
 
 #define __GLX_SEND_SHORT_ARRAY(len) \
-	WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer)
+	WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), answer)
 
 #define __GLX_SEND_INT_ARRAY(len) \
-	WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer)
+	WriteToClient(client, (len)*__GLX_SIZE_INT32, answer)
 
 #define __GLX_SEND_FLOAT_ARRAY(len) \
-	WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer)
+	WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, answer)
 
 #define __GLX_SEND_DOUBLE_ARRAY(len) \
-	WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer)
+	WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, answer)
 
 #define __GLX_SEND_VOID_ARRAY(len)  __GLX_SEND_BYTE_ARRAY(len)
 #define __GLX_SEND_UBYTE_ARRAY(len)  __GLX_SEND_BYTE_ARRAY(len)
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 28486f5..aefbcfb 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -536,7 +536,7 @@ ProcXF86DRIQueryVersion(register ClientPtr client)
         swaps(&rep.minorVersion);
         swapl(&rep.patchVersion);
     }
-    WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), &rep);
     EPHYR_LOG("leave\n");
     return Success;
 }
@@ -574,7 +574,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
     }
 
     WriteToClient(client, sizeof(xXF86DRIQueryDirectRenderingCapableReply),
-                  (char *) &rep);
+                  &rep);
     EPHYR_LOG("leave\n");
 
     return Success;
@@ -617,7 +617,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
     rep.hSAREAHigh = 0;
 #endif
 
-    WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
     if (rep.busIdStringLength)
         WriteToClient(client, rep.busIdStringLength, busIdString);
     free(busIdString);
@@ -648,7 +648,7 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
         ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
         rep.authenticated = 0;
     }
-    WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), &rep);
     EPHYR_LOG("leave\n");
     return Success;
 }
@@ -702,8 +702,7 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
                                 SIZEOF(xGenericReply) +
                                 pad_to_int32(rep.clientDriverNameLength));
 
-    WriteToClient(client,
-                  sizeof(xXF86DRIGetClientDriverNameReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIGetClientDriverNameReply), &rep);
     if (rep.clientDriverNameLength)
         WriteToClient(client, rep.clientDriverNameLength, clientDriverName);
     EPHYR_LOG("leave\n");
@@ -752,7 +751,7 @@ ProcXF86DRICreateContext(register ClientPtr client)
         return BadValue;
     }
 
-    WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRICreateContextReply), &rep);
     EPHYR_LOG("leave\n");
     return Success;
 }
@@ -974,7 +973,7 @@ ProcXF86DRICreateDrawable(ClientPtr client)
         EPHYR_LOG("paired window '%p' with remote '%d'\n", window, remote_win);
     }
 
-    WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), &rep);
     EPHYR_LOG("leave\n");
     return Success;
 }
@@ -1136,18 +1135,18 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
 
     rep.length = bytes_to_int32(rep.length);
 
-    WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), &rep);
 
     if (rep.numClipRects) {
         WriteToClient(client,
                       sizeof(drm_clip_rect_t) * rep.numClipRects,
-                      (char *) clipRects);
+                      clipRects);
     }
 
     if (rep.numBackClipRects) {
         WriteToClient(client,
                       sizeof(drm_clip_rect_t) * rep.numBackClipRects,
-                      (char *) backClipRects);
+                      backClipRects);
     }
     free(clipRects);
     clipRects = NULL;
@@ -1200,9 +1199,9 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
                                     pad_to_int32(rep.devPrivateSize));
     }
 
-    WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep);
     if (rep.length) {
-        WriteToClient(client, rep.devPrivateSize, (char *) pDevPrivate);
+        WriteToClient(client, rep.devPrivateSize, pDevPrivate);
     }
     EPHYR_LOG("leave\n");
     return Success;
diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c
index dab028b..1287e04 100644
--- a/hw/kdrive/ephyr/ephyrglxext.c
+++ b/hw/kdrive/ephyr/ephyrglxext.c
@@ -169,7 +169,7 @@ ephyrGLXQueryVersion(__GLXclientState * a_cl, GLbyte * a_pc)
         __glXSwapQueryVersionReply(client, &reply);
     }
     else {
-        WriteToClient(client, sz_xGLXQueryVersionReply, (char *) &reply);
+        WriteToClient(client, sz_xGLXQueryVersionReply, &reply);
     }
 
     res = Success;
@@ -228,7 +228,7 @@ ephyrGLXGetVisualConfigsReal(__GLXclientState * a_cl,
         __GLX_SWAP_INT(&reply.numProps);
         __GLX_SWAP_INT_ARRAY(props_buf, num_props);
     }
-    WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+    WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
     props_per_visual_size = props_buf_size / num_visuals;
     for (i = 0; i < num_visuals; i++) {
         WriteToClient(client,
@@ -282,7 +282,7 @@ ephyrGLXGetFBConfigsSGIXReal(__GLXclientState * a_cl,
         __GLX_SWAP_INT(&reply.numProps);
         __GLX_SWAP_INT_ARRAY(props_buf, num_props);
     }
-    WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+    WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
     props_per_visual_size = props_buf_size / num_visuals;
     for (i = 0; i < num_visuals; i++) {
         WriteToClient(client,
@@ -375,7 +375,7 @@ ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc)
     }
     memcpy(buf, server_string, length);
 
-    WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) &reply);
+    WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
     WriteToClient(client, (int) (reply.length << 2), server_string);
 
     res = Success;
@@ -538,7 +538,7 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
         __GLX_SWAP_INT(&reply.length);
         __GLX_SWAP_INT(&reply.contextTag);
     }
-    WriteToClient(a_cl->client, sz_xGLXMakeCurrentReply, (char *) &reply);
+    WriteToClient(a_cl->client, sz_xGLXMakeCurrentReply, &reply);
 
     res = Success;
  out:
@@ -601,7 +601,7 @@ ephyrGLXGetStringReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
         __GLX_SWAP_REPLY_SIZE();
         __GLX_SWAP_REPLY_HEADER();
     }
-    WriteToClient(client, length, (char *) string);
+    WriteToClient(client, length, string);
 
     res = Success;
  out:
@@ -690,7 +690,7 @@ ephyrGLXIsDirectReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
     reply.length = 0;
     reply.type = X_Reply;
     reply.sequenceNumber = client->sequence;
-    WriteToClient(client, sz_xGLXIsDirectReply, (char *) &reply);
+    WriteToClient(client, sz_xGLXIsDirectReply, &reply);
     res = Success;
 
  out:
diff --git a/hw/kdrive/ephyr/ephyrproxyext.c b/hw/kdrive/ephyr/ephyrproxyext.c
index 3d86d2d..c24238c 100644
--- a/hw/kdrive/ephyr/ephyrproxyext.c
+++ b/hw/kdrive/ephyr/ephyrproxyext.c
@@ -75,7 +75,7 @@ ephyrProxyProcDispatch(ClientPtr a_client)
     reply.sequence_number = a_client->sequence;
     res = Success;
 
-    WriteToClient(a_client, 32, (char *) &reply);
+    WriteToClient(a_client, 32, &reply);
 
  out:
     return res;
diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index 6b33941..1ed6a50 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -84,7 +84,7 @@ ProcXDGAQueryVersion(ClientPtr client)
     rep.majorVersion = SERVER_XDGA_MAJOR_VERSION;
     rep.minorVersion = SERVER_XDGA_MINOR_VERSION;
 
-    WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXDGAQueryVersionReply), &rep);
     return Success;
 }
 
@@ -117,7 +117,7 @@ ProcXDGAOpenFramebuffer(ClientPtr client)
     nameSize = deviceName ? (strlen(deviceName) + 1) : 0;
     rep.length = bytes_to_int32(nameSize);
 
-    WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), &rep);
     if (rep.length)
         WriteToClient(client, nameSize, deviceName);
 
@@ -164,12 +164,12 @@ ProcXDGAQueryModes(ClientPtr client)
     if (!DGAAvailable(stuff->screen)) {
         rep.number = 0;
         rep.length = 0;
-        WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep);
+        WriteToClient(client, sz_xXDGAQueryModesReply, &rep);
         return Success;
     }
 
     if (!(num = DGAGetModes(stuff->screen))) {
-        WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep);
+        WriteToClient(client, sz_xXDGAQueryModesReply, &rep);
         return Success;
     }
 
@@ -186,7 +186,7 @@ ProcXDGAQueryModes(ClientPtr client)
     rep.number = num;
     rep.length = bytes_to_int32(size);
 
-    WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep);
+    WriteToClient(client, sz_xXDGAQueryModesReply, &rep);
 
     for (i = 0; i < num; i++) {
         size = strlen(mode[i].name) + 1;
@@ -218,7 +218,7 @@ ProcXDGAQueryModes(ClientPtr client)
         info.reserved1 = mode[i].reserved1;
         info.reserved2 = mode[i].reserved2;
 
-        WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info));
+        WriteToClient(client, sz_xXDGAModeInfo, (&info));
         WriteToClient(client, size, mode[i].name);
     }
 
@@ -293,7 +293,7 @@ ProcXDGASetMode(ClientPtr client)
         DGA_SETCLIENT(stuff->screen, NULL);
         DGASelectInput(stuff->screen, NULL, 0);
         DGASetMode(stuff->screen, 0, &mode, &pPix);
-        WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep);
+        WriteToClient(client, sz_xXDGASetModeReply, &rep);
         return Success;
     }
 
@@ -345,8 +345,8 @@ ProcXDGASetMode(ClientPtr client)
 
     rep.length = bytes_to_int32(sz_xXDGAModeInfo + info.name_size);
 
-    WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep);
-    WriteToClient(client, sz_xXDGAModeInfo, (char *) (&info));
+    WriteToClient(client, sz_xXDGASetModeReply, &rep);
+    WriteToClient(client, sz_xXDGAModeInfo, (&info));
     WriteToClient(client, size, mode.name);
 
     return Success;
@@ -494,7 +494,7 @@ ProcXDGAGetViewportStatus(ClientPtr client)
 
     rep.status = DGAGetViewportStatus(stuff->screen);
 
-    WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), &rep);
     return Success;
 }
 
@@ -517,7 +517,7 @@ ProcXDGASync(ClientPtr client)
 
     DGASync(stuff->screen);
 
-    WriteToClient(client, sizeof(xXDGASyncReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXDGASyncReply), &rep);
     return Success;
 }
 
@@ -568,7 +568,7 @@ ProcXDGAChangePixmapMode(ClientPtr client)
 
     rep.x = x;
     rep.y = y;
-    WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), &rep);
 
     return Success;
 }
@@ -641,7 +641,7 @@ ProcXF86DGAGetVideoLL(ClientPtr client)
     rep.width = mode.bytesPerScanline / (mode.bitsPerPixel >> 3);
     rep.ram_size = rep.bank_size >> 10;
 
-    WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), &rep);
     return Success;
 }
 
@@ -732,7 +732,7 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
     rep.width = mode.viewportWidth;
     rep.height = mode.viewportHeight;
 
-    WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), &rep);
     return Success;
 }
 
@@ -777,7 +777,7 @@ ProcXF86DGAGetVidPage(ClientPtr client)
     rep.sequenceNumber = client->sequence;
     rep.vpage = 0;              /* silently fail */
 
-    WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), &rep);
     return Success;
 }
 
@@ -844,7 +844,7 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client)
     if (DGAAvailable(stuff->screen))
         rep.flags = XF86DGADirectPresent;
 
-    WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), &rep);
     return Success;
 }
 
@@ -870,7 +870,7 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
     rep.sequenceNumber = client->sequence;
     rep.result = 1;
 
-    WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), &rep);
     return Success;
 }
 
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 68c4b58..bd23dc2 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -296,7 +296,7 @@ ProcXF86VidModeQueryVersion(ClientPtr client)
         swaps(&rep.majorVersion);
         swaps(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), &rep);
     return Success;
 }
 
@@ -391,12 +391,10 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
         oldrep.vtotal = rep.vtotal;
         oldrep.flags = rep.flags;
         oldrep.privsize = rep.privsize;
-        WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply),
-                      (char *) &oldrep);
+        WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply), &oldrep);
     }
     else {
-        WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply),
-                      (char *) &rep);
+        WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply), &rep);
     }
     return Success;
 }
@@ -443,8 +441,7 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.modecount);
     }
-    WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply),
-                  (char *) &rep);
+    WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), &rep);
 
     do {
         mdinf.dotclock = dotClock;
@@ -485,12 +482,10 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
             oldmdinf.vtotal = mdinf.vtotal;
             oldmdinf.flags = mdinf.flags;
             oldmdinf.privsize = mdinf.privsize;
-            WriteToClient(client, sizeof(xXF86OldVidModeModeInfo),
-                          (char *) &oldmdinf);
+            WriteToClient(client, sizeof(xXF86OldVidModeModeInfo), &oldmdinf);
         }
         else {
-            WriteToClient(client, sizeof(xXF86VidModeModeInfo),
-                          (char *) &mdinf);
+            WriteToClient(client, sizeof(xXF86VidModeModeInfo), &mdinf);
         }
 
     } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
@@ -1040,8 +1035,7 @@ ProcXF86VidModeValidateModeLine(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.status);
     }
-    WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply),
-                  (char *) &rep);
+    WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), &rep);
     if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
         ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status);
     return Success;
@@ -1262,20 +1256,16 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
     }
-    WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), &rep);
     client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
     WriteSwappedDataToClient(client, nHsync * sizeof(CARD32), hsyncdata);
     WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32), vsyncdata);
     if (rep.vendorLength)
         WriteToClient(client, rep.vendorLength,
-                      (char
-                       *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR,
-                                                  0)).ptr);
+                 (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr);
     if (rep.modelLength)
         WriteToClient(client, rep.modelLength,
-                      (char
-                       *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL,
-                                                  0)).ptr);
+                 (VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr);
 
     free(hsyncdata);
     free(vsyncdata);
@@ -1311,7 +1301,7 @@ ProcXF86VidModeGetViewPort(ClientPtr client)
         swapl(&rep.x);
         swapl(&rep.y);
     }
-    WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), &rep);
     return Success;
 }
 
@@ -1380,7 +1370,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
         swapl(&rep.maxclocks);
         swapl(&rep.flags);
     }
-    WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), &rep);
     if (!ClockProg) {
         for (n = 0; n < numClocks; n++) {
             dotclock = *Clocks++;
@@ -1388,7 +1378,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
                 WriteSwappedDataToClient(client, 4, (char *) &dotclock);
             }
             else {
-                WriteToClient(client, 4, (char *) &dotclock);
+                WriteToClient(client, 4, &dotclock);
             }
         }
     }
@@ -1446,7 +1436,7 @@ ProcXF86VidModeGetGamma(ClientPtr client)
         swapl(&rep.green);
         swapl(&rep.blue);
     }
-    WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), &rep);
 
     return Success;
 }
@@ -1520,10 +1510,10 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
         swaps(&rep.size);
         SwapShorts((short *) ramp, length * 3);
     }
-    WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), &rep);
 
     if (stuff->size) {
-        WriteToClient(client, ramplen, (char *) ramp);
+        WriteToClient(client, ramplen, ramp);
         free(ramp);
     }
 
@@ -1551,8 +1541,7 @@ ProcXF86VidModeGetGammaRampSize(ClientPtr client)
         swapl(&rep.length);
         swaps(&rep.size);
     }
-    WriteToClient(client, sizeof(xXF86VidModeGetGammaRampSizeReply),
-                  (char *) &rep);
+    WriteToClient(client, sizeof(xXF86VidModeGetGammaRampSizeReply), &rep);
 
     return Success;
 }
@@ -1582,8 +1571,7 @@ ProcXF86VidModeGetPermissions(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.permissions);
     }
-    WriteToClient(client, sizeof(xXF86VidModeGetPermissionsReply),
-                  (char *) &rep);
+    WriteToClient(client, sizeof(xXF86VidModeGetPermissionsReply), &rep);
 
     return Success;
 }
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 72ce869..ee7b213 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -94,7 +94,7 @@ ProcXF86DRIQueryVersion(register ClientPtr client)
         swaps(&rep.minorVersion);
         swapl(&rep.patchVersion);
     }
-    WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), &rep);
     return Success;
 }
 
@@ -131,7 +131,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
 
     WriteToClient(client,
                   sizeof(xXF86DRIQueryDirectRenderingCapableReply),
-                  (char *) &rep);
+                  &rep);
     return Success;
 }
 
@@ -171,7 +171,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
     rep.hSAREAHigh = 0;
 #endif
 
-    WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
     if (rep.busIdStringLength)
         WriteToClient(client, rep.busIdStringLength, busIdString);
     return Success;
@@ -198,7 +198,7 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
         ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
         rep.authenticated = 0;
     }
-    WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), &rep);
     return Success;
 }
 
@@ -245,8 +245,7 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
                                 SIZEOF(xGenericReply) +
                                 pad_to_int32(rep.clientDriverNameLength));
 
-    WriteToClient(client,
-                  sizeof(xXF86DRIGetClientDriverNameReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIGetClientDriverNameReply), &rep);
     if (rep.clientDriverNameLength)
         WriteToClient(client, rep.clientDriverNameLength, clientDriverName);
     return Success;
@@ -277,7 +276,7 @@ ProcXF86DRICreateContext(register ClientPtr client)
         return BadValue;
     }
 
-    WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRICreateContextReply), &rep);
     return Success;
 }
 
@@ -326,7 +325,7 @@ ProcXF86DRICreateDrawable(ClientPtr client)
         return BadValue;
     }
 
-    WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), &rep);
     return Success;
 }
 
@@ -444,19 +443,19 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
 
     rep.length = bytes_to_int32(rep.length);
 
-    WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), &rep);
 
     if (rep.numClipRects) {
         WriteToClient(client,
                       sizeof(drm_clip_rect_t) * rep.numClipRects,
-                      (char *) pClippedRects);
+                      pClippedRects);
         free(pClippedRects);
     }
 
     if (rep.numBackClipRects) {
         WriteToClient(client,
                       sizeof(drm_clip_rect_t) * rep.numBackClipRects,
-                      (char *) pBackClipRects);
+                      pBackClipRects);
     }
 
     return Success;
@@ -503,9 +502,9 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
                                     pad_to_int32(rep.devPrivateSize));
     }
 
-    WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep);
     if (rep.length) {
-        WriteToClient(client, rep.devPrivateSize, (char *) pDevPrivate);
+        WriteToClient(client, rep.devPrivateSize, pDevPrivate);
     }
     return Success;
 }
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 81db13e..d41a81d 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -157,7 +157,7 @@ ProcAppleWMQueryVersion(register ClientPtr client)
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
     }
-    WriteToClient(client, sizeof(xAppleWMQueryVersionReply), (char *)&rep);
+    WriteToClient(client, sizeof(xAppleWMQueryVersionReply),&rep);
     return Success;
 }
 
@@ -533,7 +533,7 @@ ProcAppleWMFrameGetRect(register ClientPtr client)
     rep.w = rr.x2 - rr.x1;
     rep.h = rr.y2 - rr.y1;
 
-    WriteToClient(client, sizeof(xAppleWMFrameGetRectReply), (char *)&rep);
+    WriteToClient(client, sizeof(xAppleWMFrameGetRectReply),&rep);
     return Success;
 }
 
@@ -560,7 +560,7 @@ ProcAppleWMFrameHitTest(register ClientPtr client)
 
     rep.ret = ret;
 
-    WriteToClient(client, sizeof(xAppleWMFrameHitTestReply), (char *)&rep);
+    WriteToClient(client, sizeof(xAppleWMFrameHitTestReply),&rep);
     return Success;
 }
 
diff --git a/hw/xquartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c
index 8bb7f2d..c146687 100644
--- a/hw/xquartz/pseudoramiX.c
+++ b/hw/xquartz/pseudoramiX.c
@@ -216,7 +216,7 @@ ProcPseudoramiXGetState(ClientPtr client)
         swapl(&rep.length);
         swaps(&rep.state);
     }
-    WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep);
+    WriteToClient(client, sizeof(xPanoramiXGetStateReply),&rep);
     return Success;
 }
 
@@ -245,7 +245,7 @@ ProcPseudoramiXGetScreenCount(ClientPtr client)
         swapl(&rep.length);
         swaps(&rep.ScreenCount);
     }
-    WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
+    WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply),&rep);
     return Success;
 }
 
@@ -279,7 +279,7 @@ ProcPseudoramiXGetScreenSize(ClientPtr client)
         swaps(&rep.width);
         swaps(&rep.height);
     }
-    WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
+    WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply),&rep);
     return Success;
 }
 
@@ -303,7 +303,7 @@ ProcPseudoramiXIsActive(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.state);
     }
-    WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *)&rep);
+    WriteToClient(client, sizeof(xXineramaIsActiveReply),&rep);
     return Success;
 }
 
@@ -329,7 +329,7 @@ ProcPseudoramiXQueryScreens(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.number);
     }
-    WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *)&rep);
+    WriteToClient(client, sizeof(xXineramaQueryScreensReply),&rep);
 
     if (!noPseudoramiXExtension) {
         xXineramaScreenInfo scratch;
@@ -347,7 +347,7 @@ ProcPseudoramiXQueryScreens(ClientPtr client)
                 swaps(&scratch.width);
                 swaps(&scratch.height);
             }
-            WriteToClient(client, sz_XineramaScreenInfo, (char *)&scratch);
+            WriteToClient(client, sz_XineramaScreenInfo,&scratch);
         }
     }
 
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index 1bb8379..f77848f 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -105,7 +105,7 @@ ProcAppleDRIQueryVersion(register ClientPtr client)
         swaps(&rep.minorVersion);
         swapl(&rep.patchVersion);
     }
-    WriteToClient(client, sizeof(xAppleDRIQueryVersionReply), (char *)&rep);
+    WriteToClient(client, sizeof(xAppleDRIQueryVersionReply), &rep);
     return Success;
 }
 
@@ -139,7 +139,7 @@ ProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client)
 
     WriteToClient(client,
                   sizeof(xAppleDRIQueryDirectRenderingCapableReply),
-                  (char *)&rep);
+                  &rep);
     return Success;
 }
 
@@ -168,7 +168,7 @@ ProcAppleDRIAuthConnection(register ClientPtr client)
         swapl(&rep.authenticated); /* Yes, this is a CARD32 ... sigh */
     }
 
-    WriteToClient(client, sizeof(xAppleDRIAuthConnectionReply), (char *)&rep);
+    WriteToClient(client, sizeof(xAppleDRIAuthConnectionReply), &rep);
     return Success;
 }
 
@@ -232,7 +232,7 @@ ProcAppleDRICreateSurface(ClientPtr client)
         swapl(&rep.uid);
     }
 
-    WriteToClient(client, sizeof(xAppleDRICreateSurfaceReply), (char *)&rep);
+    WriteToClient(client, sizeof(xAppleDRICreateSurfaceReply), &rep);
     return Success;
 }
 
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index f67c383..77c997a 100644
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -95,7 +95,7 @@ ProcWindowsWMQueryVersion(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
     }
-    WriteToClient(client, sizeof(xWindowsWMQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xWindowsWMQueryVersionReply), &rep);
     return Success;
 }
 
@@ -366,7 +366,7 @@ ProcWindowsWMFrameGetRect(ClientPtr client)
            rep.x, rep.y, rep.w, rep.h);
 #endif
 
-    WriteToClient(client, sizeof(xWindowsWMFrameGetRectReply), (char *) &rep);
+    WriteToClient(client, sizeof(xWindowsWMFrameGetRectReply), &rep);
     return Success;
 }
 
diff --git a/include/dix.h b/include/dix.h
index 3d8b0e5..5bc1daa 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -102,12 +102,12 @@ SOFTWARE.
    if ((pClient)->swapped) \
       (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \
            (pClient, (int)(size), pReply); \
-      else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); }
+   else WriteToClient(pClient, (int)(size), (pReply)); }
 
 #define WriteSwappedDataToClient(pClient, size, pbuf) \
    if ((pClient)->swapped) \
       (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \
-   else (void) WriteToClient (pClient, (int)(size), (char *)(pbuf));
+   else WriteToClient(pClient, (int)(size), (pbuf));
 
 typedef struct _TimeStamp *TimeStampPtr;
 
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 1a6e593..7616e7c 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -975,9 +975,9 @@ ProcRRGetCrtcInfo(ClientPtr client)
         swaps(&rep.nOutput);
         swaps(&rep.nPossibleOutput);
     }
-    WriteToClient(client, sizeof(xRRGetCrtcInfoReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRGetCrtcInfoReply), &rep);
     if (extraLen) {
-        WriteToClient(client, extraLen, (char *) extra);
+        WriteToClient(client, extraLen, extra);
         free(extra);
     }
 
@@ -1181,7 +1181,7 @@ ProcRRSetCrtcConfig(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.newTimestamp);
     }
-    WriteToClient(client, sizeof(xRRSetCrtcConfigReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRSetCrtcConfigReply), &rep);
 
     return Success;
 }
@@ -1250,7 +1250,7 @@ ProcRRGetPanning(ClientPtr client)
         swaps(&rep.border_right);
         swaps(&rep.border_bottom);
     }
-    WriteToClient(client, sizeof(xRRGetPanningReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRGetPanningReply), &rep);
     return Success;
 }
 
@@ -1318,7 +1318,7 @@ ProcRRSetPanning(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.newTimestamp);
     }
-    WriteToClient(client, sizeof(xRRSetPanningReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRSetPanningReply), &rep);
     return Success;
 }
 
@@ -1345,7 +1345,7 @@ ProcRRGetCrtcGammaSize(ClientPtr client)
         swapl(&reply.length);
         swaps(&reply.size);
     }
-    WriteToClient(client, sizeof(xRRGetCrtcGammaSizeReply), (char *) &reply);
+    WriteToClient(client, sizeof(xRRGetCrtcGammaSizeReply), &reply);
     return Success;
 }
 
@@ -1382,7 +1382,7 @@ ProcRRGetCrtcGamma(ClientPtr client)
         swapl(&reply.length);
         swaps(&reply.size);
     }
-    WriteToClient(client, sizeof(xRRGetCrtcGammaReply), (char *) &reply);
+    WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply);
     if (crtc->gammaSize) {
         memcpy(extra, crtc->gammaRed, len);
         client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
@@ -1548,8 +1548,7 @@ ProcRRGetCrtcTransform(ClientPtr client)
         swaps(&reply->sequenceNumber);
         swapl(&reply->length);
     }
-    WriteToClient(client, sizeof(xRRGetCrtcTransformReply) + nextra,
-                  (char *) reply);
+    WriteToClient(client, sizeof(xRRGetCrtcTransformReply) + nextra, reply);
     free(reply);
     return Success;
 }
diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index 1942d74..d071787 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -63,7 +63,7 @@ ProcRRQueryVersion(ClientPtr client)
         swapl(&rep.majorVersion);
         swapl(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xRRQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRQueryVersionReply), &rep);
     return Success;
 }
 
diff --git a/randr/rrmode.c b/randr/rrmode.c
index 49a45c7..7e17d7d 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -320,7 +320,7 @@ ProcRRCreateMode(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.mode);
     }
-    WriteToClient(client, sizeof(xRRCreateModeReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRCreateModeReply), &rep);
     /* Drop out reference to this mode */
     RRModeDestroy(mode);
     return Success;
diff --git a/randr/rroutput.c b/randr/rroutput.c
index fbd0e32..fd03aab 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -489,9 +489,9 @@ ProcRRGetOutputInfo(ClientPtr client)
         swaps(&rep.nClones);
         swaps(&rep.nameLength);
     }
-    WriteToClient(client, sizeof(xRRGetOutputInfoReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRGetOutputInfoReply), &rep);
     if (extraLen) {
-        WriteToClient(client, extraLen, (char *) extra);
+        WriteToClient(client, extraLen, extra);
         free(extra);
     }
 
diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 75948fc..e8f0578 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -407,7 +407,7 @@ ProcRRListOutputProperties(ClientPtr client)
     for (prop = output->properties; prop; prop = prop->next)
         *temppAtoms++ = prop->propertyName;
 
-    WriteToClient(client, sizeof(xRRListOutputPropertiesReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep);
     if (numProps) {
         client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
         WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
@@ -448,7 +448,7 @@ ProcRRQueryOutputProperty(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
     }
-    WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), &rep);
     if (prop->num_valid) {
         memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32));
         client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 9bf9316..ec07bb1 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -228,7 +228,7 @@ ProcRRGetScreenSizeRange(ClientPtr client)
         swaps(&rep.maxWidth);
         swaps(&rep.maxHeight);
     }
-    WriteToClient(client, sizeof(xRRGetScreenSizeRangeReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRGetScreenSizeRangeReply), &rep);
     return Success;
 }
 
@@ -450,9 +450,9 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen)
         swaps(&rep.nModes);
         swaps(&rep.nbytesNames);
     }
-    WriteToClient(client, sizeof(xRRGetScreenResourcesReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRGetScreenResourcesReply), &rep);
     if (extraLen) {
-        WriteToClient(client, extraLen, (char *) extra);
+        WriteToClient(client, extraLen, extra);
         free(extra);
     }
     return Success;
@@ -860,9 +860,9 @@ ProcRRGetScreenInfo(ClientPtr client)
         swaps(&rep.rate);
         swaps(&rep.nrateEnts);
     }
-    WriteToClient(client, sizeof(xRRGetScreenInfoReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRGetScreenInfoReply), &rep);
     if (extraLen) {
-        WriteToClient(client, extraLen, (char *) extra);
+        WriteToClient(client, extraLen, extra);
         free(extra);
     }
     return Success;
@@ -1092,7 +1092,7 @@ ProcRRSetScreenConfig(ClientPtr client)
         swapl(&rep.newConfigTimestamp);
         swapl(&rep.root);
     }
-    WriteToClient(client, sizeof(xRRSetScreenConfigReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRRSetScreenConfigReply), &rep);
 
     return Success;
 }
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index aa8a61e..269a63f 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -103,7 +103,7 @@ ProcRRXineramaQueryVersion(ClientPtr client)
         swaps(&rep.majorVersion);
         swaps(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep);
     return Success;
 }
 
@@ -140,7 +140,7 @@ ProcRRXineramaGetState(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.window);
     }
-    WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *) &rep);
+    WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep);
     return Success;
 }
 
@@ -194,7 +194,7 @@ ProcRRXineramaGetScreenCount(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.window);
     }
-    WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *) &rep);
+    WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), &rep);
     return Success;
 }
 
@@ -230,7 +230,7 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
         swapl(&rep.window);
         swapl(&rep.screen);
     }
-    WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *) &rep);
+    WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep);
     return Success;
 }
 
@@ -251,7 +251,7 @@ ProcRRXineramaIsActive(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.state);
     }
-    WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXineramaIsActiveReply), &rep);
     return Success;
 }
 
@@ -314,7 +314,7 @@ ProcRRXineramaQueryScreens(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.number);
     }
-    WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
 
     if (rep.number) {
         rrScrPriv(pScreen);
diff --git a/record/record.c b/record/record.c
index 8a38118..a3ee4dd 100644
--- a/record/record.c
+++ b/record/record.c
@@ -241,12 +241,12 @@ RecordFlushReplyBuffer(RecordContextPtr pContext,
     ++pContext->inFlush;
     if (pContext->numBufBytes)
         WriteToClient(pContext->pRecordingClient, pContext->numBufBytes,
-                      (char *) pContext->replyBuffer);
+                      pContext->replyBuffer);
     pContext->numBufBytes = 0;
     if (len1)
-        WriteToClient(pContext->pRecordingClient, len1, (char *) data1);
+        WriteToClient(pContext->pRecordingClient, len1, data1);
     if (len2)
-        WriteToClient(pContext->pRecordingClient, len2, (char *) data2);
+        WriteToClient(pContext->pRecordingClient, len2, data2);
     --pContext->inFlush;
 }                               /* RecordFlushReplyBuffer */
 
@@ -1829,8 +1829,7 @@ ProcRecordQueryVersion(ClientPtr client)
         swaps(&rep.majorVersion);
         swaps(&rep.minorVersion);
     }
-    (void) WriteToClient(client, sizeof(xRecordQueryVersionReply),
-                         (char *) &rep);
+    WriteToClient(client, sizeof(xRecordQueryVersionReply), &rep);
     return Success;
 }                               /* ProcRecordQueryVersion */
 
@@ -2240,7 +2239,7 @@ ProcRecordGetContext(ClientPtr client)
         swapl(&rep.length);
         swapl(&rep.nClients);
     }
-    (void) WriteToClient(client, sizeof(xRecordGetContextReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRecordGetContextReply), &rep);
 
     /* write all the CLIENT_INFOs */
 
@@ -2257,9 +2256,9 @@ ProcRecordGetContext(ClientPtr client)
             rci.clientResource = pRCAP->pClientIDs[i];
             if (client->swapped)
                 swapl(&rci.clientResource);
-            WriteToClient(client, sizeof(xRecordClientInfo), (char *) &rci);
+            WriteToClient(client, sizeof(xRecordClientInfo), &rci);
             WriteToClient(client, sizeof(xRecordRange) * pri->nRanges,
-                          (char *) pri->pRanges);
+                          pri->pRanges);
         }
     }
     err = Success;
diff --git a/render/render.c b/render/render.c
index fe7666d..be7d21e 100644
--- a/render/render.c
+++ b/render/render.c
@@ -296,7 +296,7 @@ ProcRenderQueryVersion(ClientPtr client)
         swapl(&rep.majorVersion);
         swapl(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xRenderQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xRenderQueryVersionReply), &rep);
     return Success;
 }
 
@@ -500,7 +500,7 @@ ProcRenderQueryPictFormats(ClientPtr client)
         swapl(&reply->numVisuals);
         swapl(&reply->numSubpixel);
     }
-    WriteToClient(client, rlength, (char *) reply);
+    WriteToClient(client, rlength, reply);
     free(reply);
     return Success;
 }
@@ -557,7 +557,7 @@ ProcRenderQueryPictIndexValues(ClientPtr client)
         swapl(&reply->numIndexValues);
     }
 
-    WriteToClient(client, rlength, (char *) reply);
+    WriteToClient(client, rlength, reply);
     free(reply);
     return Success;
 }
@@ -1748,7 +1748,7 @@ ProcRenderQueryFilters(ClientPtr client)
         swapl(&reply->numAliases);
         swapl(&reply->numFilters);
     }
-    WriteToClient(client, total_bytes, (char *) reply);
+    WriteToClient(client, total_bytes, reply);
     free(reply);
 
     return Success;
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 467529a..79530f9 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -409,8 +409,8 @@ ProcXFixesGetCursorImage(ClientPtr client)
         swapl(&rep->cursorSerial);
         SwapLongs(image, npixels);
     }
-    WriteToClient(client, sizeof(xXFixesGetCursorImageReply) +
-                  (npixels << 2), (char *) rep);
+    WriteToClient(client,
+                  sizeof(xXFixesGetCursorImageReply) + (npixels << 2), rep);
     free(rep);
     return Success;
 }
@@ -565,7 +565,7 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
         SwapLongs(image, npixels);
     }
     WriteToClient(client, sizeof(xXFixesGetCursorImageAndNameReply) +
-                  (npixels << 2) + nbytesRound, (char *) rep);
+                  (npixels << 2) + nbytesRound, rep);
     free(rep);
     return Success;
 }
diff --git a/xfixes/region.c b/xfixes/region.c
index 0acbada..89675e5 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -584,7 +584,7 @@ ProcXFixesFetchRegion(ClientPtr client)
         swaps(&reply->height);
         SwapShorts((INT16 *) pRect, nBox * 4);
     }
-    (void) WriteToClient(client, sizeof(xXFixesFetchRegionReply) +
+    WriteToClient(client, sizeof(xXFixesFetchRegionReply) +
                          nBox * sizeof(xRectangle), (char *) reply);
     free(reply);
     return Success;
diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
index f80230f..54f84f4 100644
--- a/xfixes/xfixes.c
+++ b/xfixes/xfixes.c
@@ -90,7 +90,7 @@ ProcXFixesQueryVersion(ClientPtr client)
         swapl(&rep.majorVersion);
         swapl(&rep.minorVersion);
     }
-    WriteToClient(client, sizeof(xXFixesQueryVersionReply), (char *) &rep);
+    WriteToClient(client, sizeof(xXFixesQueryVersionReply), &rep);
     return Success;
 }
 
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 0bec24f..b21815c 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -193,7 +193,7 @@ ProcXkbUseExtension(ClientPtr client)
         swaps(&rep.serverMajor);
         swaps(&rep.serverMinor);
     }
-    WriteToClient(client, SIZEOF(xkbUseExtensionReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xkbUseExtensionReply), &rep);
     return Success;
 }
 
@@ -596,7 +596,7 @@ ProcXkbGetState(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swaps(&rep.ptrBtnState);
     }
-    WriteToClient(client, SIZEOF(xkbGetStateReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xkbGetStateReply), &rep);
     return Success;
 }
 
@@ -741,7 +741,7 @@ ProcXkbGetControls(ClientPtr client)
         swaps(&rep.axtOptsValues);
         swaps(&rep.axOptions);
     }
-    WriteToClient(client, SIZEOF(xkbGetControlsReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xkbGetControlsReply), &rep);
     return Success;
 }
 
@@ -1433,7 +1433,7 @@ XkbSendMap(ClientPtr client, XkbDescPtr xkb, xkbGetMapReply * rep)
         swaps(&rep->totalSyms);
         swaps(&rep->totalActs);
     }
-    WriteToClient(client, (i = SIZEOF(xkbGetMapReply)), (char *) rep);
+    WriteToClient(client, (i = SIZEOF(xkbGetMapReply)), rep);
     WriteToClient(client, len, start);
     free((char *) start);
     return Success;
@@ -2744,7 +2744,7 @@ XkbSendCompatMap(ClientPtr client,
         swaps(&rep->nTotalSI);
     }
 
-    WriteToClient(client, SIZEOF(xkbGetCompatMapReply), (char *) rep);
+    WriteToClient(client, SIZEOF(xkbGetCompatMapReply), rep);
     if (data) {
         WriteToClient(client, size, data);
         free((char *) data);
@@ -3044,7 +3044,7 @@ ProcXkbGetIndicatorState(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swapl(&rep.state);
     }
-    WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), &rep);
     return Success;
 }
 
@@ -3118,9 +3118,9 @@ XkbSendIndicatorMap(ClientPtr client,
         swapl(&rep->which);
         swapl(&rep->realIndicators);
     }
-    WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), (char *) rep);
+    WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), rep);
     if (map) {
-        WriteToClient(client, length, (char *) map);
+        WriteToClient(client, length, map);
         free((char *) map);
     }
     return Success;
@@ -3343,7 +3343,7 @@ ProcXkbGetNamedIndicator(ClientPtr client)
         swapl(&rep.ctrls);
     }
 
-    WriteToClient(client, SIZEOF(xkbGetNamedIndicatorReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xkbGetNamedIndicatorReply), &rep);
     return Success;
 }
 
@@ -3857,7 +3857,7 @@ XkbSendNames(ClientPtr client, XkbDescPtr xkb, xkbGetNamesReply * rep)
         ErrorF("[xkb] BOGUS LENGTH in write names, expected %d, got %ld\n",
                length, (unsigned long) (desc - start));
     }
-    WriteToClient(client, SIZEOF(xkbGetNamesReply), (char *) rep);
+    WriteToClient(client, SIZEOF(xkbGetNamesReply), rep);
     WriteToClient(client, length, start);
     free((char *) start);
     return Success;
@@ -4904,7 +4904,7 @@ XkbSendGeometry(ClientPtr client,
         swaps(&rep->nDoodads);
         swaps(&rep->nKeyAliases);
     }
-    WriteToClient(client, SIZEOF(xkbGetGeometryReply), (char *) rep);
+    WriteToClient(client, SIZEOF(xkbGetGeometryReply), rep);
     if (len > 0)
         WriteToClient(client, len, start);
     if (start != NULL)
@@ -5538,7 +5538,7 @@ ProcXkbPerClientFlags(ClientPtr client)
         swapl(&rep.autoCtrls);
         swapl(&rep.autoCtrlValues);
     }
-    WriteToClient(client, SIZEOF(xkbPerClientFlagsReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xkbPerClientFlagsReply), &rep);
     return Success;
 }
 
@@ -5667,9 +5667,9 @@ ProcXkbListComponents(ClientPtr client)
         swaps(&rep.nGeometries);
         swaps(&rep.extra);
     }
-    WriteToClient(client, SIZEOF(xkbListComponentsReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xkbListComponentsReply), &rep);
     if (list.nPool && list.pool) {
-        WriteToClient(client, XkbPaddedSize(list.nPool), (char *) list.pool);
+        WriteToClient(client, XkbPaddedSize(list.nPool), list.pool);
         free(list.pool);
         list.pool = NULL;
     }
@@ -5939,7 +5939,7 @@ ProcXkbGetKbdByName(ClientPtr client)
         swaps(&rep.found);
         swaps(&rep.reported);
     }
-    WriteToClient(client, SIZEOF(xkbGetKbdByNameReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xkbGetKbdByNameReply), &rep);
     if (reported & (XkbGBN_SymbolsMask | XkbGBN_TypesMask))
         XkbSendMap(client, new, &mrep);
     if (reported & XkbGBN_CompatMapMask)
@@ -6136,7 +6136,7 @@ SendDeviceLedInfo(XkbSrvLedInfoPtr sli, ClientPtr client)
         swapl(&wire.physIndicators);
         swapl(&wire.state);
     }
-    WriteToClient(client, SIZEOF(xkbDeviceLedsWireDesc), (char *) &wire);
+    WriteToClient(client, SIZEOF(xkbDeviceLedsWireDesc), &wire);
     length += SIZEOF(xkbDeviceLedsWireDesc);
     if (sli->namesPresent | sli->mapsPresent) {
         register unsigned i, bit;
@@ -6150,7 +6150,7 @@ SendDeviceLedInfo(XkbSrvLedInfoPtr sli, ClientPtr client)
                     if (client->swapped) {
                         swapl(&awire);
                     }
-                    WriteToClient(client, 4, (char *) &awire);
+                    WriteToClient(client, 4, &awire);
                     length += 4;
                 }
             }
@@ -6173,7 +6173,7 @@ SendDeviceLedInfo(XkbSrvLedInfoPtr sli, ClientPtr client)
                         swapl(&iwire.ctrls);
                     }
                     WriteToClient(client, SIZEOF(xkbIndicatorMapWireDesc),
-                                  (char *) &iwire);
+                                  &iwire);
                     length += SIZEOF(xkbIndicatorMapWireDesc);
                 }
             }
@@ -6343,7 +6343,7 @@ ProcXkbGetDeviceInfo(ClientPtr client)
         swaps(&rep.dfltLedFB);
         swapl(&rep.devType);
     }
-    WriteToClient(client, SIZEOF(xkbGetDeviceInfoReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xkbGetDeviceInfoReply), &rep);
 
     str = malloc(nameLen);
     if (!str)
@@ -6359,7 +6359,7 @@ ProcXkbGetDeviceInfo(ClientPtr client)
 
         sz = rep.nBtnsRtrn * SIZEOF(xkbActionWireDesc);
         awire = (xkbActionWireDesc *) & dev->button->xkb_acts[rep.firstBtnRtrn];
-        WriteToClient(client, sz, (char *) awire);
+        WriteToClient(client, sz, awire);
         length -= sz;
     }
     if (nDeviceLedFBs > 0) {
@@ -6760,7 +6760,7 @@ ProcXkbSetDebuggingFlags(ClientPtr client)
         swapl(&rep.supportedFlags);
         swapl(&rep.supportedCtrls);
     }
-    WriteToClient(client, SIZEOF(xkbSetDebuggingFlagsReply), (char *) &rep);
+    WriteToClient(client, SIZEOF(xkbSetDebuggingFlagsReply), &rep);
     return Success;
 }
 
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index d49e4c1..beb09cf 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -243,7 +243,7 @@ XkbSendStateNotify(DeviceIntPtr kbd, xkbStateNotify * pSN)
                 swaps(&pSN->changed);
                 swaps(&pSN->ptrBtnState);
             }
-            WriteToClient(interest->client, sizeof(xEvent), (char *) pSN);
+            WriteToClient(interest->client, sizeof(xEvent), pSN);
         }
         interest = interest->next;
     }
@@ -416,7 +416,7 @@ XkbSendControlsNotify(DeviceIntPtr kbd, xkbControlsNotify * pCN)
                 swapl(&pCN->enabledControlChanges);
                 swapl(&pCN->time);
             }
-            WriteToClient(interest->client, sizeof(xEvent), (char *) pCN);
+            WriteToClient(interest->client, sizeof(xEvent), pCN);
         }
         interest = interest->next;
     }
@@ -463,7 +463,7 @@ XkbSendIndicatorNotify(DeviceIntPtr kbd, int xkbType, xkbIndicatorNotify * pEv)
                 swapl(&pEv->changed);
                 swapl(&pEv->state);
             }
-            WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+            WriteToClient(interest->client, sizeof(xEvent), pEv);
         }
         interest = interest->next;
     }
@@ -550,7 +550,7 @@ XkbHandleBell(BOOL force,
                 swapl(&bn.name);
                 swapl(&bn.window);
             }
-            WriteToClient(interest->client, sizeof(xEvent), (char *) &bn);
+            WriteToClient(interest->client, sizeof(xEvent), &bn);
         }
         interest = interest->next;
     }
@@ -594,7 +594,7 @@ XkbSendAccessXNotify(DeviceIntPtr kbd, xkbAccessXNotify * pEv)
                 swaps(&pEv->slowKeysDelay);
                 swaps(&pEv->debounceDelay);
             }
-            WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+            WriteToClient(interest->client, sizeof(xEvent), pEv);
         }
         interest = interest->next;
     }
@@ -642,7 +642,7 @@ XkbSendNamesNotify(DeviceIntPtr kbd, xkbNamesNotify * pEv)
                 swapl(&pEv->changedIndicators);
                 swaps(&pEv->changedVirtualMods);
             }
-            WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+            WriteToClient(interest->client, sizeof(xEvent), pEv);
         }
         interest = interest->next;
     }
@@ -689,7 +689,7 @@ XkbSendCompatMapNotify(DeviceIntPtr kbd, xkbCompatMapNotify * pEv)
                 swaps(&pEv->nSI);
                 swaps(&pEv->nTotalSI);
             }
-            WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+            WriteToClient(interest->client, sizeof(xEvent), pEv);
         }
         interest = interest->next;
     }
@@ -732,7 +732,7 @@ XkbSendActionMessage(DeviceIntPtr kbd, xkbActionMessage * pEv)
                 swaps(&pEv->sequenceNumber);
                 swapl(&pEv->time);
             }
-            WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+            WriteToClient(interest->client, sizeof(xEvent), pEv);
         }
         interest = interest->next;
     }
@@ -786,7 +786,7 @@ XkbSendExtensionDeviceNotify(DeviceIntPtr dev,
                 swaps(&pEv->reason);
                 swaps(&pEv->supported);
             }
-            WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+            WriteToClient(interest->client, sizeof(xEvent), pEv);
         }
         interest = interest->next;
     }


More information about the xorg-commit mailing list