From 491601be2156a87835410fcc0ff59cf1f306cab7 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Fri, 19 Sep 2003 17:39:32 +0000 Subject: [PATCH] Changed end of line checking for Win32 compatibility --- src/sdlemu_config.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sdlemu_config.cpp b/src/sdlemu_config.cpp index 9d38921..75d7644 100644 --- a/src/sdlemu_config.cpp +++ b/src/sdlemu_config.cpp @@ -48,7 +48,7 @@ void string_tokenize_variable() for(p = vec.begin(); p != vec.end(); p++) { string::size_type lastPos = (*p).LineName().find_first_not_of(delim, 0); string::size_type pos = (*p).LineName().find_first_of(delim, lastPos); - + if(string::npos != pos && string::npos != lastPos) { string s = (*p).LineName().substr(lastPos, pos - lastPos); (*p).add_token_variable(s); @@ -59,12 +59,12 @@ void string_tokenize_variable() void string_tokenize_value() { list::iterator p; - const string delim = " =\n\t"; - + const string delim = " =\n\t\r"; // "\r" needed for Win32 compatibility... + for(p = vec.begin(); p != vec.end(); p++) { string::size_type lastPos = (*p).LineName().find_first_of(delim, 0); string::size_type pos = (*p).LineName().find_first_not_of(delim, lastPos); - + if(string::npos != pos && string::npos != lastPos) { string s = (*p).LineName().substr(pos); (*p).add_token_value(s); @@ -84,11 +84,11 @@ int sdlemu_init_config(const char *filename) char *s = new char[len]; fread(s, 1, len, f); string str(s); - - const string delim = "\n"; + + const string delim = "\n\r"; // "\r" needed for Win32 compatibility... string::size_type lastPos = str.find_first_not_of(delim, 0); string::size_type pos = str.find_first_of(delim, lastPos); - + while (string::npos != pos || string::npos != lastPos) { string string = str.substr(lastPos, pos - lastPos); if(string[0] == '#') -- 2.37.2