Skip to content

Commit 9bcee5f

Browse files
committed
restore invocation of ZSTD_entropyCompressSeqStore()
in the ZSTD_compressSequences() pipeline
1 parent 16aefb5 commit 9bcee5f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/compress/zstd_compress.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3015,7 +3015,7 @@ static size_t
30153015
ZSTD_entropyCompressSeqStore_wExtLitBuffer(
30163016
void* dst, size_t dstCapacity,
30173017
const void* literals, size_t litSize,
3018-
size_t srcSize,
3018+
size_t blockSize,
30193019
const SeqStore_t* seqStorePtr,
30203020
const ZSTD_entropyCTables_t* prevEntropy,
30213021
ZSTD_entropyCTables_t* nextEntropy,
@@ -3032,14 +3032,14 @@ ZSTD_entropyCompressSeqStore_wExtLitBuffer(
30323032
/* When srcSize <= dstCapacity, there is enough space to write a raw uncompressed block.
30333033
* Since we ran out of space, block must be not compressible, so fall back to raw uncompressed block.
30343034
*/
3035-
if ((cSize == ERROR(dstSize_tooSmall)) & (srcSize <= dstCapacity)) {
3035+
if ((cSize == ERROR(dstSize_tooSmall)) & (blockSize <= dstCapacity)) {
30363036
DEBUGLOG(4, "not enough dstCapacity (%zu) for ZSTD_entropyCompressSeqStore_internal()=> do not compress block", dstCapacity);
30373037
return 0; /* block not compressed */
30383038
}
30393039
FORWARD_IF_ERROR(cSize, "ZSTD_entropyCompressSeqStore_internal failed");
30403040

30413041
/* Check compressibility */
3042-
{ size_t const maxCSize = srcSize - ZSTD_minGain(srcSize, cctxParams->cParams.strategy);
3042+
{ size_t const maxCSize = blockSize - ZSTD_minGain(blockSize, cctxParams->cParams.strategy);
30433043
if (cSize >= maxCSize) return 0; /* block not compressed */
30443044
}
30453045
DEBUGLOG(5, "ZSTD_entropyCompressSeqStore() cSize: %zu", cSize);
@@ -6980,13 +6980,11 @@ ZSTD_compressSequences_internal(ZSTD_CCtx* cctx,
69806980
}
69816981

69826982
RETURN_ERROR_IF(dstCapacity < ZSTD_blockHeaderSize, dstSize_tooSmall, "not enough dstCapacity to write a new compressed block");
6983-
compressedSeqsSize = ZSTD_entropyCompressSeqStore_wExtLitBuffer(
6984-
op + ZSTD_blockHeaderSize /* Leave space for block header */, dstCapacity - ZSTD_blockHeaderSize,
6985-
cctx->seqStore.litStart, (size_t)(cctx->seqStore.lit - cctx->seqStore.litStart),
6986-
blockSize,
6987-
&cctx->seqStore,
6983+
compressedSeqsSize = ZSTD_entropyCompressSeqStore(&cctx->seqStore,
69886984
&cctx->blockState.prevCBlock->entropy, &cctx->blockState.nextCBlock->entropy,
69896985
&cctx->appliedParams,
6986+
op + ZSTD_blockHeaderSize /* Leave space for block header */, dstCapacity - ZSTD_blockHeaderSize,
6987+
blockSize,
69906988
cctx->tmpWorkspace, cctx->tmpWkspSize /* statically allocated in resetCCtx */,
69916989
cctx->bmi2);
69926990
FORWARD_IF_ERROR(compressedSeqsSize, "Compressing sequences of block failed");

0 commit comments

Comments
 (0)