types: fix canonical types copying Without the re-initialization, the copying fails. This wasn't noticed because this code practically never gets executed with ordinary keymaps. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
diff --git a/src/alloc.c b/src/alloc.c
index c6380fa..cd5bd17 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -41,6 +41,7 @@ XkbcCopyKeyType(const struct xkb_key_type *from, struct xkb_key_type *into)
free(into->level_names);
*into = *from;
+ darray_init(into->map);
darray_copy(into->map, from->map);
diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c
index a3fa0e2..05727f2 100644
--- a/src/xkbcomp/keytypes.c
+++ b/src/xkbcomp/keytypes.c
@@ -1055,14 +1055,14 @@ static struct xkb_kt_map_entry mapKeypad[] = {
};
static const struct xkb_key_type canonicalTypes[XkbNumRequiredTypes] = {
- {
+ [XkbOneLevelIndex] = {
.mods = { .mask = 0, .vmods = 0, .real_mods = 0 },
.num_levels = 1,
.preserve = NULL,
.name = NULL,
.level_names = NULL
},
- {
+ [XkbTwoLevelIndex] = {
.mods = { .mask = ShiftMask, .vmods = ShiftMask, .real_mods = 0 },
.num_levels = 2,
.map = darray_lit(map2Level),
@@ -1070,7 +1070,7 @@ static const struct xkb_key_type canonicalTypes[XkbNumRequiredTypes] = {
.name = NULL,
.level_names = NULL
},
- {
+ [XkbAlphabeticIndex] = {
.mods = {
.mask = ShiftMask | LockMask,
.vmods = ShiftMask | LockMask,
@@ -1082,7 +1082,7 @@ static const struct xkb_key_type canonicalTypes[XkbNumRequiredTypes] = {
.name = NULL,
.level_names = NULL
},
- {
+ [XkbKeypadIndex] = {
.mods = { .mask = ShiftMask, .vmods = ShiftMask, .real_mods = 0 },
.num_levels = 2,
.map = darray_lit(mapKeypad),