From a2ae9f1d7157ce72563345ffa79d326903c0073b Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 15 Jul 2024 19:52:55 +0200 Subject: [PATCH] (1623) xkb: XkbWriteVirtualModMap(): only pass in the needed data We don't need the whole struct here, especially do we not wanna change it. Therefore only pass in what's really needed, so it gets easier to understand. Signed-off-by: Enrico Weigelt, metux IT consult --- xkb/xkb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xkb/xkb.c b/xkb/xkb.c index 819e5c0b0..664e8e787 100644 --- a/xkb/xkb.c +++ b/xkb/xkb.c @@ -1365,18 +1365,18 @@ XkbSizeVirtualModMap(XkbDescPtr xkb, xkbGetMapReply * rep) } static char * -XkbWriteVirtualModMap(XkbDescPtr xkb, xkbGetMapReply * rep, char *buf, - ClientPtr client) +XkbWriteVirtualModMap(XkbDescPtr xkb, KeyCode firstVModMapKey, + CARD8 nVModMapKeys, char *buf) { unsigned i; xkbVModMapWireDesc *wire; unsigned short *pMap; wire = (xkbVModMapWireDesc *) buf; - pMap = &xkb->server->vmodmap[rep->firstVModMapKey]; - for (i = 0; i < rep->nVModMapKeys; i++, pMap++) { + pMap = &xkb->server->vmodmap[firstVModMapKey]; + for (i = 0; i < nVModMapKeys; i++, pMap++) { if (*pMap != 0) { - wire->key = i + rep->firstVModMapKey; + wire->key = i + firstVModMapKey; wire->vmods = *pMap; wire++; } @@ -1436,7 +1436,7 @@ XkbSendMap(ClientPtr client, XkbDescPtr xkb, xkbGetMapReply * rep) if (rep->totalModMapKeys > 0) desc = XkbWriteModifierMap(xkb, rep->firstModMapKey, rep->nModMapKeys, desc); if (rep->totalVModMapKeys > 0) - desc = XkbWriteVirtualModMap(xkb, rep, desc, client); + desc = XkbWriteVirtualModMap(xkb, rep->firstVModMapKey, rep->nVModMapKeys, desc); if ((desc - start) != (len)) { ErrorF ("[xkb] BOGUS LENGTH in write keyboard desc, expected %d, got %ld\n",