Use C99 designated initializers in various extension 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 2f5caeaddb
commit cc5f09c86f
7 changed files with 73 additions and 59 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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)) {

View File

@ -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);

View File

@ -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,