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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-03 18:29:20 +02:00
parent 9136207164
commit 83569a31c8
4 changed files with 9 additions and 16 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -762,7 +762,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd,
ReplyNotSwappd, /* 45 */
ReplyNotSwappd,
(ReplySwapPtr) SQueryFontReply,
ReplyNotSwappd,
(ReplySwapPtr) SQueryTextExtentsReply,
(ReplySwapPtr) SListFontsReply,
(ReplySwapPtr) SListFontsWithInfoReply, /* 50 */

View File

@ -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 */