static dctx is incompatible with legacy support
documented, and runtime tested
This commit is contained in:
parent
cdf7e82222
commit
b8136f019a
@ -718,7 +718,8 @@ size_t ZSTD_CDict_loadDictionary(ZSTD_CDict* cdict, const void* dict, size_t dic
|
|||||||
@return : pointer to ZSTD_DCtx*, or NULL if error (size too small)
|
@return : pointer to ZSTD_DCtx*, or NULL if error (size too small)
|
||||||
Note : zstd will never resize nor malloc() when using a static dctx.
|
Note : zstd will never resize nor malloc() when using a static dctx.
|
||||||
If it needs more memory than available, it will simply error out.
|
If it needs more memory than available, it will simply error out.
|
||||||
Note 2 : there is no corresponding "free" function.
|
Note 2 : static dctx is incompatible with legacy support
|
||||||
|
Note 3 : there is no corresponding "free" function.
|
||||||
Since workspace was allocated externally, it must be freed externally.
|
Since workspace was allocated externally, it must be freed externally.
|
||||||
Limitation : currently not compatible with internal DDict creation,
|
Limitation : currently not compatible with internal DDict creation,
|
||||||
such as ZSTD_initDStream_usingDict().
|
such as ZSTD_initDStream_usingDict().
|
||||||
|
@ -1586,6 +1586,8 @@ static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx,
|
|||||||
size_t decodedSize;
|
size_t decodedSize;
|
||||||
size_t const frameSize = ZSTD_findFrameCompressedSizeLegacy(src, srcSize);
|
size_t const frameSize = ZSTD_findFrameCompressedSizeLegacy(src, srcSize);
|
||||||
if (ZSTD_isError(frameSize)) return frameSize;
|
if (ZSTD_isError(frameSize)) return frameSize;
|
||||||
|
/* legacy support is incompatible with static dctx */
|
||||||
|
if (dctx->staticSize) return ERROR(memory_allocation);
|
||||||
|
|
||||||
decodedSize = ZSTD_decompressLegacy(dst, dstCapacity, src, frameSize, dict, dictSize);
|
decodedSize = ZSTD_decompressLegacy(dst, dstCapacity, src, frameSize, dict, dictSize);
|
||||||
|
|
||||||
@ -2258,8 +2260,11 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
|
|||||||
U32 someMoreWork = 1;
|
U32 someMoreWork = 1;
|
||||||
|
|
||||||
#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
|
#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
|
||||||
if (zds->legacyVersion)
|
if (zds->legacyVersion) {
|
||||||
|
/* legacy support is incompatible with static dctx */
|
||||||
|
if (zds->staticSize) return ERROR(memory_allocation);
|
||||||
return ZSTD_decompressLegacyStream(zds->legacyContext, zds->legacyVersion, output, input);
|
return ZSTD_decompressLegacyStream(zds->legacyContext, zds->legacyVersion, output, input);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (someMoreWork) {
|
while (someMoreWork) {
|
||||||
@ -2277,6 +2282,8 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
|
|||||||
if (legacyVersion) {
|
if (legacyVersion) {
|
||||||
const void* const dict = zds->ddict ? zds->ddict->dictContent : NULL;
|
const void* const dict = zds->ddict ? zds->ddict->dictContent : NULL;
|
||||||
size_t const dictSize = zds->ddict ? zds->ddict->dictSize : 0;
|
size_t const dictSize = zds->ddict ? zds->ddict->dictSize : 0;
|
||||||
|
/* legacy support is incompatible with static dctx */
|
||||||
|
if (zds->staticSize) return ERROR(memory_allocation);
|
||||||
CHECK_F(ZSTD_initLegacyStream(&zds->legacyContext, zds->previousLegacyVersion, legacyVersion,
|
CHECK_F(ZSTD_initLegacyStream(&zds->legacyContext, zds->previousLegacyVersion, legacyVersion,
|
||||||
dict, dictSize));
|
dict, dictSize));
|
||||||
zds->legacyVersion = zds->previousLegacyVersion = legacyVersion;
|
zds->legacyVersion = zds->previousLegacyVersion = legacyVersion;
|
||||||
|
@ -844,7 +844,8 @@ ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem);
|
|||||||
* @return : pointer to ZSTD_DCtx*, or NULL if error (size too small)
|
* @return : pointer to ZSTD_DCtx*, or NULL if error (size too small)
|
||||||
* Note : zstd will never resize nor malloc() when using a static dctx.
|
* Note : zstd will never resize nor malloc() when using a static dctx.
|
||||||
* If it needs more memory than available, it will simply error out.
|
* If it needs more memory than available, it will simply error out.
|
||||||
* Note 2 : there is no corresponding "free" function.
|
* Note 2 : static dctx is incompatible with legacy support
|
||||||
|
* Note 3 : there is no corresponding "free" function.
|
||||||
* Since workspace was allocated externally, it must be freed externally.
|
* Since workspace was allocated externally, it must be freed externally.
|
||||||
* Limitation : currently not compatible with internal DDict creation,
|
* Limitation : currently not compatible with internal DDict creation,
|
||||||
* such as ZSTD_initDStream_usingDict().
|
* such as ZSTD_initDStream_usingDict().
|
||||||
|
Loading…
Reference in New Issue
Block a user