JSON bug fixes

GH #241: SF #620 Endless loop in JSON parser (added Buffer::setCapacity)
GH #242: SF #619 Syntax error in JSON parser (float/double trim)
This commit is contained in:
Aleksandar Fabijanic
2013-07-21 22:18:56 -05:00
parent 996ddf1b43
commit 20e1cf8821
8 changed files with 56 additions and 4 deletions

View File

@@ -180,7 +180,8 @@ Dynamic::Var Parser::parse(const std::string& json)
int c = 0;
while(source.nextChar(c))
{
if (0 == parseChar(c, source)) throw SyntaxException("JSON syntax error");
if (0 == parseChar(c, source))
throw SyntaxException("JSON syntax error");
}
if (!done())
@@ -253,7 +254,7 @@ void Parser::parseBufferPopBackChar()
void Parser::parseBufferPushBackChar(char c)
{
if (_parseBuffer.size() + 1 >= _parseBuffer.capacity())
_parseBuffer.resize(_parseBuffer.capacity() * 2);
_parseBuffer.setCapacity(_parseBuffer.capacity() * 2);
_parseBuffer.append(c);
}