Skip to content

Commit

Permalink
zstd: add cast to some ZSTD_memcpy()
Browse files Browse the repository at this point in the history
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
facebook/zstd#3515.
  • Loading branch information
indygreg committed Feb 19, 2023
1 parent 8d091ad commit acfd93d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions zstd/zstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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));
}

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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));
}

Expand Down

0 comments on commit acfd93d

Please sign in to comment.