From b8a30d7347e25c78a09dc8e27d3636ff1fd5e9db Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 19 Aug 2025 12:32:12 +0200 Subject: [PATCH] xkb: ProcXkbGetMap(): use X_SEND_REPLY_WITH_RPCBUF() Use generic macro for sending out final reply. Also dropping our own unnecessary size payload computation - rpcbuf already giving us this value. Signed-off-by: Enrico Weigelt, metux IT consult --- xkb/xkb.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/xkb/xkb.c b/xkb/xkb.c index a00f2ded16..b0be57ecde 100644 --- a/xkb/xkb.c +++ b/xkb/xkb.c @@ -1405,10 +1405,7 @@ ProcXkbGetMap(ClientPtr client) xkb = dev->key->xkbInfo->desc; xkbGetMapReply rep = { - .type = X_Reply, .deviceID = dev->id, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(sizeof(xkbGetMapReply) - sizeof(xGenericReply)), .present = stuff->partial | stuff->full, .minKeyCode = xkb->min_key_code, .maxKeyCode = xkb->max_key_code, @@ -1497,22 +1494,10 @@ ProcXkbGetMap(ClientPtr client) if ((status = XkbComputeGetMapReplySize(xkb, &rep)) != Success) return status; - int payload_len = (rep.length * sizeof(CARD32)) - (sizeof(xkbGetMapReply) - sizeof(xGenericReply)); - x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE }; - if (!x_rpcbuf_makeroom(&rpcbuf, payload_len)) - return BadAlloc; - - /* use rpcbuf.wpos here, in order to get how much we've really written */ - if (rpcbuf.wpos != payload_len) - LogMessage(X_WARNING, "ProcXkbGetMap() payload_len mismatch: %ld but shoud be %d\n", - rpcbuf.wpos, payload_len); - XkbAssembleMap(client, xkb, rep, &rpcbuf); if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swaps(&rep.present); swaps(&rep.totalSyms); swaps(&rep.totalActs); @@ -1521,8 +1506,7 @@ ProcXkbGetMap(ClientPtr client) if (rpcbuf.error) return BadAlloc; - WriteToClient(client, sizeof(xkbGetMapReply), &rep); - WriteRpcbufToClient(client, &rpcbuf); + X_SEND_REPLY_WITH_RPCBUF(client, rep, rpcbuf); return Success; }