diff options
author | thegeorg <thegeorg@yandex-team.ru> | 2022-05-11 12:12:06 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.ru> | 2022-05-11 12:12:06 +0300 |
commit | 62f93da087b2fec0f89979fd11ac4d754ca36253 (patch) | |
tree | 67bf8ceb55e2d079f3575f9a7373584ad407d2a5 /contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core | |
parent | 8d55620139d4309265409767f873ba83fe046418 (diff) | |
download | ydb-62f93da087b2fec0f89979fd11ac4d754ca36253.tar.gz |
Update aws-c-common and aws-c-io
* Update `contrib/restricted/aws/aws-c-io` to 0.11.0
* Backport cJSON symbol renaming logic from aws-sdk-cpp upstream
ref:396829235a01ed34888651ee38ebd76c95510d6b
Diffstat (limited to 'contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core')
4 files changed, 468 insertions, 468 deletions
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/external/cjson/cJSON.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/external/cjson/cJSON.h index 9a010a67db..8e6232524f 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/external/cjson/cJSON.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/external/cjson/cJSON.h @@ -20,8 +20,8 @@ THE SOFTWARE. */ -#ifndef cJSON__h -#define cJSON__h +#ifndef cJSON_AS4CPP__h +#define cJSON_AS4CPP__h #ifdef __cplusplus extern "C" @@ -29,25 +29,25 @@ extern "C" #endif /* project version */ -#define CJSON_VERSION_MAJOR 1 -#define CJSON_VERSION_MINOR 7 -#define CJSON_VERSION_PATCH 7 +#define CJSON_AS4CPP_VERSION_MAJOR 1 +#define CJSON_AS4CPP_VERSION_MINOR 7 +#define CJSON_AS4CPP_VERSION_PATCH 7 #include <stddef.h> /* cJSON Types: */ -#define cJSON_Invalid (0) -#define cJSON_False (1 << 0) -#define cJSON_True (1 << 1) -#define cJSON_NULL (1 << 2) -#define cJSON_Number (1 << 3) -#define cJSON_String (1 << 4) -#define cJSON_Array (1 << 5) -#define cJSON_Object (1 << 6) -#define cJSON_Raw (1 << 7) /* raw json */ - -#define cJSON_IsReference 256 -#define cJSON_StringIsConst 512 +#define cJSON_AS4CPP_Invalid (0) +#define cJSON_AS4CPP_False (1 << 0) +#define cJSON_AS4CPP_True (1 << 1) +#define cJSON_AS4CPP_NULL (1 << 2) +#define cJSON_AS4CPP_Number (1 << 3) +#define cJSON_AS4CPP_String (1 << 4) +#define cJSON_AS4CPP_Array (1 << 5) +#define cJSON_AS4CPP_Object (1 << 6) +#define cJSON_AS4CPP_Raw (1 << 7) /* raw json */ + +#define cJSON_AS4CPP_IsReference 256 +#define cJSON_AS4CPP_StringIsConst 512 /* The cJSON structure: */ typedef struct cJSON @@ -61,24 +61,24 @@ typedef struct cJSON /* The type of the item, as above. */ int type; - /* The item's string, if type==cJSON_String and type == cJSON_Raw */ + /* The item's string, if type==cJSON_AS4CPP_String and type == cJSON_AS4CPP_Raw */ char *valuestring; - /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */ + /* writing to valueint is DEPRECATED, use cJSON_AS4CPP_SetNumberValue instead */ int valueint; - /* The item's number, if type==cJSON_Number */ + /* The item's number, if type==cJSON_AS4CPP_Number */ double valuedouble; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ char *string; } cJSON; -typedef struct cJSON_Hooks +typedef struct cJSON_AS4CPP_Hooks { void *(*malloc_fn)(size_t sz); void (*free_fn)(void *ptr); -} cJSON_Hooks; +} cJSON_AS4CPP_Hooks; -typedef int cJSON_bool; +typedef int cJSON_AS4CPP_bool; #if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) #define __WINDOWS__ @@ -87,9 +87,9 @@ typedef int cJSON_bool; /* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 2 define options: -CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols -CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default) -CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol +CJSON_AS4CPP_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols +CJSON_AS4CPP_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default) +CJSON_AS4CPP_IMPORT_SYMBOLS - Define this if you want to dllimport symbol For *nix builds that support visibility attribute, you can define similar behavior by @@ -99,188 +99,188 @@ or -xldscope=hidden (for sun cc) to CFLAGS -then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does +then using the CJSON_AS4CPP_API_VISIBILITY flag to "export" the same symbols the way CJSON_AS4CPP_EXPORT_SYMBOLS does */ /* Decide calling convention based on the cmake parameters defined in C++ SDK. */ #ifdef USE_IMPORT_EXPORT #ifdef AWS_CORE_EXPORTS -#define CJSON_EXPORT_SYMBOLS +#define CJSON_AS4CPP_EXPORT_SYMBOLS #else -#define CJSON_IMPORT_SYMBOLS +#define CJSON_AS4CPP_IMPORT_SYMBOLS #endif // AWS_CORE_EXPORTS #else -#define CJSON_HIDE_SYMBOLS +#define CJSON_AS4CPP_HIDE_SYMBOLS #endif // USE_IMPORT_EXPORT /* export symbols by default, this is necessary for copy pasting the C and header file */ -#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS) -#define CJSON_EXPORT_SYMBOLS +#if !defined(CJSON_AS4CPP_HIDE_SYMBOLS) && !defined(CJSON_AS4CPP_IMPORT_SYMBOLS) && !defined(CJSON_AS4CPP_EXPORT_SYMBOLS) +#define CJSON_AS4CPP_EXPORT_SYMBOLS #endif -#if defined(CJSON_HIDE_SYMBOLS) -#define CJSON_PUBLIC(type) type __stdcall -#elif defined(CJSON_EXPORT_SYMBOLS) -#define CJSON_PUBLIC(type) __declspec(dllexport) type __stdcall -#elif defined(CJSON_IMPORT_SYMBOLS) -#define CJSON_PUBLIC(type) __declspec(dllimport) type __stdcall +#if defined(CJSON_AS4CPP_HIDE_SYMBOLS) +#define CJSON_AS4CPP_PUBLIC(type) type __stdcall +#elif defined(CJSON_AS4CPP_EXPORT_SYMBOLS) +#define CJSON_AS4CPP_PUBLIC(type) __declspec(dllexport) type __stdcall +#elif defined(CJSON_AS4CPP_IMPORT_SYMBOLS) +#define CJSON_AS4CPP_PUBLIC(type) __declspec(dllimport) type __stdcall #endif #else /* !WIN32 */ -#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY) -#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type +#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_AS4CPP_API_VISIBILITY) +#define CJSON_AS4CPP_PUBLIC(type) __attribute__((visibility("default"))) type #else -#define CJSON_PUBLIC(type) type +#define CJSON_AS4CPP_PUBLIC(type) type #endif #endif /* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them. * This is to prevent stack overflows. */ -#ifndef CJSON_NESTING_LIMIT -#define CJSON_NESTING_LIMIT 1000 +#ifndef CJSON_AS4CPP_NESTING_LIMIT +#define CJSON_AS4CPP_NESTING_LIMIT 1000 #endif /* returns the version of cJSON as a string */ -CJSON_PUBLIC(const char*) cJSON_Version(void); +CJSON_AS4CPP_PUBLIC(const char*) cJSON_AS4CPP_Version(void); /* Supply malloc, realloc and free functions to cJSON */ -CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_InitHooks(cJSON_AS4CPP_Hooks* hooks); -/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */ +/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_AS4CPP_Parse (with cJSON_AS4CPP_Delete) and cJSON_AS4CPP_Print (with stdlib free, cJSON_AS4CPP_Hooks.free_fn, or cJSON_AS4CPP_free as appropriate). The exception is cJSON_AS4CPP_PrintPreallocated, where the caller has full responsibility of the buffer. */ /* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ -CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_Parse(const char *value); /* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */ -/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */ -CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); +/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_AS4CPP_GetErrorPtr(). */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_AS4CPP_bool require_null_terminated); /* Render a cJSON entity to text for transfer/storage. */ -CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_Print(const cJSON *item); /* Render a cJSON entity to text for transfer/storage without any formatting. */ -CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item); +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_PrintUnformatted(const cJSON *item); /* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */ -CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt); +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_PrintBuffered(const cJSON *item, int prebuffer, cJSON_AS4CPP_bool fmt); /* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */ /* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */ -CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_AS4CPP_bool format); /* Delete a cJSON entity and all subentities. */ -CJSON_PUBLIC(void) cJSON_Delete(cJSON *c); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_Delete(cJSON *c); /* Returns the number of items in an array (or object). */ -CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array); +CJSON_AS4CPP_PUBLIC(int) cJSON_AS4CPP_GetArraySize(const cJSON *array); /* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */ -CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_GetArrayItem(const cJSON *array, int index); /* Get item "string" from object. Case insensitive. */ -CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string); -CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string); -CJSON_PUBLIC(cJSON_bool) 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); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_GetObjectItem(const cJSON * const object, const char * const string); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_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_AS4CPP_Parse() returns 0. 0 when cJSON_AS4CPP_Parse() succeeds. */ +CJSON_AS4CPP_PUBLIC(const char *) cJSON_AS4CPP_GetErrorPtr(void); /* Check if the item is a string and return its valuestring */ -CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item); +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_GetStringValue(cJSON *item); /* These functions check the type of an item */ -CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item); -CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item); -CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item); -CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item); -CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item); -CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item); -CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item); -CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item); -CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item); -CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsInvalid(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsFalse(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsTrue(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsBool(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsNull(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsNumber(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsString(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsArray(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsObject(const cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsRaw(const cJSON * const item); /* These calls create a cJSON item of the appropriate type. */ -CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void); -CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void); -CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void); -CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean); -CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num); -CJSON_PUBLIC(cJSON *) cJSON_CreateInt64(long long num); -CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateNull(void); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateTrue(void); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateFalse(void); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateBool(cJSON_AS4CPP_bool boolean); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateNumber(double num); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateInt64(long long num); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateString(const char *string); /* raw json */ -CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw); -CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void); -CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateRaw(const char *raw); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateArray(void); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateObject(void); /* Create a string where valuestring references a string so - * it will not be freed by cJSON_Delete */ -CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string); + * it will not be freed by cJSON_AS4CPP_Delete */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateStringReference(const char *string); /* Create an object/arrray that only references it's elements so - * they will not be freed by cJSON_Delete */ -CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child); -CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child); + * they will not be freed by cJSON_AS4CPP_Delete */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateObjectReference(const cJSON *child); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateArrayReference(const cJSON *child); /* These utilities create an Array of count items. */ -CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count); -CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count); -CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count); -CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateIntArray(const int *numbers, int count); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateFloatArray(const float *numbers, int count); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateDoubleArray(const double *numbers, int count); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateStringArray(const char **strings, int count); /* Append item to the specified array/object. */ -CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item); -CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_AddItemToArray(cJSON *array, cJSON *item); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_AddItemToObject(cJSON *object, const char *string, cJSON *item); /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. - * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before + * WARNING: When this function was used, make sure to always check that (item->type & cJSON_AS4CPP_StringIsConst) is zero before * writing to `item->string` */ -CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ -CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); -CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_AddItemReferenceToArray(cJSON *array, cJSON *item); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); /* Remove/Detach items from Arrays/Objects. */ -CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item); -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which); -CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which); -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string); -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string); -CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string); -CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemViaPointer(cJSON *parent, cJSON * const item); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemFromArray(cJSON *array, int which); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_DeleteItemFromArray(cJSON *array, int which); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemFromObject(cJSON *object, const char *string); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_DeleteItemFromObject(cJSON *object, const char *string); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); /* Update array items. */ -CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ -CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); -CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); -CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); -CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); /* Duplicate a cJSON item */ -CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_Duplicate(const cJSON *item, cJSON_AS4CPP_bool recurse); /* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will need to be released. With recurse!=0, it will duplicate any children connected to the item. The item->next and ->prev pointers are always zero on return from Duplicate. */ /* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal. * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */ -CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive); +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_Compare(const cJSON * const a, const cJSON * const b, const cJSON_AS4CPP_bool case_sensitive); -CJSON_PUBLIC(void) cJSON_Minify(char *json); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_Minify(char *json); /* Helper functions for creating and adding items to an object at the same time. * They return the added item or NULL on failure. */ -CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name); -CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name); -CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name); -CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean); -CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number); -CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string); -CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw); -CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name); -CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddNullToObject(cJSON * const object, const char * const name); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddTrueToObject(cJSON * const object, const char * const name); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddFalseToObject(cJSON * const object, const char * const name); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_AS4CPP_bool boolean); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddNumberToObject(cJSON * const object, const char * const name, const double number); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddStringToObject(cJSON * const object, const char * const name, const char * const string); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddRawToObject(cJSON * const object, const char * const name, const char * const raw); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddObjectToObject(cJSON * const object, const char * const name); +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddArrayToObject(cJSON * const object, const char * const name); /* When assigning an integer value, it needs to be propagated to valuedouble too. */ -#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number)) -/* helper for the cJSON_SetNumberValue macro */ -CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number); -#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number)) +#define cJSON_AS4CPP_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number)) +/* helper for the cJSON_AS4CPP_SetNumberValue macro */ +CJSON_AS4CPP_PUBLIC(double) cJSON_AS4CPP_SetNumberHelper(cJSON *object, double number); +#define cJSON_AS4CPP_SetNumberValue(object, number) ((object != NULL) ? cJSON_AS4CPP_SetNumberHelper(object, (double)number) : (number)) /* Macro for iterating over an array or object */ -#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next) +#define cJSON_AS4CPP_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next) -/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */ -CJSON_PUBLIC(void *) cJSON_malloc(size_t size); -CJSON_PUBLIC(void) cJSON_free(void *object); +/* malloc/free objects using the malloc/free functions that have been set with cJSON_AS4CPP_InitHooks */ +CJSON_AS4CPP_PUBLIC(void *) cJSON_AS4CPP_malloc(size_t size); +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_free(void *object); #ifdef __cplusplus } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Aws.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Aws.cpp index 33856b968a..0711fd69d6 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Aws.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/Aws.cpp @@ -102,10 +102,10 @@ namespace Aws Aws::Http::SetInstallSigPipeHandlerFlag(options.httpOptions.installSigPipeHandler); Aws::Http::InitHttp(); Aws::InitializeEnumOverflowContainer(); - cJSON_Hooks hooks; - hooks.malloc_fn = [](size_t sz) { return Aws::Malloc("cJSON_Tag", sz); }; + cJSON_AS4CPP_Hooks hooks; + hooks.malloc_fn = [](size_t sz) { return Aws::Malloc("cJSON_AS4CPP_Tag", sz); }; hooks.free_fn = Aws::Free; - cJSON_InitHooks(&hooks); + cJSON_AS4CPP_InitHooks(&hooks); Aws::Net::InitNetwork(); Aws::Internal::InitEC2MetadataClient(); Aws::Monitoring::InitMonitoring(options.monitoringOptions.customizedMonitoringFactory_create_fn); diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp index 2525976334..cc5636cbf8 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/external/cjson/cJSON.cpp @@ -58,8 +58,8 @@ #include <aws/core/external/cjson/cJSON.h> /* define our own boolean type */ -// #define true ((cJSON_bool)1) -// #define false ((cJSON_bool)0) +// #define true ((cJSON_AS4CPP_bool)1) +// #define false ((cJSON_AS4CPP_bool)0) typedef struct { const unsigned char *json; @@ -67,13 +67,13 @@ typedef struct { } error; static error global_error = { NULL, 0 }; -CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void) +CJSON_AS4CPP_PUBLIC(const char *) cJSON_AS4CPP_GetErrorPtr(void) { return (const char*) (global_error.json + global_error.position); } -CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item) { - if (!cJSON_IsString(item)) { +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_GetStringValue(cJSON *item) { + if (!cJSON_AS4CPP_IsString(item)) { return NULL; } @@ -81,14 +81,14 @@ CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item) { } /* This is a safeguard to prevent copy-pasters from using incompatible C and header files */ -#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 7) +#if (CJSON_AS4CPP_VERSION_MAJOR != 1) || (CJSON_AS4CPP_VERSION_MINOR != 7) || (CJSON_AS4CPP_VERSION_PATCH != 7) #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. #endif -CJSON_PUBLIC(const char*) cJSON_Version(void) +CJSON_AS4CPP_PUBLIC(const char*) cJSON_AS4CPP_Version(void) { static char version[15]; - sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); + sprintf(version, "%i.%i.%i", CJSON_AS4CPP_VERSION_MAJOR, CJSON_AS4CPP_VERSION_MINOR, CJSON_AS4CPP_VERSION_PATCH); return version; } @@ -146,7 +146,7 @@ static void *internal_realloc(void *pointer, size_t size) static internal_hooks global_hooks = { internal_malloc, internal_free, internal_realloc }; -static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks) +static unsigned char* cJSON_AS4CPP_strdup(const unsigned char* string, const internal_hooks * const hooks) { size_t length = 0; unsigned char *copy = NULL; @@ -167,7 +167,7 @@ static unsigned char* cJSON_strdup(const unsigned char* string, const internal_h return copy; } -CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_InitHooks(cJSON_AS4CPP_Hooks* hooks) { if (hooks == NULL) { @@ -199,7 +199,7 @@ CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks) } /* Internal constructor. */ -static cJSON *cJSON_New_Item(const internal_hooks * const hooks) +static cJSON *cJSON_AS4CPP_New_Item(const internal_hooks * const hooks) { cJSON* node = (cJSON*)hooks->allocate(sizeof(cJSON)); if (node) @@ -211,21 +211,21 @@ static cJSON *cJSON_New_Item(const internal_hooks * const hooks) } /* Delete a cJSON structure. */ -CJSON_PUBLIC(void) cJSON_Delete(cJSON *item) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_Delete(cJSON *item) { cJSON *next = NULL; while (item != NULL) { next = item->next; - if (!(item->type & cJSON_IsReference) && (item->child != NULL)) + if (!(item->type & cJSON_AS4CPP_IsReference) && (item->child != NULL)) { - cJSON_Delete(item->child); + cJSON_AS4CPP_Delete(item->child); } - if (!(item->type & cJSON_IsReference) && (item->valuestring != NULL)) + if (!(item->type & cJSON_AS4CPP_IsReference) && (item->valuestring != NULL)) { global_hooks.deallocate(item->valuestring); } - if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + if (!(item->type & cJSON_AS4CPP_StringIsConst) && (item->string != NULL)) { global_hooks.deallocate(item->string); } @@ -263,7 +263,7 @@ typedef struct #define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset) /* Parse the input text to generate a number, and populate the result into item. */ -static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_buffer) +static cJSON_AS4CPP_bool parse_number(cJSON * const item, parse_buffer * const input_buffer) { double number = 0; unsigned char *after_end = NULL; @@ -327,7 +327,7 @@ loop_end: // Instead, we keep the integer literal as a string. if (isInteger && (number > INT_MAX || number < INT_MIN)) { - item->valuestring = (char*)cJSON_strdup(number_c_string, &global_hooks); + item->valuestring = (char*)cJSON_AS4CPP_strdup(number_c_string, &global_hooks); } /* use saturation in case of overflow */ @@ -344,14 +344,14 @@ loop_end: item->valueint = (int)number; } - item->type = cJSON_Number; + item->type = cJSON_AS4CPP_Number; input_buffer->offset += (size_t)(after_end - number_c_string); return true; } -/* don't ask me, but the original cJSON_SetNumberValue returns an integer or double */ -CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number) +/* don't ask me, but the original cJSON_AS4CPP_SetNumberValue returns an integer or double */ +CJSON_AS4CPP_PUBLIC(double) cJSON_AS4CPP_SetNumberHelper(cJSON *object, double number) { if (number >= INT_MAX) { @@ -375,8 +375,8 @@ typedef struct size_t length; size_t offset; size_t depth; /* current nesting depth (for formatted printing) */ - cJSON_bool noalloc; - cJSON_bool format; /* is this print a formatted print */ + cJSON_AS4CPP_bool noalloc; + cJSON_AS4CPP_bool format; /* is this print a formatted print */ internal_hooks hooks; } printbuffer; @@ -482,7 +482,7 @@ static void update_offset(printbuffer * const buffer) } /* Render the number nicely from the given item into a string. */ -static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer) +static cJSON_AS4CPP_bool print_number(const cJSON * const item, printbuffer * const output_buffer) { unsigned char *output_pointer = NULL; double d = item->valuedouble; @@ -711,7 +711,7 @@ fail: } /* Parse the input text into an unescaped cinput, and populate item. */ -static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_buffer) +static cJSON_AS4CPP_bool parse_string(cJSON * const item, parse_buffer * const input_buffer) { const unsigned char *input_pointer = buffer_at_offset(input_buffer) + 1; const unsigned char *input_end = buffer_at_offset(input_buffer) + 1; @@ -817,7 +817,7 @@ static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_bu /* zero terminate the output */ *output_pointer = '\0'; - item->type = cJSON_String; + item->type = cJSON_AS4CPP_String; item->valuestring = (char*)output; input_buffer->offset = (size_t) (input_end - input_buffer->content); @@ -840,7 +840,7 @@ fail: } /* Render the cstring provided to an escaped version that can be printed. */ -static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffer * const output_buffer) +static cJSON_AS4CPP_bool print_string_ptr(const unsigned char * const input, printbuffer * const output_buffer) { const unsigned char *input_pointer = NULL; unsigned char *output = NULL; @@ -962,18 +962,18 @@ static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffe } /* Invoke print_string_ptr (which is useful) on an item. */ -static cJSON_bool print_string(const cJSON * const item, printbuffer * const p) +static cJSON_AS4CPP_bool print_string(const cJSON * const item, printbuffer * const p) { return print_string_ptr((unsigned char*)item->valuestring, p); } /* Predeclare these prototypes. */ -static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer); -static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer); -static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer); -static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer); -static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer); -static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_AS4CPP_bool parse_value(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_AS4CPP_bool print_value(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_AS4CPP_bool parse_array(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_AS4CPP_bool print_array(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_AS4CPP_bool parse_object(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_AS4CPP_bool print_object(const cJSON * const item, printbuffer * const output_buffer); /* Utility to jump whitespace and cr/lf */ static parse_buffer *buffer_skip_whitespace(parse_buffer * const buffer) @@ -1013,7 +1013,7 @@ static parse_buffer *skip_utf8_bom(parse_buffer * const buffer) } /* Parse an object - create a new root, and populate. */ -CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_AS4CPP_bool require_null_terminated) { parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } }; cJSON *item = NULL; @@ -1032,7 +1032,7 @@ CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return buffer.offset = 0; buffer.hooks = global_hooks; - item = cJSON_New_Item(&global_hooks); + item = cJSON_AS4CPP_New_Item(&global_hooks); if (item == NULL) /* memory fail */ { goto fail; @@ -1063,7 +1063,7 @@ CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return fail: if (item != NULL) { - cJSON_Delete(item); + cJSON_AS4CPP_Delete(item); } if (value != NULL) @@ -1092,15 +1092,15 @@ fail: return NULL; } -/* Default options for cJSON_Parse */ -CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value) +/* Default options for cJSON_AS4CPP_Parse */ +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_Parse(const char *value) { - return cJSON_ParseWithOpts(value, 0, 0); + return cJSON_AS4CPP_ParseWithOpts(value, 0, 0); } #define cjson_min(a, b) ((a < b) ? a : b) -static unsigned char *print(const cJSON * const item, cJSON_bool format, const internal_hooks * const hooks) +static unsigned char *print(const cJSON * const item, cJSON_AS4CPP_bool format, const internal_hooks * const hooks) { static const size_t default_buffer_size = 256; printbuffer buffer[1]; @@ -1165,17 +1165,17 @@ fail: } /* Render a cJSON item/entity/structure to text. */ -CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item) +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_Print(const cJSON *item) { return (char*)print(item, true, &global_hooks); } -CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item) +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_PrintUnformatted(const cJSON *item) { return (char*)print(item, false, &global_hooks); } -CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt) +CJSON_AS4CPP_PUBLIC(char *) cJSON_AS4CPP_PrintBuffered(const cJSON *item, int prebuffer, cJSON_AS4CPP_bool fmt) { printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; @@ -1205,7 +1205,7 @@ CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON return (char*)p.buffer; } -CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buf, const int len, const cJSON_bool fmt) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_PrintPreallocated(cJSON *item, char *buf, const int len, const cJSON_AS4CPP_bool fmt) { printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; @@ -1225,7 +1225,7 @@ CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buf, const i } /* Parser core - when encountering text, process appropriately. */ -static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer) +static cJSON_AS4CPP_bool parse_value(cJSON * const item, parse_buffer * const input_buffer) { if ((input_buffer == NULL) || (input_buffer->content == NULL)) { @@ -1236,21 +1236,21 @@ static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buf /* null */ if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0)) { - item->type = cJSON_NULL; + item->type = cJSON_AS4CPP_NULL; input_buffer->offset += 4; return true; } /* false */ if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0)) { - item->type = cJSON_False; + item->type = cJSON_AS4CPP_False; input_buffer->offset += 5; return true; } /* true */ if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "true", 4) == 0)) { - item->type = cJSON_True; + item->type = cJSON_AS4CPP_True; item->valueint = 1; input_buffer->offset += 4; return true; @@ -1280,7 +1280,7 @@ static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buf } /* Render a value to text. */ -static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer) +static cJSON_AS4CPP_bool print_value(const cJSON * const item, printbuffer * const output_buffer) { unsigned char *output = NULL; @@ -1291,7 +1291,7 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp switch ((item->type) & 0xFF) { - case cJSON_NULL: + case cJSON_AS4CPP_NULL: output = ensure(output_buffer, 5); if (output == NULL) { @@ -1300,7 +1300,7 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp strcpy((char*)output, "null"); return true; - case cJSON_False: + case cJSON_AS4CPP_False: output = ensure(output_buffer, 6); if (output == NULL) { @@ -1309,7 +1309,7 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp strcpy((char*)output, "false"); return true; - case cJSON_True: + case cJSON_AS4CPP_True: output = ensure(output_buffer, 5); if (output == NULL) { @@ -1318,10 +1318,10 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp strcpy((char*)output, "true"); return true; - case cJSON_Number: + case cJSON_AS4CPP_Number: return print_number(item, output_buffer); - case cJSON_Raw: + case cJSON_AS4CPP_Raw: { size_t raw_length = 0; if (item->valuestring == NULL) @@ -1339,13 +1339,13 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp return true; } - case cJSON_String: + case cJSON_AS4CPP_String: return print_string(item, output_buffer); - case cJSON_Array: + case cJSON_AS4CPP_Array: return print_array(item, output_buffer); - case cJSON_Object: + case cJSON_AS4CPP_Object: return print_object(item, output_buffer); default: @@ -1354,12 +1354,12 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp } /* Build an array from input text. */ -static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer) +static cJSON_AS4CPP_bool parse_array(cJSON * const item, parse_buffer * const input_buffer) { cJSON *head = NULL; /* head of the linked list */ cJSON *current_item = NULL; - if (input_buffer->depth >= CJSON_NESTING_LIMIT) + if (input_buffer->depth >= CJSON_AS4CPP_NESTING_LIMIT) { return false; /* to deeply nested */ } @@ -1392,7 +1392,7 @@ static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buf do { /* allocate next item */ - cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + cJSON *new_item = cJSON_AS4CPP_New_Item(&(input_buffer->hooks)); if (new_item == NULL) { goto fail; /* allocation failure */ @@ -1431,7 +1431,7 @@ static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buf success: input_buffer->depth--; - item->type = cJSON_Array; + item->type = cJSON_AS4CPP_Array; item->child = head; input_buffer->offset++; @@ -1441,14 +1441,14 @@ success: fail: if (head != NULL) { - cJSON_Delete(head); + cJSON_AS4CPP_Delete(head); } return false; } /* Render an array to text */ -static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer) +static cJSON_AS4CPP_bool print_array(const cJSON * const item, printbuffer * const output_buffer) { unsigned char *output_pointer = NULL; size_t length = 0; @@ -1510,12 +1510,12 @@ static cJSON_bool print_array(const cJSON * const item, printbuffer * const outp } /* Build an object from the text. */ -static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer) +static cJSON_AS4CPP_bool parse_object(cJSON * const item, parse_buffer * const input_buffer) { cJSON *head = NULL; /* linked list head */ cJSON *current_item = NULL; - if (input_buffer->depth >= CJSON_NESTING_LIMIT) + if (input_buffer->depth >= CJSON_AS4CPP_NESTING_LIMIT) { return false; /* to deeply nested */ } @@ -1546,7 +1546,7 @@ static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_bu do { /* allocate next item */ - cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + cJSON *new_item = cJSON_AS4CPP_New_Item(&(input_buffer->hooks)); if (new_item == NULL) { goto fail; /* allocation failure */ @@ -1603,7 +1603,7 @@ static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_bu success: input_buffer->depth--; - item->type = cJSON_Object; + item->type = cJSON_AS4CPP_Object; item->child = head; input_buffer->offset++; @@ -1612,14 +1612,14 @@ success: fail: if (head != NULL) { - cJSON_Delete(head); + cJSON_AS4CPP_Delete(head); } return false; } /* Render an object to text. */ -static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer) +static cJSON_AS4CPP_bool print_object(const cJSON * const item, printbuffer * const output_buffer) { unsigned char *output_pointer = NULL; size_t length = 0; @@ -1733,7 +1733,7 @@ static cJSON_bool print_object(const cJSON * const item, printbuffer * const out } /* Get Array size/item / object item. */ -CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array) +CJSON_AS4CPP_PUBLIC(int) cJSON_AS4CPP_GetArraySize(const cJSON *array) { cJSON *child = NULL; size_t size = 0; @@ -1775,7 +1775,7 @@ static cJSON* get_array_item(const cJSON *array, size_t index) return current_child; } -CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_GetArrayItem(const cJSON *array, int index) { if (index < 0) { @@ -1785,7 +1785,7 @@ CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index) return get_array_item(array, (size_t)index); } -static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive) +static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_AS4CPP_bool case_sensitive) { cJSON *current_element = NULL; @@ -1813,19 +1813,19 @@ static cJSON *get_object_item(const cJSON * const object, const char * const nam return current_element; } -CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_GetObjectItem(const cJSON * const object, const char * const string) { return get_object_item(object, string, false); } -CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string) { return get_object_item(object, string, true); } -CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_HasObjectItem(const cJSON *object, const char *string) { - return cJSON_GetObjectItem(object, string) ? 1 : 0; + return cJSON_AS4CPP_GetObjectItem(object, string) ? 1 : 0; } /* Utility for array list handling. */ @@ -1844,7 +1844,7 @@ static cJSON *create_reference(const cJSON *item, const internal_hooks * const h return NULL; } - reference = cJSON_New_Item(hooks); + reference = cJSON_AS4CPP_New_Item(hooks); if (reference == NULL) { return NULL; @@ -1852,12 +1852,12 @@ static cJSON *create_reference(const cJSON *item, const internal_hooks * const h memcpy(reference, item, sizeof(cJSON)); reference->string = NULL; - reference->type |= cJSON_IsReference; + reference->type |= cJSON_AS4CPP_IsReference; reference->next = reference->prev = NULL; return reference; } -static cJSON_bool add_item_to_array(cJSON *array, cJSON *item) +static cJSON_AS4CPP_bool add_item_to_array(cJSON *array, cJSON *item) { cJSON *child = NULL; @@ -1887,7 +1887,7 @@ static cJSON_bool add_item_to_array(cJSON *array, cJSON *item) } /* Add item to array/object. */ -CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_AddItemToArray(cJSON *array, cJSON *item) { add_item_to_array(array, item); } @@ -1908,10 +1908,10 @@ static void* cast_away_const(const void* string) #endif -static cJSON_bool add_item_to_object(cJSON * const object, const char * const string, cJSON * const item, const internal_hooks * const hooks, const cJSON_bool constant_key) +static cJSON_AS4CPP_bool add_item_to_object(cJSON * const object, const char * const string, cJSON * const item, const internal_hooks * const hooks, const cJSON_AS4CPP_bool constant_key) { char *new_key = NULL; - int new_type = cJSON_Invalid; + int new_type = cJSON_AS4CPP_Invalid; if ((object == NULL) || (string == NULL) || (item == NULL)) { @@ -1921,20 +1921,20 @@ static cJSON_bool add_item_to_object(cJSON * const object, const char * const st if (constant_key) { new_key = (char*)cast_away_const(string); - new_type = item->type | cJSON_StringIsConst; + new_type = item->type | cJSON_AS4CPP_StringIsConst; } else { - new_key = (char*)cJSON_strdup((const unsigned char*)string, hooks); + new_key = (char*)cJSON_AS4CPP_strdup((const unsigned char*)string, hooks); if (new_key == NULL) { return false; } - new_type = item->type & ~cJSON_StringIsConst; + new_type = item->type & ~cJSON_AS4CPP_StringIsConst; } - if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + if (!(item->type & cJSON_AS4CPP_StringIsConst) && (item->string != NULL)) { hooks->deallocate(item->string); } @@ -1945,18 +1945,18 @@ static cJSON_bool add_item_to_object(cJSON * const object, const char * const st return add_item_to_array(object, item); } -CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_AddItemToObject(cJSON *object, const char *string, cJSON *item) { add_item_to_object(object, string, item, &global_hooks, false); } /* Add an item to an object with constant string as key */ -CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) { add_item_to_object(object, string, item, &global_hooks, true); } -CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_AddItemReferenceToArray(cJSON *array, cJSON *item) { if (array == NULL) { @@ -1966,7 +1966,7 @@ CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) add_item_to_array(array, create_reference(item, &global_hooks)); } -CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) { if ((object == NULL) || (string == NULL)) { @@ -1976,115 +1976,115 @@ CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *str add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); } -CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name) +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddNullToObject(cJSON * const object, const char * const name) { - cJSON *null = cJSON_CreateNull(); + cJSON *null = cJSON_AS4CPP_CreateNull(); if (add_item_to_object(object, name, null, &global_hooks, false)) { return null; } - cJSON_Delete(null); + cJSON_AS4CPP_Delete(null); return NULL; } -CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name) +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddTrueToObject(cJSON * const object, const char * const name) { - cJSON *true_item = cJSON_CreateTrue(); + cJSON *true_item = cJSON_AS4CPP_CreateTrue(); if (add_item_to_object(object, name, true_item, &global_hooks, false)) { return true_item; } - cJSON_Delete(true_item); + cJSON_AS4CPP_Delete(true_item); return NULL; } -CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name) +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddFalseToObject(cJSON * const object, const char * const name) { - cJSON *false_item = cJSON_CreateFalse(); + cJSON *false_item = cJSON_AS4CPP_CreateFalse(); if (add_item_to_object(object, name, false_item, &global_hooks, false)) { return false_item; } - cJSON_Delete(false_item); + cJSON_AS4CPP_Delete(false_item); return NULL; } -CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean) +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_AS4CPP_bool boolean) { - cJSON *bool_item = cJSON_CreateBool(boolean); + cJSON *bool_item = cJSON_AS4CPP_CreateBool(boolean); if (add_item_to_object(object, name, bool_item, &global_hooks, false)) { return bool_item; } - cJSON_Delete(bool_item); + cJSON_AS4CPP_Delete(bool_item); return NULL; } -CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number) +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddNumberToObject(cJSON * const object, const char * const name, const double number) { - cJSON *number_item = cJSON_CreateNumber(number); + cJSON *number_item = cJSON_AS4CPP_CreateNumber(number); if (add_item_to_object(object, name, number_item, &global_hooks, false)) { return number_item; } - cJSON_Delete(number_item); + cJSON_AS4CPP_Delete(number_item); return NULL; } -CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string) +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddStringToObject(cJSON * const object, const char * const name, const char * const string) { - cJSON *string_item = cJSON_CreateString(string); + cJSON *string_item = cJSON_AS4CPP_CreateString(string); if (add_item_to_object(object, name, string_item, &global_hooks, false)) { return string_item; } - cJSON_Delete(string_item); + cJSON_AS4CPP_Delete(string_item); return NULL; } -CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw) +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddRawToObject(cJSON * const object, const char * const name, const char * const raw) { - cJSON *raw_item = cJSON_CreateRaw(raw); + cJSON *raw_item = cJSON_AS4CPP_CreateRaw(raw); if (add_item_to_object(object, name, raw_item, &global_hooks, false)) { return raw_item; } - cJSON_Delete(raw_item); + cJSON_AS4CPP_Delete(raw_item); return NULL; } -CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name) +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddObjectToObject(cJSON * const object, const char * const name) { - cJSON *object_item = cJSON_CreateObject(); + cJSON *object_item = cJSON_AS4CPP_CreateObject(); if (add_item_to_object(object, name, object_item, &global_hooks, false)) { return object_item; } - cJSON_Delete(object_item); + cJSON_AS4CPP_Delete(object_item); return NULL; } -CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name) +CJSON_AS4CPP_PUBLIC(cJSON*) cJSON_AS4CPP_AddArrayToObject(cJSON * const object, const char * const name) { - cJSON *array = cJSON_CreateArray(); + cJSON *array = cJSON_AS4CPP_CreateArray(); if (add_item_to_object(object, name, array, &global_hooks, false)) { return array; } - cJSON_Delete(array); + cJSON_AS4CPP_Delete(array); return NULL; } -CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemViaPointer(cJSON *parent, cJSON * const item) { if ((parent == NULL) || (item == NULL)) { @@ -2114,47 +2114,47 @@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const it return item; } -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemFromArray(cJSON *array, int which) { if (which < 0) { return NULL; } - return cJSON_DetachItemViaPointer(array, get_array_item(array, (size_t)which)); + return cJSON_AS4CPP_DetachItemViaPointer(array, get_array_item(array, (size_t)which)); } -CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_DeleteItemFromArray(cJSON *array, int which) { - cJSON_Delete(cJSON_DetachItemFromArray(array, which)); + cJSON_AS4CPP_Delete(cJSON_AS4CPP_DetachItemFromArray(array, which)); } -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemFromObject(cJSON *object, const char *string) { - cJSON *to_detach = cJSON_GetObjectItem(object, string); + cJSON *to_detach = cJSON_AS4CPP_GetObjectItem(object, string); - return cJSON_DetachItemViaPointer(object, to_detach); + return cJSON_AS4CPP_DetachItemViaPointer(object, to_detach); } -CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string) { - cJSON *to_detach = cJSON_GetObjectItemCaseSensitive(object, string); + cJSON *to_detach = cJSON_AS4CPP_GetObjectItemCaseSensitive(object, string); - return cJSON_DetachItemViaPointer(object, to_detach); + return cJSON_AS4CPP_DetachItemViaPointer(object, to_detach); } -CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_DeleteItemFromObject(cJSON *object, const char *string) { - cJSON_Delete(cJSON_DetachItemFromObject(object, string)); + cJSON_AS4CPP_Delete(cJSON_AS4CPP_DetachItemFromObject(object, string)); } -CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string) { - cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(object, string)); + cJSON_AS4CPP_Delete(cJSON_AS4CPP_DetachItemFromObjectCaseSensitive(object, string)); } /* Replace array/object items with new ones. */ -CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_InsertItemInArray(cJSON *array, int which, cJSON *newitem) { cJSON *after_inserted = NULL; @@ -2183,7 +2183,7 @@ CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newit } } -CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement) { if ((parent == NULL) || (replacement == NULL) || (item == NULL)) { @@ -2213,22 +2213,22 @@ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON item->next = NULL; item->prev = NULL; - cJSON_Delete(item); + cJSON_AS4CPP_Delete(item); return true; } -CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) { if (which < 0) { return; } - cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem); + cJSON_AS4CPP_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem); } -static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive) +static cJSON_AS4CPP_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_AS4CPP_bool case_sensitive) { if ((replacement == NULL) || (string == NULL)) { @@ -2236,79 +2236,79 @@ static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSO } /* replace the name in the replacement */ - if (!(replacement->type & cJSON_StringIsConst) && (replacement->string != NULL)) + if (!(replacement->type & cJSON_AS4CPP_StringIsConst) && (replacement->string != NULL)) { - cJSON_free(replacement->string); + cJSON_AS4CPP_free(replacement->string); } - replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); - replacement->type &= ~cJSON_StringIsConst; + replacement->string = (char*)cJSON_AS4CPP_strdup((const unsigned char*)string, &global_hooks); + replacement->type &= ~cJSON_AS4CPP_StringIsConst; - cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); + cJSON_AS4CPP_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); return true; } -CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) { replace_item_in_object(object, string, newitem, false); } -CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) { replace_item_in_object(object, string, newitem, true); } /* Create basic types: */ -CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateNull(void) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if(item) { - item->type = cJSON_NULL; + item->type = cJSON_AS4CPP_NULL; } return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateTrue(void) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if(item) { - item->type = cJSON_True; + item->type = cJSON_AS4CPP_True; } return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateFalse(void) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if(item) { - item->type = cJSON_False; + item->type = cJSON_AS4CPP_False; } return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool b) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateBool(cJSON_AS4CPP_bool b) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if(item) { - item->type = b ? cJSON_True : cJSON_False; + item->type = b ? cJSON_AS4CPP_True : cJSON_AS4CPP_False; } return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateNumber(double num) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if(item) { - item->type = cJSON_Number; + item->type = cJSON_AS4CPP_Number; item->valuedouble = num; /* use saturation in case of overflow */ @@ -2329,12 +2329,12 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num) return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateInt64(long long num) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateInt64(long long num) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if(item) { - item->type = cJSON_Number; + item->type = cJSON_AS4CPP_Number; item->valuedouble = static_cast<double>(num); // For integer which is out of the range of [INT_MIN, INT_MAX], it may lose precision if we cast it to double. @@ -2343,7 +2343,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateInt64(long long num) { char buf[21]; sprintf(buf, "%lld", num); - item->valuestring = (char*)cJSON_strdup((const unsigned char*)buf, &global_hooks); + item->valuestring = (char*)cJSON_AS4CPP_strdup((const unsigned char*)buf, &global_hooks); } /* use saturation in case of overflow */ @@ -2364,16 +2364,16 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateInt64(long long num) return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateString(const char *string) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if(item) { - item->type = cJSON_String; - item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + item->type = cJSON_AS4CPP_String; + item->valuestring = (char*)cJSON_AS4CPP_strdup((const unsigned char*)string, &global_hooks); if(!item->valuestring) { - cJSON_Delete(item); + cJSON_AS4CPP_Delete(item); return NULL; } } @@ -2381,49 +2381,49 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string) return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateStringReference(const char *string) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if (item != NULL) { - item->type = cJSON_String | cJSON_IsReference; + item->type = cJSON_AS4CPP_String | cJSON_AS4CPP_IsReference; item->valuestring = (char*)cast_away_const(string); } return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateObjectReference(const cJSON *child) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if (item != NULL) { - item->type = cJSON_Object | cJSON_IsReference; + item->type = cJSON_AS4CPP_Object | cJSON_AS4CPP_IsReference; item->child = (cJSON*)cast_away_const(child); } return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child) { - cJSON *item = cJSON_New_Item(&global_hooks); +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateArrayReference(const cJSON *child) { + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if (item != NULL) { - item->type = cJSON_Array | cJSON_IsReference; + item->type = cJSON_AS4CPP_Array | cJSON_AS4CPP_IsReference; item->child = (cJSON*)cast_away_const(child); } return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateRaw(const char *raw) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if(item) { - item->type = cJSON_Raw; - item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks); + item->type = cJSON_AS4CPP_Raw; + item->valuestring = (char*)cJSON_AS4CPP_strdup((const unsigned char*)raw, &global_hooks); if(!item->valuestring) { - cJSON_Delete(item); + cJSON_AS4CPP_Delete(item); return NULL; } } @@ -2431,30 +2431,30 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw) return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateArray(void) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if(item) { - item->type=cJSON_Array; + item->type=cJSON_AS4CPP_Array; } return item; } -CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateObject(void) { - cJSON *item = cJSON_New_Item(&global_hooks); + cJSON *item = cJSON_AS4CPP_New_Item(&global_hooks); if (item) { - item->type = cJSON_Object; + item->type = cJSON_AS4CPP_Object; } return item; } /* Create Arrays: */ -CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateIntArray(const int *numbers, int count) { size_t i = 0; cJSON *n = NULL; @@ -2466,13 +2466,13 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count) return NULL; } - a = cJSON_CreateArray(); + a = cJSON_AS4CPP_CreateArray(); for(i = 0; a && (i < (size_t)count); i++) { - n = cJSON_CreateNumber(numbers[i]); + n = cJSON_AS4CPP_CreateNumber(numbers[i]); if (!n) { - cJSON_Delete(a); + cJSON_AS4CPP_Delete(a); return NULL; } if(!i) @@ -2489,7 +2489,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count) return a; } -CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateFloatArray(const float *numbers, int count) { size_t i = 0; cJSON *n = NULL; @@ -2501,14 +2501,14 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count) return NULL; } - a = cJSON_CreateArray(); + a = cJSON_AS4CPP_CreateArray(); for(i = 0; a && (i < (size_t)count); i++) { - n = cJSON_CreateNumber((double)numbers[i]); + n = cJSON_AS4CPP_CreateNumber((double)numbers[i]); if(!n) { - cJSON_Delete(a); + cJSON_AS4CPP_Delete(a); return NULL; } if(!i) @@ -2525,7 +2525,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count) return a; } -CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateDoubleArray(const double *numbers, int count) { size_t i = 0; cJSON *n = NULL; @@ -2537,14 +2537,14 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count) return NULL; } - a = cJSON_CreateArray(); + a = cJSON_AS4CPP_CreateArray(); for(i = 0;a && (i < (size_t)count); i++) { - n = cJSON_CreateNumber(numbers[i]); + n = cJSON_AS4CPP_CreateNumber(numbers[i]); if(!n) { - cJSON_Delete(a); + cJSON_AS4CPP_Delete(a); return NULL; } if(!i) @@ -2561,7 +2561,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count) return a; } -CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_CreateStringArray(const char **strings, int count) { size_t i = 0; cJSON *n = NULL; @@ -2573,14 +2573,14 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count) return NULL; } - a = cJSON_CreateArray(); + a = cJSON_AS4CPP_CreateArray(); for (i = 0; a && (i < (size_t)count); i++) { - n = cJSON_CreateString(strings[i]); + n = cJSON_AS4CPP_CreateString(strings[i]); if(!n) { - cJSON_Delete(a); + cJSON_AS4CPP_Delete(a); return NULL; } if(!i) @@ -2598,7 +2598,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count) } /* Duplication */ -CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) +CJSON_AS4CPP_PUBLIC(cJSON *) cJSON_AS4CPP_Duplicate(const cJSON *item, cJSON_AS4CPP_bool recurse) { cJSON *newitem = NULL; cJSON *child = NULL; @@ -2611,18 +2611,18 @@ CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) goto fail; } /* Create new item */ - newitem = cJSON_New_Item(&global_hooks); + newitem = cJSON_AS4CPP_New_Item(&global_hooks); if (!newitem) { goto fail; } /* Copy over all vars */ - newitem->type = item->type & (~cJSON_IsReference); + newitem->type = item->type & (~cJSON_AS4CPP_IsReference); newitem->valueint = item->valueint; newitem->valuedouble = item->valuedouble; if (item->valuestring) { - newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, &global_hooks); + newitem->valuestring = (char*)cJSON_AS4CPP_strdup((unsigned char*)item->valuestring, &global_hooks); if (!newitem->valuestring) { goto fail; @@ -2630,7 +2630,7 @@ CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) } if (item->string) { - newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, &global_hooks); + newitem->string = (item->type&cJSON_AS4CPP_StringIsConst) ? item->string : (char*)cJSON_AS4CPP_strdup((unsigned char*)item->string, &global_hooks); if (!newitem->string) { goto fail; @@ -2645,7 +2645,7 @@ CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) child = item->child; while (child != NULL) { - newchild = cJSON_Duplicate(child, true); /* Duplicate (with recurse) each item in the ->next chain */ + newchild = cJSON_AS4CPP_Duplicate(child, true); /* Duplicate (with recurse) each item in the ->next chain */ if (!newchild) { goto fail; @@ -2671,13 +2671,13 @@ CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) fail: if (newitem != NULL) { - cJSON_Delete(newitem); + cJSON_AS4CPP_Delete(newitem); } return NULL; } -CJSON_PUBLIC(void) cJSON_Minify(char *json) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_Minify(char *json) { unsigned char *into = (unsigned char*)json; @@ -2747,109 +2747,109 @@ CJSON_PUBLIC(void) cJSON_Minify(char *json) *into = '\0'; } -CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsInvalid(const cJSON * const item) { if (item == NULL) { return false; } - return (item->type & 0xFF) == cJSON_Invalid; + return (item->type & 0xFF) == cJSON_AS4CPP_Invalid; } -CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsFalse(const cJSON * const item) { if (item == NULL) { return false; } - return (item->type & 0xFF) == cJSON_False; + return (item->type & 0xFF) == cJSON_AS4CPP_False; } -CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsTrue(const cJSON * const item) { if (item == NULL) { return false; } - return (item->type & 0xff) == cJSON_True; + return (item->type & 0xff) == cJSON_AS4CPP_True; } -CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsBool(const cJSON * const item) { if (item == NULL) { return false; } - return (item->type & (cJSON_True | cJSON_False)) != 0; + return (item->type & (cJSON_AS4CPP_True | cJSON_AS4CPP_False)) != 0; } -CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsNull(const cJSON * const item) { if (item == NULL) { return false; } - return (item->type & 0xFF) == cJSON_NULL; + return (item->type & 0xFF) == cJSON_AS4CPP_NULL; } -CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsNumber(const cJSON * const item) { if (item == NULL) { return false; } - return (item->type & 0xFF) == cJSON_Number; + return (item->type & 0xFF) == cJSON_AS4CPP_Number; } -CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsString(const cJSON * const item) { if (item == NULL) { return false; } - return (item->type & 0xFF) == cJSON_String; + return (item->type & 0xFF) == cJSON_AS4CPP_String; } -CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsArray(const cJSON * const item) { if (item == NULL) { return false; } - return (item->type & 0xFF) == cJSON_Array; + return (item->type & 0xFF) == cJSON_AS4CPP_Array; } -CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsObject(const cJSON * const item) { if (item == NULL) { return false; } - return (item->type & 0xFF) == cJSON_Object; + return (item->type & 0xFF) == cJSON_AS4CPP_Object; } -CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_IsRaw(const cJSON * const item) { if (item == NULL) { return false; } - return (item->type & 0xFF) == cJSON_Raw; + return (item->type & 0xFF) == cJSON_AS4CPP_Raw; } -CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive) +CJSON_AS4CPP_PUBLIC(cJSON_AS4CPP_bool) cJSON_AS4CPP_Compare(const cJSON * const a, const cJSON * const b, const cJSON_AS4CPP_bool case_sensitive) { - if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)) || cJSON_IsInvalid(a)) + if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)) || cJSON_AS4CPP_IsInvalid(a)) { return false; } @@ -2857,14 +2857,14 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons /* check if type is valid */ switch (a->type & 0xFF) { - case cJSON_False: - case cJSON_True: - case cJSON_NULL: - case cJSON_Number: - case cJSON_String: - case cJSON_Raw: - case cJSON_Array: - case cJSON_Object: + case cJSON_AS4CPP_False: + case cJSON_AS4CPP_True: + case cJSON_AS4CPP_NULL: + case cJSON_AS4CPP_Number: + case cJSON_AS4CPP_String: + case cJSON_AS4CPP_Raw: + case cJSON_AS4CPP_Array: + case cJSON_AS4CPP_Object: break; default: @@ -2880,20 +2880,20 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons switch (a->type & 0xFF) { /* in these cases and equal type is enough */ - case cJSON_False: - case cJSON_True: - case cJSON_NULL: + case cJSON_AS4CPP_False: + case cJSON_AS4CPP_True: + case cJSON_AS4CPP_NULL: return true; - case cJSON_Number: + case cJSON_AS4CPP_Number: if (a->valuedouble == b->valuedouble) { return true; } return false; - case cJSON_String: - case cJSON_Raw: + case cJSON_AS4CPP_String: + case cJSON_AS4CPP_Raw: if ((a->valuestring == NULL) || (b->valuestring == NULL)) { return false; @@ -2905,14 +2905,14 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons return false; - case cJSON_Array: + case cJSON_AS4CPP_Array: { cJSON *a_element = a->child; cJSON *b_element = b->child; for (; (a_element != NULL) && (b_element != NULL);) { - if (!cJSON_Compare(a_element, b_element, case_sensitive)) + if (!cJSON_AS4CPP_Compare(a_element, b_element, case_sensitive)) { return false; } @@ -2929,11 +2929,11 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons return true; } - case cJSON_Object: + case cJSON_AS4CPP_Object: { cJSON *a_element = NULL; cJSON *b_element = NULL; - cJSON_ArrayForEach(a_element, a) + cJSON_AS4CPP_ArrayForEach(a_element, a) { /* TODO This has O(n^2) runtime, which is horrible! */ b_element = get_object_item(b, a_element->string, case_sensitive); @@ -2942,7 +2942,7 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons return false; } - if (!cJSON_Compare(a_element, b_element, case_sensitive)) + if (!cJSON_AS4CPP_Compare(a_element, b_element, case_sensitive)) { return false; } @@ -2950,7 +2950,7 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons /* doing this twice, once on a and b to prevent true comparison if a subset of b * TODO: Do this the proper way, this is just a fix for now */ - cJSON_ArrayForEach(b_element, b) + cJSON_AS4CPP_ArrayForEach(b_element, b) { a_element = get_object_item(a, b_element->string, case_sensitive); if (a_element == NULL) @@ -2958,7 +2958,7 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons return false; } - if (!cJSON_Compare(b_element, a_element, case_sensitive)) + if (!cJSON_AS4CPP_Compare(b_element, a_element, case_sensitive)) { return false; } @@ -2972,12 +2972,12 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons } } -CJSON_PUBLIC(void *) cJSON_malloc(size_t size) +CJSON_AS4CPP_PUBLIC(void *) cJSON_AS4CPP_malloc(size_t size) { return global_hooks.allocate(size); } -CJSON_PUBLIC(void) cJSON_free(void *object) +CJSON_AS4CPP_PUBLIC(void) cJSON_AS4CPP_free(void *object) { global_hooks.deallocate(object); } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp index 9b785d1995..9358d00c0a 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp @@ -19,7 +19,7 @@ JsonValue::JsonValue() : m_wasParseSuccessful(true) } JsonValue::JsonValue(cJSON* value) : - m_value(cJSON_Duplicate(value, true /* recurse */)), + m_value(cJSON_AS4CPP_Duplicate(value, true /* recurse */)), m_wasParseSuccessful(true) { } @@ -27,9 +27,9 @@ JsonValue::JsonValue(cJSON* value) : JsonValue::JsonValue(const Aws::String& value) : m_wasParseSuccessful(true) { const char* return_parse_end; - m_value = cJSON_ParseWithOpts(value.c_str(), &return_parse_end, 1/*require_null_terminated*/); + m_value = cJSON_AS4CPP_ParseWithOpts(value.c_str(), &return_parse_end, 1/*require_null_terminated*/); - if (!m_value || cJSON_IsInvalid(m_value)) + if (!m_value || cJSON_AS4CPP_IsInvalid(m_value)) { m_wasParseSuccessful = false; m_errorMessage = "Failed to parse JSON at: "; @@ -43,9 +43,9 @@ JsonValue::JsonValue(Aws::IStream& istream) : m_wasParseSuccessful(true) std::copy(std::istreambuf_iterator<char>(istream), std::istreambuf_iterator<char>(), std::ostreambuf_iterator<char>(memoryStream)); const char* return_parse_end; const auto input = memoryStream.str(); - m_value = cJSON_ParseWithOpts(input.c_str(), &return_parse_end, 1/*require_null_terminated*/); + m_value = cJSON_AS4CPP_ParseWithOpts(input.c_str(), &return_parse_end, 1/*require_null_terminated*/); - if (!m_value || cJSON_IsInvalid(m_value)) + if (!m_value || cJSON_AS4CPP_IsInvalid(m_value)) { m_wasParseSuccessful = false; m_errorMessage = "Failed to parse JSON. Invalid input at: "; @@ -54,7 +54,7 @@ JsonValue::JsonValue(Aws::IStream& istream) : m_wasParseSuccessful(true) } JsonValue::JsonValue(const JsonValue& value) : - m_value(cJSON_Duplicate(value.m_value, true/*recurse*/)), + m_value(cJSON_AS4CPP_Duplicate(value.m_value, true/*recurse*/)), m_wasParseSuccessful(value.m_wasParseSuccessful), m_errorMessage(value.m_errorMessage) { @@ -70,7 +70,7 @@ JsonValue::JsonValue(JsonValue&& value) : void JsonValue::Destroy() { - cJSON_Delete(m_value); + cJSON_AS4CPP_Delete(m_value); } JsonValue::~JsonValue() @@ -86,7 +86,7 @@ JsonValue& JsonValue::operator=(const JsonValue& other) } Destroy(); - m_value = cJSON_Duplicate(other.m_value, true /*recurse*/); + m_value = cJSON_AS4CPP_Duplicate(other.m_value, true /*recurse*/); m_wasParseSuccessful = other.m_wasParseSuccessful; m_errorMessage = other.m_errorMessage; return *this; @@ -108,14 +108,14 @@ JsonValue& JsonValue::operator=(JsonValue&& other) static void AddOrReplace(cJSON* root, const char* key, cJSON* value) { - const auto existing = cJSON_GetObjectItemCaseSensitive(root, key); + const auto existing = cJSON_AS4CPP_GetObjectItemCaseSensitive(root, key); if (existing) { - cJSON_ReplaceItemInObjectCaseSensitive(root, key, value); + cJSON_AS4CPP_ReplaceItemInObjectCaseSensitive(root, key, value); } else { - cJSON_AddItemToObject(root, key, value); + cJSON_AS4CPP_AddItemToObject(root, key, value); } } @@ -123,10 +123,10 @@ JsonValue& JsonValue::WithString(const char* key, const Aws::String& value) { if (!m_value) { - m_value = cJSON_CreateObject(); + m_value = cJSON_AS4CPP_CreateObject(); } - const auto val = cJSON_CreateString(value.c_str()); + const auto val = cJSON_AS4CPP_CreateString(value.c_str()); AddOrReplace(m_value, key, val); return *this; } @@ -139,7 +139,7 @@ JsonValue& JsonValue::WithString(const Aws::String& key, const Aws::String& valu JsonValue& JsonValue::AsString(const Aws::String& value) { Destroy(); - m_value = cJSON_CreateString(value.c_str()); + m_value = cJSON_AS4CPP_CreateString(value.c_str()); return *this; } @@ -147,10 +147,10 @@ JsonValue& JsonValue::WithBool(const char* key, bool value) { if (!m_value) { - m_value = cJSON_CreateObject(); + m_value = cJSON_AS4CPP_CreateObject(); } - const auto val = cJSON_CreateBool(value); + const auto val = cJSON_AS4CPP_CreateBool(value); AddOrReplace(m_value, key, val); return *this; } @@ -163,7 +163,7 @@ JsonValue& JsonValue::WithBool(const Aws::String& key, bool value) JsonValue& JsonValue::AsBool(bool value) { Destroy(); - m_value = cJSON_CreateBool(value); + m_value = cJSON_AS4CPP_CreateBool(value); return *this; } @@ -180,7 +180,7 @@ JsonValue& JsonValue::WithInteger(const Aws::String& key, int value) JsonValue& JsonValue::AsInteger(int value) { Destroy(); - m_value = cJSON_CreateNumber(static_cast<double>(value)); + m_value = cJSON_AS4CPP_CreateNumber(static_cast<double>(value)); return *this; } @@ -188,10 +188,10 @@ JsonValue& JsonValue::WithInt64(const char* key, long long value) { if (!m_value) { - m_value = cJSON_CreateObject(); + m_value = cJSON_AS4CPP_CreateObject(); } - const auto val = cJSON_CreateInt64(value); + const auto val = cJSON_AS4CPP_CreateInt64(value); AddOrReplace(m_value, key, val); return *this; } @@ -204,7 +204,7 @@ JsonValue& JsonValue::WithInt64(const Aws::String& key, long long value) JsonValue& JsonValue::AsInt64(long long value) { Destroy(); - m_value = cJSON_CreateInt64(value); + m_value = cJSON_AS4CPP_CreateInt64(value); return *this; } @@ -212,10 +212,10 @@ JsonValue& JsonValue::WithDouble(const char* key, double value) { if (!m_value) { - m_value = cJSON_CreateObject(); + m_value = cJSON_AS4CPP_CreateObject(); } - const auto val = cJSON_CreateNumber(value); + const auto val = cJSON_AS4CPP_CreateNumber(value); AddOrReplace(m_value, key, val); return *this; } @@ -228,7 +228,7 @@ JsonValue& JsonValue::WithDouble(const Aws::String& key, double value) JsonValue& JsonValue::AsDouble(double value) { Destroy(); - m_value = cJSON_CreateNumber(value); + m_value = cJSON_AS4CPP_CreateNumber(value); return *this; } @@ -236,13 +236,13 @@ JsonValue& JsonValue::WithArray(const char* key, const Array<Aws::String>& array { if (!m_value) { - m_value = cJSON_CreateObject(); + m_value = cJSON_AS4CPP_CreateObject(); } - auto arrayValue = cJSON_CreateArray(); + auto arrayValue = cJSON_AS4CPP_CreateArray(); for (unsigned i = 0; i < array.GetLength(); ++i) { - cJSON_AddItemToArray(arrayValue, cJSON_CreateString(array[i].c_str())); + cJSON_AS4CPP_AddItemToArray(arrayValue, cJSON_AS4CPP_CreateString(array[i].c_str())); } AddOrReplace(m_value, key, arrayValue); @@ -258,13 +258,13 @@ JsonValue& JsonValue::WithArray(const Aws::String& key, const Array<JsonValue>& { if (!m_value) { - m_value = cJSON_CreateObject(); + m_value = cJSON_AS4CPP_CreateObject(); } - auto arrayValue = cJSON_CreateArray(); + auto arrayValue = cJSON_AS4CPP_CreateArray(); for (unsigned i = 0; i < array.GetLength(); ++i) { - cJSON_AddItemToArray(arrayValue, cJSON_Duplicate(array[i].m_value, true /*recurse*/)); + cJSON_AS4CPP_AddItemToArray(arrayValue, cJSON_AS4CPP_Duplicate(array[i].m_value, true /*recurse*/)); } AddOrReplace(m_value, key.c_str(), arrayValue); @@ -275,13 +275,13 @@ JsonValue& JsonValue::WithArray(const Aws::String& key, Array<JsonValue>&& array { if (!m_value) { - m_value = cJSON_CreateObject(); + m_value = cJSON_AS4CPP_CreateObject(); } - auto arrayValue = cJSON_CreateArray(); + auto arrayValue = cJSON_AS4CPP_CreateArray(); for (unsigned i = 0; i < array.GetLength(); ++i) { - cJSON_AddItemToArray(arrayValue, array[i].m_value); + cJSON_AS4CPP_AddItemToArray(arrayValue, array[i].m_value); array[i].m_value = nullptr; } @@ -291,10 +291,10 @@ JsonValue& JsonValue::WithArray(const Aws::String& key, Array<JsonValue>&& array JsonValue& JsonValue::AsArray(const Array<JsonValue>& array) { - auto arrayValue = cJSON_CreateArray(); + auto arrayValue = cJSON_AS4CPP_CreateArray(); for (unsigned i = 0; i < array.GetLength(); ++i) { - cJSON_AddItemToArray(arrayValue, cJSON_Duplicate(array[i].m_value, true /*recurse*/)); + cJSON_AS4CPP_AddItemToArray(arrayValue, cJSON_AS4CPP_Duplicate(array[i].m_value, true /*recurse*/)); } Destroy(); @@ -304,10 +304,10 @@ JsonValue& JsonValue::AsArray(const Array<JsonValue>& array) JsonValue& JsonValue::AsArray(Array<JsonValue>&& array) { - auto arrayValue = cJSON_CreateArray(); + auto arrayValue = cJSON_AS4CPP_CreateArray(); for (unsigned i = 0; i < array.GetLength(); ++i) { - cJSON_AddItemToArray(arrayValue, array[i].m_value); + cJSON_AS4CPP_AddItemToArray(arrayValue, array[i].m_value); array[i].m_value = nullptr; } @@ -320,10 +320,10 @@ JsonValue& JsonValue::WithObject(const char* key, const JsonValue& value) { if (!m_value) { - m_value = cJSON_CreateObject(); + m_value = cJSON_AS4CPP_CreateObject(); } - const auto copy = value.m_value == nullptr ? cJSON_CreateObject() : cJSON_Duplicate(value.m_value, true /*recurse*/); + const auto copy = value.m_value == nullptr ? cJSON_AS4CPP_CreateObject() : cJSON_AS4CPP_Duplicate(value.m_value, true /*recurse*/); AddOrReplace(m_value, key, copy); return *this; } @@ -337,10 +337,10 @@ JsonValue& JsonValue::WithObject(const char* key, JsonValue&& value) { if (!m_value) { - m_value = cJSON_CreateObject(); + m_value = cJSON_AS4CPP_CreateObject(); } - AddOrReplace(m_value, key, value.m_value == nullptr ? cJSON_CreateObject() : value.m_value); + AddOrReplace(m_value, key, value.m_value == nullptr ? cJSON_AS4CPP_CreateObject() : value.m_value); value.m_value = nullptr; return *this; } @@ -364,7 +364,7 @@ JsonValue& JsonValue::AsObject(JsonValue && value) bool JsonValue::operator==(const JsonValue& other) const { - return cJSON_Compare(m_value, other.m_value, true /*case-sensitive*/) != 0; + return cJSON_AS4CPP_Compare(m_value, other.m_value, true /*case-sensitive*/) != 0; } bool JsonValue::operator!=(const JsonValue& other) const @@ -404,14 +404,14 @@ JsonView& JsonView::operator=(cJSON* val) Aws::String JsonView::GetString(const Aws::String& key) const { assert(m_value); - auto item = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str()); - auto str = cJSON_GetStringValue(item); + auto item = cJSON_AS4CPP_GetObjectItemCaseSensitive(m_value, key.c_str()); + auto str = cJSON_AS4CPP_GetStringValue(item); return str ? str : ""; } Aws::String JsonView::AsString() const { - const char* str = cJSON_GetStringValue(m_value); + const char* str = cJSON_AS4CPP_GetStringValue(m_value); if (str == nullptr) { return {}; @@ -422,35 +422,35 @@ Aws::String JsonView::AsString() const bool JsonView::GetBool(const Aws::String& key) const { assert(m_value); - auto item = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str()); + auto item = cJSON_AS4CPP_GetObjectItemCaseSensitive(m_value, key.c_str()); assert(item); return item->valueint != 0; } bool JsonView::AsBool() const { - assert(cJSON_IsBool(m_value)); - return cJSON_IsTrue(m_value) != 0; + assert(cJSON_AS4CPP_IsBool(m_value)); + return cJSON_AS4CPP_IsTrue(m_value) != 0; } int JsonView::GetInteger(const Aws::String& key) const { assert(m_value); - auto item = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str()); + auto item = cJSON_AS4CPP_GetObjectItemCaseSensitive(m_value, key.c_str()); assert(item); return item->valueint; } int JsonView::AsInteger() const { - assert(cJSON_IsNumber(m_value)); // can be double or value larger than int_max, but at least not UB + assert(cJSON_AS4CPP_IsNumber(m_value)); // can be double or value larger than int_max, but at least not UB return m_value->valueint; } int64_t JsonView::GetInt64(const Aws::String& key) const { assert(m_value); - auto item = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str()); + auto item = cJSON_AS4CPP_GetObjectItemCaseSensitive(m_value, key.c_str()); assert(item); if (item->valuestring) { @@ -464,7 +464,7 @@ int64_t JsonView::GetInt64(const Aws::String& key) const int64_t JsonView::AsInt64() const { - assert(cJSON_IsNumber(m_value)); + assert(cJSON_AS4CPP_IsNumber(m_value)); if (m_value->valuestring) { return Aws::Utils::StringUtils::ConvertToInt64(m_value->valuestring); @@ -478,36 +478,36 @@ int64_t JsonView::AsInt64() const double JsonView::GetDouble(const Aws::String& key) const { assert(m_value); - auto item = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str()); + auto item = cJSON_AS4CPP_GetObjectItemCaseSensitive(m_value, key.c_str()); assert(item); return item->valuedouble; } double JsonView::AsDouble() const { - assert(cJSON_IsNumber(m_value)); + assert(cJSON_AS4CPP_IsNumber(m_value)); return m_value->valuedouble; } JsonView JsonView::GetObject(const Aws::String& key) const { assert(m_value); - auto item = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str()); + auto item = cJSON_AS4CPP_GetObjectItemCaseSensitive(m_value, key.c_str()); return item; } JsonView JsonView::AsObject() const { - assert(cJSON_IsObject(m_value) || cJSON_IsNull(m_value)); + assert(cJSON_AS4CPP_IsObject(m_value) || cJSON_AS4CPP_IsNull(m_value)); return m_value; } Array<JsonView> JsonView::GetArray(const Aws::String& key) const { assert(m_value); - auto array = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str()); - assert(cJSON_IsArray(array)); - Array<JsonView> returnArray(cJSON_GetArraySize(array)); + auto array = cJSON_AS4CPP_GetObjectItemCaseSensitive(m_value, key.c_str()); + assert(cJSON_AS4CPP_IsArray(array)); + Array<JsonView> returnArray(cJSON_AS4CPP_GetArraySize(array)); auto element = array->child; for (unsigned i = 0; element && i < returnArray.GetLength(); ++i, element = element->next) @@ -520,8 +520,8 @@ Array<JsonView> JsonView::GetArray(const Aws::String& key) const Array<JsonView> JsonView::AsArray() const { - assert(cJSON_IsArray(m_value)); - Array<JsonView> returnArray(cJSON_GetArraySize(m_value)); + assert(cJSON_AS4CPP_IsArray(m_value)); + Array<JsonView> returnArray(cJSON_AS4CPP_GetArraySize(m_value)); auto element = m_value->child; @@ -551,43 +551,43 @@ Aws::Map<Aws::String, JsonView> JsonView::GetAllObjects() const bool JsonView::ValueExists(const Aws::String& key) const { - if (!cJSON_IsObject(m_value)) + if (!cJSON_AS4CPP_IsObject(m_value)) { return false; } - auto item = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str()); - return !(item == nullptr || cJSON_IsNull(item)); + auto item = cJSON_AS4CPP_GetObjectItemCaseSensitive(m_value, key.c_str()); + return !(item == nullptr || cJSON_AS4CPP_IsNull(item)); } bool JsonView::KeyExists(const Aws::String& key) const { - if (!cJSON_IsObject(m_value)) + if (!cJSON_AS4CPP_IsObject(m_value)) { return false; } - return cJSON_GetObjectItemCaseSensitive(m_value, key.c_str()) != nullptr;; + return cJSON_AS4CPP_GetObjectItemCaseSensitive(m_value, key.c_str()) != nullptr;; } bool JsonView::IsObject() const { - return cJSON_IsObject(m_value) != 0; + return cJSON_AS4CPP_IsObject(m_value) != 0; } bool JsonView::IsBool() const { - return cJSON_IsBool(m_value) != 0; + return cJSON_AS4CPP_IsBool(m_value) != 0; } bool JsonView::IsString() const { - return cJSON_IsString(m_value) != 0; + return cJSON_AS4CPP_IsString(m_value) != 0; } bool JsonView::IsIntegerType() const { - if (!cJSON_IsNumber(m_value)) + if (!cJSON_AS4CPP_IsNumber(m_value)) { return false; } @@ -602,7 +602,7 @@ bool JsonView::IsIntegerType() const bool JsonView::IsFloatingPointType() const { - if (!cJSON_IsNumber(m_value)) + if (!cJSON_AS4CPP_IsNumber(m_value)) { return false; } @@ -617,12 +617,12 @@ bool JsonView::IsFloatingPointType() const bool JsonView::IsListType() const { - return cJSON_IsArray(m_value) != 0; + return cJSON_AS4CPP_IsArray(m_value) != 0; } bool JsonView::IsNull() const { - return cJSON_IsNull(m_value) != 0; + return cJSON_AS4CPP_IsNull(m_value) != 0; } Aws::String JsonView::WriteCompact(bool treatAsObject) const @@ -636,9 +636,9 @@ Aws::String JsonView::WriteCompact(bool treatAsObject) const return {}; } - auto temp = cJSON_PrintUnformatted(m_value); + auto temp = cJSON_AS4CPP_PrintUnformatted(m_value); Aws::String out(temp); - cJSON_free(temp); + cJSON_AS4CPP_free(temp); return out; } @@ -653,9 +653,9 @@ Aws::String JsonView::WriteReadable(bool treatAsObject) const return {}; } - auto temp = cJSON_Print(m_value); + auto temp = cJSON_AS4CPP_Print(m_value); Aws::String out(temp); - cJSON_free(temp); + cJSON_AS4CPP_free(temp); return out; } |