|
|
88131a |
From c9b379ec5a1a34692af06056925bd0fc5f809713 Mon Sep 17 00:00:00 2001
|
|
|
88131a |
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
88131a |
Date: Tue, 5 Jul 2022 12:40:47 +1000
|
|
|
88131a |
Subject: [PATCH xserver 1/3] xkb: switch to array index loops to moving
|
|
|
88131a |
pointers
|
|
|
88131a |
|
|
|
88131a |
Most similar loops here use a pointer that advances with each loop
|
|
|
88131a |
iteration, let's do the same here for consistency.
|
|
|
88131a |
|
|
|
88131a |
No functional changes.
|
|
|
88131a |
|
|
|
88131a |
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
88131a |
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
88131a |
(cherry picked from commit f1070c01d616c5f21f939d5ebc533738779451ac)
|
|
|
88131a |
---
|
|
|
88131a |
xkb/xkb.c | 20 ++++++++++----------
|
|
|
88131a |
1 file changed, 10 insertions(+), 10 deletions(-)
|
|
|
88131a |
|
|
|
88131a |
diff --git a/xkb/xkb.c b/xkb/xkb.c
|
|
|
88131a |
index d056c698c..684394d77 100644
|
|
|
88131a |
--- a/xkb/xkb.c
|
|
|
88131a |
+++ b/xkb/xkb.c
|
|
|
88131a |
@@ -5372,16 +5372,16 @@ _CheckSetSections(XkbGeometryPtr geom,
|
|
|
88131a |
row->left = rWire->left;
|
|
|
88131a |
row->vertical = rWire->vertical;
|
|
|
88131a |
kWire = (xkbKeyWireDesc *) &rWire[1];
|
|
|
88131a |
- for (k = 0; k < rWire->nKeys; k++) {
|
|
|
88131a |
+ for (k = 0; k < rWire->nKeys; k++, kWire++) {
|
|
|
88131a |
XkbKeyPtr key;
|
|
|
88131a |
|
|
|
88131a |
key = XkbAddGeomKey(row);
|
|
|
88131a |
if (!key)
|
|
|
88131a |
return BadAlloc;
|
|
|
88131a |
- memcpy(key->name.name, kWire[k].name, XkbKeyNameLength);
|
|
|
88131a |
- key->gap = kWire[k].gap;
|
|
|
88131a |
- key->shape_ndx = kWire[k].shapeNdx;
|
|
|
88131a |
- key->color_ndx = kWire[k].colorNdx;
|
|
|
88131a |
+ memcpy(key->name.name, kWire->name, XkbKeyNameLength);
|
|
|
88131a |
+ key->gap = kWire->gap;
|
|
|
88131a |
+ key->shape_ndx = kWire->shapeNdx;
|
|
|
88131a |
+ key->color_ndx = kWire->colorNdx;
|
|
|
88131a |
if (key->shape_ndx >= geom->num_shapes) {
|
|
|
88131a |
client->errorValue = _XkbErrCode3(0x10, key->shape_ndx,
|
|
|
88131a |
geom->num_shapes);
|
|
|
88131a |
@@ -5393,7 +5393,7 @@ _CheckSetSections(XkbGeometryPtr geom,
|
|
|
88131a |
return BadMatch;
|
|
|
88131a |
}
|
|
|
88131a |
}
|
|
|
88131a |
- rWire = (xkbRowWireDesc *) &kWire[rWire->nKeys];
|
|
|
88131a |
+ rWire = (xkbRowWireDesc *)kWire;
|
|
|
88131a |
}
|
|
|
88131a |
wire = (char *) rWire;
|
|
|
88131a |
if (sWire->nDoodads > 0) {
|
|
|
88131a |
@@ -5458,16 +5458,16 @@ _CheckSetShapes(XkbGeometryPtr geom,
|
|
|
88131a |
return BadAlloc;
|
|
|
88131a |
ol->corner_radius = olWire->cornerRadius;
|
|
|
88131a |
ptWire = (xkbPointWireDesc *) &olWire[1];
|
|
|
88131a |
- for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++) {
|
|
|
88131a |
- pt->x = ptWire[p].x;
|
|
|
88131a |
- pt->y = ptWire[p].y;
|
|
|
88131a |
+ for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++, ptWire++) {
|
|
|
88131a |
+ pt->x = ptWire->x;
|
|
|
88131a |
+ pt->y = ptWire->y;
|
|
|
88131a |
if (client->swapped) {
|
|
|
88131a |
swaps(&pt->x);
|
|
|
88131a |
swaps(&pt->y);
|
|
|
88131a |
}
|
|
|
88131a |
}
|
|
|
88131a |
ol->num_points = olWire->nPoints;
|
|
|
88131a |
- olWire = (xkbOutlineWireDesc *) (&ptWire[olWire->nPoints]);
|
|
|
88131a |
+ olWire = (xkbOutlineWireDesc *)ptWire;
|
|
|
88131a |
}
|
|
|
88131a |
if (shapeWire->primaryNdx != XkbNoShape)
|
|
|
88131a |
shape->primary = &shape->outlines[shapeWire->primaryNdx];
|
|
|
88131a |
--
|
|
|
88131a |
2.36.1
|
|
|
88131a |
|