dix: write out X_ListFontsWithInfo 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:17:30 +02:00
parent 712febb9b4
commit 189f475093
4 changed files with 11 additions and 19 deletions

View File

@ -59,6 +59,7 @@ Equipment Corporation.
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/gc_priv.h" #include "dix/gc_priv.h"
#include "include/swaprep.h"
#include "os/auth.h" #include "os/auth.h"
#include "scrnintstr.h" #include "scrnintstr.h"
@ -862,7 +863,6 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
xFontProp *pFP; xFontProp *pFP;
int i; int i;
int aliascount = 0; int aliascount = 0;
xListFontsWithInfoReply finalReply;
if (client->clientGone) { if (client->clientGone) {
if (c->current.current_fpe < c->num_fpes) { if (c->current.current_fpe < c->num_fpes) {
@ -872,7 +872,6 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
err = Successful; err = Successful;
goto bail; goto bail;
} }
client->pSwapReplyFunc = ReplySwapVector[X_ListFontsWithInfo];
if (!c->current.patlen) if (!c->current.patlen)
goto finish; goto finish;
while (c->current.current_fpe < c->num_fpes) { while (c->current.current_fpe < c->num_fpes) {
@ -1014,7 +1013,10 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
pFP->value = pFontInfo->props[i].value; pFP->value = pFontInfo->props[i].value;
pFP++; pFP++;
} }
WriteSwappedDataToClient(client, length, reply); if (client->swapped) {
SwapFont((xQueryFontReply *) reply, FALSE);
}
WriteToClient(client, length, reply);
WriteToClient(client, namelen, name); WriteToClient(client, namelen, name);
if (pFontInfo == &fontInfo) { if (pFontInfo == &fontInfo) {
free(fontInfo.props); free(fontInfo.props);
@ -1025,13 +1027,16 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
} }
finish: finish:
length = sizeof(xListFontsWithInfoReply); length = sizeof(xListFontsWithInfoReply);
finalReply = (xListFontsWithInfoReply) { xListFontsWithInfoReply rep = {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = bytes_to_int32(sizeof(xListFontsWithInfoReply) .length = bytes_to_int32(sizeof(xListFontsWithInfoReply)
- sizeof(xGenericReply)) - sizeof(xGenericReply))
}; };
WriteSwappedDataToClient(client, length, &finalReply); if (client->swapped) {
SwapFont((xQueryFontReply *) &rep, FALSE);
}
WriteToClient(client, length, &rep);
bail: bail:
ClientWakeup(client); ClientWakeup(client);
for (i = 0; i < c->num_fpes; i++) for (i = 0; i < c->num_fpes; i++)

View File

@ -316,14 +316,6 @@ SQueryTextExtentsReply(ClientPtr pClient, int size,
WriteToClient(pClient, size, pRep); WriteToClient(pClient, size, pRep);
} }
void _X_COLD
SListFontsWithInfoReply(ClientPtr pClient, int size,
xListFontsWithInfoReply * pRep)
{
SwapFont((xQueryFontReply *) pRep, FALSE);
WriteToClient(pClient, size, pRep);
}
void _X_COLD void _X_COLD
SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep) SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
{ {

View File

@ -765,7 +765,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd, ReplyNotSwappd,
(ReplySwapPtr) SQueryTextExtentsReply, (ReplySwapPtr) SQueryTextExtentsReply,
ReplyNotSwappd, ReplyNotSwappd,
(ReplySwapPtr) SListFontsWithInfoReply, /* 50 */ ReplyNotSwappd, /* 50 */
ReplyNotSwappd, ReplyNotSwappd,
(ReplySwapPtr) SGetFontPathReply, (ReplySwapPtr) SGetFontPathReply,
ReplyNotSwappd, ReplyNotSwappd,

View File

@ -69,11 +69,6 @@ extern void SQueryTextExtentsReply(ClientPtr /* pClient */ ,
xQueryTextExtentsReply * /* pRep */ xQueryTextExtentsReply * /* pRep */
); );
extern void SListFontsWithInfoReply(ClientPtr /* pClient */ ,
int /* size */ ,
xListFontsWithInfoReply *
/* pRep */ );
extern void SGetFontPathReply(ClientPtr /* pClient */ , extern void SGetFontPathReply(ClientPtr /* pClient */ ,
int /* size */ , int /* size */ ,
xGetFontPathReply * /* pRep */ ); xGetFontPathReply * /* pRep */ );