mirror of
https://github.com/DaveGamble/cJSON.git
synced 2024-12-28 06:30:52 +08:00
Fix for printing values that contain % literals. Thanks to Jimmy Tam!
git-svn-id: http://svn.code.sf.net/p/cjson/code@11 e3330c51-1366-4df0-8b21-3ccf24e3d50e
This commit is contained in:
parent
7ca2c994a7
commit
37da1d2493
6
cJSON.c
6
cJSON.c
@ -312,7 +312,7 @@ static char *print_array(cJSON *item,int depth)
|
||||
len+=strlen(ret)+3;
|
||||
out=(char*)cJSON_realloc(out,len);
|
||||
ptr=out+strlen(out);
|
||||
ptr+=sprintf(ptr,ret);
|
||||
ptr+=sprintf(ptr,"%s",ret);
|
||||
if (child->next) {*ptr++=',';*ptr++=' ';*ptr=0;}
|
||||
child=child->next;
|
||||
cJSON_free(ret);
|
||||
@ -374,9 +374,9 @@ static char *print_object(cJSON *item,int depth)
|
||||
out=(char*)cJSON_realloc(out,len);
|
||||
ptr=out+strlen(out);
|
||||
for (i=0;i<depth;i++) *ptr++='\t';
|
||||
ptr+=sprintf(ptr,str);
|
||||
ptr+=sprintf(ptr,"%s",str);
|
||||
*ptr++=':';*ptr++='\t';
|
||||
ptr+=sprintf(ptr,ret);
|
||||
ptr+=sprintf(ptr,"%s",ret);
|
||||
if (child->next) *ptr++=',';
|
||||
*ptr++='\n';*ptr=0;
|
||||
child=child->next;
|
||||
|
Loading…
x
Reference in New Issue
Block a user