xkb: XkbAssembleMap(): use x_rpcbuf_t for writing the virtual mods

As we now have x_rpcbuf, we can use it here, instead of meddling
with pre-allocated buffer space directly via raw pointer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-07-16 01:18:32 +02:00
committed by Enrico Weigelt
parent 316e5e431a
commit 15a13ef93e

View File

@@ -1372,18 +1372,19 @@ static void XkbAssembleMap(ClientPtr client, XkbDescPtr xkb,
if (rep.totalKeyBehaviors > 0)
XkbWriteKeyBehaviors(xkb, rep.firstKeyBehavior, rep.nKeyBehaviors, rpcbuf);
char *desc = rpcbuf->buffer + rpcbuf->wpos;
if (rep.virtualMods) {
register int sz;
for (int i = sz = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
CARD8 vmods[XkbPaddedSize(XkbNumVirtualMods)] = { 0 };
size_t sz = 0;
for (size_t i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
if (rep.virtualMods & bit) {
desc[sz++] = xkb->server->vmods[i];
vmods[sz++] = xkb->server->vmods[i];
}
}
desc += XkbPaddedSize(sz);
x_rpcbuf_write_CARD8s(rpcbuf, vmods, XkbPaddedSize(sz));
}
char *desc = rpcbuf->buffer + rpcbuf->wpos;
if (rep.totalKeyExplicit > 0)
desc = XkbWriteExplicit(xkb, rep.firstKeyExplicit, rep.nKeyExplicit, desc);
if (rep.totalModMapKeys > 0)