dix: ProcGetFontPath(): use x_rpcbuf_t

Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-09-02 20:06:36 +02:00
committed by Enrico Weigelt
parent d734b75a37
commit a7811ea424
3 changed files with 21 additions and 14 deletions

View File

@@ -3396,31 +3396,24 @@ ProcSetFontPath(ClientPtr client)
int
ProcGetFontPath(ClientPtr client)
{
int rc, stringLens, numpaths;
unsigned char *bufferStart;
/* REQUEST (xReq); */
REQUEST_SIZE_MATCH(xReq);
rc = GetFontPath(client, &numpaths, &stringLens, &bufferStart);
int rc = XaceHookServerAccess(client, DixGetAttrAccess);
if (rc != Success)
return rc;
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
xGetFontPathReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(stringLens + numpaths),
.nPaths = numpaths
.nPaths = FillFontPath(&rpcbuf)
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.nPaths);
}
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, stringLens + numpaths, bufferStart);
return Success;
return X_SEND_REPLY_WITH_RPCBUF(client, rep, rpcbuf);
}
int

View File

@@ -94,6 +94,8 @@ void CloseDownClient(ClientPtr client);
ClientPtr GetCurrentClient(void);
void InitClient(ClientPtr client, int i, void *ospriv);
int FillFontPath(x_rpcbuf_t *rpcbuf);
/* lookup builtin color by name */
Bool dixLookupBuiltinColor(int screen,
char *name,

View File

@@ -59,6 +59,7 @@ Equipment Corporation.
#include "dix/dix_priv.h"
#include "dix/gc_priv.h"
#include "dix/rpcbuf_priv.h"
#include "include/swaprep.h"
#include "os/auth.h"
#include "os/log_priv.h"
@@ -1816,6 +1817,17 @@ DeleteClientFontStuff(ClientPtr client)
}
}
int FillFontPath(x_rpcbuf_t *rpcbuf)
{
for (int i = 0; i < num_fpes; i++) {
FontPathElementPtr fpe = font_path_elements[i];
/* write a pascal-string */
x_rpcbuf_write_CARD8(rpcbuf, fpe->name_length);
x_rpcbuf_write_CARD8s(rpcbuf, (CARD8*)fpe->name, fpe->name_length);
}
return num_fpes;
}
static int
register_fpe_funcs(const xfont2_fpe_funcs_rec *funcs)
{