[PATCH 11/19] Use C99 designated initializers in dmx Replies

Alan Coopersmith alan.coopersmith at oracle.com
Sun Jun 24 10:25:18 PDT 2012


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 hw/dmx/dmx.c                  |  546 ++++++++++++++++++++++-------------------
 hw/dmx/glxProxy/glxcmds.c     |  271 ++++++++++----------
 hw/dmx/glxProxy/glxcmdsswap.c |   29 ++-
 hw/dmx/glxProxy/glxsingle.c   |   97 ++++----
 4 files changed, 496 insertions(+), 447 deletions(-)

diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c
index 5ea133e..c06b127 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);
@@ -232,30 +233,30 @@ ProcDMXQueryVersion(ClientPtr client)
 static int
 ProcDMXSync(ClientPtr client)
 {
-    xDMXSyncReply rep;
-
     REQUEST_SIZE_MATCH(xDMXSyncReq);
 
     dmxFlushPendingSyncs();
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = 0;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.status);
+    {
+        xDMXSyncReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .status = 0
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.status);
+        }
+        WriteToClient(client, sizeof(xDMXSyncReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXSyncReply), &rep);
-    return Success;
 }
 
 static int
 ProcDMXForceWindowCreation(ClientPtr client)
 {
-    xDMXForceWindowCreationReply rep;
-
     REQUEST(xDMXForceWindowCreationReq);
     WindowPtr pWin;
 
@@ -288,46 +289,49 @@ ProcDMXForceWindowCreation(ClientPtr client)
     dmxForceWindowCreation(pWin);
  doreply:
     dmxFlushPendingSyncs();
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = 0;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.status);
+    {
+        xDMXForceWindowCreationReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .status = 0
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.status);
+        }
+        WriteToClient(client, sizeof(xDMXForceWindowCreationReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXForceWindowCreationReply), &rep);
-    return Success;
 }
 
 static int
 ProcDMXGetScreenCount(ClientPtr client)
 {
-    xDMXGetScreenCountReply rep;
-
     REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.screenCount = dmxGetNumScreens();
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.screenCount);
+    {
+        xDMXGetScreenCountReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .screenCount = dmxGetNumScreens()
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.screenCount);
+        }
+        WriteToClient(client, sizeof(xDMXGetScreenCountReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXGetScreenCountReply), &rep);
-    return Success;
 }
 
 static int
 ProcDMXGetScreenAttributes(ClientPtr client)
 {
     REQUEST(xDMXGetScreenAttributesReq);
-    xDMXGetScreenAttributesReply rep;
-    int length;
-    int paddedLength;
     DMXScreenAttributesRec attr;
 
     REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq);
