fix handling of \n, \r, \t escape sequences in strings

This commit is contained in:
Wolfgang Thaller 2014-10-16 02:29:41 +02:00
parent eadbe38cfc
commit 8cd19154a5

View File

@ -45,7 +45,7 @@ static int readInt(const char *str, const char *end = NULL, int baseOverride = 0
x += *str - 'A' + 10; x += *str - 'A' + 10;
else if(*str >= '0' && *str <= '9') else if(*str >= '0' && *str <= '9')
x += *str - '0'; x += *str - '0';
*str++; str++;
} }
return x; return x;
@ -86,13 +86,13 @@ static std::string readStringLit(const char *str)
switch(*p) switch(*p)
{ {
case 'n': case 'n':
out << '\n'; out << '\n'; ++p;
break; break;
case 'r': case 'r':
out << '\r'; out << '\r'; ++p;
break; break;
case 't': case 't':
out << '\t'; out << '\t'; ++p;
break; break;
case '0': case '0':
case '1': case '1':