From cff95e344dbfb9fdc0725ce60a8a5c31a6f48c93 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 29 Jul 2024 19:48:54 +0200 Subject: [PATCH] (!1794) 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 --- randr/rrcrtc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index fe96a9bcf3..e903ff4e9c 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -1676,13 +1676,16 @@ ProcRRGetCrtcGamma(ClientPtr client) swapl(&reply.length); swaps(&reply.size); } - WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply); if (crtc->gammaSize) { memcpy(extra, crtc->gammaRed, len); - client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; - WriteSwappedDataToClient(client, len, extra); - free(extra); + if (client->swapped) SwapShorts((short*)extra, len/sizeof(CARD16)); } + + WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply); + WriteToClient(client, len, extra); + + if (extra) free(extra); + return Success; }