Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Zguy/Jzon
Browse files Browse the repository at this point in the history
  • Loading branch information
Zguy committed Feb 15, 2013
2 parents 40348b3 + ecf74e5 commit 34e6dd5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Jzon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,14 @@ namespace Jzon
std::string json;
RemoveWhitespace(_json, json);

Node::Type type;
switch (json.at(0))
Node::Type type = T_VALUE;
if (!json.empty())
{
case '{' : type = T_OBJECT; break;
case '[' : type = T_ARRAY; break;
default : type = T_VALUE; break;
switch (json.at(0))
{
case '{' : type = T_OBJECT; break;
case '[' : type = T_ARRAY; break;
}
}

return type;
Expand Down Expand Up @@ -449,9 +451,9 @@ namespace Jzon
}

// This is not the most beautiful place for these, but it'll do
static const char charsUnescaped[] = { '\\' , '\"' , '\n' , '\t' , '\b' , '\f' , '\r' };
static const char *charsEscaped[] = { "\\\\", "\\\"", "\\n", "\\t", "\\b", "\\f", "\\r" };
static const unsigned int numEscapeChars = 7;
static const char charsUnescaped[] = { '\\' , '/' , '\"' , '\n' , '\t' , '\b' , '\f' , '\r' };
static const char *charsEscaped[] = { "\\\\", "\\/", "\\\"", "\\n", "\\t", "\\b", "\\f", "\\r" };
static const unsigned int numEscapeChars = 8;
static const char nullUnescaped = '\0';
static const char *nullEscaped = "\0\0";
const char *&getEscaped(const char &c)
Expand Down

0 comments on commit 34e6dd5

Please sign in to comment.