Fixed a possible INI file problem: unterminated strings will end at a newline now.

This commit is contained in:
Bart Trzynadlowski 2011-09-12 23:09:06 +00:00
parent e223d388eb
commit 02c0c32398

View file

@ -378,7 +378,7 @@ static bool IsBlank(char c)
return false; 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) CINIFile::CToken CINIFile::GetString(void)
{ {
CToken T; CToken T;
@ -394,7 +394,7 @@ CINIFile::CToken CINIFile::GetString(void)
++linePtr; // so we can find next token ++linePtr; // so we can find next token
break; break;
} }
else if (linePtr[0] == '\0') else if ((linePtr[0] == '\0') || (linePtr[0] == '\n'))
{ {
//printf("tokenizer: warning: string is missing end quote\n"); //printf("tokenizer: warning: string is missing end quote\n");
break; break;
@ -537,7 +537,7 @@ CINIFile::CToken CINIFile::GetToken(void)
else if ((linePtr[0]==';') || (linePtr[0]=='\0')) else if ((linePtr[0]==';') || (linePtr[0]=='\0'))
{ {
T.type = TOKEN_NULL; T.type = TOKEN_NULL;
return T; return T; // do not advance linePtr (so we do not de-sync the parser)
} }
// Delimiters // Delimiters