mirror of
https://github.com/DaveGamble/cJSON
synced 2025-03-31 23:59:27 +00:00
...try that again... better WINDOWS/WIN32/__WIN32__ (for Borland C) sentinelling
also missed the casts on realloc() git-svn-id: http://svn.code.sf.net/p/cjson/code@6 e3330c51-1366-4df0-8b21-3ccf24e3d50e
This commit is contained in:
parent
6d50358e26
commit
e5fe65f58a
6
cJSON.c
6
cJSON.c
@ -30,7 +30,7 @@
|
|||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include "cJSON.h"
|
#include "cJSON.h"
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#if defined(WINDOWS) || defined(__WIN32__) || defined(WIN32)
|
||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ static char *print_array(cJSON *item,int depth)
|
|||||||
ret=print_value(child,depth+1);
|
ret=print_value(child,depth+1);
|
||||||
if (!ret) {free(out);return 0;} // Check for failure!
|
if (!ret) {free(out);return 0;} // Check for failure!
|
||||||
len+=strlen(ret)+3;
|
len+=strlen(ret)+3;
|
||||||
out=realloc(out,len);
|
out=(char*)realloc(out,len);
|
||||||
ptr=out+strlen(out);
|
ptr=out+strlen(out);
|
||||||
ptr+=sprintf(ptr,ret);
|
ptr+=sprintf(ptr,ret);
|
||||||
if (child->next) {*ptr++=',';*ptr++=' ';*ptr=0;}
|
if (child->next) {*ptr++=',';*ptr++=' ';*ptr=0;}
|
||||||
@ -320,7 +320,7 @@ static char *print_object(cJSON *item,int depth)
|
|||||||
ret=print_value(child,depth);
|
ret=print_value(child,depth);
|
||||||
if (!ret) {free(out);return 0;} // Check for failure!
|
if (!ret) {free(out);return 0;} // Check for failure!
|
||||||
len+=strlen(ret)+strlen(str)+4+depth;
|
len+=strlen(ret)+strlen(str)+4+depth;
|
||||||
out=realloc(out,len);
|
out=(char*)realloc(out,len);
|
||||||
ptr=out+strlen(out);
|
ptr=out+strlen(out);
|
||||||
for (i=0;i<depth;i++) *ptr++='\t';
|
for (i=0;i<depth;i++) *ptr++='\t';
|
||||||
ptr+=sprintf(ptr,str);
|
ptr+=sprintf(ptr,str);
|
||||||
|
Loading…
Reference in New Issue
Block a user