@@ -338,56 +342,58 @@ 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;
-
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.displayNameLength);
-        swapl(&rep.logicalScreen);
-        swaps(&rep.screenWindowWidth);
-        swaps(&rep.screenWindowHeight);
-        swaps(&rep.screenWindowXoffset);
-        swaps(&rep.screenWindowYoffset);
-        swaps(&rep.rootWindowWidth);
-        swaps(&rep.rootWindowHeight);
-        swaps(&rep.rootWindowXoffset);
-        swaps(&rep.rootWindowYoffset);
-        swaps(&rep.rootWindowXorigin);
-        swaps(&rep.rootWindowYorigin);
+    else {
+        int length = attr.displayName ? strlen(attr.displayName) : 0;
+        int paddedLength = pad_to_int32(length);
+
+        xDMXGetScreenAttributesReply rep = {
+            .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);
+            swapl(&rep.length);
+            swapl(&rep.displayNameLength);
+            swapl(&rep.logicalScreen);
+            swaps(&rep.screenWindowWidth);
+            swaps(&rep.screenWindowHeight);
+            swaps(&rep.screenWindowXoffset);
+            swaps(&rep.screenWindowYoffset);
+            swaps(&rep.rootWindowWidth);
+            swaps(&rep.rootWindowHeight);
+            swaps(&rep.rootWindowXoffset);
+            swaps(&rep.rootWindowYoffset);
+            swaps(&rep.rootWindowXorigin);
+            swaps(&rep.rootWindowYorigin);
+        }
+        WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), &rep);
+        if (length)
+            WriteToClient(client, length, attr.displayName);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), &rep);
-    if (length)
-        WriteToClient(client, length, attr.displayName);
-    return Success;
 }
 
 static int
 ProcDMXChangeScreensAttributes(ClientPtr client)
 {
     REQUEST(xDMXChangeScreensAttributesReq);
-    xDMXChangeScreensAttributesReply rep;
     int status = DMX_BAD_XINERAMA;
     unsigned int mask = 0;
     unsigned int i;
@@ -442,26 +448,29 @@ ProcDMXChangeScreensAttributes(ClientPtr client)
         return status;
 
  noxinerama:
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
-    rep.errorScreen = errorScreen;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.status);
-        swapl(&rep.errorScreen);
+    {
+        xDMXChangeScreensAttributesReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .status = status,
+            .errorScreen = errorScreen
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.status);
+            swapl(&rep.errorScreen);
+        }
+        WriteToClient(client, sizeof(xDMXChangeScreensAttributesReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXChangeScreensAttributesReply), &rep);
-    return Success;
 }
 
 static int
 ProcDMXAddScreen(ClientPtr client)
 {
     REQUEST(xDMXAddScreenReq);
-    xDMXAddScreenReply rep;
     int status = 0;
     CARD32 *value_list;
     DMXScreenAttributesRec attr;
@@ -491,43 +500,50 @@ ProcDMXAddScreen(ClientPtr client)
 
     free(name);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
-    rep.physicalScreen = stuff->physicalScreen;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.status);
-        swapl(&rep.physicalScreen);
+    {
+        xDMXAddScreenReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .status = status,
+            .physicalScreen = stuff->physicalScreen
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.status);
+            swapl(&rep.physicalScreen);
+        }
+        WriteToClient(client, sizeof(xDMXAddScreenReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXAddScreenReply), &rep);
-    return Success;
 }
 
 static int
 ProcDMXRemoveScreen(ClientPtr client)
 {
     REQUEST(xDMXRemoveScreenReq);
-    xDMXRemoveScreenReply rep;
     int status = 0;
 
     REQUEST_SIZE_MATCH(xDMXRemoveScreenReq);
 
     status = dmxDetachScreen(stuff->physicalScreen);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.status);
+    {
+        xDMXRemoveScreenReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .status = status
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.status);
+        }
+        WriteToClient(client, sizeof(xDMXRemoveScreenReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXRemoveScreenReply), &rep);
-    return Success;
 }
 
 #ifdef PANORAMIX
@@ -600,7 +616,6 @@ static int
 ProcDMXGetWindowAttributes(ClientPtr client)
 {
     REQUEST(xDMXGetWindowAttributesReq);
-    xDMXGetWindowAttributesReply rep;
     int i;
     CARD32 *screens;
     CARD32 *windows;
@@ -635,85 +650,89 @@ ProcDMXGetWindowAttributes(ClientPtr client)
         free(screens);
         return BadWindow;
     }
-
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = count * 6;
-    rep.screenCount = count;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.screenCount);
-        for (i = 0; i < count; i++) {
-            swapl(&screens[i]);
-            swapl(&windows[i]);
-
-            swaps(&pos[i].x);
-            swaps(&pos[i].y);
-            swaps(&pos[i].width);
-            swaps(&pos[i].height);
-
-            swaps(&vis[i].x);
-            swaps(&vis[i].y);
-            swaps(&vis[i].width);
-            swaps(&vis[i].height);
+    else {
+        xDMXGetWindowAttributesReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = count * 6,
+            .screenCount = count
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.screenCount);
+            for (i = 0; i < count; i++) {
+                swapl(&screens[i]);
+                swapl(&windows[i]);
+
+                swaps(&pos[i].x);
+                swaps(&pos[i].y);
+                swaps(&pos[i].width);
+                swaps(&pos[i].height);
+
+                swaps(&vis[i].x);
+                swaps(&vis[i].y);
+                swaps(&vis[i].width);
+                swaps(&vis[i].height);
+            }
         }
-    }
 
-    dmxFlushPendingSyncs();
+        dmxFlushPendingSyncs();
 
