unsigned file_id;
struct list entry;
- char alias[XkbKeyNameLength + 1];
- char real[XkbKeyNameLength + 1];
+ char alias[XkbKeyNameLength];
+ char real[XkbKeyNameLength];
} AliasInfo;
typedef struct _IndicatorNameInfo {
*/
static bool
AddKeyName(KeyNamesInfo * info,
- xkb_keycode_t kc, char *name, enum merge_mode merge,
- unsigned file_id, bool reportCollisions)
+ xkb_keycode_t kc, char name[XkbKeyNameLength],
+ enum merge_mode merge, unsigned file_id, bool reportCollisions)
{
xkb_keycode_t old;
unsigned long lval;
file_id == darray_item(info->files, kc)));
if (darray_item(info->names, kc) != 0) {
- char buf[6];
+ const char *lname = LongKeyNameText(darray_item(info->names, kc));
+ const char *kname = KeyNameText(name);
- LongToKeyName(darray_item(info->names, kc), buf);
- buf[4] = '\0';
if (darray_item(info->names, kc) == lval && reportCollisions) {
log_warn(info->keymap->ctx,
"Multiple identical key name definitions; "
- "Later occurences of \"<%s> = %d\" ignored\n", buf, kc);
+ "Later occurences of \"%s = %d\" ignored\n", lname, kc);
return true;
}
if (reportCollisions)
log_warn(info->keymap->ctx,
"Multiple names for keycode %d; "
- "Using <%s>, ignoring <%s>\n", kc, buf, name);
+ "Using %s, ignoring %s\n", kc, lname, kname);
return true;
}
else {
if (reportCollisions)
log_warn(info->keymap->ctx,
"Multiple names for keycode %d; "
- "Using <%s>, ignoring <%s>\n", kc, name, buf);
+ "Using %s, ignoring %s\n", kc, kname, lname);
darray_item(info->names, kc) = 0;
darray_item(info->files, kc) = 0;
}
}
old = FindKeyByLong(info, lval);
- if ((old != 0) && (old != kc)) {
+ if (old != 0 && old != kc) {
+ const char *kname = KeyNameText(name);
+
if (merge == MERGE_OVERRIDE) {
darray_item(info->names, old) = 0;
darray_item(info->files, old) = 0;
if (reportCollisions)
log_warn(info->keymap->ctx,
- "Key name <%s> assigned to multiple keys; "
- "Using %d, ignoring %d\n", name, kc, old);
+ "Key name %s assigned to multiple keys; "
+ "Using %d, ignoring %d\n", kname, kc, old);
}
else {
if (reportCollisions && verbosity > 3)
log_warn(info->keymap->ctx,
- "Key name <%s> assigned to multiple keys; "
- "Using %d, ignoring %d\n", name, old, kc);
+ "Key name %s assigned to multiple keys; "
+ "Using %d, ignoring %d\n", kname, old, kc);
return true;
}
}
+
darray_item(info->names, kc) = lval;
darray_item(info->files, kc) = file_id;
return true;
list_foreach_safe(alias, next, &from->aliases, entry) {
def.merge = (merge == MERGE_DEFAULT) ? alias->merge : merge;
- memcpy(def.alias, alias->alias, XkbKeyNameLength);
- memcpy(def.real, alias->real, XkbKeyNameLength);
+ strncpy(def.alias, alias->alias, XkbKeyNameLength);
+ strncpy(def.real, alias->real, XkbKeyNameLength);
if (!HandleAliasDef(into, &def, def.merge, alias->file_id))
return false;
enum merge_mode merge)
{
uint64_t i;
- char buf[5];
+ char buf[XkbKeyNameLength];
IndicatorNameInfo *led;
if (from->errorCount > 0) {
if (darray_item(from->names, i) == 0)
continue;
LongToKeyName(darray_item(from->names, i), buf);
- buf[4] = '\0';
if (!AddKeyName(into, i, buf, merge, from->file_id, false))
into->errorCount++;
}
if ((info->explicitMin != 0 && stmt->value < info->explicitMin) ||
(info->explicitMax != 0 && stmt->value > info->explicitMax)) {
log_err(info->keymap->ctx,
- "Illegal keycode %lu for name <%s>; "
+ "Illegal keycode %lu for name %s; "
"Must be in the range %d-%d inclusive\n",
- stmt->value, stmt->name, info->explicitMin,
+ stmt->value, KeyNameText(stmt->name), info->explicitMin,
info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX);
return 0;
}
KeyNameText(ignore));
if (use != old->real)
- memcpy(old->real, use, XkbKeyNameLength);
+ strncpy(old->real, use, XkbKeyNameLength);
}
old->file_id = new->file_id;
alias->file_id = file_id;
alias->merge = merge;
- memcpy(alias->alias, def->alias, XkbKeyNameLength);
- memcpy(alias->real, def->real, XkbKeyNameLength);
+ strncpy(alias->alias, def->alias, XkbKeyNameLength);
+ strncpy(alias->real, def->real, XkbKeyNameLength);
list_append(&alias->entry, &info->aliases);
return true;
InitAliasInfo(&old_alias, MERGE_AUGMENT, 0, a->alias, a->real);
HandleAliasCollision(info, &old_alias, alias);
- memcpy(old_alias.real, a->real, XkbKeyNameLength);
+ strncpy(old_alias.real, a->real, XkbKeyNameLength);
alias->alias[0] = '\0';
nNew--;
break;
KEY_FIELD_VMODMAP = (1 << 7),
};
-static inline const char *
-longText(unsigned long val)
-{
- char buf[4];
-
- LongToKeyName(val, buf);
- return KeyNameText(buf);
-}
-
typedef struct _KeyInfo {
enum key_field defined;
unsigned file_id;
log_warn(info->keymap->ctx,
"Multiple actions for level %d/group %u on key %s; "
"Using %s, ignoring %s\n",
- i + 1, group + 1, longText(into->name),
+ i + 1, group + 1, LongKeyNameText(into->name),
ActionTypeText(use->type),
ActionTypeText(ignore->type));
if (use)
log_info(info->keymap->ctx,
"Multiple symbols for group %u, level %d on key %s; "
"Using %s, ignoring %s\n",
- group + 1, i + 1, longText(into->name),
+ group + 1, i + 1, LongKeyNameText(into->name),
(use == FROM ? "from" : "to"),
(use == FROM ? "to" : "from"));
}
log_warn(info->keymap->ctx,
"Multiple definitions for group %d type of key %s; "
"Using %s, ignoring %s\n",
- i, longText(into->name),
+ i, LongKeyNameText(into->name),
xkb_atom_text(info->keymap->ctx, use),
xkb_atom_text(info->keymap->ctx, ignore));
}
log_warn(info->keymap->ctx,
"Symbol map for key %s redefined; "
"Using %s definition for conflicting fields\n",
- longText(into->name),
+ LongKeyNameText(into->name),
(from->merge == MERGE_AUGMENT ? "first" : "last"));
return true;
log_err(info->keymap->ctx,
"Key %s added to map for multiple modifiers; "
"Using %s, ignoring %s.\n",
- longText(new->u.keyName), ModIndexText(use),
+ LongKeyNameText(new->u.keyName), ModIndexText(use),
ModIndexText(ignore));
mm->modifier = use;
}
log_err(info->keymap->ctx,
"Too many groups of %s for key %s (max %u); "
"Ignoring %s defined for extra groups\n",
- name, longText(keyi->name), XkbNumKbdGroups + 1, name);
+ name, LongKeyNameText(keyi->name), XkbNumKbdGroups + 1, name);
return false;
}
log_err(info->keymap->ctx,
"Illegal group index for %s of key %s\n"
"Definition with non-integer array index ignored\n",
- name, longText(keyi->name));
+ name, LongKeyNameText(keyi->name));
return false;
}
log_err(info->keymap->ctx,
"Expected a list of symbols, found %s; "
"Ignoring symbols for group %u of %s\n",
- exprOpText(value->op), ndx + 1, longText(keyi->name));
+ exprOpText(value->op), ndx + 1, LongKeyNameText(keyi->name));
return false;
}
if (!darray_empty(keyi->syms[ndx])) {
log_err(info->keymap->ctx,
"Symbols for key %s, group %u already defined; "
"Ignoring duplicate definition\n",
- longText(keyi->name), ndx + 1);
+ LongKeyNameText(keyi->name), ndx + 1);
return false;
}
nSyms = darray_size(value->value.list.syms);
log_wsgo(info->keymap->ctx,
"Could not resize group %u of key %s to contain %zu levels; "
"Symbols lost\n",
- ndx + 1, longText(keyi->name), nSyms);
+ ndx + 1, LongKeyNameText(keyi->name), nSyms);
return false;
}
keyi->symsDefined |= (1 << ndx);
log_warn(info->keymap->ctx,
"Could not resolve keysym %s for key %s, group %u (%s), level %zu\n",
darray_item(value->value.list.syms, i),
- longText(keyi->name),
+ LongKeyNameText(keyi->name),
ndx + 1,
xkb_atom_text(info->keymap->ctx,
info->groupNames[ndx]),
log_wsgo(info->keymap->ctx,
"Bad expression type (%d) for action list value; "
"Ignoring actions for group %u of %s\n",
- value->op, ndx, longText(keyi->name));
+ value->op, ndx, LongKeyNameText(keyi->name));
return false;
}
if (!darray_empty(keyi->acts[ndx])) {
log_wsgo(info->keymap->ctx,
"Actions for key %s, group %u already defined\n",
- longText(keyi->name), ndx);
+ LongKeyNameText(keyi->name), ndx);
return false;
}
log_wsgo(info->keymap->ctx,
"Could not resize group %u of key %s; "
"Actions lost\n",
- ndx, longText(keyi->name));
+ ndx, LongKeyNameText(keyi->name));
return false;
}
keyi->actsDefined |= (1 << ndx);
log_err(info->keymap->ctx,
"Illegal action definition for %s; "
"Action for group %u/level %zu ignored\n",
- longText(keyi->name), ndx + 1, i + 1);
+ LongKeyNameText(keyi->name), ndx + 1, i + 1);
}
act = (ExprDef *) act->common.next;
}
log_err(info->keymap->ctx,
"Illegal group index for type of key %s; "
"Definition with non-integer array index ignored\n",
- longText(keyi->name));
+ LongKeyNameText(keyi->name));
return false;
}
else {
log_err(info->keymap->ctx,
"Expected a virtual modifier mask, found %s; "
"Ignoring virtual modifiers definition for key %s\n",
- exprOpText(value->op), longText(keyi->name));
+ exprOpText(value->op), LongKeyNameText(keyi->name));
}
}
else if (istreq(field, "locking") ||
log_err(info->keymap->ctx,
"Radio groups not supported; "
"Ignoring radio group specification for key %s\n",
- longText(keyi->name));
+ LongKeyNameText(keyi->name));
return false;
}
else if (istreq_prefix("overlay", field) ||
log_err(info->keymap->ctx,
"Overlays not supported; "
"Ignoring overlay specification for key %s\n",
- longText(keyi->name));
+ LongKeyNameText(keyi->name));
}
else if (istreq(field, "repeating") ||
istreq(field, "repeats") ||
log_err(info->keymap->ctx,
"Illegal repeat setting for %s; "
"Non-boolean repeat setting ignored\n",
- longText(keyi->name));
+ LongKeyNameText(keyi->name));
return false;
}
keyi->repeat = val;
log_err(info->keymap->ctx,
"Illegal groupsWrap setting for %s; "
"Non-boolean value ignored\n",
- longText(keyi->name));
+ LongKeyNameText(keyi->name));
return false;
}
log_err(info->keymap->ctx,
"Illegal groupsClamp setting for %s; "
"Non-boolean value ignored\n",
- longText(keyi->name));
+ LongKeyNameText(keyi->name));
return false;
}
log_err(info->keymap->ctx,
"Illegal group index for redirect of key %s; "
"Definition with non-integer group ignored\n",
- longText(keyi->name));
+ LongKeyNameText(keyi->name));
return false;
}
if ((keyi->typesDefined | keyi->symsDefined | keyi->actsDefined) & ~1) {
xkb_group_index_t i;
log_warn(info->keymap->ctx,
- "For the map %s an explicit group specified\n",
- info->name);
- log_warn(info->keymap->ctx,
+ "For the map %s an explicit group specified, "
"but key %s has more than one group defined; "
"All groups except first one will be ignored\n",
- longText(keyi->name));
+ info->name, LongKeyNameText(keyi->name));
for (i = 1; i < XkbNumKbdGroups; i++) {
keyi->numLevels[i] = 0;
darray_free(keyi->syms[i]);
if (start_from == 0)
log_lvl(info->keymap->ctx, 5,
"Key %s not found in keycodes; Symbols ignored\n",
- longText(keyi->name));
+ LongKeyNameText(keyi->name));
return false;
}
kc = XkbKeyGetKeycode(keymap, key);
"Using %s for the %s key (keycode %d)\n",
keyi->numLevels[i],
xkb_atom_text(keymap->ctx, keyi->types[i]),
- longText(keyi->name), kc);
+ LongKeyNameText(keyi->name), kc);
}
if (FindNamedType(keymap, keyi->types[i], &types[i])) {
if (!autoType || keyi->numLevels[i] > 2)
"Type \"%s\" is not defined; "
"Using TWO_LEVEL for the %s key (keycode %d)\n",
xkb_atom_text(keymap->ctx, keyi->types[i]),
- longText(keyi->name), kc);
+ LongKeyNameText(keyi->name), kc);
types[i] = XkbTwoLevelIndex;
}
"Type \"%s\" has %d levels, but %s has %d symbols; "
"Ignoring extra symbols\n",
type->name, type->num_levels,
- longText(keyi->name),
+ LongKeyNameText(keyi->name),
keyi->numLevels[i]);
keyi->numLevels[i] = type->num_levels;
}
if (outActs == NULL) {
log_wsgo(info->keymap->ctx,
"Could not enlarge actions for %s (key %d)\n",
- longText(keyi->name), kc);
+ LongKeyNameText(keyi->name), kc);
return false;
}
key->explicit |= XkbExplicitInterpretMask;
log_lvl(info->keymap->ctx, 5,
"Key %s not found in keycodes; "
"Modifier map entry for %s not updated\n",
- longText(entry->u.keyName),
+ LongKeyNameText(entry->u.keyName),
ModIndexText(entry->modifier));
return false;
}
if (key->num_groups < 1)
log_warn(info.keymap->ctx,
- "No symbols defined for <%.4s> (keycode %d)\n",
- key->name, XkbKeyGetKeycode(keymap, key));
+ "No symbols defined for %s (keycode %d)\n",
+ KeyNameText(key->name),
+ XkbKeyGetKeycode(keymap, key));
}
}