From acfd93d0a703bc93898d836f7f116fb082f2d753 Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Sun, 19 Feb 2023 15:33:57 -0800 Subject: [PATCH] zstd: add cast to some `ZSTD_memcpy()` Visual Studio 2019 isn't liking the const disagreement for the destination argument. We have warnings as errors enabled and this leads to build failures. Adding an inline cast to remove the `const` seems to make things happy. I reported this upstream at https://github.com/facebook/zstd/issues/3515. --- zstd/zstd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zstd/zstd.c b/zstd/zstd.c index 9f92aef0..07dbf58c 100644 --- a/zstd/zstd.c +++ b/zstd/zstd.c @@ -36243,7 +36243,7 @@ void HUF_decompress4X1_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* /* Copy the arguments to local variables */ ZSTD_memcpy(&bits, &args->bits, sizeof(bits)); - ZSTD_memcpy(&ip, &args->ip, sizeof(ip)); + ZSTD_memcpy((BYTE*)&ip, &args->ip, sizeof(ip)); ZSTD_memcpy(&op, &args->op, sizeof(op)); assert(MEM_isLittleEndian()); @@ -36326,7 +36326,7 @@ void HUF_decompress4X1_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* /* Save the final values of each of the state variables back to args. */ ZSTD_memcpy(&args->bits, &bits, sizeof(bits)); - ZSTD_memcpy(&args->ip, &ip, sizeof(ip)); + ZSTD_memcpy((BYTE*)&args->ip, &ip, sizeof(ip)); ZSTD_memcpy(&args->op, &op, sizeof(op)); } @@ -37023,7 +37023,7 @@ void HUF_decompress4X2_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* /* Copy the arguments to local registers. */ ZSTD_memcpy(&bits, &args->bits, sizeof(bits)); - ZSTD_memcpy(&ip, &args->ip, sizeof(ip)); + ZSTD_memcpy((BYTE*)&ip, &args->ip, sizeof(ip)); ZSTD_memcpy(&op, &args->op, sizeof(op)); oend[0] = op[1]; @@ -37146,7 +37146,7 @@ void HUF_decompress4X2_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* /* Save the final values of each of the state variables back to args. */ ZSTD_memcpy(&args->bits, &bits, sizeof(bits)); - ZSTD_memcpy(&args->ip, &ip, sizeof(ip)); + ZSTD_memcpy((BYTE*)&args->ip, &ip, sizeof(ip)); ZSTD_memcpy(&args->op, &op, sizeof(op)); }