From eb184c316dee77a8d03c26796ab07c968a5d1764 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 4 Apr 2025 18:40:14 +0200 Subject: [PATCH] dix: write out X_GetFontPath 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 | 13 ++++++++----- dix/swaprep.c | 9 --------- dix/tables.c | 2 +- include/swaprep.h | 4 ---- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index f376e8f69..c38add466 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3489,7 +3489,6 @@ ProcSetFontPath(ClientPtr client) int ProcGetFontPath(ClientPtr client) { - xGetFontPathReply reply; int rc, stringLens, numpaths; unsigned char *bufferStart; @@ -3500,16 +3499,20 @@ ProcGetFontPath(ClientPtr client) if (rc != Success) return rc; - reply = (xGetFontPathReply) { + xGetFontPathReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(stringLens + numpaths), .nPaths = numpaths }; - WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply); - if (stringLens || numpaths) - WriteToClient(client, stringLens + numpaths, bufferStart); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swaps(&rep.nPaths); + } + WriteToClient(client, sizeof(rep), &rep); + WriteToClient(client, stringLens + numpaths, bufferStart); return Success; } diff --git a/dix/swaprep.c b/dix/swaprep.c index 3290b19c3..a8edf09ad 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -301,15 +301,6 @@ SwapFont(xQueryFontReply * pr, Bool hasGlyphs) } } -void _X_COLD -SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep) -{ - swaps(&pRep->sequenceNumber); - swapl(&pRep->length); - swaps(&pRep->nPaths); - 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 fec7166a1..74c3cd32a 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -767,7 +767,7 @@ ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, ReplyNotSwappd, /* 50 */ ReplyNotSwappd, - (ReplySwapPtr) SGetFontPathReply, + ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 55 */ diff --git a/include/swaprep.h b/include/swaprep.h index 58ce54cc5..93cb01c60 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -64,10 +64,6 @@ extern void SGetInputFocusReply(ClientPtr /* pClient */ , int /* size */ , xGetInputFocusReply * /* pRep */ ); -extern void SGetFontPathReply(ClientPtr /* pClient */ , - int /* size */ , - xGetFontPathReply * /* pRep */ ); - extern void SListExtensionsReply(ClientPtr /* pClient */ , int /* size */ , xListExtensionsReply * /* pRep */ );