dix: write out X-AllocColorCells 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 14:31:09 +02:00
parent df44f063a0
commit 3a233ac98a
4 changed files with 11 additions and 20 deletions

View File

@ -2757,16 +2757,22 @@ ProcAllocColorCells(ClientPtr client)
if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif /* XINERAMA */
{
xAllocColorCellsReply accr = {
xAllocColorCellsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(length),
.nPixels = npixels,
.nMasks = nmasks
};
WriteReplyToClient(client, sizeof(xAllocColorCellsReply), &accr);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.nPixels);
swaps(&rep.nMasks);
SwapLongs(ppixels, length / 4);
}
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, length, ppixels);
}
free(ppixels);
return Success;

View File

@ -310,16 +310,6 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
WriteToClient(pClient, size, pRep);
}
void _X_COLD
SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swaps(&pRep->nPixels);
swaps(&pRep->nMasks);
WriteToClient(pClient, size, pRep);
}
void _X_COLD
SAllocColorPlanesReply(ClientPtr pClient, int size,
xAllocColorPlanesReply * pRep)

View File

@ -801,7 +801,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd, /* 85 */
(ReplySwapPtr) SAllocColorCellsReply,
ReplyNotSwappd,
(ReplySwapPtr) SAllocColorPlanesReply,
ReplyNotSwappd,
ReplyNotSwappd,

View File

@ -68,11 +68,6 @@ extern void SGetFontPathReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetFontPathReply * /* pRep */ );
extern void SAllocColorCellsReply(ClientPtr /* pClient */ ,
int /* size */ ,
xAllocColorCellsReply * /* pRep */
);
extern void SAllocColorPlanesReply(ClientPtr /* pClient */ ,
int /* size */ ,
xAllocColorPlanesReply * /* pRep */