[Scummvm-git-logs] scummvm master -> 5c96b20c1b2426850690f7e1683c4ad8edc18e0c
sev-
noreply at scummvm.org
Thu Dec 14 15:45:37 UTC 2023
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9b59bea53b COMMON: Add INIFile::requireKeyValueDelimiter()
5c96b20c1b MOHAWK: LB: Require delimiters in INI files
Commit: 9b59bea53baac9a3949eadc574709ad05c678a52
https://github.com/scummvm/scummvm/commit/9b59bea53baac9a3949eadc574709ad05c678a52
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-12-14T16:45:32+01:00
Commit Message:
COMMON: Add INIFile::requireKeyValueDelimiter()
Changed paths:
common/formats/ini-file.cpp
common/formats/ini-file.h
diff --git a/common/formats/ini-file.cpp b/common/formats/ini-file.cpp
index 32101f61fcd..55fc5c83bbe 100644
--- a/common/formats/ini-file.cpp
+++ b/common/formats/ini-file.cpp
@@ -53,6 +53,7 @@ bool INIFile::isValidName(const String &name) const {
INIFile::INIFile() {
_allowNonEnglishCharacters = false;
_suppressValuelessLineWarning = false;
+ _requireKeyValueDelimiter = false;
}
void INIFile::clear() {
@@ -174,6 +175,11 @@ bool INIFile::loadFromStream(SeekableReadStream &stream) {
if (!p) {
if (!_suppressValuelessLineWarning)
warning("Config file buggy: Junk found in line %d: '%s'", lineno, line.c_str());
+
+ // there is no '=' on this line. skip if delimiter is required.
+ if (_requireKeyValueDelimiter)
+ continue;
+
kv.key = line;
kv.value.clear();
} else {
@@ -481,4 +487,8 @@ void INIFile::suppressValuelessLineWarning() {
_suppressValuelessLineWarning = true;
}
+void INIFile::requireKeyValueDelimiter() {
+ _requireKeyValueDelimiter = true;
+}
+
} // End of namespace Common
diff --git a/common/formats/ini-file.h b/common/formats/ini-file.h
index a2767d5c487..119f9da6523 100644
--- a/common/formats/ini-file.h
+++ b/common/formats/ini-file.h
@@ -133,11 +133,24 @@ public:
void allowNonEnglishCharacters(); /*!< Allow non-English characters in this INI file. */
void suppressValuelessLineWarning(); /*!< Disable warnings for lines that contain only keys. */
+ /**
+ * Requires that every key/value line have a delimiter character.
+ * Otherwise, lines that don't contain a delimiter are interpreted as
+ * if the entire line is a key with an empty value. This can cause
+ * unexpected junk lines to reach engines. (bug #13920)
+ *
+ * It may be better if instead this were the default behavior for
+ * clients to disable if needed, but first we would need to identify
+ * everything that depends on the current behavior.
+ */
+ void requireKeyValueDelimiter();
+
private:
String _defaultSectionName;
SectionList _sections;
bool _allowNonEnglishCharacters;
bool _suppressValuelessLineWarning;
+ bool _requireKeyValueDelimiter;
Section *getSection(const String §ion);
const Section *getSection(const String §ion) const;
Commit: 5c96b20c1b2426850690f7e1683c4ad8edc18e0c
https://github.com/scummvm/scummvm/commit/5c96b20c1b2426850690f7e1683c4ad8edc18e0c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-12-14T16:45:32+01:00
Commit Message:
MOHAWK: LB: Require delimiters in INI files
Fixes bug #13920
Changed paths:
engines/mohawk/livingbooks.cpp
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 003bae180eb..908412045c8 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -153,6 +153,9 @@ MohawkEngine_LivingBooks::MohawkEngine_LivingBooks(OSystem *syst, const MohawkGa
SearchMan.addSubDirectoryMatching(gameDataDir, "Rugrats Adventure Game", 0, 2);
// CarmenTQ
SearchMan.addSubDirectoryMatching(gameDataDir, "95instal", 0, 4);
+
+ // Sheila Rae, the Brave (Europe version) contains a junk line (bug #13920)
+ _bookInfoFile.requireKeyValueDelimiter();
}
MohawkEngine_LivingBooks::~MohawkEngine_LivingBooks() {
More information about the Scummvm-git-logs
mailing list