|
|
@@ -119,7 +119,7 @@ char* strndup(const char* str, size_t n) |
|
|
|
{ |
|
|
|
if(str) { |
|
|
|
size_t len = strlen(str); |
|
|
|
size_t nn = min(len,n); |
|
|
|
size_t nn = json_min(len,n); |
|
|
|
char* s = (char*)malloc(sizeof(char) * (nn + 1)); |
|
|
|
|
|
|
|
if(s) { |
|
|
@@ -276,7 +276,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok, |
|
|
|
case json_tokener_state_null: |
|
|
|
printbuf_memappend_fast(tok->pb, &c, 1); |
|
|
|
if(strncasecmp(json_null_str, tok->pb->buf, |
|
|
|
min(tok->st_pos+1, strlen(json_null_str))) == 0) { |
|
|
|
json_min(tok->st_pos+1, strlen(json_null_str))) == 0) { |
|
|
|
if(tok->st_pos == strlen(json_null_str)) { |
|
|
|
current = NULL; |
|
|
|
saved_state = json_tokener_state_finish; |
|
|
@@ -439,7 +439,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok, |
|
|
|
case json_tokener_state_boolean: |
|
|
|
printbuf_memappend_fast(tok->pb, &c, 1); |
|
|
|
if(strncasecmp(json_true_str, tok->pb->buf, |
|
|
|
min(tok->st_pos+1, strlen(json_true_str))) == 0) { |
|
|
|
json_min(tok->st_pos+1, strlen(json_true_str))) == 0) { |
|
|
|
if(tok->st_pos == strlen(json_true_str)) { |
|
|
|
current = json_object_new_boolean(1); |
|
|
|
saved_state = json_tokener_state_finish; |
|
|
@@ -447,7 +447,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok, |
|
|
|
goto redo_char; |
|
|
|
} |
|
|
|
} else if(strncasecmp(json_false_str, tok->pb->buf, |
|
|
|
min(tok->st_pos+1, strlen(json_false_str))) == 0) { |
|
|
|
json_min(tok->st_pos+1, strlen(json_false_str))) == 0) { |
|
|
|
if(tok->st_pos == strlen(json_false_str)) { |
|
|
|
current = json_object_new_boolean(0); |
|
|
|
saved_state = json_tokener_state_finish; |
|
|
|