From: Patrik Gornicz Date: Fri, 29 Aug 2008 03:04:00 +0000 (-0400) Subject: fix config reader bug X-Git-Tag: physics-premerge~122 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=commitdiff_plain;h=7ffb6c2da6f41929a6f8043d2127f28122864110;p=libbear.git fix config reader bug --- diff --git a/src/config/reader.cpp b/src/config/reader.cpp index 19f7d33..beb6e20 100644 --- a/src/config/reader.cpp +++ b/src/config/reader.cpp @@ -36,6 +36,7 @@ bool extractLine(const string& str, string* name, string* value); /// ***** Private Variables ***** char* configDir = "configs/"; +char* testFile = "test.cfg"; /// ***** Public Methods ***** @@ -44,7 +45,7 @@ void readConfigs(inputMap* map) char fileName[64]; strcpy(fileName, configDir); - strcat(fileName, "test.cfg"); + strcat(fileName, testFile); ifstream file(fileName); @@ -141,14 +142,17 @@ bool extractLine(const string& str, string* name, string* value) char_pos--; // decrement to stay on this char break; case 2: - if(c_str[char_pos] == '=') - state++; - if(c_str[char_pos] != ' ' - && c_str[char_pos] != '\t') + && c_str[char_pos] != '\t' + && c_str[char_pos] != '=') { return false; } + + if(c_str[char_pos] == '=') + { + state++; + } break; case 3: if(c_str[char_pos] != ' '