diff --git a/src/keymap-dump.c b/src/keymap-dump.c index 071996a..46f2139 100644 --- a/src/keymap-dump.c +++ b/src/keymap-dump.c @@ -739,7 +739,7 @@ write_compat(struct xkb_keymap *keymap, char **buf, size_t *size, static bool write_keysyms(struct xkb_keymap *keymap, char **buf, size_t *size, - size_t *offset, struct xkb_key *key, unsigned int group) + size_t *offset, struct xkb_key *key, xkb_group_index_t group) { const xkb_keysym_t *syms; int num_syms, level; @@ -780,7 +780,7 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size, size_t *offset) { struct xkb_key *key; - int group, tmp; + xkb_group_index_t group, tmp; bool showActions; if (keymap->symbols_section_name) @@ -828,7 +828,7 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size, continue; type = XkbKeyTypeIndex(key, group); write_buf(keymap, buf, size, offset, - "\n\t\t\ttype[group%d]= \"%s\",", + "\n\t\t\ttype[group%u]= \"%s\",", group + 1, darray_item(keymap->types, type).name); } @@ -862,7 +862,7 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size, case XkbRedirectIntoRange: write_buf(keymap, buf, size, offset, - "\n\t\t\tgroupsRedirect= Group%d,", + "\n\t\t\tgroupsRedirect= Group%u,", key->out_of_range_group_number + 1); break; } @@ -890,13 +890,13 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size, if (group != 0) write_buf(keymap, buf, size, offset, ","); write_buf(keymap, buf, size, offset, - "\n\t\t\tsymbols[Group%d]= [ ", group + 1); + "\n\t\t\tsymbols[Group%u]= [ ", group + 1); if (!write_keysyms(keymap, buf, size, offset, key, group)) return false; write_buf(keymap, buf, size, offset, " ]"); if (showActions) { write_buf(keymap, buf, size, offset, - ",\n\t\t\tactions[Group%d]= [ ", group + 1); + ",\n\t\t\tactions[Group%u]= [ ", group + 1); for (level = 0; level < XkbKeyGroupWidth(keymap, key, group); level++) { diff --git a/src/map.c b/src/map.c index d35d8bc..b9c9874 100644 --- a/src/map.c +++ b/src/map.c @@ -244,7 +244,7 @@ xkb_map_led_get_index(struct xkb_keymap *keymap, const char *name) */ unsigned int xkb_key_get_level(struct xkb_state *state, xkb_keycode_t kc, - unsigned int group) + xkb_group_index_t group) { struct xkb_keymap *keymap = xkb_state_get_map(state); struct xkb_key_type *type; @@ -270,11 +270,12 @@ xkb_key_get_level(struct xkb_state *state, xkb_keycode_t kc, * Returns the group to use for the given key and state, taking * wrapping/clamping/etc into account. */ -unsigned int +xkb_group_index_t xkb_key_get_group(struct xkb_state *state, xkb_keycode_t kc) { struct xkb_keymap *keymap = xkb_state_get_map(state); - unsigned int ret = xkb_state_serialize_group(state, XKB_STATE_EFFECTIVE); + xkb_group_index_t ret = xkb_state_serialize_group(state, + XKB_STATE_EFFECTIVE); struct xkb_key *key; if (!XkbKeycodeInRange(keymap, kc)) @@ -309,7 +310,7 @@ xkb_key_get_group(struct xkb_state *state, xkb_keycode_t kc) */ int xkb_key_get_syms_by_level(struct xkb_keymap *keymap, struct xkb_key *key, - unsigned int group, unsigned int level, + xkb_group_index_t group, unsigned int level, const xkb_keysym_t **syms_out) { int num_syms; @@ -341,7 +342,8 @@ xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t kc, { struct xkb_keymap *keymap = xkb_state_get_map(state); struct xkb_key *key; - int group, level; + xkb_group_index_t group; + unsigned int level; if (!state || !XkbKeycodeInRange(keymap, kc)) return -1; diff --git a/src/state.c b/src/state.c index 94bff55..6b0dae3 100644 --- a/src/state.c +++ b/src/state.c @@ -109,7 +109,8 @@ struct xkb_state { static union xkb_action * xkb_key_get_action(struct xkb_state *state, xkb_keycode_t kc) { - unsigned int group, level; + xkb_group_index_t group; + unsigned int level; struct xkb_key *key = NULL; if (XkbKeycodeInRange(state->keymap, kc)) diff --git a/src/xkb-priv.h b/src/xkb-priv.h index 76ab3aa..55a89f2 100644 --- a/src/xkb-priv.h +++ b/src/xkb-priv.h @@ -136,7 +136,7 @@ struct xkb_mod_action { struct xkb_group_action { uint8_t type; uint8_t flags; - int16_t group; + int32_t group; }; struct xkb_iso_action { @@ -144,7 +144,7 @@ struct xkb_iso_action { uint8_t flags; uint8_t mask; uint8_t real_mods; - uint8_t group; + int32_t group; uint8_t affect; uint16_t vmods; }; @@ -270,7 +270,7 @@ struct xkb_behavior { struct xkb_indicator_map { unsigned char flags; unsigned char which_groups; - unsigned char groups; + uint32_t groups; unsigned char which_mods; struct xkb_mods mods; unsigned int ctrls; @@ -314,12 +314,12 @@ struct xkb_key { unsigned char kt_index[XkbNumKbdGroups]; - unsigned int num_groups; + xkb_group_index_t num_groups; /* How many levels the largest group has. */ unsigned char width; uint8_t out_of_range_group_action; - uint8_t out_of_range_group_number; + xkb_group_index_t out_of_range_group_number; /* per level/group index into 'syms' */ int *sym_index; @@ -387,26 +387,27 @@ XkbKeyGetKeycode(struct xkb_keymap *keymap, struct xkb_key *key) xkb_foreach_key_from(iter, keymap, keymap->min_key_code) static inline unsigned char -XkbKeyTypeIndex(struct xkb_key *key, unsigned int group) +XkbKeyTypeIndex(struct xkb_key *key, xkb_group_index_t group) { return key->kt_index[group & 0x3]; } static inline struct xkb_key_type * -XkbKeyType(struct xkb_keymap *keymap, struct xkb_key *key, unsigned int group) +XkbKeyType(struct xkb_keymap *keymap, struct xkb_key *key, + xkb_group_index_t group) { return &darray_item(keymap->types, XkbKeyTypeIndex(key, group)); } static inline uint16_t XkbKeyGroupWidth(struct xkb_keymap *keymap, struct xkb_key *key, - unsigned int group) + xkb_group_index_t group) { return XkbKeyType(keymap, key, group)->num_levels; } static inline unsigned int -XkbKeyNumSyms(struct xkb_key *key, unsigned int group, unsigned int level) +XkbKeyNumSyms(struct xkb_key *key, xkb_group_index_t group, unsigned int level) { return key->num_syms[group * key->width + level]; } @@ -418,13 +419,14 @@ XkbKeySym(struct xkb_key *key, int ndx) } static inline int -XkbKeySymOffset(struct xkb_key *key, unsigned group, unsigned int level) +XkbKeySymOffset(struct xkb_key *key, xkb_group_index_t group, + unsigned int level) { return key->sym_index[group * key->width + level]; } static inline xkb_keysym_t * -XkbKeySymEntry(struct xkb_key *key, unsigned group, unsigned int level) +XkbKeySymEntry(struct xkb_key *key, xkb_group_index_t group, unsigned int level) { return XkbKeySym(key, XkbKeySymOffset(key, group, level)); } @@ -435,7 +437,7 @@ XkbKeyHasActions(struct xkb_key *key) return key->acts_index != 0; } -static inline unsigned char +static inline unsigned int XkbKeyNumActions(struct xkb_key *key) { if (XkbKeyHasActions(key)) @@ -451,7 +453,7 @@ XkbKeyActionsPtr(struct xkb_keymap *keymap, struct xkb_key *key) static inline union xkb_action * XkbKeyActionEntry(struct xkb_keymap *keymap, struct xkb_key *key, - unsigned int group, unsigned int level) + xkb_group_index_t group, unsigned int level) { if (XkbKeyHasActions(key)) return &XkbKeyActionsPtr(keymap, key)[key->width * group + level]; @@ -482,11 +484,11 @@ xkb_key_get_group(struct xkb_state *state, xkb_keycode_t kc); extern unsigned int xkb_key_get_level(struct xkb_state *state, xkb_keycode_t kc, - unsigned int group); + xkb_group_index_t group); extern int xkb_key_get_syms_by_level(struct xkb_keymap *keymap, struct xkb_key *key, - unsigned int group, unsigned int level, + xkb_group_index_t group, unsigned int level, const xkb_keysym_t **syms_out); /** diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index 07e881e..c10d543 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -320,7 +320,8 @@ HandleLockMods(struct xkb_keymap *keymap, struct xkb_any_action *action, static bool CheckGroupField(struct xkb_keymap *keymap, unsigned action, - ExprDef * value, unsigned *flags_inout, int *grp_rtrn) + ExprDef * value, unsigned *flags_inout, + xkb_group_index_t *grp_rtrn) { ExprDef *spec; ExprResult rtrn; @@ -352,7 +353,7 @@ HandleSetLatchGroup(struct xkb_keymap *keymap, struct xkb_any_action *action, struct xkb_group_action *act; unsigned rtrn; unsigned t1; - int t2; + xkb_group_index_t t2; act = (struct xkb_group_action *) action; if (array_ndx != NULL) { @@ -391,7 +392,7 @@ HandleLockGroup(struct xkb_keymap *keymap, struct xkb_any_action *action, { struct xkb_group_action *act; unsigned t1; - int t2; + xkb_group_index_t t2; act = (struct xkb_group_action *) action; if ((array_ndx != NULL) && (field == F_Group)) @@ -584,7 +585,7 @@ HandleISOLock(struct xkb_keymap *keymap, struct xkb_any_action *action, ExprResult rtrn; struct xkb_iso_action *act; unsigned flags, mods; - int group; + xkb_group_index_t group; act = (struct xkb_iso_action *) action; switch (field) { diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index a0e1220..994a5f6 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -53,7 +53,7 @@ typedef struct _LEDInfo { unsigned char real_mods; unsigned short vmods; unsigned char which_groups; - unsigned char groups; + uint32_t groups; unsigned int ctrls; } LEDInfo; @@ -308,25 +308,24 @@ AddInterp(CompatInfo * info, SymInterpInfo * new) } static bool -AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC) +AddGroupCompat(CompatInfo *info, xkb_group_index_t group, GroupCompatInfo *new) { GroupCompatInfo *gc; - enum merge_mode merge; - merge = newGC->merge; gc = &info->groupCompat[group]; - if (((gc->real_mods == newGC->real_mods) && - (gc->vmods == newGC->vmods))) { + if (gc->real_mods == new->real_mods && gc->vmods == new->vmods) return true; - } - if (((gc->file_id == newGC->file_id) && (warningLevel > 0)) - || (warningLevel > 9)) { - WARN("Compat map for group %d redefined\n", group + 1); + + if ((gc->file_id == new->file_id && warningLevel > 0) || + warningLevel > 9) { + WARN("Compat map for group %u redefined\n", group + 1); ACTION("Using %s definition\n", - (merge == MERGE_AUGMENT ? "old" : "new")); + (new->merge == MERGE_AUGMENT ? "old" : "new")); } - if (newGC->defined && (merge != MERGE_AUGMENT || !gc->defined)) - *gc = *newGC; + + if (new->defined && (new->merge != MERGE_AUGMENT || !gc->defined)) + *gc = *new; + return true; } @@ -492,7 +491,7 @@ MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, SymInterpInfo *si; LEDInfo *led, *rtrn, *next; GroupCompatInfo *gcm; - int i; + xkb_group_index_t i; if (from->errorCount > 0) { into->errorCount += from->errorCount; @@ -943,18 +942,17 @@ HandleGroupCompatDef(GroupCompatDef *def, struct xkb_keymap *keymap, if (def->merge != MERGE_DEFAULT) merge = def->merge; - if (!XkbIsLegalGroup(def->group - 1)) { - ERROR("Keyboard group must be in the range 1..%d\n", - XkbNumKbdGroups + 1); - ACTION("Compatibility map for illegal group %d ignored\n", - def->group); + if (def->group < 1 || def->group > XkbNumKbdGroups) { + ERROR("Keyboard group must be in the range 1..%u\n", + XkbNumKbdGroups); + ACTION("Compatibility map for illegal group %u ignored\n", def->group); return false; } tmp.file_id = info->file_id; tmp.merge = merge; if (!ExprResolveVModMask(def->def, &val, keymap)) { ERROR("Expected a modifier mask in group compatibility definition\n"); - ACTION("Ignoring illegal compatibility map for group %d\n", + ACTION("Ignoring illegal compatibility map for group %u\n", def->group); return false; } @@ -1228,7 +1226,7 @@ bool CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) { - int i; + xkb_group_index_t i; CompatInfo info; GroupCompatInfo *gcm; @@ -1332,7 +1330,7 @@ UpdateActionMods(struct xkb_keymap *keymap, union xkb_action *act, */ static struct xkb_sym_interpret * FindInterpForKey(struct xkb_keymap *keymap, struct xkb_key *key, - uint32_t group, uint32_t level) + xkb_group_index_t group, uint32_t level) { struct xkb_sym_interpret *ret = NULL; struct xkb_sym_interpret *interp; @@ -1396,7 +1394,8 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, struct xkb_key *key) union xkb_action *acts; uint32_t vmodmask = 0; int num_acts = 0; - int group, level; + xkb_group_index_t group; + int level; int i; /* If we've been told not to bind interps to this key, then don't. */ diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c index 2dcc74c..d22ffc2 100644 --- a/src/xkbcomp/expr.c +++ b/src/xkbcomp/expr.c @@ -620,7 +620,7 @@ ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr, return ret; if (val_rtrn->uval == 0 || val_rtrn->uval > XkbNumKbdGroups) { - ERROR("Group index %d is out of range (1..%d)\n", + ERROR("Group index %u is out of range (1..%d)\n", val_rtrn->uval, XkbNumKbdGroups); return false; } diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index ea03e9c..532ea4c 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -94,7 +94,7 @@ typedef struct _KeyInfo { xkb_atom_t dfltType; uint8_t out_of_range_group_action; - uint8_t out_of_range_group_number; + xkb_group_index_t out_of_range_group_number; } KeyInfo; /** @@ -103,7 +103,7 @@ typedef struct _KeyInfo { static void InitKeyInfo(KeyInfo *keyi, unsigned file_id) { - int i; + xkb_group_index_t i; static const char dflt[4] = "*"; keyi->defined = 0; @@ -133,7 +133,7 @@ InitKeyInfo(KeyInfo *keyi, unsigned file_id) static void FreeKeyInfo(KeyInfo *keyi) { - int i; + xkb_group_index_t i; for (i = 0; i < XkbNumKbdGroups; i++) { darray_free(keyi->syms[i]); @@ -151,7 +151,7 @@ FreeKeyInfo(KeyInfo *keyi) static bool CopyKeyInfo(KeyInfo * old, KeyInfo * new, bool clearOld) { - int i; + xkb_group_index_t i; *new = *old; @@ -194,7 +194,7 @@ typedef struct _SymbolsInfo { int errorCount; unsigned file_id; enum merge_mode merge; - unsigned explicit_group; + xkb_group_index_t explicit_group; darray(KeyInfo) keys; KeyInfo dflt; VModInfo vmods; @@ -208,7 +208,7 @@ static void InitSymbolsInfo(SymbolsInfo * info, struct xkb_keymap *keymap, unsigned file_id) { - int i; + xkb_group_index_t i; info->name = NULL; info->explicit_group = 0; @@ -242,7 +242,7 @@ FreeSymbolsInfo(SymbolsInfo * info) } static bool -ResizeKeyGroup(KeyInfo *keyi, unsigned int group, unsigned int numLevels, +ResizeKeyGroup(KeyInfo *keyi, xkb_group_index_t group, unsigned int numLevels, unsigned sizeSyms, bool forceActions) { int i; @@ -280,7 +280,7 @@ enum key_group_selector { static bool MergeKeyGroups(SymbolsInfo * info, - KeyInfo * into, KeyInfo * from, unsigned group) + KeyInfo * into, KeyInfo * from, xkb_group_index_t group) { darray_xkb_keysym_t resultSyms; enum key_group_selector using = NONE; @@ -346,7 +346,7 @@ MergeKeyGroups(SymbolsInfo * info, } if (report) { WARN - ("Multiple actions for level %d/group %d on key %s\n", + ("Multiple actions for level %d/group %u on key %s\n", i + 1, group + 1, longText(into->name)); ACTION("Using %s, ignoring %s\n", XkbcActionTypeText(use->type), @@ -429,7 +429,7 @@ MergeKeyGroups(SymbolsInfo * info, use = TO; if (toSize && fromSize && report) { - INFO("Multiple symbols for group %d, level %d on key %s\n", + INFO("Multiple symbols for group %u, level %d on key %s\n", group + 1, i + 1, longText(into->name)); ACTION("Using %s, ignoring %s\n", (use == FROM ? "from" : "to"), @@ -486,7 +486,7 @@ static bool MergeKeys(SymbolsInfo *info, struct xkb_keymap *keymap, KeyInfo *into, KeyInfo *from) { - int i; + xkb_group_index_t i; unsigned collide = 0; bool report; @@ -813,7 +813,7 @@ HandleIncludeSymbols(IncludeStmt *stmt, struct xkb_keymap *keymap, static bool GetGroupIndex(KeyInfo *keyi, struct xkb_keymap *keymap, - ExprDef * arrayNdx, unsigned what, unsigned *ndx_rtrn) + ExprDef *arrayNdx, unsigned what, xkb_group_index_t *ndx_rtrn) { const char *name; ExprResult tmp; @@ -824,7 +824,7 @@ GetGroupIndex(KeyInfo *keyi, struct xkb_keymap *keymap, name = "actions"; if (arrayNdx == NULL) { - int i; + xkb_group_index_t i; unsigned defined; if (what == SYMBOLS) defined = keyi->symsDefined; @@ -837,7 +837,7 @@ GetGroupIndex(KeyInfo *keyi, struct xkb_keymap *keymap, return true; } } - ERROR("Too many groups of %s for key %s (max %d)\n", name, + ERROR("Too many groups of %s for key %s (max %u)\n", name, longText(keyi->name), XkbNumKbdGroups + 1); ACTION("Ignoring %s defined for extra groups\n", name); return false; @@ -856,9 +856,9 @@ static bool AddSymbolsToKey(KeyInfo *keyi, struct xkb_keymap *keymap, ExprDef *arrayNdx, ExprDef *value, SymbolsInfo *info) { - unsigned ndx, nSyms, nLevels; - unsigned int i; - long j; + xkb_group_index_t ndx; + size_t nSyms, nLevels; + size_t i, j; if (!GetGroupIndex(keyi, keymap, arrayNdx, SYMBOLS, &ndx)) return false; @@ -868,13 +868,13 @@ AddSymbolsToKey(KeyInfo *keyi, struct xkb_keymap *keymap, } if (value->op != ExprKeysymList) { ERROR("Expected a list of symbols, found %s\n", exprOpText(value->op)); - ACTION("Ignoring symbols for group %d of %s\n", ndx + 1, + ACTION("Ignoring symbols for group %u of %s\n", ndx + 1, longText(keyi->name)); return false; } if (!darray_empty(keyi->syms[ndx])) { - ERROR("Symbols for key %s, group %d already defined\n", - longText(keyi->name), ndx + 1); + ERROR("Symbols for key %s, group %u already defined\n", + longText(keyi->name), ndx + 1); ACTION("Ignoring duplicate definition\n"); return false; } @@ -882,7 +882,7 @@ AddSymbolsToKey(KeyInfo *keyi, struct xkb_keymap *keymap, nLevels = darray_size(value->value.list.symsMapIndex); if ((keyi->numLevels[ndx] < nSyms || darray_empty(keyi->syms[ndx])) && (!ResizeKeyGroup(keyi, ndx, nLevels, nSyms, false))) { - WSGO("Could not resize group %d of key %s to contain %d levels\n", + WSGO("Could not resize group %u of key %s to contain %zu levels\n", ndx + 1, longText(keyi->name), nSyms); ACTION("Symbols lost\n"); return false; @@ -905,7 +905,7 @@ AddSymbolsToKey(KeyInfo *keyi, struct xkb_keymap *keymap, darray_item(keyi->symsMapIndex[ndx], i) + j))) { WARN( - "Could not resolve keysym %s for key %s, group %d (%s), level %d\n", + "Could not resolve keysym %s for key %s, group %u (%s), level %zu\n", darray_item(value->value.list.syms, i), longText(keyi->name), ndx + 1, @@ -937,8 +937,9 @@ static bool AddActionsToKey(KeyInfo *keyi, struct xkb_keymap *keymap, ExprDef *arrayNdx, ExprDef *value, SymbolsInfo *info) { - unsigned int i; - unsigned ndx, nActs; + size_t i; + xkb_group_index_t ndx; + size_t nActs; ExprDef *act; struct xkb_any_action *toAct; @@ -951,13 +952,13 @@ AddActionsToKey(KeyInfo *keyi, struct xkb_keymap *keymap, ExprDef *arrayNdx, } if (value->op != ExprActionList) { WSGO("Bad expression type (%d) for action list value\n", value->op); - ACTION("Ignoring actions for group %d of %s\n", ndx, + ACTION("Ignoring actions for group %u of %s\n", ndx, longText(keyi->name)); return false; } if (!darray_empty(keyi->acts[ndx])) { - WSGO("Actions for key %s, group %d already defined\n", - longText(keyi->name), ndx); + WSGO("Actions for key %s, group %u already defined\n", + longText(keyi->name), ndx); return false; } for (nActs = 0, act = value->value.child; act != NULL; nActs++) { @@ -969,7 +970,7 @@ AddActionsToKey(KeyInfo *keyi, struct xkb_keymap *keymap, ExprDef *arrayNdx, } if ((keyi->numLevels[ndx] < nActs || darray_empty(keyi->acts[ndx])) && !ResizeKeyGroup(keyi, ndx, nActs, nActs, true)) { - WSGO("Could not resize group %d of key %s\n", ndx, + WSGO("Could not resize group %u of key %s\n", ndx, longText(keyi->name)); ACTION("Actions lost\n"); return false; @@ -982,7 +983,7 @@ AddActionsToKey(KeyInfo *keyi, struct xkb_keymap *keymap, ExprDef *arrayNdx, if (!HandleActionDef(act, keymap, toAct, info->action)) { ERROR("Illegal action definition for %s\n", longText(keyi->name)); - ACTION("Action for group %d/level %d ignored\n", ndx + 1, i + 1); + ACTION("Action for group %u/level %zu ignored\n", ndx + 1, i + 1); } act = (ExprDef *) act->common.next; } @@ -1267,13 +1268,13 @@ HandleSymbolsBody(VarDef *def, struct xkb_keymap *keymap, KeyInfo *keyi, static bool SetExplicitGroup(SymbolsInfo *info, KeyInfo *keyi) { - unsigned group = info->explicit_group; + xkb_group_index_t group = info->explicit_group; if (group == 0) return true; if ((keyi->typesDefined | keyi->symsDefined | keyi->actsDefined) & ~1) { - int i; + xkb_group_index_t i; WARN("For the map %s an explicit group specified\n", info->name); WARN("but key %s has more than one group defined\n", longText(keyi->name)); @@ -1438,7 +1439,8 @@ static struct xkb_key * FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym) { struct xkb_key *key, *ret = NULL; - unsigned int group, level, min_group = UINT_MAX, min_level = UINT_MAX; + xkb_group_index_t group, min_group = UINT_MAX; + unsigned int level, min_level = UINT_MAX; xkb_foreach_key(key, keymap) { for (group = 0; group < key->num_groups; group++) { @@ -1570,7 +1572,8 @@ FindAutomaticType(struct xkb_keymap *keymap, int width, static void PrepareKeyDef(KeyInfo *keyi) { - int i, j, width, defined, lastGroup; + xkb_group_index_t i, lastGroup; + int j, width, defined; bool identical; defined = keyi->symsDefined | keyi->actsDefined | keyi->typesDefined; @@ -1679,13 +1682,14 @@ PrepareKeyDef(KeyInfo *keyi) * This function recurses. */ static bool -CopySymbolsDef(struct xkb_keymap *keymap, KeyInfo *keyi, int start_from) +CopySymbolsDef(struct xkb_keymap *keymap, KeyInfo *keyi, + xkb_keycode_t start_from) { - unsigned int i; xkb_keycode_t kc; struct xkb_key *key; - unsigned int sizeSyms = 0; - unsigned width, tmp, nGroups; + size_t sizeSyms = 0; + xkb_group_index_t i, nGroups; + unsigned width, tmp; struct xkb_key_type * type; bool haveActions, autoType, useAlias; unsigned types[XkbNumKbdGroups]; @@ -1706,7 +1710,8 @@ CopySymbolsDef(struct xkb_keymap *keymap, KeyInfo *keyi, int start_from) kc = XkbKeyGetKeycode(keymap, key); haveActions = false; - for (i = width = nGroups = 0; i < XkbNumKbdGroups; i++) { + width = 0; + for (i = nGroups = 0; i < XkbNumKbdGroups; i++) { if (((i + 1) > nGroups) && (((keyi->symsDefined | keyi->actsDefined) & (1 << i)) || (keyi->typesDefined) & (1 << i))) @@ -1724,7 +1729,7 @@ CopySymbolsDef(struct xkb_keymap *keymap, KeyInfo *keyi, int start_from) else { if (warningLevel >= 5) { WARN("No automatic type for %d symbols\n", - (unsigned int) keyi->numLevels[i]); + keyi->numLevels[i]); ACTION("Using %s for the %s key (keycode %d)\n", xkb_atom_text(keymap->ctx, keyi->types[i]), longText(keyi->name), kc); @@ -1892,7 +1897,7 @@ bool CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) { - int i; + xkb_group_index_t i; struct xkb_key *key; SymbolsInfo info; KeyInfo *keyi;