diff --git a/cJSON.c b/cJSON.c index bd534e20b4087d0b35d9613df65cb6a46a3d2564..86295ec2f4a3d5c88a64936b8de846c1d4e2015d 100644 --- a/cJSON.c +++ b/cJSON.c @@ -354,7 +354,7 @@ cJSON *cJSON_CreateArray() {cJSON *item=cJSON_New_Item();item->type=cJSON_A cJSON *cJSON_CreateObject() {cJSON *item=cJSON_New_Item();item->type=cJSON_Object;return item;} // Create Arrays: -cJSON *cJSON_CreateIntArray(int *numbers,int count) {cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(int i=0;ichild=n;else suffix_object(p,n);p=n;}return a;} -cJSON *cJSON_CreateFloatArray(float *numbers,int count) {cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(int i=0;ichild=n;else suffix_object(p,n);p=n;}return a;} -cJSON *cJSON_CreateDoubleArray(double *numbers,int count) {cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(int i=0;ichild=n;else suffix_object(p,n);p=n;}return a;} -cJSON *cJSON_CreateStringArray(const char **strings,int count) {cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(int i=0;ichild=n;else suffix_object(p,n);p=n;}return a;} +cJSON *cJSON_CreateIntArray(int *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;ichild=n;else suffix_object(p,n);p=n;}return a;} +cJSON *cJSON_CreateFloatArray(float *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;ichild=n;else suffix_object(p,n);p=n;}return a;} +cJSON *cJSON_CreateDoubleArray(double *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;ichild=n;else suffix_object(p,n);p=n;}return a;} +cJSON *cJSON_CreateStringArray(const char **strings,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;ichild=n;else suffix_object(p,n);p=n;}return a;} diff --git a/test.c b/test.c index dbd66e1becb36a991e2c412c66097818fefaab74..a0d23609d704a9b76d83f371ac132712db488503 100644 --- a/test.c +++ b/test.c @@ -102,7 +102,7 @@ void create_objects() {"zip",37.371991,-1.22026e+2,"","SUNNYVALE","CA","94085","US"}}; root=cJSON_CreateArray(); - for (int i=0;i<2;i++) + for (i=0;i<2;i++) { cJSON_AddItemToArray(root,fld=cJSON_CreateObject()); cJSON_AddItemToObject(fld, "precision", cJSON_CreateString(fields[i].precision));