From e45decb482e5ce44a87a672f7b4a42b8fb625a81 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 28 Aug 2025 16:10:26 +0200 Subject: [PATCH] Xi: ProcXGetDeviceButtonMapping(): use x_rpcbuf_t Use x_rpcbuf_t for reply payload assembly. Signed-off-by: Enrico Weigelt, metux IT consult --- Xi/getbmap.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Xi/getbmap.c b/Xi/getbmap.c index 77ea8ec82c..dd64a92eaf 100644 --- a/Xi/getbmap.c +++ b/Xi/getbmap.c @@ -52,9 +52,13 @@ SOFTWARE. #include -#include "inputstr.h" /* DeviceIntPtr */ #include #include + +#include "dix/dix_priv.h" +#include "dix/rpcbuf_priv.h" + +#include "inputstr.h" /* DeviceIntPtr */ #include "exglobals.h" #include "getbmap.h" @@ -83,19 +87,13 @@ ProcXGetDeviceButtonMapping(ClientPtr client) if (b == NULL) return BadMatch; - xGetDeviceButtonMappingReply rep = { - .repType = X_Reply, + x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE }; + x_rpcbuf_write_CARD8s(&rpcbuf, &b->map[1], b->numButtons); + + xGetDeviceButtonMappingReply reply = { .RepType = X_GetDeviceButtonMapping, - .sequenceNumber = client->sequence, .nElts = b->numButtons, - .length = bytes_to_int32(b->numButtons), }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - } - WriteToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep); - WriteToClient(client, rep.nElts, &b->map[1]); - return Success; + return X_SEND_REPLY_WITH_RPCBUF(client, reply, rpcbuf); }