@@ -3015,7 +3015,7 @@ static size_t
3015
3015
ZSTD_entropyCompressSeqStore_wExtLitBuffer (
3016
3016
void * dst , size_t dstCapacity ,
3017
3017
const void * literals , size_t litSize ,
3018
- size_t srcSize ,
3018
+ size_t blockSize ,
3019
3019
const SeqStore_t * seqStorePtr ,
3020
3020
const ZSTD_entropyCTables_t * prevEntropy ,
3021
3021
ZSTD_entropyCTables_t * nextEntropy ,
@@ -3032,14 +3032,14 @@ ZSTD_entropyCompressSeqStore_wExtLitBuffer(
3032
3032
/* When srcSize <= dstCapacity, there is enough space to write a raw uncompressed block.
3033
3033
* Since we ran out of space, block must be not compressible, so fall back to raw uncompressed block.
3034
3034
*/
3035
- if ((cSize == ERROR (dstSize_tooSmall )) & (srcSize <= dstCapacity )) {
3035
+ if ((cSize == ERROR (dstSize_tooSmall )) & (blockSize <= dstCapacity )) {
3036
3036
DEBUGLOG (4 , "not enough dstCapacity (%zu) for ZSTD_entropyCompressSeqStore_internal()=> do not compress block" , dstCapacity );
3037
3037
return 0 ; /* block not compressed */
3038
3038
}
3039
3039
FORWARD_IF_ERROR (cSize , "ZSTD_entropyCompressSeqStore_internal failed" );
3040
3040
3041
3041
/* 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 );
3043
3043
if (cSize >= maxCSize ) return 0 ; /* block not compressed */
3044
3044
}
3045
3045
DEBUGLOG (5 , "ZSTD_entropyCompressSeqStore() cSize: %zu" , cSize );
@@ -6980,13 +6980,11 @@ ZSTD_compressSequences_internal(ZSTD_CCtx* cctx,
6980
6980
}
6981
6981
6982
6982
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 ,
6988
6984
& cctx -> blockState .prevCBlock -> entropy , & cctx -> blockState .nextCBlock -> entropy ,
6989
6985
& cctx -> appliedParams ,
6986
+ op + ZSTD_blockHeaderSize /* Leave space for block header */ , dstCapacity - ZSTD_blockHeaderSize ,
6987
+ blockSize ,
6990
6988
cctx -> tmpWorkspace , cctx -> tmpWkspSize /* statically allocated in resetCCtx */ ,
6991
6989
cctx -> bmi2 );
6992
6990
FORWARD_IF_ERROR (compressedSeqsSize , "Compressing sequences of block failed" );
0 commit comments