Rename to ZSTD_d_forceIgnoreChecksum, add to DCtx, add function to set the advanced param
This commit is contained in:
@@ -1397,6 +1397,11 @@ size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format)
|
|||||||
return ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, format);
|
return ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t ZSTD_DCtx_setForceSkipChecksum(ZSTD_DCtx* dctx, ZSTD_format_e format)
|
||||||
|
{
|
||||||
|
return ZSTD_DCtx_setParameter(dctx, ZSTD_d_forceSkipChecksum, format);
|
||||||
|
}
|
||||||
|
|
||||||
ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam)
|
ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam)
|
||||||
{
|
{
|
||||||
ZSTD_bounds bounds = { 0, 0, 0 };
|
ZSTD_bounds bounds = { 0, 0, 0 };
|
||||||
@@ -1414,6 +1419,9 @@ ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam)
|
|||||||
bounds.lowerBound = (int)ZSTD_obm_buffered;
|
bounds.lowerBound = (int)ZSTD_obm_buffered;
|
||||||
bounds.upperBound = (int)ZSTD_obm_stable;
|
bounds.upperBound = (int)ZSTD_obm_stable;
|
||||||
return bounds;
|
return bounds;
|
||||||
|
case ZSTD_d_forceIgnoreChecksum:
|
||||||
|
bounds.lowerBound = (int)ZSTD_d_validateChecksum;
|
||||||
|
bounds.upperBound = (int)ZSTD_d_ignoreChecksum;
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
bounds.error = ERROR(parameter_unsupported);
|
bounds.error = ERROR(parameter_unsupported);
|
||||||
@@ -1453,6 +1461,9 @@ size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter dParam, int value
|
|||||||
CHECK_DBOUNDS(ZSTD_d_stableOutBuffer, value);
|
CHECK_DBOUNDS(ZSTD_d_stableOutBuffer, value);
|
||||||
dctx->outBufferMode = (ZSTD_outBufferMode_e)value;
|
dctx->outBufferMode = (ZSTD_outBufferMode_e)value;
|
||||||
return 0;
|
return 0;
|
||||||
|
case ZSTD_d_forceIgnoreChecksum:
|
||||||
|
CHECK_DBOUNDS(ZSTD_d_forceIgnoreChecksum, value);
|
||||||
|
dctx->forceIgnoreChecksum = (ZSTD_ignoreChecksumMode_e)value;
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
RETURN_ERROR(parameter_unsupported, "");
|
RETURN_ERROR(parameter_unsupported, "");
|
||||||
@@ -1524,7 +1535,7 @@ static void ZSTD_DCtx_updateOversizedDuration(ZSTD_DStream* zds, size_t const ne
|
|||||||
{
|
{
|
||||||
if (ZSTD_DCtx_isOverflow(zds, neededInBuffSize, neededOutBuffSize))
|
if (ZSTD_DCtx_isOverflow(zds, neededInBuffSize, neededOutBuffSize))
|
||||||
zds->oversizedDuration++;
|
zds->oversizedDuration++;
|
||||||
else
|
else
|
||||||
zds->oversizedDuration = 0;
|
zds->oversizedDuration = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,7 +1742,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
|
|||||||
|
|
||||||
{ int const tooSmall = (zds->inBuffSize < neededInBuffSize) || (zds->outBuffSize < neededOutBuffSize);
|
{ int const tooSmall = (zds->inBuffSize < neededInBuffSize) || (zds->outBuffSize < neededOutBuffSize);
|
||||||
int const tooLarge = ZSTD_DCtx_isOversizedTooLong(zds);
|
int const tooLarge = ZSTD_DCtx_isOversizedTooLong(zds);
|
||||||
|
|
||||||
if (tooSmall || tooLarge) {
|
if (tooSmall || tooLarge) {
|
||||||
size_t const bufferSize = neededInBuffSize + neededOutBuffSize;
|
size_t const bufferSize = neededInBuffSize + neededOutBuffSize;
|
||||||
DEBUGLOG(4, "inBuff : from %u to %u",
|
DEBUGLOG(4, "inBuff : from %u to %u",
|
||||||
|
|||||||
@@ -100,6 +100,11 @@ typedef enum {
|
|||||||
ZSTD_obm_stable = 1 /* ZSTD_outBuffer is stable */
|
ZSTD_obm_stable = 1 /* ZSTD_outBuffer is stable */
|
||||||
} ZSTD_outBufferMode_e;
|
} ZSTD_outBufferMode_e;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ZSTD_d_validateChecksum = 0,
|
||||||
|
ZSTD_d_ignoreChecksum = 1
|
||||||
|
} ZSTD_ignoreChecksumMode_e;
|
||||||
|
|
||||||
struct ZSTD_DCtx_s
|
struct ZSTD_DCtx_s
|
||||||
{
|
{
|
||||||
const ZSTD_seqSymbol* LLTptr;
|
const ZSTD_seqSymbol* LLTptr;
|
||||||
@@ -122,6 +127,7 @@ struct ZSTD_DCtx_s
|
|||||||
XXH64_state_t xxhState;
|
XXH64_state_t xxhState;
|
||||||
size_t headerSize;
|
size_t headerSize;
|
||||||
ZSTD_format_e format;
|
ZSTD_format_e format;
|
||||||
|
ZSTD_ignoreChecksumMode_e forceIgnoreChecksum; /* if enabled, will ignore checksums in compressed frame */
|
||||||
const BYTE* litPtr;
|
const BYTE* litPtr;
|
||||||
ZSTD_customMem customMem;
|
ZSTD_customMem customMem;
|
||||||
size_t litSize;
|
size_t litSize;
|
||||||
|
|||||||
+3
-3
@@ -528,7 +528,7 @@ typedef enum {
|
|||||||
* At the time of this writing, they include :
|
* At the time of this writing, they include :
|
||||||
* ZSTD_d_format
|
* ZSTD_d_format
|
||||||
* ZSTD_d_stableOutBuffer
|
* ZSTD_d_stableOutBuffer
|
||||||
* ZSTD_d_forceSkipChecksum
|
* ZSTD_d_forceIgnoreChecksum
|
||||||
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
||||||
* note : never ever use experimentalParam? names directly
|
* note : never ever use experimentalParam? names directly
|
||||||
*/
|
*/
|
||||||
@@ -1692,7 +1692,7 @@ ZSTDLIB_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowS
|
|||||||
*/
|
*/
|
||||||
#define ZSTD_d_stableOutBuffer ZSTD_d_experimentalParam2
|
#define ZSTD_d_stableOutBuffer ZSTD_d_experimentalParam2
|
||||||
|
|
||||||
/* ZSTD_d_forceSkipChecksum
|
/* ZSTD_d_forceIgnoreChecksum
|
||||||
* Experimental parameter.
|
* Experimental parameter.
|
||||||
* Default is 0 == disabled. Set to 1 to enable
|
* Default is 0 == disabled. Set to 1 to enable
|
||||||
*
|
*
|
||||||
@@ -1700,7 +1700,7 @@ ZSTDLIB_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowS
|
|||||||
* of whether or not checksumming was specified during decompression. This offers some
|
* of whether or not checksumming was specified during decompression. This offers some
|
||||||
* slight performance benefits, and may be useful for debugging.
|
* slight performance benefits, and may be useful for debugging.
|
||||||
*/
|
*/
|
||||||
#define ZSTD_d_forceSkipChecksum ZSTD_d_experimentalParam3
|
#define ZSTD_d_forceIgnoreChecksum ZSTD_d_experimentalParam3
|
||||||
|
|
||||||
/*! ZSTD_DCtx_setFormat() :
|
/*! ZSTD_DCtx_setFormat() :
|
||||||
* Instruct the decoder context about what kind of data to decode next.
|
* Instruct the decoder context about what kind of data to decode next.
|
||||||
|
|||||||
Reference in New Issue
Block a user