@@ -423,10 +423,12 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok, | |||||
case 'n': | case 'n': | ||||
case 'r': | case 'r': | ||||
case 't': | case 't': | ||||
case 'f': | |||||
if(c == 'b') printbuf_memappend_fast(tok->pb, "\b", 1); | if(c == 'b') printbuf_memappend_fast(tok->pb, "\b", 1); | ||||
else if(c == 'n') printbuf_memappend_fast(tok->pb, "\n", 1); | else if(c == 'n') printbuf_memappend_fast(tok->pb, "\n", 1); | ||||
else if(c == 'r') printbuf_memappend_fast(tok->pb, "\r", 1); | else if(c == 'r') printbuf_memappend_fast(tok->pb, "\r", 1); | ||||
else if(c == 't') printbuf_memappend_fast(tok->pb, "\t", 1); | else if(c == 't') printbuf_memappend_fast(tok->pb, "\t", 1); | ||||
else if(c == 'f') printbuf_memappend_fast(tok->pb, "\f", 1); | |||||
state = saved_state; | state = saved_state; | ||||
break; | break; | ||||
case 'u': | case 'u': | ||||
@@ -167,8 +167,7 @@ int json_parse_int64(const char *buf, int64_t *retval) | |||||
buf_skip_space++; | buf_skip_space++; | ||||
if (buf_skip_space[0] == '0' && buf_skip_space[1] == '\0') | if (buf_skip_space[0] == '0' && buf_skip_space[1] == '\0') | ||||
orig_has_neg = 0; // "-0" is the same as just plain "0" | orig_has_neg = 0; // "-0" is the same as just plain "0" | ||||
if (errno != ERANGE) | |||||
{ | { | ||||
char buf_cmp[100]; | char buf_cmp[100]; | ||||
char *buf_cmp_start = buf_cmp; | char *buf_cmp_start = buf_cmp; | ||||
@@ -196,16 +195,12 @@ int json_parse_int64(const char *buf, int64_t *retval) | |||||
) | ) | ||||
) | ) | ||||
{ | { | ||||
errno = ERANGE; | |||||
if (orig_has_neg) | |||||
num64 = INT64_MIN; | |||||
else | |||||
num64 = INT64_MAX; | |||||
} | } | ||||
} | } | ||||
if (errno == ERANGE) | |||||
{ | |||||
if (orig_has_neg) | |||||
num64 = INT64_MIN; | |||||
else | |||||
num64 = INT64_MAX; | |||||
} | |||||
*retval = num64; | *retval = num64; | ||||
return 0; | return 0; | ||||
} | } | ||||