mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
![]() This commit adds int64 support for cjson. To enable int64, you need to define the macro ENABLE_INT64. To make it more clear, you need to build cjson like this: mkdir build cd build cmake -DENABLE_INT64=ON .. make This implementation changed the type of valueint in struct cJSON: from int to long long(int64), and added a new flag cJSON_IsInt64. For a int64 cJSON item, the value of item->type would be cJSON_Number | cJSON_IsInt64. The existing functions parse_number and print_number can handle int64 now. Considering I have added a new type cJSON_IsInt64, some new functions have been added: CJSON_PUBLIC(long long *) cJSON_GetInt64NumberValue(cJSON * const item) CJSON_PUBLIC(cJSON_bool) cJSON_IsInt64Number(const cJSON * const item) CJSON_PUBLIC(cJSON *) cJSON_CreateInt64Number(long long integer) CJSON_PUBLIC(cJSON*) cJSON_AddInt64NumberToObject(cJSON * const object, const char * const name, const long long integer) CJSON_PUBLIC(long long) cJSON_SetInt64NumberValue(cJSON * const object, const long long integer) And some existing functions are also adjusted for int64, including parse_number, cJSON_SetNumberHelper, print_number, cJSON_CreateNumber, cJSON_Compare and compare_json(in cJSON_Utils). Besides the code changes, we have also added some testcases for int64. These tests will run if ENABLE_INT64 is turned on. |
||
---|---|---|
.. | ||
inputs | ||
json-patch-tests | ||
unity | ||
cjson_add.c | ||
CMakeLists.txt | ||
common.h | ||
compare_tests.c | ||
json_patch_tests.c | ||
minify_tests.c | ||
misc_int64_tests.c | ||
misc_tests.c | ||
misc_utils_tests.c | ||
old_utils_tests.c | ||
parse_array.c | ||
parse_examples.c | ||
parse_hex4.c | ||
parse_number.c | ||
parse_object.c | ||
parse_string.c | ||
parse_value.c | ||
parse_with_opts.c | ||
print_array.c | ||
print_number.c | ||
print_object.c | ||
print_string.c | ||
print_value.c | ||
readme_examples.c | ||
unity_setup.c |