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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-09-02 19:11:03 +02:00
committed by Enrico Weigelt
parent e2d9dc4054
commit a41114cbe7

View File

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