From 4140099d0f956bf666b7d4d4043cc991ab9bbdd9 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 15 Jul 2024 19:52:55 +0200 Subject: [PATCH] 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 0827aa11f..854225297 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",