From 83569a31c87a5a336cb20e2af8b805b5bf34bd13 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 3 Apr 2025 18:29:20 +0200 Subject: [PATCH] dix: write out X_QueryFont 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 | 6 +++++- dix/swaprep.c | 11 +---------- dix/tables.c | 2 +- include/swaprep.h | 6 ++---- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index cdb31c3bb..3a88640f6 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1362,7 +1362,11 @@ ProcQueryFont(ClientPtr client) reply->sequenceNumber = client->sequence; QueryFont(pFont, reply, nprotoxcistructs); - WriteReplyToClient(client, rlength, reply); + if (client->swapped) { + SwapFont(reply, TRUE); + } + + WriteToClient(client, rlength, reply); free(reply); return Success; } diff --git a/dix/swaprep.c b/dix/swaprep.c index 0c26e966e..de885f9a7 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -59,8 +59,6 @@ static void SwapFontInfo(xQueryFontReply * pr); static void SwapCharInfo(xCharInfo * pInfo); -static void SwapFont(xQueryFontReply * pr, Bool hasGlyphs); - /** * Thanks to Jack Palevich for testing and subsequently rewriting all this * @@ -274,7 +272,7 @@ SwapFontInfo(xQueryFontReply * pr) swapl(&pr->nCharInfos); } -static void _X_COLD +void _X_COLD SwapFont(xQueryFontReply * pr, Bool hasGlyphs) { unsigned i; @@ -303,13 +301,6 @@ SwapFont(xQueryFontReply * pr, Bool hasGlyphs) } } -void _X_COLD -SQueryFontReply(ClientPtr pClient, int size, xQueryFontReply * pRep) -{ - SwapFont(pRep, TRUE); - WriteToClient(pClient, size, pRep); -} - void _X_COLD SQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply * pRep) diff --git a/dix/tables.c b/dix/tables.c index 1b195790e..b14ccba66 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -762,7 +762,7 @@ ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, ReplyNotSwappd, /* 45 */ ReplyNotSwappd, - (ReplySwapPtr) SQueryFontReply, + ReplyNotSwappd, (ReplySwapPtr) SQueryTextExtentsReply, (ReplySwapPtr) SListFontsReply, (ReplySwapPtr) SListFontsWithInfoReply, /* 50 */ diff --git a/include/swaprep.h b/include/swaprep.h index 6571dcb26..44750eeea 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -26,6 +26,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef SWAPREP_H #define SWAPREP_H 1 +void SwapFont(xQueryFontReply * pr, Bool hasGlyphs); + extern void Swap32Write(ClientPtr /* pClient */ , int /* size */ , CARD32 * /* pbuf */ ); @@ -62,10 +64,6 @@ extern void SGetInputFocusReply(ClientPtr /* pClient */ , int /* size */ , xGetInputFocusReply * /* pRep */ ); -extern void SQueryFontReply(ClientPtr /* pClient */ , - int /* size */ , - xQueryFontReply * /* pRep */ ); - extern void SQueryTextExtentsReply(ClientPtr /* pClient */ , int /* size */ , xQueryTextExtentsReply * /* pRep */