From 70ab6964b1a95dd6fc33e07d1a73250436d725e0 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Wed, 15 Mar 2017 16:13:40 -0500 Subject: [PATCH] FS-10036: fix windows build issues. These patches need to go upstream --- src/cJSON.c | 6 ++++++ src/include/switch_cJSON.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cJSON.c b/src/cJSON.c index 85709f1e3b..8cd284ebb6 100644 --- a/src/cJSON.c +++ b/src/cJSON.c @@ -847,7 +847,9 @@ CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value) return cJSON_ParseWithOpts(value, 0, 0); } +#ifndef min #define min(a, b) ((a < b) ? a : b) +#endif static unsigned char *print(const cJSON * const item, cjbool format, const internal_hooks * const hooks) { @@ -1558,10 +1560,14 @@ CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJ { global_hooks.deallocate(item->string); } +#ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-qual" +#endif item->string = (char*)string; +#ifdef __GNUC__ #pragma GCC diagnostic pop +#endif item->type |= cJSON_StringIsConst; cJSON_AddItemToArray(object, item); } diff --git a/src/include/switch_cJSON.h b/src/include/switch_cJSON.h index 79dbb98157..37366f9e28 100644 --- a/src/include/switch_cJSON.h +++ b/src/include/switch_cJSON.h @@ -141,7 +141,7 @@ CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array); CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int item); /* Get item "string" from object. Case insensitive. */ CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON *object, const char *string); -CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON *object, const char *string); +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string); CJSON_PUBLIC(int) cJSON_HasObjectItem(const cJSON *object, const char *string); /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);