Rework reply initialization in ProcGetProperty & NullPropertyReply
Don't need to pass an empty reply to NullPropertyReply, let it make it's own. Move reply initialization code in remaining replies in ProcGetProperty to group with the rest of the fields. (Prepares for coming C99 designated initializer conversion.) 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:
parent
6be74a9080
commit
db69212df8
|
@ -413,15 +413,18 @@ DeleteAllWindowProperties(WindowPtr pWin)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
NullPropertyReply(ClientPtr client,
|
NullPropertyReply(ClientPtr client, ATOM propertyType, int format)
|
||||||
ATOM propertyType, int format, xGetPropertyReply * reply)
|
|
||||||
{
|
{
|
||||||
reply->nItems = 0;
|
xGetPropertyReply reply;
|
||||||
reply->length = 0;
|
memset(&reply, 0, sizeof(xGetPropertyReply));
|
||||||
reply->bytesAfter = 0;
|
reply.type = X_Reply;
|
||||||
reply->propertyType = propertyType;
|
reply.sequenceNumber = client->sequence;
|
||||||
reply->format = format;
|
reply.nItems = 0;
|
||||||
WriteReplyToClient(client, sizeof(xGenericReply), reply);
|
reply.length = 0;
|
||||||
|
reply.bytesAfter = 0;
|
||||||
|
reply.propertyType = propertyType;
|
||||||
|
reply.format = format;
|
||||||
|
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,13 +473,9 @@ ProcGetProperty(ClientPtr client)
|
||||||
return BadAtom;
|
return BadAtom;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&reply, 0, sizeof(xGetPropertyReply));
|
|
||||||
reply.type = X_Reply;
|
|
||||||
reply.sequenceNumber = client->sequence;
|
|
||||||
|
|
||||||
rc = dixLookupProperty(&pProp, pWin, stuff->property, client, prop_mode);
|
rc = dixLookupProperty(&pProp, pWin, stuff->property, client, prop_mode);
|
||||||
if (rc == BadMatch)
|
if (rc == BadMatch)
|
||||||
return NullPropertyReply(client, None, 0, &reply);
|
return NullPropertyReply(client, None, 0);
|
||||||
else if (rc != Success)
|
else if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -485,6 +484,9 @@ ProcGetProperty(ClientPtr client)
|
||||||
|
|
||||||
if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType))
|
if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType))
|
||||||
) {
|
) {
|
||||||
|
memset(&reply, 0, sizeof(xGetPropertyReply));
|
||||||
|
reply.type = X_Reply;
|
||||||
|
reply.sequenceNumber = client->sequence;
|
||||||
reply.bytesAfter = pProp->size;
|
reply.bytesAfter = pProp->size;
|
||||||
reply.format = pProp->format;
|
reply.format = pProp->format;
|
||||||
reply.length = 0;
|
reply.length = 0;
|
||||||
|
@ -510,6 +512,9 @@ ProcGetProperty(ClientPtr client)
|
||||||
|
|
||||||
len = min(n - ind, 4 * stuff->longLength);
|
len = min(n - ind, 4 * stuff->longLength);
|
||||||
|
|
||||||
|
memset(&reply, 0, sizeof(xGetPropertyReply));
|
||||||
|
reply.type = X_Reply;
|
||||||
|
reply.sequenceNumber = client->sequence;
|
||||||
reply.bytesAfter = n - (ind + len);
|
reply.bytesAfter = n - (ind + len);
|
||||||
reply.format = pProp->format;
|
reply.format = pProp->format;
|
||||||
reply.length = bytes_to_int32(len);
|
reply.length = bytes_to_int32(len);
|
||||||
|
|
Loading…
Reference in New Issue