|  | @@ -458,17 +458,28 @@ static int cJSONUtils_ApplyPatch(cJSON *object, cJSON *patch)
 | 
											
												
													
														|  |      return 0;
 |  |      return 0;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -int cJSONUtils_ApplyPatches(cJSON *object,cJSON *patches)
 |  | 
 | 
											
												
													
														|  | 
 |  | +int cJSONUtils_ApplyPatches(cJSON *object, cJSON *patches)
 | 
											
												
													
														|  |  {
 |  |  {
 | 
											
												
													
														|  | -	int err;
 |  | 
 | 
											
												
													
														|  | -	if (patches->type!=cJSON_Array) return 1;	/* malformed patches. */
 |  | 
 | 
											
												
													
														|  | -	if (patches) patches=patches->child;
 |  | 
 | 
											
												
													
														|  | -	while (patches)
 |  | 
 | 
											
												
													
														|  | -	{
 |  | 
 | 
											
												
													
														|  | -		if ((err=cJSONUtils_ApplyPatch(object,patches))) return err;
 |  | 
 | 
											
												
													
														|  | -		patches=patches->next;
 |  | 
 | 
											
												
													
														|  | -	}
 |  | 
 | 
											
												
													
														|  | -	return 0;
 |  | 
 | 
											
												
													
														|  | 
 |  | +    int err;
 | 
											
												
													
														|  | 
 |  | +    if (patches->type != cJSON_Array)
 | 
											
												
													
														|  | 
 |  | +    {
 | 
											
												
													
														|  | 
 |  | +        /* malformed patches. */
 | 
											
												
													
														|  | 
 |  | +        return 1;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    if (patches)
 | 
											
												
													
														|  | 
 |  | +    {
 | 
											
												
													
														|  | 
 |  | +        patches = patches->child;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    while (patches)
 | 
											
												
													
														|  | 
 |  | +    {
 | 
											
												
													
														|  | 
 |  | +        if ((err = cJSONUtils_ApplyPatch(object, patches)))
 | 
											
												
													
														|  | 
 |  | +        {
 | 
											
												
													
														|  | 
 |  | +            return err;
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        patches = patches->next;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    return 0;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  static void cJSONUtils_GeneratePatch(cJSON *patches,const char *op,const char *path,const char *suffix,cJSON *val)
 |  |  static void cJSONUtils_GeneratePatch(cJSON *patches,const char *op,const char *path,const char *suffix,cJSON *val)
 |