From 3dc4f5ec9227c849c9acae80360e92d249276bd9 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 29 Jul 2024 20:01:10 +0200 Subject: [PATCH] (!1794) randr: ProcRRQueryOutputProperty(): 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/rrproperty.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/randr/rrproperty.c b/randr/rrproperty.c index 03cb29f02..f655eea94 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -491,14 +491,16 @@ ProcRRQueryOutputProperty(ClientPtr client) swaps(&rep.sequenceNumber); swapl(&rep.length); } - WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), &rep); if (prop->num_valid) { memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32)); - client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; - WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32), - extra); - free(extra); + if (client->swapped) SwapLongs((CARD32*)extra, prop->num_valid); } + + WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), &rep); + WriteToClient(client, prop->num_valid * sizeof(INT32), extra); + + if (extra) free(extra); + return Success; }