release 6.12.4 (preliminary)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 9b2b1b2e996c06793bc975dd66dccaadb0c0d637 Mon Sep 17 00:00:00 2001
|
||||
From 444b8286e00345a68fecc43eaa0aabdb10d7b39b Mon Sep 17 00:00:00 2001
|
||||
From: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
Date: Mon, 29 Jul 2024 00:42:23 +0200
|
||||
Subject: zstd: import upstream v1.5.6
|
||||
@@ -7960,16 +7960,16 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
FORWARD_IF_ERROR(dictID, "ZSTD_compress_insertDictionary failed");
|
||||
assert(dictID <= (size_t)(U32)-1);
|
||||
cdict->dictID = (U32)dictID;
|
||||
@@ -4811,7 +5450,7 @@ ZSTD_CDict* ZSTD_createCDict_advanced2(
|
||||
cctxParams.useRowMatchFinder, cctxParams.enableDedicatedDictSearch,
|
||||
customMem);
|
||||
@@ -4813,7 +5452,7 @@ ZSTD_CDict* ZSTD_createCDict_advanced2(
|
||||
if (!cdict)
|
||||
return NULL;
|
||||
|
||||
- if (ZSTD_isError( ZSTD_initCDict_internal(cdict,
|
||||
+ if (!cdict || ZSTD_isError( ZSTD_initCDict_internal(cdict,
|
||||
dict, dictSize,
|
||||
dictLoadMethod, dictContentType,
|
||||
cctxParams) )) {
|
||||
@@ -4906,6 +5545,7 @@ const ZSTD_CDict* ZSTD_initStaticCDict(
|
||||
@@ -4908,6 +5547,7 @@ const ZSTD_CDict* ZSTD_initStaticCDict(
|
||||
params.cParams = cParams;
|
||||
params.useRowMatchFinder = useRowMatchFinder;
|
||||
cdict->useRowMatchFinder = useRowMatchFinder;
|
||||
@@ -7977,7 +7977,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
|
||||
if (ZSTD_isError( ZSTD_initCDict_internal(cdict,
|
||||
dict, dictSize,
|
||||
@@ -4985,12 +5625,17 @@ size_t ZSTD_compressBegin_usingCDict_adv
|
||||
@@ -4987,12 +5627,17 @@ size_t ZSTD_compressBegin_usingCDict_adv
|
||||
|
||||
/* ZSTD_compressBegin_usingCDict() :
|
||||
* cdict must be != NULL */
|
||||
@@ -7996,7 +7996,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
/*! ZSTD_compress_usingCDict_internal():
|
||||
* Implementation of various ZSTD_compress_usingCDict* functions.
|
||||
*/
|
||||
@@ -5000,7 +5645,7 @@ static size_t ZSTD_compress_usingCDict_i
|
||||
@@ -5002,7 +5647,7 @@ static size_t ZSTD_compress_usingCDict_i
|
||||
const ZSTD_CDict* cdict, ZSTD_frameParameters fParams)
|
||||
{
|
||||
FORWARD_IF_ERROR(ZSTD_compressBegin_usingCDict_internal(cctx, cdict, fParams, srcSize), ""); /* will check if cdict != NULL */
|
||||
@@ -8005,7 +8005,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
}
|
||||
|
||||
/*! ZSTD_compress_usingCDict_advanced():
|
||||
@@ -5197,30 +5842,41 @@ size_t ZSTD_initCStream(ZSTD_CStream* zc
|
||||
@@ -5199,30 +5844,41 @@ size_t ZSTD_initCStream(ZSTD_CStream* zc
|
||||
|
||||
static size_t ZSTD_nextInputSizeHint(const ZSTD_CCtx* cctx)
|
||||
{
|
||||
@@ -8059,7 +8059,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
if (zcs->appliedParams.inBufferMode == ZSTD_bm_buffered) {
|
||||
assert(zcs->inBuff != NULL);
|
||||
assert(zcs->inBuffSize > 0);
|
||||
@@ -5229,8 +5885,10 @@ static size_t ZSTD_compressStream_generi
|
||||
@@ -5231,8 +5887,10 @@ static size_t ZSTD_compressStream_generi
|
||||
assert(zcs->outBuff != NULL);
|
||||
assert(zcs->outBuffSize > 0);
|
||||
}
|
||||
@@ -8071,7 +8071,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
assert((U32)flushMode <= (U32)ZSTD_e_end);
|
||||
|
||||
while (someMoreWork) {
|
||||
@@ -5245,7 +5903,7 @@ static size_t ZSTD_compressStream_generi
|
||||
@@ -5247,7 +5905,7 @@ static size_t ZSTD_compressStream_generi
|
||||
|| zcs->appliedParams.outBufferMode == ZSTD_bm_stable) /* OR we are allowed to return dstSizeTooSmall */
|
||||
&& (zcs->inBuffPos == 0) ) {
|
||||
/* shortcut to compression pass directly into output buffer */
|
||||
@@ -8080,7 +8080,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
op, oend-op, ip, iend-ip);
|
||||
DEBUGLOG(4, "ZSTD_compressEnd : cSize=%u", (unsigned)cSize);
|
||||
FORWARD_IF_ERROR(cSize, "ZSTD_compressEnd failed");
|
||||
@@ -5262,8 +5920,7 @@ static size_t ZSTD_compressStream_generi
|
||||
@@ -5264,8 +5922,7 @@ static size_t ZSTD_compressStream_generi
|
||||
zcs->inBuff + zcs->inBuffPos, toLoad,
|
||||
ip, iend-ip);
|
||||
zcs->inBuffPos += loaded;
|
||||
@@ -8090,7 +8090,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
if ( (flushMode == ZSTD_e_continue)
|
||||
&& (zcs->inBuffPos < zcs->inBuffTarget) ) {
|
||||
/* not enough input to fill full block : stop here */
|
||||
@@ -5274,6 +5931,20 @@ static size_t ZSTD_compressStream_generi
|
||||
@@ -5276,6 +5933,20 @@ static size_t ZSTD_compressStream_generi
|
||||
/* empty */
|
||||
someMoreWork = 0; break;
|
||||
}
|
||||
@@ -8111,7 +8111,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
}
|
||||
/* compress current block (note : this stage cannot be stopped in the middle) */
|
||||
DEBUGLOG(5, "stream compression stage (flushMode==%u)", flushMode);
|
||||
@@ -5281,9 +5952,8 @@ static size_t ZSTD_compressStream_generi
|
||||
@@ -5283,9 +5954,8 @@ static size_t ZSTD_compressStream_generi
|
||||
void* cDst;
|
||||
size_t cSize;
|
||||
size_t oSize = oend-op;
|
||||
@@ -8123,7 +8123,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
if (oSize >= ZSTD_compressBound(iSize) || zcs->appliedParams.outBufferMode == ZSTD_bm_stable)
|
||||
cDst = op; /* compress into output buffer, to skip flush stage */
|
||||
else
|
||||
@@ -5291,9 +5961,9 @@ static size_t ZSTD_compressStream_generi
|
||||
@@ -5293,9 +5963,9 @@ static size_t ZSTD_compressStream_generi
|
||||
if (inputBuffered) {
|
||||
unsigned const lastBlock = (flushMode == ZSTD_e_end) && (ip==iend);
|
||||
cSize = lastBlock ?
|
||||
@@ -8135,7 +8135,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
zcs->inBuff + zcs->inToCompress, iSize);
|
||||
FORWARD_IF_ERROR(cSize, "%s", lastBlock ? "ZSTD_compressEnd failed" : "ZSTD_compressContinue failed");
|
||||
zcs->frameEnded = lastBlock;
|
||||
@@ -5306,19 +5976,16 @@ static size_t ZSTD_compressStream_generi
|
||||
@@ -5308,19 +5978,16 @@ static size_t ZSTD_compressStream_generi
|
||||
if (!lastBlock)
|
||||
assert(zcs->inBuffTarget <= zcs->inBuffSize);
|
||||
zcs->inToCompress = zcs->inBuffPos;
|
||||
@@ -8161,7 +8161,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
}
|
||||
if (cDst == op) { /* no need to flush */
|
||||
op += cSize;
|
||||
@@ -5388,8 +6055,10 @@ size_t ZSTD_compressStream(ZSTD_CStream*
|
||||
@@ -5390,8 +6057,10 @@ size_t ZSTD_compressStream(ZSTD_CStream*
|
||||
/* After a compression call set the expected input/output buffer.
|
||||
* This is validated at the start of the next compression call.
|
||||
*/
|
||||
@@ -8173,7 +8173,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
if (cctx->appliedParams.inBufferMode == ZSTD_bm_stable) {
|
||||
cctx->expectedInBuffer = *input;
|
||||
}
|
||||
@@ -5408,22 +6077,22 @@ static size_t ZSTD_checkBufferStability(
|
||||
@@ -5410,22 +6079,22 @@ static size_t ZSTD_checkBufferStability(
|
||||
{
|
||||
if (cctx->appliedParams.inBufferMode == ZSTD_bm_stable) {
|
||||
ZSTD_inBuffer const expect = cctx->expectedInBuffer;
|
||||
@@ -8202,7 +8202,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
ZSTD_CCtx_params params = cctx->requestedParams;
|
||||
ZSTD_prefixDict const prefixDict = cctx->prefixDict;
|
||||
FORWARD_IF_ERROR( ZSTD_initLocalDict(cctx) , ""); /* Init the local dict if present. */
|
||||
@@ -5437,9 +6106,9 @@ static size_t ZSTD_CCtx_init_compressStr
|
||||
@@ -5439,9 +6108,9 @@ static size_t ZSTD_CCtx_init_compressStr
|
||||
params.compressionLevel = cctx->cdict->compressionLevel;
|
||||
}
|
||||
DEBUGLOG(4, "ZSTD_compressStream2 : transparent init stage");
|
||||
@@ -8215,7 +8215,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
? prefixDict.dictSize
|
||||
: (cctx->cdict ? cctx->cdict->dictContentSize : 0);
|
||||
ZSTD_cParamMode_e const mode = ZSTD_getCParamMode(cctx->cdict, ¶ms, cctx->pledgedSrcSizePlusOne - 1);
|
||||
@@ -5451,6 +6120,9 @@ static size_t ZSTD_CCtx_init_compressStr
|
||||
@@ -5453,6 +6122,9 @@ static size_t ZSTD_CCtx_init_compressStr
|
||||
params.useBlockSplitter = ZSTD_resolveBlockSplitterMode(params.useBlockSplitter, ¶ms.cParams);
|
||||
params.ldmParams.enableLdm = ZSTD_resolveEnableLdm(params.ldmParams.enableLdm, ¶ms.cParams);
|
||||
params.useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params.useRowMatchFinder, ¶ms.cParams);
|
||||
@@ -8225,7 +8225,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
|
||||
{ U64 const pledgedSrcSize = cctx->pledgedSrcSizePlusOne - 1;
|
||||
assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams)));
|
||||
@@ -5477,6 +6149,8 @@ static size_t ZSTD_CCtx_init_compressStr
|
||||
@@ -5479,6 +6151,8 @@ static size_t ZSTD_CCtx_init_compressStr
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8234,7 +8234,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
size_t ZSTD_compressStream2( ZSTD_CCtx* cctx,
|
||||
ZSTD_outBuffer* output,
|
||||
ZSTD_inBuffer* input,
|
||||
@@ -5491,8 +6165,27 @@ size_t ZSTD_compressStream2( ZSTD_CCtx*
|
||||
@@ -5493,8 +6167,27 @@ size_t ZSTD_compressStream2( ZSTD_CCtx*
|
||||
|
||||
/* transparent initialization stage */
|
||||
if (cctx->streamStage == zcss_init) {
|
||||
@@ -8264,7 +8264,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
}
|
||||
/* end of transparent initialization stage */
|
||||
|
||||
@@ -5510,13 +6203,20 @@ size_t ZSTD_compressStream2_simpleArgs (
|
||||
@@ -5512,13 +6205,20 @@ size_t ZSTD_compressStream2_simpleArgs (
|
||||
const void* src, size_t srcSize, size_t* srcPos,
|
||||
ZSTD_EndDirective endOp)
|
||||
{
|
||||
@@ -8291,7 +8291,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
}
|
||||
|
||||
size_t ZSTD_compress2(ZSTD_CCtx* cctx,
|
||||
@@ -5539,6 +6239,7 @@ size_t ZSTD_compress2(ZSTD_CCtx* cctx,
|
||||
@@ -5541,6 +6241,7 @@ size_t ZSTD_compress2(ZSTD_CCtx* cctx,
|
||||
/* Reset to the original values. */
|
||||
cctx->requestedParams.inBufferMode = originalInBufferMode;
|
||||
cctx->requestedParams.outBufferMode = originalOutBufferMode;
|
||||
@@ -8299,7 +8299,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
FORWARD_IF_ERROR(result, "ZSTD_compressStream2_simpleArgs failed");
|
||||
if (result != 0) { /* compression not completed, due to lack of output space */
|
||||
assert(oPos == dstCapacity);
|
||||
@@ -5549,64 +6250,61 @@ size_t ZSTD_compress2(ZSTD_CCtx* cctx,
|
||||
@@ -5551,64 +6252,61 @@ size_t ZSTD_compress2(ZSTD_CCtx* cctx,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8384,7 +8384,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
if (cctx->cdict) {
|
||||
dictSize = (U32)cctx->cdict->dictContentSize;
|
||||
} else if (cctx->prefixDict.dict) {
|
||||
@@ -5615,25 +6313,55 @@ ZSTD_copySequencesToSeqStoreExplicitBloc
|
||||
@@ -5617,25 +6315,55 @@ ZSTD_copySequencesToSeqStoreExplicitBloc
|
||||
dictSize = 0;
|
||||
}
|
||||
ZSTD_memcpy(updatedRepcodes.rep, cctx->blockState.prevCBlock->rep, sizeof(repcodes_t));
|
||||
@@ -8449,7 +8449,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
ZSTD_memcpy(cctx->blockState.nextCBlock->rep, updatedRepcodes.rep, sizeof(repcodes_t));
|
||||
|
||||
if (inSeqs[idx].litLength) {
|
||||
@@ -5642,26 +6370,15 @@ ZSTD_copySequencesToSeqStoreExplicitBloc
|
||||
@@ -5644,26 +6372,15 @@ ZSTD_copySequencesToSeqStoreExplicitBloc
|
||||
ip += inSeqs[idx].litLength;
|
||||
seqPos->posInSrc += inSeqs[idx].litLength;
|
||||
}
|
||||
@@ -8479,7 +8479,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
{
|
||||
U32 idx = seqPos->idx;
|
||||
U32 startPosInSequence = seqPos->posInSequence;
|
||||
@@ -5673,6 +6390,9 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
@@ -5675,6 +6392,9 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
U32 bytesAdjustment = 0;
|
||||
U32 finalMatchSplit = 0;
|
||||
|
||||
@@ -8489,7 +8489,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
if (cctx->cdict) {
|
||||
dictSize = cctx->cdict->dictContentSize;
|
||||
} else if (cctx->prefixDict.dict) {
|
||||
@@ -5680,7 +6400,7 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
@@ -5682,7 +6402,7 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
} else {
|
||||
dictSize = 0;
|
||||
}
|
||||
@@ -8498,7 +8498,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
DEBUGLOG(5, "Start seq: idx: %u (of: %u ml: %u ll: %u)", idx, inSeqs[idx].offset, inSeqs[idx].matchLength, inSeqs[idx].litLength);
|
||||
ZSTD_memcpy(updatedRepcodes.rep, cctx->blockState.prevCBlock->rep, sizeof(repcodes_t));
|
||||
while (endPosInSequence && idx < inSeqsSize && !finalMatchSplit) {
|
||||
@@ -5688,7 +6408,7 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
@@ -5690,7 +6410,7 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
U32 litLength = currSeq.litLength;
|
||||
U32 matchLength = currSeq.matchLength;
|
||||
U32 const rawOffset = currSeq.offset;
|
||||
@@ -8507,7 +8507,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
|
||||
/* Modify the sequence depending on where endPosInSequence lies */
|
||||
if (endPosInSequence >= currSeq.litLength + currSeq.matchLength) {
|
||||
@@ -5702,7 +6422,6 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
@@ -5704,7 +6424,6 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
/* Move to the next sequence */
|
||||
endPosInSequence -= currSeq.litLength + currSeq.matchLength;
|
||||
startPosInSequence = 0;
|
||||
@@ -8515,7 +8515,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
} else {
|
||||
/* This is the final (partial) sequence we're adding from inSeqs, and endPosInSequence
|
||||
does not reach the end of the match. So, we have to split the sequence */
|
||||
@@ -5742,21 +6461,23 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
@@ -5744,21 +6463,23 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
}
|
||||
/* Check if this offset can be represented with a repcode */
|
||||
{ U32 const ll0 = (litLength == 0);
|
||||
@@ -8546,7 +8546,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
}
|
||||
DEBUGLOG(5, "Ending seq: idx: %u (of: %u ml: %u ll: %u)", idx, inSeqs[idx].offset, inSeqs[idx].matchLength, inSeqs[idx].litLength);
|
||||
assert(idx == inSeqsSize || endPosInSequence <= inSeqs[idx].litLength + inSeqs[idx].matchLength);
|
||||
@@ -5779,7 +6500,7 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
@@ -5781,7 +6502,7 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim
|
||||
|
||||
typedef size_t (*ZSTD_sequenceCopier) (ZSTD_CCtx* cctx, ZSTD_sequencePosition* seqPos,
|
||||
const ZSTD_Sequence* const inSeqs, size_t inSeqsSize,
|
||||
@@ -8555,7 +8555,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
static ZSTD_sequenceCopier ZSTD_selectSequenceCopier(ZSTD_sequenceFormat_e mode)
|
||||
{
|
||||
ZSTD_sequenceCopier sequenceCopier = NULL;
|
||||
@@ -5793,6 +6514,57 @@ static ZSTD_sequenceCopier ZSTD_selectSe
|
||||
@@ -5795,6 +6516,57 @@ static ZSTD_sequenceCopier ZSTD_selectSe
|
||||
return sequenceCopier;
|
||||
}
|
||||
|
||||
@@ -8613,7 +8613,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
/* Compress, block-by-block, all of the sequences given.
|
||||
*
|
||||
* Returns the cumulative size of all compressed blocks (including their headers),
|
||||
@@ -5805,9 +6577,6 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
@@ -5807,9 +6579,6 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
const void* src, size_t srcSize)
|
||||
{
|
||||
size_t cSize = 0;
|
||||
@@ -8623,7 +8623,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
size_t remaining = srcSize;
|
||||
ZSTD_sequencePosition seqPos = {0, 0, 0};
|
||||
|
||||
@@ -5827,22 +6596,29 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
@@ -5829,22 +6598,29 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
}
|
||||
|
||||
while (remaining) {
|
||||
@@ -8659,7 +8659,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
cSize += cBlockSize;
|
||||
ip += blockSize;
|
||||
op += cBlockSize;
|
||||
@@ -5851,6 +6627,7 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
@@ -5853,6 +6629,7 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -8667,7 +8667,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
compressedSeqsSize = ZSTD_entropyCompressSeqStore(&cctx->seqStore,
|
||||
&cctx->blockState.prevCBlock->entropy, &cctx->blockState.nextCBlock->entropy,
|
||||
&cctx->appliedParams,
|
||||
@@ -5859,11 +6636,11 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
@@ -5861,11 +6638,11 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
cctx->entropyWorkspace, ENTROPY_WORKSPACE_SIZE /* statically allocated in resetCCtx */,
|
||||
cctx->bmi2);
|
||||
FORWARD_IF_ERROR(compressedSeqsSize, "Compressing sequences of block failed");
|
||||
@@ -8681,7 +8681,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
/* We don't want to emit our first block as a RLE even if it qualifies because
|
||||
* doing so will cause the decoder (cli only) to throw a "should consume all input error."
|
||||
* This is only an issue for zstd <= v1.4.3
|
||||
@@ -5874,12 +6651,12 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
@@ -5876,12 +6653,12 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
if (compressedSeqsSize == 0) {
|
||||
/* ZSTD_noCompressBlock writes the block header as well */
|
||||
cBlockSize = ZSTD_noCompressBlock(op, dstCapacity, ip, blockSize, lastBlock);
|
||||
@@ -8698,7 +8698,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
} else {
|
||||
U32 cBlockHeader;
|
||||
/* Error checking and repcodes update */
|
||||
@@ -5891,11 +6668,10 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
@@ -5893,11 +6670,10 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
cBlockHeader = lastBlock + (((U32)bt_compressed)<<1) + (U32)(compressedSeqsSize << 3);
|
||||
MEM_writeLE24(op, cBlockHeader);
|
||||
cBlockSize = ZSTD_blockHeaderSize + compressedSeqsSize;
|
||||
@@ -8711,7 +8711,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
|
||||
if (lastBlock) {
|
||||
break;
|
||||
@@ -5906,12 +6682,15 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
@@ -5908,12 +6684,15 @@ ZSTD_compressSequences_internal(ZSTD_CCt
|
||||
dstCapacity -= cBlockSize;
|
||||
cctx->isFirstBlock = 0;
|
||||
}
|
||||
@@ -8728,7 +8728,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
const ZSTD_Sequence* inSeqs, size_t inSeqsSize,
|
||||
const void* src, size_t srcSize)
|
||||
{
|
||||
@@ -5921,7 +6700,7 @@ size_t ZSTD_compressSequences(ZSTD_CCtx*
|
||||
@@ -5923,7 +6702,7 @@ size_t ZSTD_compressSequences(ZSTD_CCtx*
|
||||
size_t frameHeaderSize = 0;
|
||||
|
||||
/* Transparent initialization stage, same as compressStream2() */
|
||||
@@ -8737,7 +8737,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
assert(cctx != NULL);
|
||||
FORWARD_IF_ERROR(ZSTD_CCtx_init_compressStream2(cctx, ZSTD_e_end, srcSize), "CCtx initialization failed");
|
||||
/* Begin writing output, starting with frame header */
|
||||
@@ -5949,26 +6728,34 @@ size_t ZSTD_compressSequences(ZSTD_CCtx*
|
||||
@@ -5951,26 +6730,34 @@ size_t ZSTD_compressSequences(ZSTD_CCtx*
|
||||
cSize += 4;
|
||||
}
|
||||
|
||||
@@ -8776,7 +8776,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
if (zcs->appliedParams.nbWorkers > 0) return remainingToFlush; /* minimal estimation */
|
||||
/* single thread mode : attempt to calculate remaining to flush more precisely */
|
||||
{ size_t const lastBlockSize = zcs->frameEnded ? 0 : ZSTD_BLOCKHEADERSIZE;
|
||||
@@ -6090,7 +6877,7 @@ static ZSTD_compressionParameters ZSTD_g
|
||||
@@ -6092,7 +6879,7 @@ static ZSTD_compressionParameters ZSTD_g
|
||||
cp.targetLength = (unsigned)(-clampedCompressionLevel);
|
||||
}
|
||||
/* refine parameters based on srcSize & dictSize */
|
||||
@@ -8785,7 +8785,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6125,3 +6912,29 @@ ZSTD_parameters ZSTD_getParams(int compr
|
||||
@@ -6127,3 +6914,29 @@ ZSTD_parameters ZSTD_getParams(int compr
|
||||
if (srcSizeHint == 0) srcSizeHint = ZSTD_CONTENTSIZE_UNKNOWN;
|
||||
return ZSTD_getParams_internal(compressionLevel, srcSizeHint, dictSize, ZSTD_cpm_unknown);
|
||||
}
|
||||
@@ -18522,7 +18522,7 @@ Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
@@ -77,7 +77,7 @@ EXPORT_SYMBOL(zstd_init_dstream);
|
||||
@@ -113,7 +113,7 @@ EXPORT_SYMBOL(zstd_init_dstream);
|
||||
|
||||
size_t zstd_reset_dstream(zstd_dstream *dstream)
|
||||
{
|
||||
|
Reference in New Issue
Block a user