dix: write out X_QueryTextExtents 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 19:23:22 +02:00
parent 189f475093
commit 1f2cf6fe4b
4 changed files with 15 additions and 24 deletions

View File

@ -1375,7 +1375,6 @@ ProcQueryFont(ClientPtr client)
int
ProcQueryTextExtents(ClientPtr client)
{
xQueryTextExtentsReply reply;
FontPtr pFont;
ExtentInfoRec info;
unsigned long length;
@ -1397,7 +1396,8 @@ ProcQueryTextExtents(ClientPtr client)
}
if (!xfont2_query_text_extents(pFont, length, (unsigned char *) &stuff[1], &info))
return BadAlloc;
reply = (xQueryTextExtentsReply) {
xQueryTextExtentsReply rep = {
.type = X_Reply,
.drawDirection = info.drawDirection,
.sequenceNumber = client->sequence,
@ -1410,7 +1410,18 @@ ProcQueryTextExtents(ClientPtr client)
.overallLeft = info.overallLeft,
.overallRight = info.overallRight
};
WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.fontAscent);
swaps(&rep.fontDescent);
swaps(&rep.overallAscent);
swaps(&rep.overallDescent);
swapl(&rep.overallWidth);
swapl(&rep.overallLeft);
swapl(&rep.overallRight);
}
WriteToClient(client, sizeof(rep), &rep);
return Success;
}

View File

@ -301,21 +301,6 @@ SwapFont(xQueryFontReply * pr, Bool hasGlyphs)
}
}
void _X_COLD
SQueryTextExtentsReply(ClientPtr pClient, int size,
xQueryTextExtentsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swaps(&pRep->fontAscent);
swaps(&pRep->fontDescent);
swaps(&pRep->overallAscent);
swaps(&pRep->overallDescent);
swapl(&pRep->overallWidth);
swapl(&pRep->overallLeft);
swapl(&pRep->overallRight);
WriteToClient(pClient, size, pRep);
}
void _X_COLD
SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
{

View File

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

View File

@ -64,11 +64,6 @@ extern void SGetInputFocusReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetInputFocusReply * /* pRep */ );
extern void SQueryTextExtentsReply(ClientPtr /* pClient */ ,
int /* size */ ,
xQueryTextExtentsReply * /* pRep */
);
extern void SGetFontPathReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetFontPathReply * /* pRep */ );