Fix ZSTD_createCStream_usingCDict() and ZSTD_compress_usingCDict()
parent
87cec8fd56
commit
33fc0ad56a
|
@ -257,7 +257,7 @@ size_t ZSTD_DStreamWorkspaceBound(size_t maxWindowSize);
|
|||
typedef struct ZSTD_CStream_s ZSTD_CStream;
|
||||
/*===== ZSTD_CStream management functions =====*/
|
||||
ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream(ZSTD_parameters params, unsigned long long pledgedSrcSize, void* workspace, size_t workspaceSize);
|
||||
ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream_usingCDict(ZSTD_parameters params, const ZSTD_CDict* cdict, unsigned long long pledgedSrcSize, void* workspace, size_t workspaceSize);
|
||||
ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream_usingCDict(const ZSTD_CDict* cdict, unsigned long long pledgedSrcSize, void* workspace, size_t workspaceSize);
|
||||
|
||||
/*===== Streaming compression functions =====*/
|
||||
ZSTDLIB_API size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize); /**< re-use compression parameters from previous init; skip dictionary loading stage; zcs must be init at least once before. note: pledgedSrcSize must be correct, a size of 0 means unknown. for a frame size of 0 use initCStream_advanced */
|
||||
|
|
|
@ -2861,6 +2861,8 @@ size_t ZSTD_compress_usingCDict(ZSTD_CCtx* cctx,
|
|||
if (cdict->refContext->params.fParams.contentSizeFlag==1) {
|
||||
cctx->params.fParams.contentSizeFlag = 1;
|
||||
cctx->frameContentSize = srcSize;
|
||||
} else {
|
||||
cctx->params.fParams.contentSizeFlag = 0;
|
||||
}
|
||||
|
||||
return ZSTD_compressEnd(cctx, dst, dstCapacity, src, srcSize);
|
||||
|
@ -3015,12 +3017,15 @@ ZSTD_CStream* ZSTD_createCStream(ZSTD_parameters params, unsigned long long pled
|
|||
return zcs;
|
||||
}
|
||||
|
||||
ZSTD_CStream* ZSTD_createCStream_usingCDict(ZSTD_parameters params, const ZSTD_CDict* cdict, unsigned long long pledgedSrcSize, void* workspace, size_t workspaceSize)
|
||||
ZSTD_CStream* ZSTD_createCStream_usingCDict(const ZSTD_CDict* cdict, unsigned long long pledgedSrcSize, void* workspace, size_t workspaceSize)
|
||||
{
|
||||
ZSTD_parameters const params = ZSTD_getParamsFromCDict(cdict);
|
||||
ZSTD_CStream* const zcs = ZSTD_createCStream(params, pledgedSrcSize, workspace, workspaceSize);
|
||||
if (zcs) {
|
||||
zcs->cdict = cdict;
|
||||
zcs->cctx->dictID = params.fParams.noDictIDFlag ? 0 : cdict->refContext->dictID;
|
||||
if (ZSTD_isError(ZSTD_resetCStream_internal(zcs, pledgedSrcSize))) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return zcs;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue