xserver: Branch 'master' - 7 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Feb 6 20:10:02 UTC 2025
glx/clientinfo.c | 2 -
glx/createcontext.c | 2 -
glx/glxcmds.c | 95 ++++++++++++++++++++++------------------------------
glx/indirect_util.c | 30 ++++++++--------
glx/single2.c | 10 ++---
glx/single2swap.c | 7 +--
glx/unpack.h | 2 -
glx/vndcmds.c | 4 +-
8 files changed, 70 insertions(+), 82 deletions(-)
New commits:
commit a647cc8a41995e17228934607ec16f7c6387150b
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Aug 28 14:22:31 2024 +0200
glx: DoQueryContext(): use core's swapping macros
No need to have duplicated byte swapping macros in GLX for things that
the core alreay provides. Using core's macros is actually even easier.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 4a157dcae..90154b404 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1684,12 +1684,10 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
sendBuf[9] = (int) (ctx->renderType);
if (client->swapped) {
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.n);
- __GLX_SWAP_INT_ARRAY(sendBuf, sizeof(sendBuf) / sizeof(CARD32));
+ swaps(&reply.sequenceNumber);
+ swapl(&reply.length);
+ swapl(&reply.n);
+ SwapLongs(sendBuf, sizeof(sendBuf) / 4);
}
WriteToClient(client, sizeof(xGLXQueryContextInfoEXTReply), &reply);
commit 56ca98aa47f97ed8e34450f701d69806df3aa4aa
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Aug 28 14:09:55 2024 +0200
glx: DoQueryContext(): drop duplicate write path
We now have two copies of the same write path in both swapped and
non-swapped branch. One is enough.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 6f27ee609..4a157dcae 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1689,15 +1689,12 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.n);
- WriteToClient(client, sizeof(xGLXQueryContextInfoEXTReply), &reply);
__GLX_SWAP_INT_ARRAY(sendBuf, sizeof(sendBuf) / sizeof(CARD32));
- WriteToClient(client, sizeof(sendBuf), sendBuf);
- }
- else {
- WriteToClient(client, sizeof(xGLXQueryContextInfoEXTReply), &reply);
- WriteToClient(client, sizeof(sendBuf), sendBuf);
}
+ WriteToClient(client, sizeof(xGLXQueryContextInfoEXTReply), &reply);
+ WriteToClient(client, sizeof(sendBuf), sendBuf);
+
return Success;
}
commit ab4142bc75d7d913c585ca5beeb6aebb2b8480b8
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Aug 28 13:35:20 2024 +0200
glx: DoQueryContext(): determine reply length from buffer size
The reply length (in units as well as bytes) can safely be determined
at compile time, by using sizeof() operator. No need for unnecessarily
complicated shifting bits back and forth.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index a7043e93c..6f27ee609 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1660,7 +1660,6 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
ClientPtr client = cl->client;
__GLXcontext *ctx;
CARD32 sendBuf[GLX_QUERY_NPROPS * 2];
- int nReplyBytes;
int err;
if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
@@ -1669,11 +1668,10 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
xGLXQueryContextInfoEXTReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
- .length = GLX_QUERY_NPROPS << 1,
+ .length = bytes_to_int32(sizeof(sendBuf)),
.n = GLX_QUERY_NPROPS,
};
- nReplyBytes = reply.length << 2;
sendBuf[0] = GLX_SHARE_CONTEXT_EXT;
sendBuf[1] = (int) (ctx->share_id);
sendBuf[2] = GLX_VISUAL_ID_EXT;
@@ -1686,20 +1684,18 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
sendBuf[9] = (int) (ctx->renderType);
if (client->swapped) {
- int length = reply.length;
-
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.n);
WriteToClient(client, sizeof(xGLXQueryContextInfoEXTReply), &reply);
- __GLX_SWAP_INT_ARRAY(sendBuf, length);
- WriteToClient(client, length << 2, sendBuf);
+ __GLX_SWAP_INT_ARRAY(sendBuf, sizeof(sendBuf) / sizeof(CARD32));
+ WriteToClient(client, sizeof(sendBuf), sendBuf);
}
else {
WriteToClient(client, sizeof(xGLXQueryContextInfoEXTReply), &reply);
- WriteToClient(client, nReplyBytes, sendBuf);
+ WriteToClient(client, sizeof(sendBuf), sendBuf);
}
return Success;
commit ef77c486d5fceaaa00b19662a9edaff3e5d92010
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Aug 28 13:31:35 2024 +0200
glx: DoQueryContext(): explicitly use reply buf type defined by spec
The spec defines the reply as array of "CARD32", not "int". The latter
just accidentially has the same type (for now :o), but it's *semantically*
incorrect. Using CARD32 instead.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index a17af308e..a7043e93c 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1659,7 +1659,7 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
- int sendBuf[GLX_QUERY_NPROPS * 2];
+ CARD32 sendBuf[GLX_QUERY_NPROPS * 2];
int nReplyBytes;
int err;
@@ -1694,7 +1694,7 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.n);
WriteToClient(client, sizeof(xGLXQueryContextInfoEXTReply), &reply);
- __GLX_SWAP_INT_ARRAY((int *) sendBuf, length);
+ __GLX_SWAP_INT_ARRAY(sendBuf, length);
WriteToClient(client, length << 2, sendBuf);
}
else {
commit 0a7763bfcea9e6efbe70cca754f122efe5bd636f
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Aug 28 13:28:50 2024 +0200
glx: DoQueryContext(): use fixed size array instead of variable length
Our array here really is fixed, but it's size is determined by a variable
(that's assigned a fix values), unncessarily making it a VLA (even making
it const doesn't change that), so giving false alarms when compiling w/
-Wvla or -Werror=vla.
Replacing the variable by #define trivially fixes this.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index ac9bf20a2..a17af308e 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1652,13 +1652,14 @@ __glXDisp_SwapBuffers(__GLXclientState * cl, GLbyte * pc)
return Success;
}
+#define GLX_QUERY_NPROPS 5
+
static int
DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
- int nProps = 5;
- int sendBuf[nProps * 2];
+ int sendBuf[GLX_QUERY_NPROPS * 2];
int nReplyBytes;
int err;
@@ -1668,8 +1669,8 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
xGLXQueryContextInfoEXTReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
- .length = nProps << 1,
- .n = nProps
+ .length = GLX_QUERY_NPROPS << 1,
+ .n = GLX_QUERY_NPROPS,
};
nReplyBytes = reply.length << 2;
@@ -1704,6 +1705,8 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
return Success;
}
+#undef GLX_QUERY_NPROPS
+
int
__glXDisp_QueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc)
{
commit 6bd673ab152dca665495080bb88911da37d7d366
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Aug 28 13:27:23 2024 +0200
glx: use sizeof() for reply struct
The reply struct's size can safely be determined by the sizeof()
operator, so no need for using an extra define here. Making the code
easier to read and also open the door for future convenience macros
that might determine the buffer size on their own.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
diff --git a/glx/clientinfo.c b/glx/clientinfo.c
index 778ca31dd..899f5d2c0 100644
--- a/glx/clientinfo.c
+++ b/glx/clientinfo.c
@@ -41,7 +41,7 @@ set_client_info(__GLXclientState * cl, xGLXSetClientInfoARBReq * req,
/* Verify that the size of the packet matches the size inferred from the
* sizes specified for the various fields.
*/
- size = sz_xGLXSetClientInfoARBReq;
+ size = sizeof(xGLXSetClientInfoARBReq);
size = safe_add(size, safe_mul(req->numVersions, bytes_per_version));
size = safe_add(size, safe_pad(req->numGLExtensionBytes));
size = safe_add(size, safe_pad(req->numGLXExtensionBytes));
diff --git a/glx/createcontext.c b/glx/createcontext.c
index 185bd6bb2..59ecf3eaf 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -114,7 +114,7 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
/* Verify that the size of the packet matches the size inferred from the
* sizes specified for the various fields.
*/
- const unsigned expected_size = (sz_xGLXCreateContextAttribsARBReq
+ const unsigned expected_size = (sizeof(xGLXCreateContextAttribsARBReq)
+ (req->numAttribs * 8)) / 4;
if (req->length != expected_size)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 12b3c7dc5..ac9bf20a2 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -720,7 +720,7 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
}
- WriteToClient(client, sz_xGLXIsDirectReply, &reply);
+ WriteToClient(client, sizeof(xGLXIsDirectReply), &reply);
return Success;
}
@@ -759,7 +759,7 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc)
__GLX_SWAP_INT(&reply.minorVersion);
}
- WriteToClient(client, sz_xGLXQueryVersionReply, &reply);
+ WriteToClient(client, sizeof(xGLXQueryVersionReply), &reply);
return Success;
}
@@ -930,7 +930,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
__GLX_SWAP_INT(&reply.numProps);
}
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
+ WriteToClient(client, sizeof(xGLXGetVisualConfigsReply), &reply);
for (i = 0; i < pGlxScreen->numVisuals; i++) {
modes = pGlxScreen->visuals[i];
@@ -1043,7 +1043,7 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
__GLX_SWAP_INT(&reply.numAttribs);
}
- WriteToClient(client, sz_xGLXGetFBConfigsReply, &reply);
+ WriteToClient(client, sizeof(xGLXGetFBConfigsReply), &reply);
for (modes = pGlxScreen->fbconfigs; modes != NULL; modes = modes->next) {
p = 0;
@@ -1692,12 +1692,12 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.n);
- WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
+ WriteToClient(client, sizeof(xGLXQueryContextInfoEXTReply), &reply);
__GLX_SWAP_INT_ARRAY((int *) sendBuf, length);
WriteToClient(client, length << 2, sendBuf);
}
else {
- WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
+ WriteToClient(client, sizeof(xGLXQueryContextInfoEXTReply), &reply);
WriteToClient(client, nReplyBytes, sendBuf);
}
@@ -1935,12 +1935,12 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.numAttribs);
- WriteToClient(client, sz_xGLXGetDrawableAttributesReply, &reply);
+ WriteToClient(client, sizeof(xGLXGetDrawableAttributesReply), &reply);
__GLX_SWAP_INT_ARRAY((int *) attributes, length);
WriteToClient(client, length << 2, attributes);
}
else {
- WriteToClient(client, sz_xGLXGetDrawableAttributesReply, &reply);
+ WriteToClient(client, sizeof(xGLXGetDrawableAttributesReply), &reply);
WriteToClient(client, reply.length * sizeof(CARD32), attributes);
}
@@ -2020,8 +2020,8 @@ __glXDisp_Render(__GLXclientState * cl, GLbyte * pc)
}
commandsDone = 0;
- pc += sz_xGLXRenderReq;
- left = (req->length << 2) - sz_xGLXRenderReq;
+ pc += sizeof(xGLXRenderReq);
+ left = (req->length << 2) - sizeof(xGLXRenderReq);
while (left > 0) {
__GLXrenderSizeData entry;
int extra = 0;
@@ -2130,18 +2130,18 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc)
/*
** Check the request length.
*/
- if ((req->length << 2) != safe_pad(dataBytes) + sz_xGLXRenderLargeReq) {
+ if ((req->length << 2) != safe_pad(dataBytes) + sizeof(xGLXRenderLargeReq)) {
client->errorValue = req->length;
/* Reset in case this isn't 1st request. */
ResetLargeCommandStatus(glxc);
return BadLength;
}
- pc += sz_xGLXRenderLargeReq;
+ pc += sizeof(xGLXRenderLargeReq);
if (glxc->largeCmdRequestsSoFar == 0) {
__GLXrenderSizeData entry;
int extra = 0;
- int left = (req->length << 2) - sz_xGLXRenderLargeReq;
+ int left = (req->length << 2) - sizeof(xGLXRenderLargeReq);
int cmdlen;
int err;
@@ -2396,12 +2396,12 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.n);
- WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply);
+ WriteToClient(client, sizeof(xGLXQueryExtensionsStringReply), &reply);
__GLX_SWAP_INT_ARRAY((int *) buf, length);
WriteToClient(client, length << 2, buf);
}
else {
- WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply);
+ WriteToClient(client, sizeof(xGLXQueryExtensionsStringReply), &reply);
WriteToClient(client, (int) (length << 2), buf);
}
@@ -2468,13 +2468,13 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.n);
- WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
+ WriteToClient(client, sizeof(xGLXQueryServerStringReply), &reply);
/** no swap is needed for an array of chars **/
/* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
WriteToClient(client, length << 2, buf);
}
else {
- WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
+ WriteToClient(client, sizeof(xGLXQueryServerStringReply), &reply);
WriteToClient(client, (int) (length << 2), buf);
}
diff --git a/glx/indirect_util.c b/glx/indirect_util.c
index 56ef179cd..83579c529 100644
--- a/glx/indirect_util.c
+++ b/glx/indirect_util.c
@@ -135,7 +135,7 @@ __glXSendReply(ClientPtr client, const void *data, size_t elements,
*/
(void) memcpy(&reply.pad3, data, 8);
- WriteToClient(client, sz_xGLXSingleReply, &reply);
+ WriteToClient(client, sizeof(xGLXSingleReply), &reply);
if (reply_ints != 0) {
WriteToClient(client, reply_ints * 4, data);
@@ -183,7 +183,7 @@ __glXSendReplySwap(ClientPtr client, const void *data, size_t elements,
*/
(void) memcpy(&reply.pad3, data, 8);
- WriteToClient(client, sz_xGLXSingleReply, &reply);
+ WriteToClient(client, sizeof(xGLXSingleReply), &reply);
if (reply_ints != 0) {
WriteToClient(client, reply_ints * 4, data);
diff --git a/glx/single2.c b/glx/single2.c
index ef355b470..18fd2c1bc 100644
--- a/glx/single2.c
+++ b/glx/single2.c
@@ -198,7 +198,7 @@ __glXDisp_RenderMode(__GLXclientState * cl, GLbyte * pc)
.size = nitems,
.newMode = newMode
};
- WriteToClient(client, sz_xGLXRenderModeReply, &reply);
+ WriteToClient(client, sizeof(xGLXRenderModeReply), &reply);
if (retBytes) {
WriteToClient(client, retBytes, retBuffer);
}
diff --git a/glx/single2swap.c b/glx/single2swap.c
index fc9e584b0..4bafd0dd5 100644
--- a/glx/single2swap.c
+++ b/glx/single2swap.c
@@ -215,7 +215,7 @@ __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, &reply);
+ WriteToClient(client, sizeof(xGLXRenderModeReply), &reply);
if (retBytes) {
WriteToClient(client, retBytes, retBuffer);
}
diff --git a/glx/unpack.h b/glx/unpack.h
index 9676e64c4..256073470 100644
--- a/glx/unpack.h
+++ b/glx/unpack.h
@@ -59,7 +59,7 @@
reply.sequenceNumber = client->sequence;
#define __GLX_SEND_HEADER() \
- WriteToClient (client, sz_xGLXSingleReply, &reply);
+ WriteToClient (client, sizeof(xGLXSingleReply), &reply);
#define __GLX_PUT_RETVAL(a) \
reply.retval = (a);
diff --git a/glx/vndcmds.c b/glx/vndcmds.c
index cb3732d2a..4ffa5f19f 100644
--- a/glx/vndcmds.c
+++ b/glx/vndcmds.c
@@ -110,7 +110,7 @@ static int dispatch_GLXQueryVersion(ClientPtr client)
reply.majorVersion = GlxCheckSwap(client, 1);
reply.minorVersion = GlxCheckSwap(client, 4);
- WriteToClient(client, sz_xGLXQueryVersionReply, &reply);
+ WriteToClient(client, sizeof(xGLXQueryVersionReply), &reply);
return Success;
}
@@ -272,7 +272,7 @@ static int CommonMakeCurrent(ClientPtr client,
}
reply.contextTag = GlxCheckSwap(client, reply.contextTag);
- WriteToClient(client, sz_xGLXMakeCurrentReply, &reply);
+ WriteToClient(client, sizeof(xGLXMakeCurrentReply), &reply);
return Success;
}
commit 558ded4dbf95a0cf5a48db8273faae89e7d8ea1f
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Aug 28 13:25:06 2024 +0200
glx: assign at declaration
Assigning structs at declaration is quicker to read/understand. No need
to support ancient compilers that couldn't do that, anymore.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1665>
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index ab1ed6410..12b3c7dc5 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -702,14 +702,13 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
- xGLXIsDirectReply reply;
__GLXcontext *glxc;
int err;
if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
return err;
- reply = (xGLXIsDirectReply) {
+ xGLXIsDirectReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
@@ -731,13 +730,11 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
- xGLXQueryVersionReply reply;
- GLuint major, minor;
REQUEST_SIZE_MATCH(xGLXQueryVersionReq);
- major = req->majorVersion;
- minor = req->minorVersion;
+ GLuint major = req->majorVersion;
+ GLuint minor = req->minorVersion;
(void) major;
(void) minor;
@@ -746,7 +743,7 @@ __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 = (xGLXQueryVersionReply) {
+ xGLXQueryVersionReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
@@ -906,7 +903,6 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
{
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
ClientPtr client = cl->client;
- xGLXGetVisualConfigsReply reply;
__GLXscreen *pGlxScreen;
__GLXconfig *modes;
CARD32 buf[GLX_VIS_CONFIG_TOTAL];
@@ -918,7 +914,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
- reply = (xGLXGetVisualConfigsReply) {
+ xGLXGetVisualConfigsReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = (pGlxScreen->numVisuals *
@@ -1021,7 +1017,6 @@ static int
DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
{
ClientPtr client = cl->client;
- xGLXGetFBConfigsReply reply;
__GLXscreen *pGlxScreen;
CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH];
int p, err;
@@ -1033,7 +1028,7 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err))
return err;
- reply = (xGLXGetFBConfigsReply) {
+ xGLXGetFBConfigsReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = __GLX_FBCONFIG_ATTRIBS_LENGTH * pGlxScreen->numFBConfigs,
@@ -1662,7 +1657,6 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
- xGLXQueryContextInfoEXTReply reply;
int nProps = 5;
int sendBuf[nProps * 2];
int nReplyBytes;
@@ -1671,7 +1665,7 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
return err;
- reply = (xGLXQueryContextInfoEXTReply) {
+ xGLXQueryContextInfoEXTReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = nProps << 1,
@@ -1877,7 +1871,6 @@ static int
DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
{
ClientPtr client = cl->client;
- xGLXGetDrawableAttributesReply reply;
__GLXdrawable *pGlxDraw = NULL;
DrawablePtr pDraw;
CARD32 attributes[20];
@@ -1927,7 +1920,7 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
ATTRIB(GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT);
#undef ATTRIB
- reply = (xGLXGetDrawableAttributesReply) {
+ xGLXGetDrawableAttributesReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = num << 1,
@@ -2373,7 +2366,6 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
- xGLXQueryExtensionsStringReply reply;
__GLXscreen *pGlxScreen;
size_t n, length;
char *buf;
@@ -2384,7 +2376,8 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
n = strlen(pGlxScreen->GLXextensions) + 1;
length = __GLX_PAD(n) >> 2;
- reply = (xGLXQueryExtensionsStringReply) {
+
+ xGLXQueryExtensionsStringReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = length,
@@ -2425,7 +2418,6 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
- xGLXQueryServerStringReply reply;
size_t n, length;
const char *ptr;
char *buf;
@@ -2457,7 +2449,8 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
n = strlen(ptr) + 1;
length = __GLX_PAD(n) >> 2;
- reply = (xGLXQueryServerStringReply) {
+
+ xGLXQueryServerStringReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = length,
diff --git a/glx/indirect_util.c b/glx/indirect_util.c
index 50b8e3f1c..56ef179cd 100644
--- a/glx/indirect_util.c
+++ b/glx/indirect_util.c
@@ -112,7 +112,6 @@ __glXSendReply(ClientPtr client, const void *data, size_t elements,
size_t element_size, GLboolean always_array, CARD32 retval)
{
size_t reply_ints = 0;
- xGLXSingleReply reply = { 0, };
if (__glXErrorOccured()) {
elements = 0;
@@ -121,11 +120,13 @@ __glXSendReply(ClientPtr client, const void *data, size_t elements,
reply_ints = bytes_to_int32(elements * element_size);
}
- reply.length = reply_ints;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.size = elements;
- reply.retval = retval;
+ xGLXSingleReply reply = {
+ .length = reply_ints,
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .size = elements,
+ .retval = retval,
+ };
/* It is faster on almost always every architecture to just copy the 8
* bytes, even when not necessary, than check to see of the value of
@@ -159,7 +160,6 @@ __glXSendReplySwap(ClientPtr client, const void *data, size_t elements,
size_t element_size, GLboolean always_array, CARD32 retval)
{
size_t reply_ints = 0;
- xGLXSingleReply reply = { 0, };
if (__glXErrorOccured()) {
elements = 0;
@@ -168,11 +168,13 @@ __glXSendReplySwap(ClientPtr client, const void *data, size_t elements,
reply_ints = bytes_to_int32(elements * element_size);
}
- reply.length = bswap_32(reply_ints);
- reply.type = X_Reply;
- reply.sequenceNumber = bswap_16(client->sequence);
- reply.size = bswap_32(elements);
- reply.retval = bswap_32(retval);
+ xGLXSingleReply reply = {
+ .length = bswap_32(reply_ints),
+ .type = X_Reply,
+ .sequenceNumber = bswap_16(client->sequence),
+ .size = bswap_32(elements),
+ .retval = bswap_32(retval),
+ };
/* It is faster on almost always every architecture to just copy the 8
* bytes, even when not necessary, than check to see of the value of
diff --git a/glx/single2.c b/glx/single2.c
index 7c9e24549..ef355b470 100644
--- a/glx/single2.c
+++ b/glx/single2.c
@@ -106,7 +106,6 @@ int
__glXDisp_RenderMode(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXRenderModeReply reply;
__GLXcontext *cx;
GLint nitems = 0, retBytes = 0, retval, newModeCheck;
GLubyte *retBuffer = NULL;
@@ -191,7 +190,7 @@ __glXDisp_RenderMode(__GLXclientState * cl, GLbyte * pc)
** selection array, as per the API for glRenderMode itself.
*/
noChangeAllowed:;
- reply = (xGLXRenderModeReply) {
+ xGLXRenderModeReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = nitems,
@@ -230,7 +229,6 @@ __glXDisp_Finish(__GLXclientState * cl, GLbyte * pc)
ClientPtr client = cl->client;
__GLXcontext *cx;
int error;
- xGLXSingleReply reply = { 0, };
REQUEST_SIZE_MATCH(xGLXSingleReq);
@@ -244,6 +242,8 @@ __glXDisp_Finish(__GLXclientState * cl, GLbyte * pc)
/* Send empty reply packet to indicate finish is finished */
client = cl->client;
+
+ xGLXSingleReply reply = { 0 };
__GLX_BEGIN_REPLY(0);
__GLX_SEND_HEADER();
return Success;
@@ -327,7 +327,6 @@ DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap)
__GLXcontext *cx;
GLenum name;
const char *string;
- xGLXSingleReply reply = { 0, };
__GLX_DECLARE_SWAP_VARIABLES;
int error;
@@ -381,6 +380,7 @@ DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap)
length = strlen((const char *) string) + 1;
}
+ xGLXSingleReply reply = { 0 };
__GLX_BEGIN_REPLY(length);
__GLX_PUT_SIZE(length);
diff --git a/glx/single2swap.c b/glx/single2swap.c
index b7c7c00da..fc9e584b0 100644
--- a/glx/single2swap.c
+++ b/glx/single2swap.c
@@ -112,7 +112,6 @@ __glXDispSwap_RenderMode(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
__GLXcontext *cx;
- xGLXRenderModeReply reply;
GLint nitems = 0, retBytes = 0, retval, newModeCheck;
GLubyte *retBuffer = NULL;
GLenum newMode;
@@ -203,7 +202,7 @@ __glXDispSwap_RenderMode(__GLXclientState * cl, GLbyte * pc)
** selection array, as per the API for glRenderMode itself.
*/
noChangeAllowed:;
- reply = (xGLXRenderModeReply) {
+ xGLXRenderModeReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = nitems,
@@ -250,7 +249,6 @@ __glXDispSwap_Finish(__GLXclientState * cl, GLbyte * pc)
ClientPtr client = cl->client;
__GLXcontext *cx;
int error;
- xGLXSingleReply reply = { 0, };
__GLX_DECLARE_SWAP_VARIABLES;
@@ -266,6 +264,7 @@ __glXDispSwap_Finish(__GLXclientState * cl, GLbyte * pc)
glFinish();
/* Send empty reply packet to indicate finish is finished */
+ xGLXSingleReply reply = { 0 };
__GLX_BEGIN_REPLY(0);
__GLX_PUT_RETVAL(0);
__GLX_SWAP_REPLY_HEADER();
More information about the xorg-commit
mailing list