dix: write out X_QueryExtension reply directly

No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-04 18:54:08 +02:00
parent 0b585587a2
commit a1e5033170
2 changed files with 15 additions and 15 deletions

View File

@ -224,34 +224,34 @@ ExtensionAvailable(ClientPtr client, ExtensionEntry *ext)
int
ProcQueryExtension(ClientPtr client)
{
xQueryExtensionReply reply;
int i;
REQUEST(xQueryExtensionReq);
REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes);
reply = (xQueryExtensionReply) {
xQueryExtensionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.major_opcode = 0
};
if (!NumExtensions)
reply.present = xFalse;
if (!NumExtensions || !extensions)
rep.present = xFalse;
else {
i = FindExtension((char *) &stuff[1], stuff->nbytes);
int i = FindExtension((char *) &stuff[1], stuff->nbytes);
if (i < 0 || !ExtensionAvailable(client, extensions[i]))
reply.present = xFalse;
rep.present = xFalse;
else {
reply.present = xTrue;
reply.major_opcode = extensions[i]->base;
reply.first_event = extensions[i]->eventBase;
reply.first_error = extensions[i]->errorBase;
rep.present = xTrue;
rep.major_opcode = extensions[i]->base;
rep.first_event = extensions[i]->eventBase;
rep.first_error = extensions[i]->errorBase;
}
}
WriteReplyToClient(client, sizeof(xQueryExtensionReply), &reply);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(rep), &rep);
return Success;
}

View File

@ -813,7 +813,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd, /* 95 */
ReplyNotSwappd,
ReplyNotSwappd,
(ReplySwapPtr) SGenericReply, /* SQueryExtensionReply, */
ReplyNotSwappd,
(ReplySwapPtr) SListExtensionsReply,
ReplyNotSwappd, /* 100 */
ReplyNotSwappd,