Lines 23-28
Link Here
|
23 |
#include "json_object.h" |
23 |
#include "json_object.h" |
24 |
#include "json_tokener.h" |
24 |
#include "json_tokener.h" |
25 |
|
25 |
|
|
|
26 |
#include <cpl_port.h> /* MIN and MAX macros */ |
26 |
|
27 |
|
27 |
#if !HAVE_STRNCASECMP && defined(_MSC_VER) |
28 |
#if !HAVE_STRNCASECMP && defined(_MSC_VER) |
28 |
/* MSC has the version as _strnicmp */ |
29 |
/* MSC has the version as _strnicmp */ |
Lines 106-112
Link Here
|
106 |
{ |
107 |
{ |
107 |
if(str) { |
108 |
if(str) { |
108 |
size_t len = strlen(str); |
109 |
size_t len = strlen(str); |
109 |
size_t nn = min(len,n); |
110 |
size_t nn = MIN(len,n); |
110 |
char* s = (char*)malloc(sizeof(char) * (nn + 1)); |
111 |
char* s = (char*)malloc(sizeof(char) * (nn + 1)); |
111 |
|
112 |
|
112 |
if(s) { |
113 |
if(s) { |
Lines 230-236
Link Here
|
230 |
case json_tokener_state_null: |
231 |
case json_tokener_state_null: |
231 |
printbuf_memappend(tok->pb, &c, 1); |
232 |
printbuf_memappend(tok->pb, &c, 1); |
232 |
if(strncasecmp(json_null_str, tok->pb->buf, |
233 |
if(strncasecmp(json_null_str, tok->pb->buf, |
233 |
min(tok->st_pos+1, strlen(json_null_str))) == 0) { |
234 |
MIN(tok->st_pos+1, strlen(json_null_str))) == 0) { |
234 |
if(tok->st_pos == strlen(json_null_str)) { |
235 |
if(tok->st_pos == strlen(json_null_str)) { |
235 |
current = NULL; |
236 |
current = NULL; |
236 |
saved_state = json_tokener_state_finish; |
237 |
saved_state = json_tokener_state_finish; |
Lines 351-357
Link Here
|
351 |
case json_tokener_state_boolean: |
352 |
case json_tokener_state_boolean: |
352 |
printbuf_memappend(tok->pb, &c, 1); |
353 |
printbuf_memappend(tok->pb, &c, 1); |
353 |
if(strncasecmp(json_true_str, tok->pb->buf, |
354 |
if(strncasecmp(json_true_str, tok->pb->buf, |
354 |
min(tok->st_pos+1, strlen(json_true_str))) == 0) { |
355 |
MIN(tok->st_pos+1, strlen(json_true_str))) == 0) { |
355 |
if(tok->st_pos == strlen(json_true_str)) { |
356 |
if(tok->st_pos == strlen(json_true_str)) { |
356 |
current = json_object_new_boolean(1); |
357 |
current = json_object_new_boolean(1); |
357 |
saved_state = json_tokener_state_finish; |
358 |
saved_state = json_tokener_state_finish; |
Lines 359-365
Link Here
|
359 |
goto redo_char; |
360 |
goto redo_char; |
360 |
} |
361 |
} |
361 |
} else if(strncasecmp(json_false_str, tok->pb->buf, |
362 |
} else if(strncasecmp(json_false_str, tok->pb->buf, |
362 |
min(tok->st_pos+1, strlen(json_false_str))) == 0) { |
363 |
MIN(tok->st_pos+1, strlen(json_false_str))) == 0) { |
363 |
if(tok->st_pos == strlen(json_false_str)) { |
364 |
if(tok->st_pos == strlen(json_false_str)) { |
364 |
current = json_object_new_boolean(0); |
365 |
current = json_object_new_boolean(0); |
365 |
saved_state = json_tokener_state_finish; |
366 |
saved_state = json_tokener_state_finish; |