From a41114cbe7616df1425565c656ea5c27c7b29b6e Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 2 Sep 2025 19:11:03 +0200 Subject: [PATCH] dix: ProcListInstalledColormaps(): 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 --- dix/dispatch.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index b6b4e54ab..a7dbd579c 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -2555,24 +2555,19 @@ ProcListInstalledColormaps(ClientPtr client) const ScreenPtr pScreen = pWin->drawable.pScreen; const int nummaps = pScreen->ListInstalledColormaps(pScreen, cm); + x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE }; + x_rpcbuf_write_CARD32s(&rpcbuf, cm, nummaps); /* Colormap is an XID, thus CARD32 */ + free(cm); + xListInstalledColormapsReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, .nColormaps = nummaps, - .length = nummaps, }; if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swaps(&rep.nColormaps); - SwapLongs(cm, nummaps * sizeof(Colormap) / 4); } - WriteToClient(client, sizeof(rep), &rep); - WriteToClient(client, nummaps * sizeof(Colormap), cm); - free(cm); - return Success; + return X_SEND_REPLY_WITH_RPCBUF(client, rep, rpcbuf); } int