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

View File

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