XI: directly write out X_GetExtensionVersion reply

Write out the X_GetExtensionVersion reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-03-31 14:24:39 +02:00
parent 62863427a3
commit be45dd2d06
3 changed files with 9 additions and 28 deletions

View File

@ -421,10 +421,7 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
{ {
/* All we look at is the type field */ /* All we look at is the type field */
/* This is common to all replies */ /* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion) if (rep->RepType == X_ListInputDevices)
SRepXGetExtensionVersion(client, len,
(xGetExtensionVersionReply *) rep);
else if (rep->RepType == X_ListInputDevices)
SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep); SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
else if (rep->RepType == X_OpenDevice) else if (rep->RepType == X_OpenDevice)
SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep); SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);

View File

@ -103,25 +103,14 @@ ProcXGetExtensionVersion(ClientPtr client)
.present = TRUE .present = TRUE
}; };
WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep); if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.major_version);
swaps(&rep.minor_version);
}
WriteToClient(client, sizeof(xGetExtensionVersionReply), &rep);
return Success; return Success;
} }
/***********************************************************************
*
* This procedure writes the reply for the XGetExtensionVersion function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetExtensionVersion(ClientPtr client, int size,
xGetExtensionVersionReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->major_version);
swaps(&rep->minor_version);
WriteToClient(client, size, rep);
}

View File

@ -36,9 +36,4 @@ int SProcXGetExtensionVersion(ClientPtr /* client */
int ProcXGetExtensionVersion(ClientPtr /* client */ int ProcXGetExtensionVersion(ClientPtr /* client */
); );
void SRepXGetExtensionVersion(ClientPtr /* client */ ,
int /* size */ ,
xGetExtensionVersionReply * /* rep */
);
#endif /* GETVERS_H */ #endif /* GETVERS_H */