From edec4d2f6c071c5aadbd7e0075abdafb4031e6d7 Mon Sep 17 00:00:00 2001 From: RavRabbit Date: Wed, 7 Jun 2017 18:00:28 +0200 Subject: [PATCH] fex: add support for '-' and '/' characters Newer fex files like orangepi_oneplus.fex from the sunxi-boards repo fail conversion to the binary format: -------------------------- E: orangepi_oneplus.fex:258: invalid character at 4. -------------------------- This is because they contain a '-' character in section and key names, and also '/' characters in some section names, which our compiler denies. Relax the section and key filter to allow '-' and '/' as well. Signed-off-by: Andre Przywara --- script_bin.c | 2 +- script_fex.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/script_bin.c b/script_bin.c index 9c63084..ebed175 100644 --- a/script_bin.c +++ b/script_bin.c @@ -242,7 +242,7 @@ static int decompile_section(void *bin, size_t bin_size, words = (entry->pattern >> 0) & 0xffff; for (char *p = entry->name; *p; p++) - if (!(isalnum(*p) || *p == '_')) { + if (!(isalnum(*p) || *p == '_' || *p == '-')) { pr_info("Warning: Malformed entry key \"%s\"\n", entry->name); break; diff --git a/script_fex.c b/script_fex.c index 0288560..2c840d4 100644 --- a/script_fex.c +++ b/script_fex.c @@ -211,7 +211,7 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script) if (*s == '[') { /* section */ char *p = ++s; - while (isalnum(*p) || *p == '_') + while (isalnum(*p) || *p == '_' || *p == '-' || *p == '/') p++; if (*p == ']' && *(p+1) == '\0') { @@ -239,7 +239,7 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script) goto parse_error; }; - while (isalnum(*p) || *p == '_') + while (isalnum(*p) || *p == '_' || *p == '-') p++; mark = p; p = skip_blank(p);