From 62b849799983d6154261c6662d5d8c40fafa67f4 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 29 Jul 2024 19:30:03 +0200 Subject: [PATCH] randr: ProcRRGetProviderProperty(): 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 Part-of: --- randr/rrproviderproperty.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/randr/rrproviderproperty.c b/randr/rrproviderproperty.c index 45e9a63e6..23a105c02 100644 --- a/randr/rrproviderproperty.c +++ b/randr/rrproviderproperty.c @@ -685,24 +685,26 @@ ProcRRGetProviderProperty(ClientPtr client) swapl(&reply.bytesAfter); swapl(&reply.nItems); } - WriteToClient(client, sizeof(xGenericReply), &reply); if (len) { memcpy(extra, (char *) prop_value->data + ind, len); switch (reply.format) { case 32: - client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; + if (client->swapped) + SwapLongs((CARD32*) extra, len/sizeof(CARD32)); break; case 16: - client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; + if (client->swapped) + SwapShorts((short*) extra, len/sizeof(CARD16)); break; default: - client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient; break; } - WriteSwappedDataToClient(client, len, extra); - free(extra); } + WriteToClient(client, sizeof(xGenericReply), &reply); + WriteToClient(client, len, extra); + free(extra); + if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */ *prev = prop->next; RRDestroyProviderProperty(prop);