randr: ProcRRGetCrtcGamma(): use SwapShort()/SwapLong()

Simplify reply payload preparation and sendout by using SwapShort()
and SwapLong() instead of WriteToClientSwapped() and callbacks.

This also allows even further simplifications by using generic macros
for the request send path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-29 19:48:54 +02:00 committed by Marge Bot
parent 62b8497999
commit d9863f7cb0

View File

@ -1676,13 +1676,16 @@ ProcRRGetCrtcGamma(ClientPtr client)
swapl(&reply.length); swapl(&reply.length);
swaps(&reply.size); swaps(&reply.size);
} }
WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply);
if (crtc->gammaSize) { if (crtc->gammaSize) {
memcpy(extra, crtc->gammaRed, len); memcpy(extra, crtc->gammaRed, len);
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; if (client->swapped)
WriteSwappedDataToClient(client, len, extra); SwapShorts((short*)extra, len/sizeof(CARD16));
free(extra);
} }
WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply);
WriteToClient(client, len, extra);
free(extra);
return Success; return Success;
} }