-    WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), &rep);
-    if (count) {
-        WriteToClient(client, count * sizeof(*screens), screens);
-        WriteToClient(client, count * sizeof(*windows), windows);
-        WriteToClient(client, count * sizeof(*pos), pos);
-        WriteToClient(client, count * sizeof(*vis), vis);
-    }
+        WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), &rep);
+        if (count) {
+            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);
-    free(pos);
-    free(windows);
-    free(screens);
+        free(vis);
+        free(pos);
+        free(windows);
+        free(screens);
 
-    return Success;
+        return Success;
+    }
 }
 
 static int
 ProcDMXGetDesktopAttributes(ClientPtr client)
 {
-    xDMXGetDesktopAttributesReply rep;
     DMXDesktopAttributesRec attr;
 
     REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq);
 
     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;
-
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swaps(&rep.width);
-        swaps(&rep.height);
-        swaps(&rep.shiftX);
-        swaps(&rep.shiftY);
+    {
+        xDMXGetDesktopAttributesReply rep = {
+            .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);
+            swapl(&rep.length);
+            swaps(&rep.width);
+            swaps(&rep.height);
+            swaps(&rep.shiftX);
+            swaps(&rep.shiftY);
+        }
+        WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), &rep);
-    return Success;
 }
 
 static int
 ProcDMXChangeDesktopAttributes(ClientPtr client)
 {
     REQUEST(xDMXChangeDesktopAttributesReq);
-    xDMXChangeDesktopAttributesReply rep;
     int status = DMX_BAD_XINERAMA;
     CARD32 *value_list;
     DMXDesktopAttributesRec attr;
@@ -739,84 +758,92 @@ ProcDMXChangeDesktopAttributes(ClientPtr client)
         return status;
 
  noxinerama:
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.status);
+    {
+        xDMXChangeDesktopAttributesReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .status = status
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.status);
+        }
+        WriteToClient(client, sizeof(xDMXChangeDesktopAttributesReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXChangeDesktopAttributesReply), &rep);
-    return Success;
 }
 
 static int
 ProcDMXGetInputCount(ClientPtr client)
 {
-    xDMXGetInputCountReply rep;
-
     REQUEST_SIZE_MATCH(xDMXGetInputCountReq);
 
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.inputCount = dmxGetInputCount();
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.inputCount);
+    {
+        xDMXGetInputCountReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .inputCount = dmxGetInputCount()
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.inputCount);
+        }
+        WriteToClient(client, sizeof(xDMXGetInputCountReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXGetInputCountReply), &rep);
-    return Success;
 }
 
 static int
 ProcDMXGetInputAttributes(ClientPtr client)
 {
     REQUEST(xDMXGetInputAttributesReq);
-    xDMXGetInputAttributesReply rep;
-    int length;
-    int paddedLength;
     DMXInputAttributesRec attr;
 
     REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq);
 
     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;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.inputType);
