[API] Add ZSTD_c_stable{In,Out}Buffer parameters
This commit adds the parameters and sets the value in the CCtxParams but it does not do anything with the value.
This commit is contained in:
@@ -99,7 +99,7 @@ static void ZSTD_DCtx_resetParameters(ZSTD_DCtx* dctx)
|
||||
assert(dctx->streamStage == zdss_init);
|
||||
dctx->format = ZSTD_f_zstd1;
|
||||
dctx->maxWindowSize = ZSTD_MAXWINDOWSIZE_DEFAULT;
|
||||
dctx->outBufferMode = ZSTD_obm_buffered;
|
||||
dctx->outBufferMode = ZSTD_bm_buffered;
|
||||
dctx->forceIgnoreChecksum = ZSTD_d_validateChecksum;
|
||||
}
|
||||
|
||||
@@ -1431,8 +1431,8 @@ ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam)
|
||||
ZSTD_STATIC_ASSERT(ZSTD_f_zstd1 < ZSTD_f_zstd1_magicless);
|
||||
return bounds;
|
||||
case ZSTD_d_stableOutBuffer:
|
||||
bounds.lowerBound = (int)ZSTD_obm_buffered;
|
||||
bounds.upperBound = (int)ZSTD_obm_stable;
|
||||
bounds.lowerBound = (int)ZSTD_bm_buffered;
|
||||
bounds.upperBound = (int)ZSTD_bm_stable;
|
||||
return bounds;
|
||||
case ZSTD_d_forceIgnoreChecksum:
|
||||
bounds.lowerBound = (int)ZSTD_d_validateChecksum;
|
||||
@@ -1495,7 +1495,7 @@ size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter dParam, int value
|
||||
return 0;
|
||||
case ZSTD_d_stableOutBuffer:
|
||||
CHECK_DBOUNDS(ZSTD_d_stableOutBuffer, value);
|
||||
dctx->outBufferMode = (ZSTD_outBufferMode_e)value;
|
||||
dctx->outBufferMode = (ZSTD_bufferMode_e)value;
|
||||
return 0;
|
||||
case ZSTD_d_forceIgnoreChecksum:
|
||||
CHECK_DBOUNDS(ZSTD_d_forceIgnoreChecksum, value);
|
||||
@@ -1585,7 +1585,7 @@ static size_t ZSTD_checkOutBuffer(ZSTD_DStream const* zds, ZSTD_outBuffer const*
|
||||
{
|
||||
ZSTD_outBuffer const expect = zds->expectedOutBuffer;
|
||||
/* No requirement when ZSTD_obm_stable is not enabled. */
|
||||
if (zds->outBufferMode != ZSTD_obm_stable)
|
||||
if (zds->outBufferMode != ZSTD_bm_stable)
|
||||
return 0;
|
||||
/* Any buffer is allowed in zdss_init, this must be the same for every other call until
|
||||
* the context is reset.
|
||||
@@ -1595,7 +1595,7 @@ static size_t ZSTD_checkOutBuffer(ZSTD_DStream const* zds, ZSTD_outBuffer const*
|
||||
/* The buffer must match our expectation exactly. */
|
||||
if (expect.dst == output->dst && expect.pos == output->pos && expect.size == output->size)
|
||||
return 0;
|
||||
RETURN_ERROR(dstBuffer_wrong, "ZSTD_obm_stable enabled but output differs!");
|
||||
RETURN_ERROR(dstBuffer_wrong, "ZSTD_d_stableOutBuffer enabled but output differs!");
|
||||
}
|
||||
|
||||
/* Calls ZSTD_decompressContinue() with the right parameters for ZSTD_decompressStream()
|
||||
@@ -1607,7 +1607,7 @@ static size_t ZSTD_decompressContinueStream(
|
||||
ZSTD_DStream* zds, char** op, char* oend,
|
||||
void const* src, size_t srcSize) {
|
||||
int const isSkipFrame = ZSTD_isSkipFrame(zds);
|
||||
if (zds->outBufferMode == ZSTD_obm_buffered) {
|
||||
if (zds->outBufferMode == ZSTD_bm_buffered) {
|
||||
size_t const dstSize = isSkipFrame ? 0 : zds->outBuffSize - zds->outStart;
|
||||
size_t const decodedSize = ZSTD_decompressContinue(zds,
|
||||
zds->outBuff + zds->outStart, dstSize, src, srcSize);
|
||||
@@ -1627,7 +1627,7 @@ static size_t ZSTD_decompressContinueStream(
|
||||
/* Flushing is not needed. */
|
||||
zds->streamStage = zdss_read;
|
||||
assert(*op <= oend);
|
||||
assert(zds->outBufferMode == ZSTD_obm_stable);
|
||||
assert(zds->outBufferMode == ZSTD_bm_stable);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1740,7 +1740,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
|
||||
} }
|
||||
|
||||
/* Check output buffer is large enough for ZSTD_odm_stable. */
|
||||
if (zds->outBufferMode == ZSTD_obm_stable
|
||||
if (zds->outBufferMode == ZSTD_bm_stable
|
||||
&& zds->fParams.frameType != ZSTD_skippableFrame
|
||||
&& zds->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN
|
||||
&& (U64)(size_t)(oend-op) < zds->fParams.frameContentSize) {
|
||||
@@ -1770,7 +1770,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
|
||||
|
||||
/* Adapt buffer sizes to frame header instructions */
|
||||
{ size_t const neededInBuffSize = MAX(zds->fParams.blockSizeMax, 4 /* frame checksum */);
|
||||
size_t const neededOutBuffSize = zds->outBufferMode == ZSTD_obm_buffered
|
||||
size_t const neededOutBuffSize = zds->outBufferMode == ZSTD_bm_buffered
|
||||
? ZSTD_decodingBufferSize_min(zds->fParams.windowSize, zds->fParams.frameContentSize)
|
||||
: 0;
|
||||
|
||||
|
||||
@@ -99,11 +99,6 @@ typedef enum {
|
||||
ZSTD_use_once = 1 /* Use the dictionary once and set to ZSTD_dont_use */
|
||||
} ZSTD_dictUses_e;
|
||||
|
||||
typedef enum {
|
||||
ZSTD_obm_buffered = 0, /* Buffer the output */
|
||||
ZSTD_obm_stable = 1 /* ZSTD_outBuffer is stable */
|
||||
} ZSTD_outBufferMode_e;
|
||||
|
||||
struct ZSTD_DCtx_s
|
||||
{
|
||||
const ZSTD_seqSymbol* LLTptr;
|
||||
@@ -158,7 +153,7 @@ struct ZSTD_DCtx_s
|
||||
U32 legacyVersion;
|
||||
U32 hostageByte;
|
||||
int noForwardProgress;
|
||||
ZSTD_outBufferMode_e outBufferMode;
|
||||
ZSTD_bufferMode_e outBufferMode;
|
||||
ZSTD_outBuffer expectedOutBuffer;
|
||||
|
||||
/* workspace */
|
||||
|
||||
Reference in New Issue
Block a user