[Scummvm-cvs-logs] CVS: scummvm/common config-file.cpp,1.21,1.22
kirben
kirben at users.sourceforge.net
Sat Apr 23 20:42:23 CEST 2005
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17531/common
Modified Files:
config-file.cpp
Log Message:
The last section of config file was not saved, when loading config file.
Fix all string compares.
Index: config-file.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/config-file.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- config-file.cpp 23 Apr 2005 22:28:36 -0000 1.21
+++ config-file.cpp 24 Apr 2005 03:41:57 -0000 1.22
@@ -150,6 +150,10 @@
}
}
+ // Save last section
+ if (!section.name.isEmpty())
+ _sections.push_back(section);
+
return !stream.ioFailed();
}
@@ -195,7 +199,7 @@
void ConfigFile::removeSection(const String §ion) {
assert(isValidName(section));
for (List<Section>::iterator i = _sections.begin(); i != _sections.end(); ++i) {
- if (scumm_stricmp(section.c_str(), i->name.c_str())) {
+ if (!scumm_stricmp(section.c_str(), i->name.c_str())) {
_sections.erase(i);
return;
}
@@ -282,7 +286,7 @@
ConfigFile::Section *ConfigFile::getSection(const String §ion) {
for (List<Section>::iterator i = _sections.begin(); i != _sections.end(); ++i) {
- if (scumm_stricmp(section.c_str(), i->name.c_str())) {
+ if (!scumm_stricmp(section.c_str(), i->name.c_str())) {
return &(*i);
}
}
@@ -291,7 +295,7 @@
const ConfigFile::Section *ConfigFile::getSection(const String §ion) const {
for (List<Section>::const_iterator i = _sections.begin(); i != _sections.end(); ++i) {
- if (scumm_stricmp(section.c_str(), i->name.c_str())) {
+ if (!scumm_stricmp(section.c_str(), i->name.c_str())) {
return &(*i);
}
}
@@ -304,7 +308,7 @@
const ConfigFile::KeyValue* ConfigFile::Section::getKey(const String &key) const {
for (List<KeyValue>::const_iterator i = keys.begin(); i != keys.end(); ++i) {
- if (scumm_stricmp(key.c_str(), i->key.c_str())) {
+ if (!scumm_stricmp(key.c_str(), i->key.c_str())) {
return &(*i);
}
}
@@ -313,7 +317,7 @@
void ConfigFile::Section::setKey(const String &key, const String &value) {
for (List<KeyValue>::iterator i = keys.begin(); i != keys.end(); ++i) {
- if (scumm_stricmp(key.c_str(), i->key.c_str())) {
+ if (!scumm_stricmp(key.c_str(), i->key.c_str())) {
i->value = value;
return;
}
@@ -327,7 +331,7 @@
void ConfigFile::Section::removeKey(const String &key) {
for (List<KeyValue>::iterator i = keys.begin(); i != keys.end(); ++i) {
- if (scumm_stricmp(key.c_str(), i->key.c_str())) {
+ if (!scumm_stricmp(key.c_str(), i->key.c_str())) {
keys.erase(i);
return;
}
More information about the Scummvm-git-logs
mailing list