Use C99 designated initializers in glx Replies

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Alan Coopersmith 2012-07-09 19:12:43 -07:00
parent cc5f09c86f
commit 26efa09d0c
3 changed files with 75 additions and 55 deletions

View File

@ -651,17 +651,17 @@ DoMakeCurrent(__GLXclientState * cl,
StopUsingContext(prevglxc); StopUsingContext(prevglxc);
reply = (xGLXMakeCurrentReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.contextTag = 0
};
if (glxc) { if (glxc) {
StartUsingContext(cl, glxc); StartUsingContext(cl, glxc);
reply.contextTag = glxc->id; reply.contextTag = glxc->id;
} }
else {
reply.contextTag = 0;
}
reply.length = 0;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) { if (client->swapped) {
__glXSwapMakeCurrentReply(client, &reply); __glXSwapMakeCurrentReply(client, &reply);
@ -722,10 +722,12 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err)) if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
return err; return err;
reply.isDirect = glxc->isDirect; reply = (xGLXIsDirectReply) {
reply.length = 0; .type = X_Reply,
reply.type = X_Reply; .sequenceNumber = client->sequence,
reply.sequenceNumber = client->sequence; .length = 0,
.isDirect = glxc->isDirect
};
if (client->swapped) { if (client->swapped) {
__glXSwapIsDirectReply(client, &reply); __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 ** client if it wants to work with older clients; however, in this
** implementation the server just returns its version number. ** implementation the server just returns its version number.
*/ */
reply.majorVersion = glxMajorVersion; reply = (xGLXQueryVersionReply) {
reply.minorVersion = glxMinorVersion; .type = X_Reply,
reply.length = 0; .sequenceNumber = client->sequence,
reply.type = X_Reply; .length = 0,
reply.sequenceNumber = client->sequence; .majorVersion = glxMajorVersion,
.minorVersion = glxMinorVersion
};
if (client->swapped) { if (client->swapped) {
__glXSwapQueryVersionReply(client, &reply); __glXSwapQueryVersionReply(client, &reply);
@ -935,12 +939,14 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err; return err;
reply.numVisuals = pGlxScreen->numVisuals; reply = (xGLXGetVisualConfigsReply) {
reply.numProps = GLX_VIS_CONFIG_TOTAL; .type = X_Reply,
reply.length = .sequenceNumber = client->sequence,
(reply.numVisuals * __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2; .length = (pGlxScreen->numVisuals *
reply.type = X_Reply; __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2,
reply.sequenceNumber = client->sequence; .numVisuals = pGlxScreen->numVisuals,
.numProps = GLX_VIS_CONFIG_TOTAL
};
if (client->swapped) { if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_SHORT(&reply.sequenceNumber);
@ -1039,11 +1045,13 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err)) if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err))
return err; return err;
reply.numFBConfigs = pGlxScreen->numFBConfigs; reply = (xGLXGetFBConfigsReply) {
reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS; .type = X_Reply,
reply.length = (__GLX_FBCONFIG_ATTRIBS_LENGTH * reply.numFBConfigs); .sequenceNumber = client->sequence,
reply.type = X_Reply; .length = __GLX_FBCONFIG_ATTRIBS_LENGTH * pGlxScreen->numFBConfigs,
reply.sequenceNumber = client->sequence; .numFBConfigs = pGlxScreen->numFBConfigs,
.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS
};
if (client->swapped) { if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_SHORT(&reply.sequenceNumber);
@ -1663,10 +1671,12 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
return err; return err;
nProps = 3; nProps = 3;
reply.length = nProps << 1; reply = (xGLXQueryContextInfoEXTReply) {
reply.type = X_Reply; .type = X_Reply,
reply.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
reply.n = nProps; .length = nProps << 1,
.n = nProps
};
nReplyBytes = reply.length << 2; nReplyBytes = reply.length << 2;
sendBuf = (int *) malloc((size_t) nReplyBytes); sendBuf = (int *) malloc((size_t) nReplyBytes);
@ -1870,10 +1880,12 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
return error; return error;
numAttribs = 3; numAttribs = 3;
reply.length = numAttribs << 1; reply = (xGLXGetDrawableAttributesReply) {
reply.type = X_Reply; .type = X_Reply,
reply.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
reply.numAttribs = numAttribs; .length = numAttribs << 1,
.numAttribs = numAttribs
};
attributes[0] = GLX_TEXTURE_TARGET_EXT; attributes[0] = GLX_TEXTURE_TARGET_EXT;
attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_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; n = strlen(pGlxScreen->GLXextensions) + 1;
length = __GLX_PAD(n) >> 2; length = __GLX_PAD(n) >> 2;
reply.type = X_Reply; reply = (xGLXQueryExtensionsStringReply) {
reply.sequenceNumber = client->sequence; .type = X_Reply,
reply.length = length; .sequenceNumber = client->sequence,
reply.n = n; .length = length,
.n = n
};
/* Allocate buffer to make sure it's a multiple of 4 bytes big. */ /* Allocate buffer to make sure it's a multiple of 4 bytes big. */
buf = calloc(length, 4); buf = calloc(length, 4);
@ -2370,10 +2384,12 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
n = strlen(ptr) + 1; n = strlen(ptr) + 1;
length = __GLX_PAD(n) >> 2; length = __GLX_PAD(n) >> 2;
reply.type = X_Reply; reply = (xGLXQueryServerStringReply) {
reply.sequenceNumber = client->sequence; .type = X_Reply,
reply.length = length; .sequenceNumber = client->sequence,
reply.n = n; .length = length,
.n = n
};
buf = calloc(length, 4); buf = calloc(length, 4);
if (buf == NULL) { if (buf == NULL) {

View File

@ -193,12 +193,14 @@ __glXDisp_RenderMode(__GLXclientState * cl, GLbyte * pc)
*/ */
noChangeAllowed:; noChangeAllowed:;
client = cl->client; client = cl->client;
reply.length = nitems; reply = (xGLXRenderModeReply) {
reply.type = X_Reply; .type = X_Reply,
reply.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
reply.retval = retval; .length = nitems,
reply.size = nitems; .retval = retval,
reply.newMode = newMode; .size = nitems,
.newMode = newMode
};
WriteToClient(client, sz_xGLXRenderModeReply, &reply); WriteToClient(client, sz_xGLXRenderModeReply, &reply);
if (retBytes) { if (retBytes) {
WriteToClient(client, retBytes, retBuffer); WriteToClient(client, retBytes, retBuffer);

View File

@ -205,12 +205,14 @@ __glXDispSwap_RenderMode(__GLXclientState * cl, GLbyte * pc)
*/ */
noChangeAllowed:; noChangeAllowed:;
client = cl->client; client = cl->client;
reply.length = nitems; reply = (xGLXRenderModeReply) {
reply.type = X_Reply; .type = X_Reply,
reply.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
reply.retval = retval; .length = nitems,
reply.size = nitems; .retval = retval,
reply.newMode = newMode; .size = nitems,
.newMode = newMode
};
__GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.retval); __GLX_SWAP_INT(&reply.retval);