From 02c0c32398c99bd11e50b676a8dff8b99b81307c Mon Sep 17 00:00:00 2001 From: Bart Trzynadlowski Date: Mon, 12 Sep 2011 23:09:06 +0000 Subject: [PATCH] Fixed a possible INI file problem: unterminated strings will end at a newline now. --- Src/INIFile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Src/INIFile.cpp b/Src/INIFile.cpp index e62b9f5..4bcc048 100644 --- a/Src/INIFile.cpp +++ b/Src/INIFile.cpp @@ -378,7 +378,7 @@ static bool IsBlank(char c) return false; } -// Fetches a string. Tolerates all characters between quotes. +// Fetches a string. Tolerates all characters between quotes, except \n. CINIFile::CToken CINIFile::GetString(void) { CToken T; @@ -394,7 +394,7 @@ CINIFile::CToken CINIFile::GetString(void) ++linePtr; // so we can find next token break; } - else if (linePtr[0] == '\0') + else if ((linePtr[0] == '\0') || (linePtr[0] == '\n')) { //printf("tokenizer: warning: string is missing end quote\n"); break; @@ -537,7 +537,7 @@ CINIFile::CToken CINIFile::GetToken(void) else if ((linePtr[0]==';') || (linePtr[0]=='\0')) { T.type = TOKEN_NULL; - return T; + return T; // do not advance linePtr (so we do not de-sync the parser) } // Delimiters