mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
Fix WINPR_JSON_AddItemToArray compatibility with cJSON < 1.7.13
Modified the WINPR_JSON_AddItemToArray function to not expect a return value from cJSON_AddItemToArray. WINPR_JSON_AddItemToArray failure is given by the same conditions that cause add_item_to_array. add_item_to_array is a private cJSON function called by cJSON_AddItemToArray. The logic analysis is based on cJSON 1.7.12, which is the last release before cJSON_AddItemToArray's signature changed to include a bool return. See https://github.com/DaveGamble/cJSON/blob/v1.7.12/cJSON.c line: 1848.
This commit is contained in:
committed by
Armin Novak
parent
458837282e
commit
b16a23c2bc
@@ -32,13 +32,11 @@
|
||||
|
||||
#if defined(WITH_CJSON)
|
||||
#if CJSON_VERSION_MAJOR == 1
|
||||
#if CJSON_VERSION_MINOR <= 7
|
||||
#if CJSON_VERSION_PATCH < 13
|
||||
#if (CJSON_VERSION_MINOR < 7) || ((CJSON_VERSION_MINOR == 7) && (CJSON_VERSION_PATCH < 13))
|
||||
#define USE_CJSON_COMPAT
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(WITH_JSONC)
|
||||
#if JSON_C_MAJOR_VERSION == 0
|
||||
@@ -617,7 +615,14 @@ BOOL WINPR_JSON_AddItemToArray(WINPR_JSON* array, WINPR_JSON* item)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
#elif defined(WITH_CJSON)
|
||||
#if defined(USE_CJSON_COMPAT)
|
||||
if ((array == NULL) || (item == NULL))
|
||||
return FALSE;
|
||||
cJSON_AddItemToArray((cJSON*)array, (cJSON*)item);
|
||||
return TRUE;
|
||||
#else
|
||||
return cJSON_AddItemToArray((cJSON*)array, (cJSON*)item);
|
||||
#endif
|
||||
#else
|
||||
WINPR_UNUSED(array);
|
||||
WINPR_UNUSED(item);
|
||||
|
||||
Reference in New Issue
Block a user