aboutsummaryrefslogtreecommitdiff
path: root/common/ini-file.cpp
diff options
context:
space:
mode:
authorAndrei Prykhodko2019-08-20 13:12:12 +0300
committerFilippos Karapetis2019-08-20 13:53:01 +0300
commitc2054682f0f20ad284582b0717d0298df401a228 (patch)
treeeb0d62fdf2d0bd8fd218abd3a208c18ec18bf285 /common/ini-file.cpp
parent1dd915ccdf361fa16161ebff859e17f459f0c617 (diff)
downloadscummvm-rg350-c2054682f0f20ad284582b0717d0298df401a228.tar.gz
scummvm-rg350-c2054682f0f20ad284582b0717d0298df401a228.tar.bz2
scummvm-rg350-c2054682f0f20ad284582b0717d0298df401a228.zip
COMMON: added support for ini files with non english characters
Diffstat (limited to 'common/ini-file.cpp')
-rw-r--r--common/ini-file.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/common/ini-file.cpp b/common/ini-file.cpp
index 90d40b7c7d..4c4acc9e60 100644
--- a/common/ini-file.cpp
+++ b/common/ini-file.cpp
@@ -29,12 +29,18 @@
namespace Common {
bool INIFile::isValidName(const String &name) const {
+ if (_allowNonEnglishCharacters)
+ return true;
const char *p = name.c_str();
while (*p && (isAlnum(*p) || *p == '-' || *p == '_' || *p == '.' || *p == ' '))
p++;
return *p == 0;
}
+INIFile::INIFile() {
+ _allowNonEnglishCharacters = false;
+}
+
void INIFile::clear() {
_sections.clear();
}
@@ -102,7 +108,7 @@ bool INIFile::loadFromStream(SeekableReadStream &stream) {
// is, verify that it only consists of alphanumerics,
// periods, dashes and underscores). Mohawk Living Books games
// can have periods in their section names.
- while (*p && (isAlnum(*p) || *p == '-' || *p == '_' || *p == '.' || *p == ' '))
+ while (*p && ((_allowNonEnglishCharacters && *p != ']') || isAlnum(*p) || *p == '-' || *p == '_' || *p == '.' || *p == ' '))
p++;
if (*p == '\0')
@@ -435,4 +441,8 @@ void INIFile::Section::removeKey(const String &key) {
}
}
+void INIFile::allowNonEnglishCharacters() {
+ _allowNonEnglishCharacters = true;
+}
+
} // End of namespace Common