return NULL;
}
-static void
-EscapeMapName(char *name)
+void
+XkbEscapeMapName(char *name)
{
/*
* All latin-1 alphanumerics, plus parens, slash, minus, underscore and
if (!file)
return NULL;
- EscapeMapName(name);
+ XkbEscapeMapName(name);
file->file_type = type;
file->topName = strdup_safe(name);
file->name = name;
CopyCompatToKeymap(struct xkb_keymap *keymap, CompatInfo *info)
{
keymap->compat_section_name = strdup_safe(info->name);
+ XkbEscapeMapName(keymap->compat_section_name);
if (!darray_empty(info->interps)) {
/* Most specific to least specific. */
unsigned i;
keymap->keycodes_section_name = strdup_safe(info->name);
+ XkbEscapeMapName(keymap->keycodes_section_name);
keymap->min_key_code = info->min_key_code;
keymap->max_key_code = info->max_key_code;
struct xkb_key *key;
keymap->symbols_section_name = strdup_safe(info->name);
+ XkbEscapeMapName(keymap->symbols_section_name);
keymap->num_group_names = darray_size(info->group_names);
keymap->group_names = darray_mem(info->group_names, 0);
CopyKeyTypesToKeymap(struct xkb_keymap *keymap, KeyTypesInfo *info)
{
keymap->types_section_name = strdup_safe(info->name);
+ XkbEscapeMapName(keymap->types_section_name);
keymap->num_types = darray_size(info->types);
if (keymap->num_types == 0)
XkbFileFromComponents(struct xkb_context *ctx,
const struct xkb_component_names *kkctgs);
+void
+XkbEscapeMapName(char *name);
+
bool
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
enum merge_mode merge);
{
struct xkb_context *ctx = test_get_context(0);
struct xkb_keymap *keymap;
- char *original, *dump;
+ char *original, *dump, *dump2;
assert(ctx);
xkb_keymap_unref(keymap);
keymap = test_compile_string(ctx, dump);
assert(keymap);
+ /* Now test that the dump of the dump is equal to the dump! */
+ dump2 = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_USE_ORIGINAL_FORMAT);
+ assert(dump2);
+ assert(streq(dump, dump2));
/* Test response to invalid formats and flags. */
assert(!xkb_keymap_new_from_string(ctx, dump, 0, 0));
xkb_keymap_unref(keymap);
free(dump);
+ free(dump2);
xkb_context_unref(ctx);