Skip to content

Commit

Permalink
Fix for Cheedoong#17 : Incorrect data encoded in json when numeric su…
Browse files Browse the repository at this point in the history
…pport is enabled
  • Loading branch information
Minhaajuddin Khan committed Sep 10, 2020
1 parent d3a3d98 commit d152fc1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions include/xml2json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ static bool xml2json_has_digits_only(const char * input, bool *hasDecimal)
const char * runPtr = input;

*hasDecimal = false;


//Check for negative number
if (*runPtr == '-')
{
runPtr++;
}

while (*runPtr != '\0')
{
if (*runPtr == '.')
Expand All @@ -57,7 +63,7 @@ static bool xml2json_has_digits_only(const char * input, bool *hasDecimal)
else
return false; // we found two dots - not a number
}
else if (isalpha(*runPtr))
else if (!isdigit(*runPtr))
{
return false;
}
Expand Down

0 comments on commit d152fc1

Please sign in to comment.