From c6b6a8fcb75023b89ec1d4b9f3ce3c9eb44764e1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 28 Feb 2019 23:13:49 +0100 Subject: Use C99 designated initializers in various extension Replies commit cc5f09c86f7bea23b7546c3491b2c52ce8100a71 Author: Alan Coopersmith Date: Mon Jul 9 19:12:43 2012 -0700 Use C99 designated initializers in various extension Replies Signed-off-by: Alan Coopersmith Reviewed-by: Keith Packard Tested-by: Daniel Stone Attributes ArcticaProject/nx-libs#382 --- nx-X11/programs/Xserver/record/record.c | 35 ++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'nx-X11/programs/Xserver/record') diff --git a/nx-X11/programs/Xserver/record/record.c b/nx-X11/programs/Xserver/record/record.c index c18b96e46..31803a289 100644 --- a/nx-X11/programs/Xserver/record/record.c +++ b/nx-X11/programs/Xserver/record/record.c @@ -1949,14 +1949,16 @@ 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); @@ -2287,6 +2289,7 @@ ProcRecordGetContext(ClientPtr client) GetContextRangeInfoPtr pri; int i; int err; + CARD32 nClients, length; REQUEST_SIZE_MATCH(xRecordGetContextReq); VERIFY_CONTEXT(pContext, stuff->context, client); @@ -2359,24 +2362,28 @@ 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 * ( (sizeof(xRecordClientInfo) >> 2) + pri->nRanges * (sizeof(xRecordRange) >> 2)); } /* write the reply header */ - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.enabled = pContext->pRecordingClient != NULL; - rep.elementHeader = pContext->elemHeaders; + 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); -- cgit v1.2.3