types: fix canonical types copying
authorRan Benita <ran234@gmail.com>
Mon, 23 Jul 2012 18:18:18 +0000 (21:18 +0300)
committerRan Benita <ran234@gmail.com>
Thu, 26 Jul 2012 19:55:41 +0000 (22:55 +0300)
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>
src/alloc.c
src/xkbcomp/keytypes.c

index c6380fa..cd5bd17 100644 (file)
@@ -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);
 
index a3fa0e2..05727f2 100644 (file)
@@ -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),