From d459390a2d704792fe317fb88aab9a09cdc11930 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 4 Apr 2025 16:12:52 +0200 Subject: [PATCH] dix: write out X_QueryBestSize 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 --- dix/dispatch.c | 12 +++++++++--- dix/swaprep.c | 9 --------- dix/tables.c | 2 +- include/swaprep.h | 4 ---- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index 1c78c7220..b03e6405c 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3193,7 +3193,6 @@ ProcFreeCursor(ClientPtr client) int ProcQueryBestSize(ClientPtr client) { - xQueryBestSizeReply reply; DrawablePtr pDraw; ScreenPtr pScreen; int rc; @@ -3219,14 +3218,21 @@ ProcQueryBestSize(ClientPtr client) return rc; (*pScreen->QueryBestSize) (stuff->class, &stuff->width, &stuff->height, pScreen); - reply = (xQueryBestSizeReply) { + + xQueryBestSizeReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .width = stuff->width, .height = stuff->height }; - WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply); + + if (client->swapped) { + swaps(&rep.sequenceNumber); + swaps(&rep.width); + swaps(&rep.height); + } + WriteToClient(client, sizeof(rep), &rep); return Success; } diff --git a/dix/swaprep.c b/dix/swaprep.c index 5c6f535be..a5b159eab 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -310,15 +310,6 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep) WriteToClient(pClient, size, pRep); } -void _X_COLD -SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply * pRep) -{ - swaps(&pRep->sequenceNumber); - swaps(&pRep->width); - swaps(&pRep->height); - WriteToClient(pClient, size, pRep); -} - void _X_COLD SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply * pRep) { diff --git a/dix/tables.c b/dix/tables.c index 609d3a8e3..ef8749517 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -812,7 +812,7 @@ ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, ReplyNotSwappd, /* 95 */ ReplyNotSwappd, - (ReplySwapPtr) SQueryBestSizeReply, + ReplyNotSwappd, (ReplySwapPtr) SGenericReply, /* SQueryExtensionReply, */ (ReplySwapPtr) SListExtensionsReply, ReplyNotSwappd, /* 100 */ diff --git a/include/swaprep.h b/include/swaprep.h index 222881a18..78ce01ba6 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -68,10 +68,6 @@ extern void SGetFontPathReply(ClientPtr /* pClient */ , int /* size */ , xGetFontPathReply * /* pRep */ ); -extern void SQueryBestSizeReply(ClientPtr /* pClient */ , - int /* size */ , - xQueryBestSizeReply * /* pRep */ ); - extern void SListExtensionsReply(ClientPtr /* pClient */ , int /* size */ , xListExtensionsReply * /* pRep */ );