Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package aws-c-common for openSUSE:Factory checked in at 2024-02-21 17:59:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/aws-c-common (Old) and /work/SRC/openSUSE:Factory/.aws-c-common.new.1706 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "aws-c-common" Wed Feb 21 17:59:08 2024 rev:2 rq:1148508 version:0.9.13 Changes: -------- --- /work/SRC/openSUSE:Factory/aws-c-common/aws-c-common.changes 2024-01-29 22:27:32.990256597 +0100 +++ /work/SRC/openSUSE:Factory/.aws-c-common.new.1706/aws-c-common.changes 2024-02-21 17:59:09.977269560 +0100 @@ -1,0 +2,13 @@ +Mon Feb 19 14:54:52 UTC 2024 - John Paul Adrian Glaubitz <[email protected]> + +- Update to version 0.9.13 + * cJSON update to 1.7.17 by @graebm in (#1081) + * Add more generic AVX feature detection as well as flags for if + avx512 intrinsics are available. by @JonathanHenson in (#1041) + * chore: Relax stale issue timings by @kellertk in (#1085) + * Use _Exit() on test failure, to avoid LeakSanitizer spam by @graebm in (#1088) + * Fix a bunch of places we forget to aws_raise_error() by @graebm in (#1089) + * Consistently use lowercase for Windows libraries + and header files by @giordano in (#1058) + +------------------------------------------------------------------- Old: ---- v0.9.12.tar.gz New: ---- v0.9.13.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ aws-c-common.spec ++++++ --- /var/tmp/diff_new_pack.k8bWnH/_old 2024-02-21 17:59:12.593364158 +0100 +++ /var/tmp/diff_new_pack.k8bWnH/_new 2024-02-21 17:59:12.601364448 +0100 @@ -1,7 +1,7 @@ # # spec file for package aws-c-common # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define library_version 1.0.0 %define library_soversion 1 Name: aws-c-common -Version: 0.9.12 +Version: 0.9.13 Release: 0 Summary: Core C99 package for AWS SDK for C License: Apache-2.0 ++++++ v0.9.12.tar.gz -> v0.9.13.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/.github/workflows/ci.yml new/aws-c-common-0.9.13/.github/workflows/ci.yml --- old/aws-c-common-0.9.12/.github/workflows/ci.yml 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/.github/workflows/ci.yml 2024-02-13 19:09:29.000000000 +0100 @@ -6,7 +6,7 @@ - 'main' env: - BUILDER_VERSION: v0.9.49 + BUILDER_VERSION: v0.9.55 BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net BUILDER_SOURCE: releases PACKAGE_NAME: aws-c-common diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/.github/workflows/codecov.yml new/aws-c-common-0.9.13/.github/workflows/codecov.yml --- old/aws-c-common-0.9.12/.github/workflows/codecov.yml 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/.github/workflows/codecov.yml 2024-02-13 19:09:29.000000000 +0100 @@ -4,7 +4,7 @@ push: env: - BUILDER_VERSION: v0.9.37 + BUILDER_VERSION: v0.9.55 BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net BUILDER_SOURCE: releases PACKAGE_NAME: aws-c-common diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/.github/workflows/stale_issue.yml new/aws-c-common-0.9.13/.github/workflows/stale_issue.yml --- old/aws-c-common-0.9.12/.github/workflows/stale_issue.yml 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/.github/workflows/stale_issue.yml 2024-02-13 19:09:29.000000000 +0100 @@ -33,8 +33,8 @@ closed-for-staleness-label: closed-for-staleness # Issue timing - days-before-stale: 2 - days-before-close: 5 + days-before-stale: 10 + days-before-close: 4 days-before-ancient: 36500 # If you don't want to mark a issue as being ancient based on a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/CMakeLists.txt new/aws-c-common-0.9.13/CMakeLists.txt --- old/aws-c-common-0.9.12/CMakeLists.txt 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/CMakeLists.txt 2024-02-13 19:09:29.000000000 +0100 @@ -24,7 +24,6 @@ include(AwsSanitizers) include(AwsThreadAffinity) include(AwsThreadName) -include(AwsSIMD) include(CTest) set(GENERATED_ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated") @@ -62,7 +61,7 @@ option(AWS_NUM_CPU_CORES "Number of CPU cores of the target machine. Useful when cross-compiling." 0) if (WIN32) - set(WINDOWS_KERNEL_LIB "Kernel32" CACHE STRING "The name of the kernel library to link against (default: Kernel32)") + set(WINDOWS_KERNEL_LIB "kernel32" CACHE STRING "The name of the kernel library to link against (default: kernel32)") file(GLOB AWS_COMMON_OS_HEADERS "include/aws/common/windows/*" @@ -85,7 +84,7 @@ # PSAPI_VERSION=1 is needed to support GetProcessMemoryInfo on both pre and # post Win7 OS's. list(APPEND PLATFORM_DEFINES PSAPI_VERSION=1) - list(APPEND PLATFORM_LIBS BCrypt ${WINDOWS_KERNEL_LIB} Ws2_32 Shlwapi Psapi) + list(APPEND PLATFORM_LIBS bcrypt ${WINDOWS_KERNEL_LIB} ws2_32 shlwapi psapi) else () file(GLOB AWS_COMMON_OS_HEADERS "include/aws/common/posix/*" @@ -224,12 +223,9 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE -DCJSON_HIDE_SYMBOLS) -# Enable SIMD encoder if the compiler supports the right features -simd_add_definitions(${PROJECT_NAME}) - -if (HAVE_AVX2_INTRINSICS) +if (AWS_HAVE_AVX2_INTRINSICS) target_compile_definitions(${PROJECT_NAME} PRIVATE -DUSE_SIMD_ENCODING) - simd_add_source_avx2(${PROJECT_NAME} "source/arch/intel/encoding_avx2.c") + simd_add_source_avx(${PROJECT_NAME} "source/arch/intel/encoding_avx2.c") message(STATUS "Building SIMD base64 decoder") endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/README.md new/aws-c-common-0.9.13/README.md --- old/aws-c-common-0.9.12/README.md 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/README.md 2024-02-13 19:09:29.000000000 +0100 @@ -158,7 +158,7 @@ * Avoid C99 features in header files. For some types such as bool, uint32_t etc..., these are defined if not available for the language standard being used in `aws/common/common.h`, so feel free to use them. * For C++ compatibility, don't put const members in structs. -* Avoid C++ style comments e.g. `//`. +* Avoid C++ style comments e.g. `//` in header files and prefer block style (`/* */`) for long blocks of text. C++ style comments are fine in C files. * All public API functions need C++ guards and Windows dll semantics. * Use Unix line endings. * Where implementation hiding is desired for either ABI or runtime polymorphism reasons, use the `void *impl` pattern. v-tables diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/cmake/AwsFeatureTests.cmake new/aws-c-common-0.9.13/cmake/AwsFeatureTests.cmake --- old/aws-c-common-0.9.12/cmake/AwsFeatureTests.cmake 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/cmake/AwsFeatureTests.cmake 2024-02-13 19:09:29.000000000 +0100 @@ -35,7 +35,7 @@ endif() check_c_source_compiles(" - #include <Windows.h> + #include <windows.h> #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) int main() { return 0; @@ -117,3 +117,7 @@ return 0; }" AWS_HAVE_MSVC_INTRINSICS_X64) endif() + +# This does a lot to detect when intrinsics are available and has to set cflags to do so. +# leave it in its own file for ease of managing it. +include(AwsSIMD) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/cmake/AwsSIMD.cmake new/aws-c-common-0.9.13/cmake/AwsSIMD.cmake --- old/aws-c-common-0.9.12/cmake/AwsSIMD.cmake 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/cmake/AwsSIMD.cmake 2024-02-13 19:09:29.000000000 +0100 @@ -8,18 +8,31 @@ if (MSVC) check_c_compiler_flag("/arch:AVX2" HAVE_M_AVX2_FLAG) if (HAVE_M_AVX2_FLAG) - set(AVX2_CFLAGS "/arch:AVX2") + set(AVX_CFLAGS "/arch:AVX2") endif() else() check_c_compiler_flag(-mavx2 HAVE_M_AVX2_FLAG) if (HAVE_M_AVX2_FLAG) - set(AVX2_CFLAGS "-mavx -mavx2") + set(AVX_CFLAGS "-mavx -mavx2") endif() endif() + if (MSVC) + check_c_compiler_flag("/arch:AVX512" HAVE_M_AVX512_FLAG) + if (HAVE_M_AVX512_FLAG) + # docs imply AVX512 brings in AVX2. And it will compile, but it will break at runtime on + # instructions such as _mm256_load_si256(). Leave it on. + set(AVX_CFLAGS "/arch:AVX512 /arch:AVX2") + endif() + else() + check_c_compiler_flag("-mavx512f -mvpclmulqdq" HAVE_M_AVX512_FLAG) + if (HAVE_M_AVX512_FLAG) + set(AVX_CFLAGS "-mavx512f -mvpclmulqdq -mpclmul -mavx -mavx2 -msse4.2") + endif() + endif() set(old_flags "${CMAKE_REQUIRED_FLAGS}") - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${AVX2_CFLAGS}") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${AVX_CFLAGS}") check_c_source_compiles(" #include <immintrin.h> @@ -35,7 +48,15 @@ _mm256_permutevar8x32_epi32(vec, vec); return 0; - }" HAVE_AVX2_INTRINSICS) + }" AWS_HAVE_AVX2_INTRINSICS) + + check_c_source_compiles(" + #include <immintrin.h> + + int main() { + __m512 a = _mm512_setzero_ps(); + return 0; + }" AWS_HAVE_AVX512_INTRINSICS) check_c_source_compiles(" #include <immintrin.h> @@ -45,30 +66,20 @@ __m256i vec; memset(&vec, 0, sizeof(vec)); return (int)_mm256_extract_epi64(vec, 2); - }" HAVE_MM256_EXTRACT_EPI64) + }" AWS_HAVE_MM256_EXTRACT_EPI64) set(CMAKE_REQUIRED_FLAGS "${old_flags}") endif() # USE_CPU_EXTENSIONS -macro(simd_add_definition_if target definition) - if(${definition}) - target_compile_definitions(${target} PRIVATE -D${definition}) - endif(${definition}) -endmacro(simd_add_definition_if) - -# Configure private preprocessor definitions for SIMD-related features -# Does not set any processor feature codegen flags -function(simd_add_definitions target) - simd_add_definition_if(${target} HAVE_AVX2_INTRINSICS) - simd_add_definition_if(${target} HAVE_MM256_EXTRACT_EPI64) -endfunction(simd_add_definitions) - -# Adds source files only if AVX2 is supported. These files will be built with -# avx2 intrinsics enabled. -# Usage: simd_add_source_avx2(target file1.c file2.c ...) -function(simd_add_source_avx2 target) +# The part where the definition is added to the compiler flags has been moved to config.h.in +# see git history for more details. + +# Adds AVX flags, if any, that are supported. These files will be built with +# available avx intrinsics enabled. +# Usage: simd_add_source_avx(target file1.c file2.c ...) +function(simd_add_source_avx target) foreach(file ${ARGN}) target_sources(${target} PRIVATE ${file}) - set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS "${AVX2_CFLAGS}") + set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS "${AVX_CFLAGS}") endforeach() -endfunction(simd_add_source_avx2) +endfunction(simd_add_source_avx) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/include/aws/common/condition_variable.h new/aws-c-common-0.9.13/include/aws/common/condition_variable.h --- old/aws-c-common-0.9.12/include/aws/common/condition_variable.h 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/include/aws/common/condition_variable.h 2024-02-13 19:09:29.000000000 +0100 @@ -33,7 +33,7 @@ * You can do something like struct aws_condition_variable var = * AWS_CONDITION_VARIABLE_INIT; * - * If on Windows and you get an error about AWS_CONDITION_VARIABLE_INIT being undefined, please include Windows.h to get + * If on Windows and you get an error about AWS_CONDITION_VARIABLE_INIT being undefined, please include windows.h to get * CONDITION_VARIABLE_INIT. */ #ifdef _WIN32 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/include/aws/common/config.h.in new/aws-c-common-0.9.13/include/aws/common/config.h.in --- old/aws-c-common-0.9.12/include/aws/common/config.h.in 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/include/aws/common/config.h.in 2024-02-13 19:09:29.000000000 +0100 @@ -19,5 +19,8 @@ #cmakedefine AWS_HAVE_EXECINFO #cmakedefine AWS_HAVE_WINAPI_DESKTOP #cmakedefine AWS_HAVE_LINUX_IF_LINK_H +#cmakedefine AWS_HAVE_AVX2_INTRINSICS +#cmakedefine AWS_HAVE_AVX512_INTRINSICS +#cmakedefine AWS_HAVE_MM256_EXTRACT_EPI64 #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/include/aws/common/cpuid.h new/aws-c-common-0.9.13/include/aws/common/cpuid.h --- old/aws-c-common-0.9.12/include/aws/common/cpuid.h 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/include/aws/common/cpuid.h 2024-02-13 19:09:29.000000000 +0100 @@ -17,6 +17,7 @@ AWS_CPU_FEATURE_AVX512, AWS_CPU_FEATURE_ARM_CRC, AWS_CPU_FEATURE_BMI2, + AWS_CPU_FEATURE_VPCLMULQDQ, AWS_CPU_FEATURE_COUNT, }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/include/aws/common/external/cJSON.h new/aws-c-common-0.9.13/include/aws/common/external/cJSON.h --- old/aws-c-common-0.9.12/include/aws/common/external/cJSON.h 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/include/aws/common/external/cJSON.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,308 +0,0 @@ -/* - Copyright (c) 2009-2017 Dave Gamble and cJSON contributors - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -/* - * This file has been modified from its original version by Amazon: - * (1) Address clang-tidy errors by renaming function parameters in a number of places - * to match their .c counterparts. - * (2) Misc tweaks to unchecked writes to make security static analysis happier - * (3) Remove cJSON_GetErrorPtr and global_error as they are not thread-safe. - */ - -/* NOLINTBEGIN */ - -#ifndef AWS_COMMON_EXTERNAL_CJSON_H -#define AWS_COMMON_EXTERNAL_CJSON_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) -#define __WINDOWS__ -#endif - -#ifdef __WINDOWS__ - -/* 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 3 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 - -For *nix builds that support visibility attribute, you can define similar behavior by - -setting default visibility to hidden by adding --fvisibility=hidden (for gcc) -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 - -*/ - -#define CJSON_CDECL __cdecl -#define CJSON_STDCALL __stdcall - -/* 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 -#endif - -#if defined(CJSON_HIDE_SYMBOLS) -#define CJSON_PUBLIC(type) type CJSON_STDCALL -#elif defined(CJSON_EXPORT_SYMBOLS) -#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL -#elif defined(CJSON_IMPORT_SYMBOLS) -#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL -#endif -#else /* !__WINDOWS__ */ -#define CJSON_CDECL -#define CJSON_STDCALL - -#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY) -#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type -#else -#define CJSON_PUBLIC(type) type -#endif -#endif - -/* project version */ -#define CJSON_VERSION_MAJOR 1 -#define CJSON_VERSION_MINOR 7 -#define CJSON_VERSION_PATCH 16 - -#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 - -/* The cJSON structure: */ -typedef struct cJSON -{ - /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ - struct cJSON *next; - struct cJSON *prev; - /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ - struct cJSON *child; - - /* The type of the item, as above. */ - int type; - - /* The item's string, if type==cJSON_String and type == cJSON_Raw */ - char *valuestring; - /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */ - int valueint; - /* The item's number, if type==cJSON_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 -{ - /* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */ - void *(CJSON_CDECL *malloc_fn)(size_t sz); - void (CJSON_CDECL *free_fn)(void *ptr); -} cJSON_Hooks; - -typedef int cJSON_bool; - -/* 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 -#endif - -/* returns the version of cJSON as a string */ -CJSON_PUBLIC(const char*) cJSON_Version(void); - -/* Supply malloc, realloc and free functions to cJSON */ -CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_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. */ -/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ -CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value); -CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length); -/* 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); -CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated); - -/* Render a cJSON entity to text for transfer/storage. */ -CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); -/* Render a cJSON entity to text for transfer/storage without any formatting. */ -CJSON_PUBLIC(char *) cJSON_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); -/* 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); -/* Delete a cJSON entity and all subentities. */ -CJSON_PUBLIC(void) cJSON_Delete(cJSON *item); - -/* Returns the number of items in an array (or object). */ -CJSON_PUBLIC(int) cJSON_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); -/* 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); - -/* Check item type and return its value */ -CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item); -CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const 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); - -/* 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_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); - -/* 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); -/* Create an object/array 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); - -/* These utilities create an Array of count items. - * The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/ -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 *const *strings, int count); - -/* Append item to the specified array/object. */ -CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); -CJSON_PUBLIC(cJSON_bool) cJSON_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 - * writing to `item->string` */ -CJSON_PUBLIC(cJSON_bool) cJSON_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(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); -CJSON_PUBLIC(cJSON_bool) cJSON_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); - -/* Update array items. */ -CJSON_PUBLIC(cJSON_bool) 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(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); -CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); -CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); - -/* Duplicate a cJSON item */ -CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_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); - -/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings. - * The input pointer json cannot point to a read-only address area, such as a string constant, - * but should point to a readable and writable address area. */ -CJSON_PUBLIC(void) cJSON_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); - -/* 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)) -/* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */ -CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring); - -/* If the object is not a boolean type this does nothing and returns cJSON_Invalid else it returns the new type*/ -#define cJSON_SetBoolValue(object, boolValue) ( \ - (object != NULL && ((object)->type & (cJSON_False|cJSON_True))) ? \ - (object)->type=((object)->type &(~(cJSON_False|cJSON_True)))|((boolValue)?cJSON_True:cJSON_False) : \ - cJSON_Invalid\ -) - -/* 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) - -/* 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); - -#ifdef __cplusplus -} -#endif -/* NOLINTEND */ -#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/include/aws/common/json.h new/aws-c-common-0.9.13/include/aws/common/json.h --- old/aws-c-common-0.9.12/include/aws/common/json.h 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/include/aws/common/json.h 2024-02-13 19:09:29.000000000 +0100 @@ -400,7 +400,7 @@ * @param value The aws_json_value to format. * @param output The destination for the JSON string * @return AWS_OP_SUCCESS if the JSON string was allocated to output without any errors - * Will return AWS_ERROR_INVALID_ARGUMENT if the value passed is not an aws_json_value or if there + * Will return AWS_OP_ERR if the value passed is not an aws_json_value or if there * aws an error appending the JSON into the byte buffer. */ AWS_COMMON_API diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/include/aws/common/mutex.h new/aws-c-common-0.9.13/include/aws/common/mutex.h --- old/aws-c-common-0.9.12/include/aws/common/mutex.h 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/include/aws/common/mutex.h 2024-02-13 19:09:29.000000000 +0100 @@ -8,7 +8,7 @@ #include <aws/common/common.h> #ifdef _WIN32 -/* NOTE: Do not use this macro before including Windows.h */ +/* NOTE: Do not use this macro before including windows.h */ # define AWSMUTEX_TO_WINDOWS(pMutex) (PSRWLOCK) & (pMutex)->mutex_handle #else # include <pthread.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/include/aws/common/rw_lock.h new/aws-c-common-0.9.13/include/aws/common/rw_lock.h --- old/aws-c-common-0.9.12/include/aws/common/rw_lock.h 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/include/aws/common/rw_lock.h 2024-02-13 19:09:29.000000000 +0100 @@ -8,7 +8,7 @@ #include <aws/common/common.h> #ifdef _WIN32 -/* NOTE: Do not use this macro before including Windows.h */ +/* NOTE: Do not use this macro before including windows.h */ # define AWSSRW_TO_WINDOWS(pCV) (PSRWLOCK) pCV #else # include <pthread.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/include/aws/testing/aws_test_harness.h new/aws-c-common-0.9.13/include/aws/testing/aws_test_harness.h --- old/aws-c-common-0.9.12/include/aws/testing/aws_test_harness.h 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/include/aws/testing/aws_test_harness.h 2024-02-13 19:09:29.000000000 +0100 @@ -42,6 +42,7 @@ /** Prints a message to AWS_TESTING_REPORT_FD using printf format that appends the function, file and line number. * If format is null, returns 0 without printing anything; otherwise returns 1. + * If function or file are null, the function, file and line number are not appended. */ static int s_cunit_failure_message0( const char *prefix, @@ -61,7 +62,11 @@ vfprintf(AWS_TESTING_REPORT_FD, format, ap); va_end(ap); - fprintf(AWS_TESTING_REPORT_FD, " [%s(): %s:%d]\n", function, file, line); + if (function && file) { + fprintf(AWS_TESTING_REPORT_FD, " [%s(): %s:%d]\n", function, file, line); + } else { + fprintf(AWS_TESTING_REPORT_FD, "\n"); + } return 1; } @@ -70,9 +75,6 @@ #define CUNIT_FAILURE_MESSAGE(func, file, line, format, ...) \ s_cunit_failure_message0(FAIL_PREFIX, func, file, line, format, #__VA_ARGS__) -static int total_failures; -static int total_skip; - #define SUCCESS (0) #define FAILURE (-1) /* The exit code returned to ctest to indicate the test is skipped. Refer to cmake doc: @@ -83,7 +85,6 @@ #define POSTSKIP_INTERNAL() \ do { \ - total_skip++; \ return SKIP; \ } while (0) @@ -106,9 +107,11 @@ #define PRINT_FAIL_INTERNAL0(...) \ s_cunit_failure_message0(FAIL_PREFIX, __func__, __FILE__, __LINE__, ##__VA_ARGS__, (const char *)NULL) +#define PRINT_FAIL_WITHOUT_LOCATION(...) \ + s_cunit_failure_message0(FAIL_PREFIX, NULL, NULL, __LINE__, ##__VA_ARGS__, (const char *)NULL) + #define POSTFAIL_INTERNAL() \ do { \ - total_failures++; \ return FAILURE; \ } while (0) @@ -478,7 +481,8 @@ const size_t leaked_bytes = aws_mem_tracer_bytes(allocator); if (leaked_bytes) { aws_mem_tracer_dump(allocator); - PRINT_FAIL_INTERNAL0("Test leaked memory: %zu bytes %zu allocations", leaked_bytes, leaked_allocations); + PRINT_FAIL_WITHOUT_LOCATION( + "Test leaked memory: %zu bytes %zu allocations", leaked_bytes, leaked_allocations); goto fail; } @@ -495,14 +499,21 @@ } fail: - FAIL("%s [ \033[31mFAILED\033[0m ]", harness->test_name); + PRINT_FAIL_WITHOUT_LOCATION("%s [ \033[31mFAILED\033[0m ]", harness->test_name); + /* Use _Exit() to terminate without cleaning up resources. + * This prevents LeakSanitizer spam (yes, we know failing tests don't bother cleaning up). + * It also prevents errors where threads that haven't cleaned are still using the logger declared in this fn. */ + fflush(AWS_TESTING_REPORT_FD); + fflush(stdout); + fflush(stderr); + _Exit(FAILURE); } /* Enables terminal escape sequences for text coloring on Windows. */ /* https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences */ #ifdef _WIN32 -# include <Windows.h> +# include <windows.h> # ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING # define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/allocator.c new/aws-c-common-0.9.13/source/allocator.c --- old/aws-c-common-0.9.12/source/allocator.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/allocator.c 2024-02-13 19:09:29.000000000 +0100 @@ -12,7 +12,7 @@ #include <stdlib.h> #ifdef _WIN32 -# include <Windows.h> +# include <windows.h> #endif #ifdef __MACH__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/arch/intel/cpuid.c new/aws-c-common-0.9.13/source/arch/intel/cpuid.c --- old/aws-c-common-0.9.12/source/arch/intel/cpuid.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/arch/intel/cpuid.c 2024-02-13 19:09:29.000000000 +0100 @@ -113,6 +113,18 @@ return true; } +static bool s_has_vpclmulqdq(void) { + uint32_t abcd[4]; + /* Check VPCLMULQDQ: + * CPUID.(EAX=07H, ECX=0H):ECX.VPCLMULQDQ[bit 20]==1 */ + uint32_t vpclmulqdq_mask = (1 << 20); + aws_run_cpuid(7, 0, abcd); + if ((abcd[2] & vpclmulqdq_mask) != vpclmulqdq_mask) { + return false; + } + return true; +} + has_feature_fn *s_check_cpu_feature[AWS_CPU_FEATURE_COUNT] = { [AWS_CPU_FEATURE_CLMUL] = s_has_clmul, [AWS_CPU_FEATURE_SSE_4_1] = s_has_sse41, @@ -120,6 +132,7 @@ [AWS_CPU_FEATURE_AVX2] = s_has_avx2, [AWS_CPU_FEATURE_AVX512] = s_has_avx512, [AWS_CPU_FEATURE_BMI2] = s_has_bmi2, + [AWS_CPU_FEATURE_VPCLMULQDQ] = s_has_vpclmulqdq, }; bool aws_cpu_has_feature(enum aws_cpu_feature_name feature_name) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/arch/intel/encoding_avx2.c new/aws-c-common-0.9.13/source/arch/intel/encoding_avx2.c --- old/aws-c-common-0.9.12/source/arch/intel/encoding_avx2.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/arch/intel/encoding_avx2.c 2024-02-13 19:09:29.000000000 +0100 @@ -179,7 +179,7 @@ * so we'll just copy right out of the vector as a fallback */ -#ifdef HAVE_MM256_EXTRACT_EPI64 +#ifdef AWS_HAVE_MM256_EXTRACT_EPI64 uint64_t hi = _mm256_extract_epi64(vec, 2); const uint64_t *p_hi = &hi; #else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/common.c new/aws-c-common-0.9.13/source/common.c --- old/aws-c-common-0.9.12/source/common.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/common.c 2024-02-13 19:09:29.000000000 +0100 @@ -14,7 +14,7 @@ #include <stdlib.h> #ifdef _WIN32 -# include <Windows.h> +# include <windows.h> #else # include <dlfcn.h> #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/external/cJSON.c new/aws-c-common-0.9.13/source/external/cJSON.c --- old/aws-c-common-0.9.12/source/external/cJSON.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/external/cJSON.c 2024-02-13 19:09:29.000000000 +0100 @@ -20,9 +20,16 @@ THE SOFTWARE. */ +/* + * This file has been modified from its original version by Amazon: + * (1) Remove cJSON_GetErrorPtr and global_error as they are not thread-safe. + * (2) Add NOLINTBEGIN/NOLINTEND so clang-tidy ignores file. + * (3) Replace sprintf() with snprintf() to make compilers happier. + */ +/* NOLINTBEGIN */ + /* cJSON */ /* JSON parser in C. */ -/* NOLINTBEGIN */ /* disable warnings about old C89 functions in MSVC */ #if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) @@ -57,7 +64,7 @@ #pragma GCC visibility pop #endif -#include <aws/common/external/cJSON.h> +#include "cJSON.h" /* define our own boolean type */ #ifdef true @@ -90,6 +97,14 @@ const unsigned char *json; size_t position; } error; +#if 0 /* Amazon edit */ +static error global_error = { NULL, 0 }; + +CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void) +{ + return (const char*) (global_error.json + global_error.position); +} +#endif /* Amazon edit */ CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item) { @@ -112,14 +127,14 @@ } /* 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 != 16) +#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 17) #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. #endif CJSON_PUBLIC(const char*) cJSON_Version(void) { static char version[15]; - snprintf(version, sizeof(version) / sizeof(char), "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); + snprintf(version, sizeof(version), "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); /* Amazon edit */ return version; } @@ -396,7 +411,12 @@ { char *copy = NULL; /* if object's type is not cJSON_String or is cJSON_IsReference, it should not set valuestring */ - if (!(object->type & cJSON_String) || (object->type & cJSON_IsReference)) + if ((object == NULL) || !(object->type & cJSON_String) || (object->type & cJSON_IsReference)) + { + return NULL; + } + /* return NULL if the object is corrupted */ + if (object->valuestring == NULL) { return NULL; } @@ -555,22 +575,22 @@ /* This checks for NaN and Infinity */ if (isnan(d) || isinf(d)) { - length = snprintf((char*)number_buffer, sizeof(number_buffer) / sizeof(char), "null"); - } - else if (d == (double)item->valueint) - { - length = snprintf((char*)number_buffer, sizeof(number_buffer) / sizeof(char), "%d", item->valueint); + length = snprintf((char*)number_buffer, sizeof(number_buffer), "null"); /* Amazon edit */ } + else if(d == (double)item->valueint) + { + length = snprintf((char*)number_buffer, sizeof(number_buffer), "%d", item->valueint); /* Amazon edit */ + } else { /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */ - length = snprintf((char*)number_buffer, sizeof(number_buffer) / sizeof(char), "%1.15g", d); + length = snprintf((char*)number_buffer, sizeof(number_buffer), "%1.15g", d); /* Amazon edit */ /* Check whether the original double can be recovered */ if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || !compare_double((double)test, d)) { /* If not, print with 17 decimal places of precision */ - length = snprintf((char*)number_buffer, sizeof(number_buffer) / sizeof(char), "%1.17g", d); + length = snprintf((char*)number_buffer, sizeof(number_buffer), "%1.17g", d); /* Amazon edit */ } } @@ -1003,7 +1023,7 @@ break; default: /* escape and print as unicode codepoint */ - snprintf((char*)output_pointer, 6 * sizeof(char), "u%04x", *input_pointer); + snprintf((char*)output_pointer, 6, "u%04x", *input_pointer); /* Amazon edit */ output_pointer += 4; break; } @@ -1092,6 +1112,12 @@ parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } }; cJSON *item = NULL; +#if 0 /* Amazon edit */ + /* reset error position */ + global_error.json = NULL; + global_error.position = 0; +#endif /* Amazon edit */ + if (value == NULL || 0 == buffer_length) { goto fail; @@ -1155,6 +1181,10 @@ { *return_parse_end = (const char*)local_error.json + local_error.position; } + +#if 0 /* Amazon edit */ + global_error = local_error; +#endif /* Amazon edit */ } return NULL; @@ -1982,14 +2012,11 @@ } #if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) - #pragma GCC diagnostic push + #pragma GCC diagnostic push #endif #ifdef __GNUC__ - #if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 1))) - #pragma GCC diagnostic ignored "-Wcast-qual" - #endif +#pragma GCC diagnostic ignored "-Wcast-qual" #endif - /* helper function to cast away const */ static void* cast_away_const(const void* string) { @@ -2256,7 +2283,7 @@ { cJSON *after_inserted = NULL; - if (which < 0) + if (which < 0 || newitem == NULL) { return false; } @@ -2267,6 +2294,11 @@ return add_item_to_array(array, newitem); } + if (after_inserted != array->child && after_inserted->prev == NULL) { + /* return false if after_inserted is a corrupted array item */ + return false; + } + newitem->next = after_inserted; newitem->prev = after_inserted->prev; after_inserted->prev = newitem; @@ -3109,4 +3141,5 @@ { global_hooks.deallocate(object); } +/* Amazon edit */ /* NOLINTEND */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/external/cJSON.h new/aws-c-common-0.9.13/source/external/cJSON.h --- old/aws-c-common-0.9.12/source/external/cJSON.h 1970-01-01 01:00:00.000000000 +0100 +++ new/aws-c-common-0.9.13/source/external/cJSON.h 2024-02-13 19:09:29.000000000 +0100 @@ -0,0 +1,310 @@ +/* + Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +/* + * This file has been modified from its original version by Amazon: + * (1) Remove cJSON_GetErrorPtr and global_error as they are not thread-safe. + * (2) Add NOLINTBEGIN/NOLINTEND so clang-tidy ignores file. + */ +/* NOLINTBEGIN */ + +#ifndef cJSON__h +#define cJSON__h + +#ifdef __cplusplus +extern "C" +{ +#endif + +#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) +#define __WINDOWS__ +#endif + +#ifdef __WINDOWS__ + +/* 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 3 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 + +For *nix builds that support visibility attribute, you can define similar behavior by + +setting default visibility to hidden by adding +-fvisibility=hidden (for gcc) +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 + +*/ + +#define CJSON_CDECL __cdecl +#define CJSON_STDCALL __stdcall + +/* 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 +#endif + +#if defined(CJSON_HIDE_SYMBOLS) +#define CJSON_PUBLIC(type) type CJSON_STDCALL +#elif defined(CJSON_EXPORT_SYMBOLS) +#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL +#elif defined(CJSON_IMPORT_SYMBOLS) +#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL +#endif +#else /* !__WINDOWS__ */ +#define CJSON_CDECL +#define CJSON_STDCALL + +#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY) +#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type +#else +#define CJSON_PUBLIC(type) type +#endif +#endif + +/* project version */ +#define CJSON_VERSION_MAJOR 1 +#define CJSON_VERSION_MINOR 7 +#define CJSON_VERSION_PATCH 17 + +#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 + +/* The cJSON structure: */ +typedef struct cJSON +{ + /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ + struct cJSON *next; + struct cJSON *prev; + /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ + struct cJSON *child; + + /* The type of the item, as above. */ + int type; + + /* The item's string, if type==cJSON_String and type == cJSON_Raw */ + char *valuestring; + /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */ + int valueint; + /* The item's number, if type==cJSON_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 +{ + /* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */ + void *(CJSON_CDECL *malloc_fn)(size_t sz); + void (CJSON_CDECL *free_fn)(void *ptr); +} cJSON_Hooks; + +typedef int cJSON_bool; + +/* 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 +#endif + +/* returns the version of cJSON as a string */ +CJSON_PUBLIC(const char*) cJSON_Version(void); + +/* Supply malloc, realloc and free functions to cJSON */ +CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_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. */ +/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ +CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value); +CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length); +/* 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); +CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated); + +/* Render a cJSON entity to text for transfer/storage. */ +CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); +/* Render a cJSON entity to text for transfer/storage without any formatting. */ +CJSON_PUBLIC(char *) cJSON_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); +/* 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); +/* Delete a cJSON entity and all subentities. */ +CJSON_PUBLIC(void) cJSON_Delete(cJSON *item); + +/* Returns the number of items in an array (or object). */ +CJSON_PUBLIC(int) cJSON_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); +/* 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); +#if 0 /* Amazon edit */ +/* 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); +#endif /* Amazon edit */ + +/* Check item type and return its value */ +CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item); +CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const 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); + +/* 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_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); + +/* 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); +/* Create an object/array 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); + +/* These utilities create an Array of count items. + * The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/ +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 *const *strings, int count); + +/* Append item to the specified array/object. */ +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); +CJSON_PUBLIC(cJSON_bool) cJSON_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 + * writing to `item->string` */ +CJSON_PUBLIC(cJSON_bool) cJSON_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(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); +CJSON_PUBLIC(cJSON_bool) cJSON_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); + +/* Update array items. */ +CJSON_PUBLIC(cJSON_bool) 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(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); + +/* Duplicate a cJSON item */ +CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_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); + +/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings. + * The input pointer json cannot point to a read-only address area, such as a string constant, + * but should point to a readable and writable address area. */ +CJSON_PUBLIC(void) cJSON_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); + +/* 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)) +/* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */ +CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring); + +/* If the object is not a boolean type this does nothing and returns cJSON_Invalid else it returns the new type*/ +#define cJSON_SetBoolValue(object, boolValue) ( \ + (object != NULL && ((object)->type & (cJSON_False|cJSON_True))) ? \ + (object)->type=((object)->type &(~(cJSON_False|cJSON_True)))|((boolValue)?cJSON_True:cJSON_False) : \ + cJSON_Invalid\ +) + +/* 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) + +/* 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); + +#ifdef __cplusplus +} +#endif +/* Amazon edit */ +/* NOLINTEND */ +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/json.c new/aws-c-common-0.9.13/source/json.c --- old/aws-c-common-0.9.12/source/json.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/json.c 2024-02-13 19:09:29.000000000 +0100 @@ -9,7 +9,7 @@ #include <aws/common/json.h> #include <aws/common/private/json_impl.h> -#include <aws/common/external/cJSON.h> +#include "external/cJSON.h" static struct aws_allocator *s_aws_json_module_allocator = NULL; static bool s_aws_json_module_initialized = false; @@ -397,7 +397,7 @@ char *tmp = cJSON_PrintUnformatted(cjson); if (tmp == NULL) { - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } // Append the text to the byte buffer @@ -415,7 +415,7 @@ char *tmp = cJSON_Print(cjson); if (tmp == NULL) { - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } // Append the text to the byte buffer diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/log_formatter.c new/aws-c-common-0.9.13/source/log_formatter.c --- old/aws-c-common-0.9.12/source/log_formatter.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/log_formatter.c 2024-02-13 19:09:29.000000000 +0100 @@ -205,7 +205,7 @@ struct aws_default_log_formatter_impl *impl = formatter->impl; if (formatted_output == NULL) { - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/logging.c new/aws-c-common-0.9.13/source/logging.c --- old/aws-c-common-0.9.12/source/logging.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/logging.c 2024-02-13 19:09:29.000000000 +0100 @@ -337,11 +337,11 @@ unsigned char c = bytes[i - 1]; int written = snprintf(buffer + current_index, bufsz - current_index, "%02x", c); if (written < 0) { - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); } current_index += written; if (bufsz <= current_index) { - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_SHORT_BUFFER); } } return AWS_OP_SUCCESS; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/windows/clock.c new/aws-c-common-0.9.13/source/windows/clock.c --- old/aws-c-common-0.9.12/source/windows/clock.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/windows/clock.c 2024-02-13 19:09:29.000000000 +0100 @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0. */ -#include <Windows.h> #include <aws/common/clock.h> +#include <windows.h> static const uint64_t FILE_TIME_TO_NS = 100; static const uint64_t EC_TO_UNIX_EPOCH = 11644473600LL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/windows/condition_variable.c new/aws-c-common-0.9.13/source/windows/condition_variable.c --- old/aws-c-common-0.9.12/source/windows/condition_variable.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/windows/condition_variable.c 2024-02-13 19:09:29.000000000 +0100 @@ -8,7 +8,7 @@ #include <aws/common/clock.h> #include <aws/common/mutex.h> -#include <Windows.h> +#include <windows.h> #define AWSCV_TO_WINDOWS(pCV) (PCONDITION_VARIABLE) & (pCV)->condition_handle diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/windows/device_random.c new/aws-c-common-0.9.13/source/windows/device_random.c --- old/aws-c-common-0.9.12/source/windows/device_random.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/windows/device_random.c 2024-02-13 19:09:29.000000000 +0100 @@ -7,7 +7,8 @@ #include <aws/common/byte_buf.h> #include <aws/common/thread.h> -#include <Windows.h> +#include <windows.h> + #include <bcrypt.h> static BCRYPT_ALG_HANDLE s_alg_handle = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/windows/file.c new/aws-c-common-0.9.13/source/windows/file.c --- old/aws-c-common-0.9.12/source/windows/file.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/windows/file.c 2024-02-13 19:09:29.000000000 +0100 @@ -8,9 +8,9 @@ #include <aws/common/logging.h> #include <aws/common/string.h> -#include <Shlwapi.h> #include <errno.h> #include <io.h> +#include <shlwapi.h> #include <stdio.h> #include <windows.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/windows/mutex.c new/aws-c-common-0.9.13/source/windows/mutex.c --- old/aws-c-common-0.9.12/source/windows/mutex.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/windows/mutex.c 2024-02-13 19:09:29.000000000 +0100 @@ -6,7 +6,7 @@ #include <aws/common/mutex.h> #include <aws/common/thread.h> -#include <Windows.h> +#include <windows.h> /* Convert a string from a macro to a wide string */ #define WIDEN2(s) L## #s diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/windows/rw_lock.c new/aws-c-common-0.9.13/source/windows/rw_lock.c --- old/aws-c-common-0.9.12/source/windows/rw_lock.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/windows/rw_lock.c 2024-02-13 19:09:29.000000000 +0100 @@ -6,7 +6,8 @@ #include <aws/common/rw_lock.h> #include <aws/common/thread.h> -#include <Windows.h> +#include <windows.h> + #include <synchapi.h> /* Convert a string from a macro to a wide string */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/source/windows/thread.c new/aws-c-common-0.9.13/source/windows/thread.c --- old/aws-c-common-0.9.12/source/windows/thread.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/source/windows/thread.c 2024-02-13 19:09:29.000000000 +0100 @@ -10,7 +10,7 @@ #include <aws/common/private/thread_shared.h> #include <aws/common/string.h> -#include <Windows.h> +#include <windows.h> #include <inttypes.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/tests/CMakeLists.txt new/aws-c-common-0.9.13/tests/CMakeLists.txt --- old/aws-c-common-0.9.12/tests/CMakeLists.txt 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/tests/CMakeLists.txt 2024-02-13 19:09:29.000000000 +0100 @@ -295,7 +295,7 @@ add_test_case(byte_swap_test) -if(HAVE_AVX2_INTRINSICS) +if(AWS_HAVE_AVX2_INTRINSICS) add_test_case(alignment32_test) else() add_test_case(alignment16_test) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-c-common-0.9.12/tests/encoding_test.c new/aws-c-common-0.9.13/tests/encoding_test.c --- old/aws-c-common-0.9.12/tests/encoding_test.c 2023-12-30 01:12:05.000000000 +0100 +++ new/aws-c-common-0.9.13/tests/encoding_test.c 2024-02-13 19:09:29.000000000 +0100 @@ -1298,7 +1298,7 @@ static int s_utf8_validation_callback_always_passes(const uint32_t codepoint, void *user_data) { (void)codepoint; (void)user_data; - return AWS_ERROR_SUCCESS; + return AWS_OP_SUCCESS; } static struct utf8_example s_valid_utf8_examples_for_callback[] = {
