diff --git a/lib/inih/ini.c b/lib/inih/ini.c index b4d5921211..111b6bea92 100644 --- a/lib/inih/ini.c +++ b/lib/inih/ini.c @@ -51,6 +51,18 @@ static char* lskip(const char* s) return (char*)s; } +/* Strip quotes from single and double quoted strings */ +static char* unquote(char* s) +{ + int l = strlen(s); + if (l && s[0] == s[l - 1] && (s[0] == '\'' || s[0] == '"')) + { + s[l - 1] = '\0'; + s++; + } + return s; +} + /* Return pointer to first char (of chars) or inline comment in given string, or pointer to null at end of string if neither found. Inline comment must be prefixed by a whitespace character to register as a comment. */ @@ -194,6 +206,7 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler, #endif value = lskip(value); rstrip(value); + unquote(value); /* Valid name[=:]value pair found, call handler */ strncpy0(prev_name, name, sizeof(prev_name));