feat(compress): route CDict end through Rust

Share the existing end-state projection between the public C wrapper and
Rust-owned compressed-dictionary orchestration. The CDict callback now reaches
ZSTD_rust_compressEnd through the private dispatcher without re-entering the
public C end wrapper, while the exported API keeps its compatibility wrapper.

Test Plan:
- ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo fmt --manifest-path rust/Cargo.toml --all -- --check
- ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo test --manifest-path rust/Cargo.toml --lib
- ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings
- ulimit -v 41943040; make -j1
- ulimit -v 41943040; make -j1 -C tests test-zstream ZSTREAM_TESTTIME=-T2s
- ulimit -v 41943040; make -j1 -C tests test-fuzzer FUZZERTEST=-T3s FUZZER_FLAGS=--no-big-tests
This commit is contained in:
2026-07-20 01:30:23 +02:00
parent 6e9fdcf305
commit 2c644304f5
+11 -4
View File
@@ -6205,9 +6205,9 @@ static void ZSTD_rust_compressEnd_trace(void* context, size_t extraCSize)
ZSTD_CCtx_trace((ZSTD_CCtx*)context, extraCSize);
}
size_t ZSTD_compressEnd_public(ZSTD_CCtx* cctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize)
static size_t ZSTD_compressEnd_dispatch(ZSTD_CCtx* cctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize)
{
ZSTD_rust_compressContinueContext continueContext;
ZSTD_rust_compressEndState state;
@@ -6229,6 +6229,13 @@ size_t ZSTD_compressEnd_public(ZSTD_CCtx* cctx,
&state, dst, dstCapacity, src, srcSize);
}
size_t ZSTD_compressEnd_public(ZSTD_CCtx* cctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize)
{
return ZSTD_compressEnd_dispatch(cctx, dst, dstCapacity, src, srcSize);
}
/* NOTE: Must just wrap ZSTD_compressEnd_public() */
size_t ZSTD_compressEnd(ZSTD_CCtx* cctx,
void* dst, size_t dstCapacity,
@@ -6939,7 +6946,7 @@ static size_t ZSTD_rust_compressUsingCDict_end(
void* context, void* dst, size_t dstCapacity,
const void* src, size_t srcSize)
{
return ZSTD_compressEnd_public(
return ZSTD_compressEnd_dispatch(
(ZSTD_CCtx*)context, dst, dstCapacity, src, srcSize);
}