Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-05-31 11:43:46 +0000
committerStijn Buys <ingar@osirion.org>2008-05-31 11:43:46 +0000
commit2a41efa0d43b573e1c8851086268b8a64d51c511 (patch)
tree1727c8aeb8b540ee4990bd92c0e8158a409b9397 /src/filesystem
parent4b527153ccf2a2830e38038ce4cf06ccc764d310 (diff)
fixes zlib compression, infi file parser updates
Diffstat (limited to 'src/filesystem')
-rw-r--r--src/filesystem/inifile.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/filesystem/inifile.cc b/src/filesystem/inifile.cc
index 337cf45..0cc690f 100644
--- a/src/filesystem/inifile.cc
+++ b/src/filesystem/inifile.cc
@@ -4,6 +4,7 @@
the terms of the GNU General Public License version 2
*/
+#include "auxiliary/functions.h"
#include "math/mathlib.h"
#include "filesystem/filesystem.h"
#include "filesystem/inifile.h"
@@ -83,21 +84,27 @@ bool IniFile::getline() {
if (s.size() > 2 && s[0] == '[' && s[s.size()-1] == ']') {
// condebug << "Inifile got section header " << s << std::endl;
section_current = s.substr(1, s.size()-2);
+
+ aux::trim(section_current);
+ aux::to_lowercase(section_current);
+
last_read_was_section = true;
return true;
} else {
// key=value pair
size_t found = s.find('=');
- if (found != std::string::npos) {
- // make lowercase
+ if (found != std::string::npos && found > 0) {
+ // make lowercase and strip spaces
key_current = s.substr(0, found);
- while (key_current.size() && key_current[key_current.size()-1] == ' ')
- key_current.erase(key_current.size()-1, 1);
+ aux::trim(key_current);
+ aux::to_lowercase(key_current);
if (key_current.size()) {
value_current = s.substr(found+1, s.size() - found - 1);
- last_read_was_key = true;
+ aux::trim (value_current);
+ last_read_was_key = true;
+ //con_debug << "IniFile got " << key_current << "=" << value_current << std::endl;
return true;
}