remove parse check for strtox

This commit is contained in:
Jett 2016-10-16 17:18:40 -05:00
parent 8877ad72fa
commit 201e1f37fd
2 changed files with 4 additions and 12 deletions

View File

@ -8832,7 +8832,6 @@ basic_json_parser_63:
T result = 0; T result = 0;
const char *fst = st; const char *fst = st;
bool successful_parse = false;
char cp = *fst; char cp = *fst;
int exp = 0; // exponent int exp = 0; // exponent
{ {
@ -8841,7 +8840,6 @@ basic_json_parser_63:
if (cp == '-' or cp == '+') if (cp == '-' or cp == '+')
{ {
++fst; ++fst;
successful_parse = true;
} }
// read in fractional part of number, until an 'e' is reached. // read in fractional part of number, until an 'e' is reached.
@ -8849,7 +8847,6 @@ basic_json_parser_63:
while (nl_isdigit(cp = *fst)) while (nl_isdigit(cp = *fst))
{ {
result = result * 10 + (cp - '0'); result = result * 10 + (cp - '0');
successful_parse = true;
++fst; ++fst;
} }
@ -8858,7 +8855,6 @@ basic_json_parser_63:
while (nl_isdigit(cp = *++fst)) while (nl_isdigit(cp = *++fst))
{ {
result = result * 10 + (cp - '0'); result = result * 10 + (cp - '0');
successful_parse = true;
--exp; --exp;
} }
} }
@ -8874,7 +8870,7 @@ basic_json_parser_63:
// if exponent is bogus (i.e. "1.234empty" or "1.234e+mpty") restore // if exponent is bogus (i.e. "1.234empty" or "1.234e+mpty") restore
// bogus exponent back onto returned string (endptr). // bogus exponent back onto returned string (endptr).
if (successful_parse and (*fst == 'e' or *fst == 'E')) if (*fst == 'e' or *fst == 'E')
{ {
cp = *++fst; cp = *++fst;
bool negative_exp = cp == '-'; // read in exponent sign (+/-) bool negative_exp = cp == '-'; // read in exponent sign (+/-)
@ -8959,7 +8955,7 @@ skip_loop:
if (endptr != nullptr) if (endptr != nullptr)
{ {
*endptr = const_cast<char *>(successful_parse ? fst : st); *endptr = const_cast<char *>(fst);
} }
return result; return result;

View File

@ -8129,7 +8129,6 @@ class basic_json
T result = 0; T result = 0;
const char *fst = st; const char *fst = st;
bool successful_parse = false;
char cp = *fst; char cp = *fst;
int exp = 0; // exponent int exp = 0; // exponent
{ {
@ -8138,7 +8137,6 @@ class basic_json
if (cp == '-' or cp == '+') if (cp == '-' or cp == '+')
{ {
++fst; ++fst;
successful_parse = true;
} }
// read in fractional part of number, until an 'e' is reached. // read in fractional part of number, until an 'e' is reached.
@ -8146,7 +8144,6 @@ class basic_json
while (nl_isdigit(cp = *fst)) while (nl_isdigit(cp = *fst))
{ {
result = result * 10 + (cp - '0'); result = result * 10 + (cp - '0');
successful_parse = true;
++fst; ++fst;
} }
@ -8155,7 +8152,6 @@ class basic_json
while (nl_isdigit(cp = *++fst)) while (nl_isdigit(cp = *++fst))
{ {
result = result * 10 + (cp - '0'); result = result * 10 + (cp - '0');
successful_parse = true;
--exp; --exp;
} }
} }
@ -8171,7 +8167,7 @@ class basic_json
// if exponent is bogus (i.e. "1.234empty" or "1.234e+mpty") restore // if exponent is bogus (i.e. "1.234empty" or "1.234e+mpty") restore
// bogus exponent back onto returned string (endptr). // bogus exponent back onto returned string (endptr).
if (successful_parse and (*fst == 'e' or *fst == 'E')) if (*fst == 'e' or *fst == 'E')
{ {
cp = *++fst; cp = *++fst;
bool negative_exp = cp == '-'; // read in exponent sign (+/-) bool negative_exp = cp == '-'; // read in exponent sign (+/-)
@ -8256,7 +8252,7 @@ skip_loop:
if (endptr != nullptr) if (endptr != nullptr)
{ {
*endptr = const_cast<char *>(successful_parse ? fst : st); *endptr = const_cast<char *>(fst);
} }
return result; return result;