diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/jplist.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/jplist.c b/src/jplist.c index 782d2b3..4f30cd0 100644 --- a/src/jplist.c +++ b/src/jplist.c | |||
| @@ -460,6 +460,8 @@ static int64_t parse_decimal(const char* str, const char* str_end, char** endp) | |||
| 460 | if (str[0] == '-') { | 460 | if (str[0] == '-') { |
| 461 | is_neg = 1; | 461 | is_neg = 1; |
| 462 | (*endp)++; | 462 | (*endp)++; |
| 463 | } else if (str[0] == '+') { | ||
| 464 | (*endp)++; | ||
| 463 | } | 465 | } |
| 464 | if (is_neg) { | 466 | if (is_neg) { |
| 465 | MAX++; | 467 | MAX++; |
| @@ -522,7 +524,7 @@ static plist_t parse_primitive(const char* js, jsmntok_info_t* ti, int* index) | |||
| 522 | } else { | 524 | } else { |
| 523 | val = plist_new_uint((uint64_t)intpart); | 525 | val = plist_new_uint((uint64_t)intpart); |
| 524 | } | 526 | } |
| 525 | } else if ((*endp == '.' && endp+1 < str_end && isdigit(*(endp+1))) || ((*endp == 'e' || *endp == 'E') && endp+1 < str_end && (isdigit(*(endp+1)) || ((*(endp+1) == '-') && endp+2 < str_end && isdigit(*(endp+2)))))) { | 527 | } else if ((*endp == '.' && endp+1 < str_end && isdigit(*(endp+1))) || ((*endp == 'e' || *endp == 'E') && endp+1 < str_end && (isdigit(*(endp+1)) || (((*(endp+1) == '-') || (*(endp+1) == '+')) && endp+2 < str_end && isdigit(*(endp+2)))))) { |
| 526 | /* floating point */ | 528 | /* floating point */ |
| 527 | double dval = (double)intpart; | 529 | double dval = (double)intpart; |
| 528 | char* fendp = endp; | 530 | char* fendp = endp; |
| @@ -546,7 +548,7 @@ static plist_t parse_primitive(const char* js, jsmntok_info_t* ti, int* index) | |||
| 546 | if (fendp >= str_end) { | 548 | if (fendp >= str_end) { |
| 547 | break; | 549 | break; |
| 548 | } | 550 | } |
| 549 | if (fendp+1 < str_end && (*fendp == 'e' || *fendp == 'E') && (isdigit(*(fendp+1)) || ((*(fendp+1) == '-') && fendp+2 < str_end && isdigit(*(fendp+2))))) { | 551 | if (fendp+1 < str_end && (*fendp == 'e' || *fendp == 'E') && (isdigit(*(fendp+1)) || (((*(fendp+1) == '-') || (*(fendp+1) == '+')) && fendp+2 < str_end && isdigit(*(fendp+2))))) { |
| 550 | int64_t exp = parse_decimal(fendp+1, str_end, &fendp); | 552 | int64_t exp = parse_decimal(fendp+1, str_end, &fendp); |
| 551 | dval = dval * pow(10, (double)exp); | 553 | dval = dval * pow(10, (double)exp); |
| 552 | } else { | 554 | } else { |
