GeezerVison is showing github.com — deps: update zstd to 1.6.0 · nodejs/node@e14f5ef
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: deps/zstd/lib/BUCK +10-5Lines changed: 10 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,7 +32,6 @@ cxx_library( | 32 | 32 | srcs=glob(['decompress/zstd*.c']), | 33 | 33 | deps=[ | 34 | 34 | ':common', | 35 | | - ':legacy', | 36 | 35 | ], | 37 | 36 | ) | 38 | 37 |
| @@ -47,6 +46,14 @@ cxx_library( | 47 | 46 | deps=[':common'], | 48 | 47 | ) | 49 | 48 |
| | 49 | +# Decoders for formats older than v0.8. Not a dependency of :decompress, | | 50 | +# because ZSTD_LEGACY_SUPPORT is 0 (see .buckconfig), which makes them | | 51 | +# unreachable. | | 52 | +# Enabling legacy formats means two edits, which only make sense together : | | 53 | +# raise the level in .buckconfig, AND add ':legacy' to :decompress deps. | | 54 | +# Raising the level alone fails to link, which is easy to notice. Adding the | | 55 | +# dep alone is silent : these decoders get compiled back in, while | | 56 | +# ZSTD_isLegacy() remains compiled out, so legacy frames are still rejected. | 50 | 57 | cxx_library( | 51 | 58 | name='legacy', | 52 | 59 | header_namespace='', | @@ -56,9 +63,6 @@ cxx_library( | 56 | 63 | ]), | 57 | 64 | srcs=glob(['legacy/*.c']), | 58 | 65 | deps=[':common'], | 59 | | - exported_preprocessor_flags=[ | 60 | | - '-DZSTD_LEGACY_SUPPORT=4', | 61 | | - ], | 62 | 66 | ) | 63 | 67 |
| 64 | 68 | cxx_library( | @@ -79,6 +83,7 @@ cxx_library( | 79 | 83 | header_namespace='', | 80 | 84 | visibility=['PUBLIC'], | 81 | 85 | exported_headers=subdir_glob([ | | 86 | + ('common', 'bmi2.h'), | 82 | 87 | ('common', 'compiler.h'), | 83 | 88 | ]), | 84 | 89 | ) | @@ -132,7 +137,7 @@ cxx_library( | 132 | 137 | exported_headers=[ | 133 | 138 | 'zstd_errors.h', | 134 | 139 | 'common/error_private.h', | 135 | | - ] | | 140 | + ], | 136 | 141 | srcs=['common/error_private.c'], | 137 | 142 | ) | 138 | 143 |
| |
Collapse file Copy file name to clipboardExpand all lines: deps/zstd/lib/Makefile +9-9Lines changed: 9 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -128,7 +128,7 @@ $(ZSTD_STATICLIB): $(ZSTD_STATICLIB_OBJ) | 128 | 128 | $(AR) $(ARFLAGS) $@ $^ | 129 | 129 |
| 130 | 130 | libzstd.a: $(ZSTD_STATICLIB) | 131 | | - cp -f $< $@ | | 131 | + $(CP) $< $@ | 132 | 132 |
| 133 | 133 | endif | 134 | 134 |
| @@ -166,13 +166,13 @@ $(ZSTD_DYNLIB): $(ZSTD_DYNLIB_OBJ) | 166 | 166 | $(if $(filter -DZSTD_MULTITHREAD,$(CPPFLAGS)),\ | 167 | 167 | @echo compiling multi-threaded dynamic library $(LIBVER),\ | 168 | 168 | @echo compiling single-threaded dynamic library $(LIBVER)) | 169 | | - $(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@ | | 169 | + $(CC) $(FLAGS) $^ $(SONAME_FLAGS) -o $@ | 170 | 170 | @echo creating versioned links | 171 | | - ln -sf $@ libzstd.$(SHARED_EXT_MAJOR) | 172 | | - ln -sf $@ libzstd.$(SHARED_EXT) | | 171 | + $(LN) -sf $@ libzstd.$(SHARED_EXT_MAJOR) | | 172 | + $(LN) -sf $@ libzstd.$(SHARED_EXT) | 173 | 173 |
| 174 | 174 | $(LIBZSTD): $(ZSTD_DYNLIB) | 175 | | - cp -f $< $@ | | 175 | + $(CP) $< $@ | 176 | 176 |
| 177 | 177 | endif # ifndef BUILD_DIR | 178 | 178 | endif # if windows | @@ -255,7 +255,7 @@ libzstd-nomt: $(ZSTD_NOMT_FILES) | 255 | 255 | echo "Error: Found zstdmt in list."; \ | 256 | 256 | exit 1; \ | 257 | 257 | fi | 258 | | - $(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@ | | 258 | + $(CC) $(FLAGS) $^ $(SONAME_FLAGS) -o $@ | 259 | 259 |
| 260 | 260 | .PHONY: clean | 261 | 261 | clean: | @@ -268,7 +268,7 @@ clean: | 268 | 268 | #----------------------------------------------------------------------------- | 269 | 269 | # make install is validated only for below listed environments | 270 | 270 | #----------------------------------------------------------------------------- | 271 | | -ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX MSYS_NT% CYGWIN_NT%,$(UNAME))) | | 271 | +ifneq (,$(filter $(INSTALL_OS_LIST),$(UNAME))) | 272 | 272 |
| 273 | 273 | lib: libzstd.pc | 274 | 274 |
| @@ -363,8 +363,8 @@ install-shared: | 363 | 363 | [ -e $(DESTDIR)$(LIBDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/ | 364 | 364 | @echo Installing shared library | 365 | 365 | $(INSTALL_PROGRAM) $(LIBZSTD) $(DESTDIR)$(LIBDIR) | 366 | | - ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR) | 367 | | - ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT) | | 366 | + $(LN) -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR) | | 367 | + $(LN) -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT) | 368 | 368 |
| 369 | 369 | .PHONY: install-includes | 370 | 370 | install-includes: | |
Collapse file Copy file name to clipboardExpand all lines: deps/zstd/lib/README.md +25-5Lines changed: 25 additions & 5 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -7,15 +7,30 @@ in order to make it easier to select or exclude features. | 7 | 7 |
| 8 | 8 | #### Building | 9 | 9 |
| 10 | | -`Makefile` script is provided, supporting [Makefile conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html#Makefile-Conventions), | | 10 | +A `Makefile` script is provided, supporting [Makefile conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html#Makefile-Conventions), | 11 | 11 | including commands variables, staged install, directory variables and standard targets. | 12 | 12 | - `make` : generates both static and dynamic libraries | 13 | | -- `make install` : install libraries and headers in target system directories | | 13 | +- `make install` : install libraries, headers and pkg-config in local system directories | 14 | 14 |
| 15 | | -`libzstd` default scope is pretty large, including compression, decompression, dictionary builder, | 16 | | -and support for decoding legacy formats >= v0.5.0. | | 15 | +`libzstd` default scope includes compression, decompression, and dictionary builder. | | 16 | +Note: starting v1.6.0, support for decoding legacy formats is disabled by default. | | 17 | +See _modular build_ below to learn how to enable it. | 17 | 18 | The scope can be reduced on demand (see paragraph _modular build_). | 18 | 19 |
| | 20 | +#### Multiarch Support | | 21 | + | | 22 | +For multiarch systems (like Debian/Ubuntu), libraries should be installed to architecture-specific directories. | | 23 | +When creating packages for such systems, use the `LIBDIR` variable to specify the correct multiarch path: | | 24 | + | | 25 | +```bash | | 26 | +# For x86_64 systems on Ubuntu/Debian: | | 27 | +make install PREFIX=/usr LIBDIR=/usr/lib/x86_64-linux-gnu | | 28 | + | | 29 | +# For ARM64 systems on Ubuntu/Debian: | | 30 | +make install PREFIX=/usr LIBDIR=/usr/lib/aarch64-linux-gnu | | 31 | +``` | | 32 | + | | 33 | +This will not only install the files in the correct directories, but also generate the correct paths for `pkg-config`. | 19 | 34 |
| 20 | 35 | #### Multithreading support | 21 | 36 |
| @@ -85,7 +100,7 @@ The file structure is designed to make this selection manually achievable for an | 85 | 100 | Specifying a number limits versions supported to that version onward. | 86 | 101 | For example, `ZSTD_LEGACY_SUPPORT=2` means : "support legacy formats >= v0.2.0". | 87 | 102 | Conversely, `ZSTD_LEGACY_SUPPORT=0` means "do __not__ support legacy formats". | 88 | | - By default, this build macro is set as `ZSTD_LEGACY_SUPPORT=5`. | | 103 | + By default, this build macro is set as `ZSTD_LEGACY_SUPPORT=0` (disabled). | 89 | 104 | Decoding supported legacy format is a transparent capability triggered within decompression functions. | 90 | 105 | It's also allowed to invoke legacy API directly, exposed in `lib/legacy/zstd_legacy.h`. | 91 | 106 | Each version does also provide its own set of advanced API. | @@ -193,6 +208,11 @@ The file structure is designed to make this selection manually achievable for an | 193 | 208 | and assembly decoding loops. You may want to use this macro if these loops are | 194 | 209 | slower on your platform. | 195 | 210 |
| | 211 | +- The macro `ZDICT_QSORT` can enforce selection of a specific sorting variant, | | 212 | + which is useful when autodetection fails, for example with older versions of `musl`. | | 213 | + For this scenario, it can be set as `ZDICT_QSORT=ZDICT_QSORT_C90`. | | 214 | + Other selectable suffixes are `_GNU`, `_APPLE`, `_MSVC` and `_C11`. | | 215 | + | 196 | 216 | #### Windows : using MinGW+MSYS to create DLL | 197 | 217 |
| 198 | 218 | DLL can be created using MinGW+MSYS with the `make libzstd` command. | |
Collapse file Copy file name to clipboardExpand all lines: deps/zstd/lib/common/allocations.h +6-2Lines changed: 6 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -33,9 +33,13 @@ MEM_STATIC void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem) | 33 | 33 | MEM_STATIC void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem) | 34 | 34 | { | 35 | 35 | if (customMem.customAlloc) { | 36 | | - /* calloc implemented as malloc+memset; | 37 | | - * not as efficient as calloc, but next best guess for custom malloc */ | | 36 | + /* calloc implemented as malloc+memset */ | 38 | 37 | void* const ptr = customMem.customAlloc(customMem.opaque, size); | | 38 | + | | 39 | + if (ptr == NULL) { | | 40 | + return NULL; | | 41 | + } | | 42 | + | 39 | 43 | ZSTD_memset(ptr, 0, size); | 40 | 44 | return ptr; | 41 | 45 | } | |
Collapse file Copy file name to clipboardExpand all lines: deps/zstd/lib/common/bits.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -21,7 +21,7 @@ MEM_STATIC unsigned ZSTD_countTrailingZeros32_fallback(U32 val) | 21 | 21 | 30, 22, 20, 15, 25, 17, 4, 8, | 22 | 22 | 31, 27, 13, 23, 21, 19, 16, 7, | 23 | 23 | 26, 12, 18, 6, 11, 5, 10, 9}; | 24 | | - return DeBruijnBytePos[((U32) ((val & -(S32) val) * 0x077CB531U)) >> 27]; | | 24 | + return DeBruijnBytePos[((U32) ((val & (0-val)) * 0x077CB531U)) >> 27]; | 25 | 25 | } | 26 | 26 | } | 27 | 27 |
| |
Collapse file Copy file name to clipboardExpand all lines: deps/zstd/lib/common/bitstream.h +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -102,8 +102,8 @@ typedef enum { BIT_DStream_unfinished = 0, /* fully refilled */ | 102 | 102 | } BIT_DStream_status; /* result of BIT_reloadDStream() */ | 103 | 103 |
| 104 | 104 | MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, size_t srcSize); | 105 | | -MEM_STATIC BitContainerType BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits); | 106 | | -MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD); | | 105 | +FORCE_INLINE_TEMPLATE BitContainerType BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits); | | 106 | +FORCE_INLINE_TEMPLATE BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD); | 107 | 107 | MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* bitD); | 108 | 108 |
| 109 | 109 |
| @@ -432,7 +432,7 @@ FORCE_INLINE_TEMPLATE BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD) | 432 | 432 | /* start < ptr < limitPtr => cautious update */ | 433 | 433 | { U32 nbBytes = bitD->bitsConsumed >> 3; | 434 | 434 | BIT_DStream_status result = BIT_DStream_unfinished; | 435 | | - if (bitD->ptr - nbBytes < bitD->start) { | | 435 | + if (nbBytes > (size_t)(bitD->ptr - bitD->start)) { | 436 | 436 | nbBytes = (U32)(bitD->ptr - bitD->start); /* ptr > start */ | 437 | 437 | result = BIT_DStream_endOfBuffer; | 438 | 438 | } | |
Collapse file Copy file name to clipboard +40Lines changed: 40 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +/* | | 2 | + * Copyright (c) Meta Platforms, Inc. and affiliates. | | 3 | + * All rights reserved. | | 4 | + * | | 5 | + * This source code is licensed under both the BSD-style license (found in the | | 6 | + * LICENSE file in the root directory of this source tree) and the GPLv2 (found | | 7 | + * in the COPYING file in the root directory of this source tree). | | 8 | + * You may select, at your option, one of the above-listed licenses. | | 9 | + */ | | 10 | + | | 11 | +#ifndef ZSTD_BMI2_H | | 12 | +#define ZSTD_BMI2_H | | 13 | + | | 14 | +#include "portability_macros.h" | | 15 | + | | 16 | +#if defined(ZSTD_USE_KERNEL_CPU_FEATURES) | | 17 | +# include <asm/cpufeature.h> | | 18 | +#endif | | 19 | + | | 20 | +/* | | 21 | + * Select between the BMI2 and default implementations at the final dispatch | | 22 | + * site. Integrations may ignore the caller-provided hint and consult their own | | 23 | + * CPU-feature policy instead. | | 24 | + * | | 25 | + * ZSTD_USE_BMI2() may not evaluate its argument. ZSTD_SET_BMI2() may not | | 26 | + * evaluate its value argument, which avoids executing the userspace CPUID | | 27 | + * probe when the integration supplies the dispatch decision. | | 28 | + */ | | 29 | +#if !DYNAMIC_BMI2 | | 30 | +# define ZSTD_USE_BMI2(bmi2) 0 | | 31 | +# define ZSTD_SET_BMI2(state, value) do { } while (0) | | 32 | +#elif defined(ZSTD_USE_KERNEL_CPU_FEATURES) | | 33 | +# define ZSTD_USE_BMI2(bmi2) cpu_feature_enabled(X86_FEATURE_BMI2) | | 34 | +# define ZSTD_SET_BMI2(state, value) do { (state) = 0; } while (0) | | 35 | +#else | | 36 | +# define ZSTD_USE_BMI2(bmi2) (bmi2) | | 37 | +# define ZSTD_SET_BMI2(state, value) do { (state) = (value); } while (0) | | 38 | +#endif | | 39 | + | | 40 | +#endif /* ZSTD_BMI2_H */ |
Collapse file Copy file name to clipboardExpand all lines: deps/zstd/lib/common/compiler.h +37-11Lines changed: 37 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 54 | 54 | #endif | 55 | 55 |
| 56 | 56 | /* UNUSED_ATTR tells the compiler it is okay if the function is unused. */ | 57 | | -#if defined(__GNUC__) || defined(__IAR_SYSTEMS_ICC__) | | 57 | +#if defined(__GNUC__) || defined(__clang__) || defined(__IAR_SYSTEMS_ICC__) /* clang-cl defines __clang__ but not __GNUC__ */ | 58 | 58 | # define UNUSED_ATTR __attribute__((unused)) | 59 | 59 | #else | 60 | 60 | # define UNUSED_ATTR | | 98 | 98 | #elif defined(__IAR_SYSTEMS_ICC__) | 99 | 99 | # define MEM_STATIC static inline UNUSED_ATTR | 100 | 100 | #elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) | 101 | | -# define MEM_STATIC static inline | | 101 | +# define MEM_STATIC static inline UNUSED_ATTR | 102 | 102 | #elif defined(_MSC_VER) | 103 | | -# define MEM_STATIC static __inline | | 103 | +# define MEM_STATIC static __inline UNUSED_ATTR | 104 | 104 | #else | 105 | 105 | # define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ | 106 | 106 | #endif | | 132 | 132 | #define BMI2_TARGET_ATTRIBUTE TARGET_ATTRIBUTE("lzcnt,bmi,bmi2") | 133 | 133 |
| 134 | 134 | /* prefetch | | 135 | + * PREFETCH_L1(ptr) / PREFETCH_L2(ptr) take a `const void*`. | | 136 | + * `ptr` is only used as an address hint: it may point anywhere, | | 137 | + * including invalid or out-of-bounds memory, and is never accessed. | | 138 | + * Each variant below must therefore accept a `const void*` argument. | 135 | 139 | * can be disabled, by declaring NO_PREFETCH build macro */ | 136 | 140 | #if defined(NO_PREFETCH) | 137 | 141 | # define PREFETCH_L1(ptr) do { (void)(ptr); } while (0) /* disabled */ | | 145 | 149 | # define PREFETCH_L1(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */) | 146 | 150 | # define PREFETCH_L2(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */) | 147 | 151 | # elif defined(__aarch64__) | 148 | | -# define PREFETCH_L1(ptr) do { __asm__ __volatile__("prfm pldl1keep, %0" ::"Q"(*(ptr))); } while (0) | 149 | | -# define PREFETCH_L2(ptr) do { __asm__ __volatile__("prfm pldl2keep, %0" ::"Q"(*(ptr))); } while (0) | | 152 | + /* The "Q" operand needs an lvalue, so cast to `const char*` before | | 153 | + * dereferencing: dereferencing a `const void*` is ill-formed in C | | 154 | + * (-Wvoid-ptr-dereference). The `prfm` instruction is only a hint and | | 155 | + * never faults, whatever the address. */ | | 156 | +# define PREFETCH_L1(ptr) do { __asm__ __volatile__("prfm pldl1keep, %0" ::"Q"(*(const char*)(ptr))); } while (0) | | 157 | +# define PREFETCH_L2(ptr) do { __asm__ __volatile__("prfm pldl2keep, %0" ::"Q"(*(const char*)(ptr))); } while (0) | 150 | 158 | # else | 151 | 159 | # define PREFETCH_L1(ptr) do { (void)(ptr); } while (0) /* disabled */ | 152 | 160 | # define PREFETCH_L2(ptr) do { (void)(ptr); } while (0) /* disabled */ | | 218 | 226 | # if defined(__ARM_NEON) || defined(_M_ARM64) | 219 | 227 | # define ZSTD_ARCH_ARM_NEON | 220 | 228 | # endif | | 229 | +# if defined(__ARM_FEATURE_SVE) | | 230 | +# define ZSTD_ARCH_ARM_SVE | | 231 | +# endif | | 232 | +# if defined(__ARM_FEATURE_SVE2) | | 233 | +# define ZSTD_ARCH_ARM_SVE2 | | 234 | +# endif | | 235 | +# if defined(__riscv) && defined(__riscv_vector) | | 236 | +# if ((defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 14) || \ | | 237 | + (defined(__clang__) && __clang_major__ >= 19)) | | 238 | + #define ZSTD_ARCH_RISCV_RVV | | 239 | +# endif | | 240 | +#endif | 221 | 241 | # | 222 | 242 | # if defined(ZSTD_ARCH_X86_AVX2) | 223 | 243 | # include <immintrin.h> | | 227 | 247 | # elif defined(ZSTD_ARCH_ARM_NEON) | 228 | 248 | # include <arm_neon.h> | 229 | 249 | # endif | | 250 | +# if defined(ZSTD_ARCH_ARM_SVE) || defined(ZSTD_ARCH_ARM_SVE2) | | 251 | +# include <arm_sve.h> | | 252 | +# endif | | 253 | +# if defined(ZSTD_ARCH_RISCV_RVV) | | 254 | +# include <riscv_vector.h> | | 255 | +# endif | 230 | 256 | #endif | 231 | 257 |
| 232 | 258 | /* C-language Attributes are added in C23. */ | @@ -357,9 +383,9 @@ ptrdiff_t ZSTD_wrappedPtrDiff(unsigned char const* lhs, unsigned char const* rhs | 357 | 383 | */ | 358 | 384 | MEM_STATIC | 359 | 385 | ZSTD_ALLOW_POINTER_OVERFLOW_ATTR | 360 | | -unsigned char const* ZSTD_wrappedPtrAdd(unsigned char const* ptr, ptrdiff_t add) | | 386 | +const void* ZSTD_wrappedPtrAdd(const void* ptr, ptrdiff_t add) | 361 | 387 | { | 362 | | - return ptr + add; | | 388 | + return (const char*)ptr + add; | 363 | 389 | } | 364 | 390 |
| 365 | 391 | /** | @@ -370,9 +396,9 @@ unsigned char const* ZSTD_wrappedPtrAdd(unsigned char const* ptr, ptrdiff_t add) | 370 | 396 | */ | 371 | 397 | MEM_STATIC | 372 | 398 | ZSTD_ALLOW_POINTER_OVERFLOW_ATTR | 373 | | -unsigned char const* ZSTD_wrappedPtrSub(unsigned char const* ptr, ptrdiff_t sub) | | 399 | +const void* ZSTD_wrappedPtrSub(const void* ptr, ptrdiff_t sub) | 374 | 400 | { | 375 | | - return ptr - sub; | | 401 | + return (const char*)ptr - sub; | 376 | 402 | } | 377 | 403 |
| 378 | 404 | /** | @@ -382,9 +408,9 @@ unsigned char const* ZSTD_wrappedPtrSub(unsigned char const* ptr, ptrdiff_t sub) | 382 | 408 | * @returns `ptr + add` except it defines `NULL + 0 == NULL`. | 383 | 409 | */ | 384 | 410 | MEM_STATIC | 385 | | -unsigned char* ZSTD_maybeNullPtrAdd(unsigned char* ptr, ptrdiff_t add) | | 411 | +void* ZSTD_maybeNullPtrAdd(void* ptr, ptrdiff_t add) | 386 | 412 | { | 387 | | - return add > 0 ? ptr + add : ptr; | | 413 | + return add > 0 ? (char*)ptr + add : ptr; | 388 | 414 | } | 389 | 415 |
| 390 | 416 | /* Issue #3240 reports an ASAN failure on an llvm-mingw build. Out of an | |
|