dix: write out X_ListProperties 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 19:26:55 +02:00
parent 67c09e3bc6
commit b6cd982477
4 changed files with 13 additions and 20 deletions

View File

@ -574,7 +574,6 @@ int
ProcListProperties(ClientPtr client) ProcListProperties(ClientPtr client)
{ {
Atom *pAtoms = NULL, *temppAtoms; Atom *pAtoms = NULL, *temppAtoms;
xListPropertiesReply xlpr;
int rc, numProps = 0; int rc, numProps = 0;
WindowPtr pWin; WindowPtr pWin;
PropertyPtr pProp, realProp; PropertyPtr pProp, realProp;
@ -606,18 +605,24 @@ ProcListProperties(ClientPtr client)
} }
} }
xlpr = (xListPropertiesReply) { xListPropertiesReply rep = {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = bytes_to_int32(numProps * sizeof(Atom)), .length = bytes_to_int32(numProps * sizeof(Atom)),
.nProperties = numProps .nProperties = numProps
}; };
WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
if (numProps) { if (client->swapped) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; swaps(&rep.sequenceNumber);
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); swapl(&rep.length);
free(pAtoms); swaps(&rep.nProperties);
SwapLongs(pAtoms, numProps);
} }
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, numProps * sizeof(Atom), pAtoms);
free(pAtoms);
return Success; return Success;
} }

View File

@ -181,15 +181,6 @@ SGenericReply(ClientPtr pClient, int size, xGenericReply * pRep)
WriteToClient(pClient, size, pRep); WriteToClient(pClient, size, pRep);
} }
void _X_COLD
SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swaps(&pRep->nProperties);
WriteToClient(pClient, size, pRep);
}
static void _X_COLD static void _X_COLD
SwapTimecoord(xTimecoord * pCoord) SwapTimecoord(xTimecoord * pCoord)
{ {

View File

@ -736,7 +736,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, /* 20 */ ReplyNotSwappd, /* 20 */
(ReplySwapPtr) SListPropertiesReply, ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,

View File

@ -44,9 +44,6 @@ extern void SGenericReply(ClientPtr /* pClient */ ,
int /* size */ , int /* size */ ,
xGenericReply * /* pRep */ ); xGenericReply * /* pRep */ );
extern void SListPropertiesReply(ClientPtr /* pClient */ ,
int /* size */ ,
xListPropertiesReply * /* pRep */ );
extern void SwapTimeCoordWrite(ClientPtr /* pClient */ , extern void SwapTimeCoordWrite(ClientPtr /* pClient */ ,
int /* size */ , int /* size */ ,
xTimecoord * /* pRep */ ); xTimecoord * /* pRep */ );