-        swapl(&rep.physicalScreen);
-        swapl(&rep.physicalId);
-        swapl(&rep.nameLength);
+    else {
+        int length = attr.name ? strlen(attr.name) : 0;
+        int paddedLength = pad_to_int32(length);
+
+        xDMXGetInputAttributesReply rep = {
+            .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);
+            swapl(&rep.inputType);
+            swapl(&rep.physicalScreen);
+            swapl(&rep.physicalId);
+            swapl(&rep.nameLength);
+        }
+        WriteToClient(client, sizeof(xDMXGetInputAttributesReply), &rep);
+        if (length)
+            WriteToClient(client, length, attr.name);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXGetInputAttributesReply), &rep);
-    if (length)
-        WriteToClient(client, length, attr.name);
-    return Success;
 }
 
 static int
 ProcDMXAddInput(ClientPtr client)
 {
     REQUEST(xDMXAddInputReq);
-    xDMXAddInputReply rep;
     int status = 0;
     CARD32 *value_list;
     DMXInputAttributesRec attr;
@@ -848,27 +875,29 @@ ProcDMXAddInput(ClientPtr client)
 
     if (status)
         return status;
-
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
-    rep.physicalId = id;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.status);
-        swapl(&rep.physicalId);
+    else {
+        xDMXAddInputReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .status = status,
+            .physicalId = id
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.status);
+            swapl(&rep.physicalId);
+        }
+        WriteToClient(client, sizeof(xDMXAddInputReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXAddInputReply), &rep);
-    return Success;
 }
 
 static int
 ProcDMXRemoveInput(ClientPtr client)
 {
     REQUEST(xDMXRemoveInputReq);
-    xDMXRemoveInputReply rep;
     int status = 0;
 
     REQUEST_SIZE_MATCH(xDMXRemoveInputReq);
@@ -877,18 +906,21 @@ ProcDMXRemoveInput(ClientPtr client)
 
     if (status)
         return status;
-
-    rep.type = X_Reply;
-    rep.sequenceNumber = client->sequence;
-    rep.length = 0;
-    rep.status = status;
-    if (client->swapped) {
-        swaps(&rep.sequenceNumber);
-        swapl(&rep.length);
-        swapl(&rep.status);
+    else {
+        xDMXRemoveInputReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .status = status
+        };
+        if (client->swapped) {
+            swaps(&rep.sequenceNumber);
+            swapl(&rep.length);
+            swapl(&rep.status);
+        }
+        WriteToClient(client, sizeof(xDMXRemoveInputReply), &rep);
+        return Success;
     }
-    WriteToClient(client, sizeof(xDMXRemoveInputReply), &rep);
-    return Success;
 }
 
 static int
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index 32684fa..29b8ec0 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) {
@@ -1425,7 +1426,6 @@ __glXIsDirect(__GLXclientState * cl, GLbyte * pc)
 {
     ClientPtr client = cl->client;
     xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
-    xGLXIsDirectReply reply;
     __GLXcontext *glxc;
 
     /*
@@ -1437,20 +1437,23 @@ __glXIsDirect(__GLXclientState * cl, GLbyte * pc)
         client->errorValue = req->context;
         return __glXBadContext;
     }
+    else {
+        xGLXIsDirectReply reply = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .isDirect = 0
+        };
 
-    reply.isDirect = 0;
-    reply.length = 0;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
+        if (client->swapped) {
+            __glXSwapIsDirectReply(client, &reply);
+        }
+        else {
+            WriteToClient(client, sz_xGLXIsDirectReply, &reply);
+        }
 
-    if (client->swapped) {
-        __glXSwapIsDirectReply(client, &reply);
-    }
-    else {
-        WriteToClient(client, sz_xGLXIsDirectReply, &reply);
+        return Success;
     }
-
-    return Success;
 }
 
 int
@@ -1459,18 +1462,18 @@ __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);
@@ -1665,7 +1668,10 @@ __glXGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
 {
     ClientPtr client = cl->client;
     xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
-    xGLXGetVisualConfigsReply reply;
+    xGLXGetVisualConfigsReply reply = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence
+    };
     __GLXscreenInfo *pGlxScreen;
     __GLXvisualConfig *pGlxVisual;
     CARD32 buf[__GLX_TOTAL_CONFIG];
@@ -1684,8 +1690,6 @@ __glXGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
     reply.numProps = __GLX_TOTAL_CONFIG;
     reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
                     __GLX_TOTAL_CONFIG) >> 2;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
 
     WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
 
@@ -2565,9 +2569,7 @@ __glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
 {
     ClientPtr client = cl->client;
     xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
-    xGLXQueryExtensionsStringReply reply;
     GLint screen;
-    size_t length;
     int len, numbytes;
     char *be_buf;
 
@@ -2624,20 +2626,23 @@ __glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
 
 #endif
 
-    length = len;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = len;
-    reply.n = numbytes;
+    {
+        size_t length = len;
+        xGLXQueryExtensionsStringReply reply = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = len,
+            .n = numbytes
+        };
 
-    if (client->swapped) {
-        glxSwapQueryExtensionsStringReply(client, &reply, be_buf);
-    }
-    else {
-        WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply);
-        WriteToClient(client, (int) (length << 2), be_buf);
+        if (client->swapped) {
+            glxSwapQueryExtensionsStringReply(client, &reply, be_buf);
+        }
+        else {
+            WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply);
+            WriteToClient(client, (int) (length << 2), be_buf);
+        }
     }
-
     return Success;
 }
 
@@ -2646,10 +2651,8 @@ __glXQueryServerString(__GLXclientState * cl, GLbyte * pc)
 {
     ClientPtr client = cl->client;
     xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
-    xGLXQueryServerStringReply reply;
     int name;
     GLint screen;
-    size_t length;
     int len, numbytes;
     char *be_buf;
 
@@ -2705,20 +2708,23 @@ __glXQueryServerString(__GLXclientState * cl, GLbyte * pc)
     len = __GLX_PAD(numbytes) >> 2;
 #endif
 
-    length = len;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = length;
-    reply.n = numbytes;
+    {
+        size_t length = len;
+        xGLXQueryServerStringReply reply = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = length,
+            .n = numbytes
+        };
 
-    if (client->swapped) {
-        glxSwapQueryServerStringReply(client, &reply, be_buf);
-    }
-    else {
-        WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
-        WriteToClient(client, (int) (length << 2), be_buf);
+        if (client->swapped) {
+            glxSwapQueryServerStringReply(client, &reply, be_buf);
+        }
+        else {
+            WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
+            WriteToClient(client, (int) (length << 2), be_buf);
+        }
     }
-
     return Success;
 }
 
@@ -2846,7 +2852,6 @@ __glXGetFBConfigs(__GLXclientState * cl, GLbyte * pc)
 {
     ClientPtr client = cl->client;
     xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
-    xGLXGetFBConfigsReply reply;
     __GLXFBConfig *pFBConfig;
     CARD32 buf[2 * __GLX_TOTAL_FBCONFIG_PROPS];
     int numAttribs = __GLX_TOTAL_FBCONFIG_PROPS;
@@ -2863,20 +2868,24 @@ __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;
+    {
+        xGLXGetFBConfigsReply reply = {
+            .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;
-        __GLX_SWAP_SHORT(&reply.sequenceNumber);
-        __GLX_SWAP_INT(&reply.length);
-        __GLX_SWAP_INT(&reply.numFBConfigs);
-        __GLX_SWAP_INT(&reply.numAttribs);
+        if (client->swapped) {
+            __GLX_DECLARE_SWAP_VARIABLES;
+            __GLX_SWAP_SHORT(&reply.sequenceNumber);
+            __GLX_SWAP_INT(&reply.length);
+            __GLX_SWAP_INT(&reply.numFBConfigs);
+            __GLX_SWAP_INT(&reply.numAttribs);
+        }
+        WriteToClient(client, sz_xGLXGetFBConfigsReply, &reply);
     }
-    WriteToClient(client, sz_xGLXGetFBConfigsReply, &reply);
 
     for (i = 0; i < numFBConfigs; i++) {
         int associatedVisualId = 0;
@@ -3180,10 +3189,6 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)
     ClientPtr client = cl->client;
     __GLXcontext *ctx;
     xGLXQueryContextReq *req;
-    xGLXQueryContextReply reply;
-    int nProps;
-    int *sendBuf, *pSendBuf;
-    int nReplyBytes;
 
     req = (xGLXQueryContextReq *) pc;
     dixLookupResourceByType((pointer *) &ctx, req->context, __glXContextRes,
@@ -3192,34 +3197,36 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)
         client->errorValue = req->context;
         return __glXBadContext;
     }
+    else {
+        int nProps = 3;
+        xGLXQueryContextReply reply = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = nProps << 1,
+            .n = nProps
+        };
+        int nReplyBytes = reply.length << 2;
+        int *sendBuf = malloc(nReplyBytes);
+        int *pSendBuf = sendBuf;
+
+        *pSendBuf++ = GLX_FBCONFIG_ID;
+        *pSendBuf++ = (int) (ctx->pFBConfig->id);
+        *pSendBuf++ = GLX_RENDER_TYPE;
+        *pSendBuf++ = (int) (ctx->pFBConfig->renderType);
+        *pSendBuf++ = GLX_SCREEN;
+        *pSendBuf++ = (int) (ctx->pScreen->myNum);
 
-    nProps = 3;
-
-    reply.length = nProps << 1;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.n = nProps;
-
-    nReplyBytes = reply.length << 2;
-    sendBuf = (int *) malloc(nReplyBytes);
-    pSendBuf = sendBuf;
-    *pSendBuf++ = GLX_FBCONFIG_ID;
-    *pSendBuf++ = (int) (ctx->pFBConfig->id);
-    *pSendBuf++ = GLX_RENDER_TYPE;
-    *pSendBuf++ = (int) (ctx->pFBConfig->renderType);
-    *pSendBuf++ = GLX_SCREEN;
-    *pSendBuf++ = (int) (ctx->pScreen->myNum);
+        if (client->swapped) {
+            __glXSwapQueryContextReply(client, &reply, sendBuf);
+        }
+        else {
+            WriteToClient(client, sz_xGLXQueryContextReply, &reply);
+            WriteToClient(client, nReplyBytes, sendBuf);
+        }
+        free((char *) sendBuf);
 
-    if (client->swapped) {
-        __glXSwapQueryContextReply(client, &reply, sendBuf);
+        return Success;
     }
-    else {
-        WriteToClient(client, sz_xGLXQueryContextReply, &reply);
-        WriteToClient(client, nReplyBytes, sendBuf);
-    }
-    free((char *) sendBuf);
-
-    return Success;
 }
 
 int
@@ -3228,10 +3235,6 @@ __glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc)
     ClientPtr client = cl->client;
     __GLXcontext *ctx;
     xGLXQueryContextInfoEXTReq *req;
-    xGLXQueryContextInfoEXTReply reply;
-    int nProps;
-    int *sendBuf, *pSendBuf;
-    int nReplyBytes;
 
     req = (xGLXQueryContextInfoEXTReq *) pc;
     dixLookupResourceByType((pointer *) &ctx,
@@ -3242,36 +3245,38 @@ __glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc)
         client->errorValue = req->context;
         return __glXBadContext;
     }
+    else {
+        int nProps = 4;
+        xGLXQueryContextInfoEXTReply reply = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = nProps << 1,
+            .n = nProps
+        };
+        int nReplyBytes = reply.length << 2;
+        int *sendBuf = malloc(nReplyBytes);
+        int *pSendBuf = sendBuf;
+
+        *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
+        *pSendBuf++ = (int) (ctx->share_id);
+        *pSendBuf++ = GLX_VISUAL_ID_EXT;
+        *pSendBuf++ = (int) (ctx->pVisual ? ctx->pVisual->vid : 0);
+        *pSendBuf++ = GLX_SCREEN_EXT;
+        *pSendBuf++ = (int) (ctx->pScreen->myNum);
+        *pSendBuf++ = GLX_FBCONFIG_ID;
+        *pSendBuf++ = (int) (ctx->pFBConfig ? ctx->pFBConfig->id : 0);
 
-    nProps = 4;
-
-    reply.length = nProps << 1;
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.n = nProps;
-
-    nReplyBytes = reply.length << 2;
-    sendBuf = (int *) malloc(nReplyBytes);
-    pSendBuf = sendBuf;
-    *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
-    *pSendBuf++ = (int) (ctx->share_id);
-    *pSendBuf++ = GLX_VISUAL_ID_EXT;
-    *pSendBuf++ = (int) (ctx->pVisual ? ctx->pVisual->vid : 0);
-    *pSendBuf++ = GLX_SCREEN_EXT;
-    *pSendBuf++ = (int) (ctx->pScreen->myNum);
-    *pSendBuf++ = GLX_FBCONFIG_ID;
-    *pSendBuf++ = (int) (ctx->pFBConfig ? ctx->pFBConfig->id : 0);
+        if (client->swapped) {
+            __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
+        }
+        else {
+            WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
+            WriteToClient(client, nReplyBytes, sendBuf);
+        }
+        free((char *) sendBuf);
 
-    if (client->swapped) {
-        __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
+        return Success;
     }
-    else {
-        WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
-        WriteToClient(client, nReplyBytes, sendBuf);
-    }
-    free((char *) sendBuf);
-
-    return Success;
 }
 
 int
diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c
index a11c919..13ef50e 100644
--- a/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/hw/dmx/glxProxy/glxcmdsswap.c
@@ -274,7 +274,6 @@ __glXSwapGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
 {
     ClientPtr client = cl->client;
     xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
-    xGLXGetVisualConfigsReply reply;
     __GLXscreenInfo *pGlxScreen;
     __GLXvisualConfig *pGlxVisual;
     CARD32 buf[__GLX_TOTAL_CONFIG];
@@ -293,18 +292,22 @@ __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;
-
-    __GLX_SWAP_SHORT(&reply.sequenceNumber);
-    __GLX_SWAP_INT(&reply.length);
-    __GLX_SWAP_INT(&reply.numVisuals);
-    __GLX_SWAP_INT(&reply.numProps);
-    WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
+    {
+        xGLXGetVisualConfigsReply reply = {
+            .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);
+        __GLX_SWAP_INT(&reply.numVisuals);
+        __GLX_SWAP_INT(&reply.numProps);
+        WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
+    }
 
     for (i = 0; i < pGlxScreen->numVisuals; i++) {
         pGlxVisual = &pGlxScreen->pGlxVisual[i];
diff --git a/hw/dmx/glxProxy/glxsingle.c b/hw/dmx/glxProxy/glxsingle.c
index 2253060..ba953ae 100644
--- a/hw/dmx/glxProxy/glxsingle.c
+++ b/hw/dmx/glxProxy/glxsingle.c
@@ -213,7 +213,6 @@ __glXForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
     ClientPtr client = cl->client;
     xGLXSingleReq *req = (xGLXSingleReq *) pc;
     xGLXSingleReq *be_req;
-    xGLXSingleReply reply;
     xGLXSingleReply be_reply;
     __GLXcontext *glxc;
     int buf_size;
@@ -269,21 +268,25 @@ __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;
-
-    if (client->swapped) {
-        SendSwappedReply(client, &reply, be_buf, be_buf_size);
-    }
-    else {
-        WriteToClient(client, sizeof(xGLXSingleReply), &reply);
-        if (be_buf_size > 0)
-            WriteToClient(client, be_buf_size, be_buf);
+    {
+        xGLXSingleReply reply = {
+            .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);
+        }
+        else {
+            WriteToClient(client, sizeof(xGLXSingleReply), &reply);
+            if (be_buf_size > 0)
+                WriteToClient(client, be_buf_size, be_buf);
+        }
     }
 
     if (be_buf_size > 0)
@@ -298,7 +301,6 @@ __glXForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
     ClientPtr client = cl->client;
     xGLXSingleReq *req = (xGLXSingleReq *) pc;
     xGLXSingleReq *be_req;
-    xGLXSingleReply reply;
     xGLXSingleReply be_reply;
     __GLXcontext *glxc;
     int buf_size;
@@ -371,21 +373,25 @@ __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;
-
-    if (client->swapped) {
-        SendSwappedReply(client, &reply, be_buf, be_buf_size);
-    }
-    else {
-        WriteToClient(client, sizeof(xGLXSingleReply), &reply);
-        if (be_buf_size > 0)
-            WriteToClient(client, be_buf_size, be_buf);
+    {
+        xGLXSingleReply reply = {
+            .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);
+        }
+        else {
+            WriteToClient(client, sizeof(xGLXSingleReply), &reply);
+            if (be_buf_size > 0)
+                WriteToClient(client, be_buf_size, be_buf);
+        }
     }
 
     if (be_buf_size > 0)
@@ -779,7 +785,6 @@ __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
 {
     xGLXSingleReq *req = (xGLXSingleReq *) pc;
     xGLXSingleReq *be_req;
-    xGLXReadPixelsReply reply;
     xGLXReadPixelsReply be_reply;
     GLbyte *be_pc;
     GLint x, y;
@@ -1004,19 +1009,23 @@ __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
 
     }                           /* of if buf_size > 0 */
 
-    reply.type = X_Reply;
-    reply.sequenceNumber = client->sequence;
-    reply.length = buf_size >> 2;
+    {
+        xGLXReadPixelsReply reply = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = buf_size >> 2
+        };
 
-    if (client->swapped) {
-        __GLX_SWAP_SHORT(&reply.sequenceNumber);
-        __GLX_SWAP_INT(&reply.length);
-    }
+        if (client->swapped) {
+            __GLX_SWAP_SHORT(&reply.sequenceNumber);
+            __GLX_SWAP_INT(&reply.length);
+        }
 
-    WriteToClient(client, sizeof(xGLXReadPixelsReply), &reply);
-    if (buf_size > 0) {
-        WriteToClient(client, buf_size, buf);
-        free(buf);
+        WriteToClient(client, sizeof(xGLXReadPixelsReply), &reply);
+        if (buf_size > 0) {
+            WriteToClient(client, buf_size, buf);
+            free(buf);
+        }
     }
 
     return Success;
-- 
1.7.9.2



More information about the xorg-devel mailing list