xkb_atom_t ignore = (clobber ? into->type : from->type);
if (report) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_TYPE_MERGING_GROUPS,
"Multiple definitions for group %d type of key %s; "
"Using %s, ignoring %s\n",
ignore = (clobber ? &intoLevel->action : &fromLevel->action);
if (report) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_ACTION,
"Multiple actions for level %d/group %u on key %s; "
"Using %s, ignoring %s\n",
}
else if (!XkbLevelsSameSyms(fromLevel, intoLevel)) {
if (report) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_SYMBOL,
"Multiple symbols for level %d/group %u on key %s; "
"Using %s, ignoring %s\n",
}
if (collide) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_KEY_FIELDS,
"Symbol map for key %s redefined; "
"Using %s definition for conflicting fields\n",
ignore = (clobber ? old->modifier : new->modifier);
if (new->haveSymbol) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_MODMAP,
"Symbol \"%s\" added to modifier map for multiple modifiers; "
"Using %s, ignoring %s\n",
ModIndexText(info->ctx, &info->mods, use),
ModIndexText(info->ctx, &info->mods, ignore));
} else {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_CONFLICTING_MODMAP,
"Key \"%s\" added to modifier map for multiple modifiers; "
"Using %s, ignoring %s\n",
{
SymbolsInfo included;
+ if (!include)
+ return false;
+
InitSymbolsInfo(&included, info->keymap, info->actions, &info->mods);
included.name = include->stmt;
include->stmt = NULL;
if (stmt->modifier) {
next_incl.explicit_group = atoi(stmt->modifier) - 1;
if (next_incl.explicit_group >= XKB_MAX_GROUPS) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Cannot set explicit group to %d - must be between 1..%d; "
"Ignoring group number\n",
}
if (i >= XKB_MAX_GROUPS) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Too many groups of %s for key %s (max %u); "
"Ignoring %s defined for extra groups\n",
}
if (!ExprResolveGroup(info->ctx, arrayNdx, ndx_rtrn)) {
- log_err_with_code(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
+ log_err(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Illegal group index for %s of key %s\n"
"Definition with non-integer array index ignored\n",
name, KeyInfoText(info, keyi));
}
if (value->expr.op != EXPR_KEYSYM_LIST) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Expected a list of symbols, found %s; "
"Ignoring symbols for group %u of %s\n",
}
if (groupi->defined & GROUP_FIELD_SYMS) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_CONFLICTING_KEY_SYMBOLS_ENTRY,
"Symbols for key %s, group %u already defined; "
"Ignoring duplicate definition\n",
sym_index = darray_item(value->keysym_list.symsMapIndex, i);
leveli->num_syms = darray_item(value->keysym_list.symsNumEntries, i);
- if (leveli->num_syms > 1)
+ if (leveli->num_syms > 1) {
leveli->u.syms = calloc(leveli->num_syms, sizeof(*leveli->u.syms));
+ if (!leveli->u.syms) {
+ log_err(info->ctx, "Failed to allocate memory for leveli->u.syms\n");
+ continue;
+ }
+ }
for (unsigned j = 0; j < leveli->num_syms; j++) {
xkb_keysym_t keysym = darray_item(value->keysym_list.syms,
}
if (value->expr.op != EXPR_ACTION_LIST) {
- log_wsgo(info->ctx,
+ log_wsgo(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Bad expression type (%d) for action list value; "
"Ignoring actions for group %u of %s\n",
value->expr.op, ndx, KeyInfoText(info, keyi));
}
if (groupi->defined & GROUP_FIELD_ACTS) {
- log_wsgo(info->ctx,
+ log_wsgo(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"Actions for key %s, group %u already defined\n",
KeyInfoText(info, keyi), ndx);
return false;
union xkb_action *toAct = &darray_item(groupi->levels, i).action;
if (!HandleActionDef(info->ctx, info->actions, &info->mods, act, toAct))
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_VALUE,
"Illegal action definition for %s; "
"Action for group %u/level %u ignored\n",
xkb_atom_t val;
if (!ExprResolveString(info->ctx, value, &val)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"The type field of a key symbol map must be a string; "
"Ignoring illegal type definition\n");
keyi->defined |= KEY_FIELD_DEFAULT_TYPE;
}
else if (!ExprResolveGroup(info->ctx, arrayNdx, &ndx)) {
- log_err_with_code(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
+ log_err(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Illegal group index for type of key %s; "
"Definition with non-integer array index ignored\n",
KeyInfoText(info, keyi));
if (!ExprResolveModMask(info->ctx, value, MOD_VIRT, &info->mods,
&mask)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_UNSUPPORTED_MODIFIER_MASK,
"Expected a virtual modifier mask, found %s; "
"Ignoring virtual modifiers definition for key %s\n",
unsigned int val;
if (!ExprResolveEnum(info->ctx, value, &val, repeatEntries)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_VALUE,
"Illegal repeat setting for %s; "
"Non-boolean repeat setting ignored\n",
bool set;
if (!ExprResolveBoolean(info->ctx, value, &set)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_VALUE,
"Illegal groupsWrap setting for %s; "
"Non-boolean value ignored\n",
bool set;
if (!ExprResolveBoolean(info->ctx, value, &set)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_VALUE,
"Illegal groupsClamp setting for %s; "
"Non-boolean value ignored\n",
xkb_layout_index_t grp;
if (!ExprResolveGroup(info->ctx, value, &grp)) {
- log_err_with_code(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
+ log_err(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Illegal group index for redirect of key %s; "
"Definition with non-integer group ignored\n",
KeyInfoText(info, keyi));
keyi->defined |= KEY_FIELD_GROUPINFO;
}
else {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_UNKNOWN_FIELD,
"Unknown field %s in a symbol interpretation; "
"Definition ignored\n",
}
if (!ExprResolveGroup(info->ctx, arrayNdx, &group)) {
- log_err_with_code(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
+ log_err(info->ctx, XKB_ERROR_UNSUPPORTED_GROUP_INDEX,
"Illegal index in group name definition; "
"Definition with non-integer array index ignored\n");
return false;
}
if (!ExprResolveString(info->ctx, value, &name)) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_FIELD_TYPE,
"Group name must be a string; "
"Illegal name for group %d ignored\n", group);
group_to_use = info->explicit_group;
}
else {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_NON_BASE_GROUP_NAME,
"An explicit group was specified for the '%s' map, "
"but it provides a name for a group other than Group1 (%d); "
}
else if (!elem && (istreq(field, "groupswrap") ||
istreq(field, "wrapgroups"))) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_WARNING_UNSUPPORTED_SYMBOLS_FIELD,
"Global \"groupswrap\" not supported; Ignored\n");
ret = true;
}
else if (!elem && (istreq(field, "groupsclamp") ||
istreq(field, "clampgroups"))) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_WARNING_UNSUPPORTED_SYMBOLS_FIELD,
"Global \"groupsclamp\" not supported; Ignored\n");
ret = true;
}
else if (!elem && (istreq(field, "groupsredirect") ||
istreq(field, "redirectgroups"))) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_WARNING_UNSUPPORTED_SYMBOLS_FIELD,
"Global \"groupsredirect\" not supported; Ignored\n");
ret = true;
}
else if (!elem && istreq(field, "allownone")) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_WARNING_UNSUPPORTED_SYMBOLS_FIELD,
"Radio groups not supported; "
"Ignoring \"allownone\" specification\n");
for (; def; def = (VarDef *) def->common.next) {
if (def->name && def->name->expr.op == EXPR_FIELD_REF) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_SCOPE,
"Cannot set a global default value from within a key statement; "
"Move statements to the global file scope\n");
}
if (warn) {
- log_warn_with_code(info->ctx,
+ log_warn(info->ctx,
XKB_WARNING_MULTIPLE_GROUPS_AT_ONCE,
"For the map %s an explicit group specified, "
"but key %s has more than one group defined; "
// Handle normal entry
ndx = XkbModNameToIndex(&info->mods, def->modifier, MOD_REAL);
if (ndx == XKB_MOD_INVALID) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_REAL_MODIFIER,
"Illegal modifier map definition; "
"Ignoring map for non-modifier \"%s\"\n",
tmp.u.keySym = sym;
}
else {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_MODMAP_ENTRY,
"Modmap entries may contain only key names or keysyms; "
"Illegal definition for %s modifier ignored\n",
ok = HandleModMapDef(info, (ModMapDef *) stmt);
break;
default:
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_WRONG_STATEMENT_TYPE,
"Symbols files may not include other types; "
"Ignoring %s\n", stmt_type_to_string(stmt->type));
info->errorCount++;
if (info->errorCount > 10) {
- log_err_with_code(info->ctx,
+ log_err(info->ctx,
XKB_ERROR_INVALID_SYNTAX,
"Abandoning symbols file \"%s\"\n",
file->name);
}
if (type_name == XKB_ATOM_NONE) {
- log_warn_with_code(keymap->ctx,
+ log_warn(keymap->ctx,
XKB_WARNING_CANNOT_INFER_KEY_TYPE,
"Couldn't find an automatic type for key '%s' group %d with %lu levels; "
"Using the default type\n",
break;
if (i >= keymap->num_types) {
- log_warn_with_code(keymap->ctx,
+ log_warn(keymap->ctx,
XKB_WARNING_UNDEFINED_KEY_TYPE,
"The type \"%s\" for key '%s' group %d was not previously defined; "
"Using the default type\n",
}
key->groups = calloc(key->num_groups, sizeof(*key->groups));
+ if (!key->groups) {
+ log_err(info->ctx, "Failed to allocate memory for key->groups\n");
+ return false;
+ }
/* Find and assign the groups' types in the keymap. */
darray_enumerate(i, groupi, keyi->groups) {
continue;
if (key->num_groups < 1)
- log_info(info->ctx,
+ log_info(info->ctx, XKB_LOG_MESSAGE_NO_ID,
"No symbols defined for %s\n",
KeyNameText(info->ctx, key->name));
}