force contentSizeFlag=0 when using ZSTD_initCStream_usingCDict()

because by definition srcSize is not known when using this prototype.
added relevant test

Note : this use was already working, because at a later stage
(both ZSTD_compressBegin_usingCDict() and ZSTD_copyCCtx())
pledgedSrcSize=0 is translated into "unknown", no matter the frame parameter.
This is not correct, but of little importance,
as the medium term plan is to no longer set fParams within CDict
This commit is contained in:
Yann Collet
2017-04-11 11:59:44 -07:00
parent ab9162ebb4
commit 4ee6b15dac
2 changed files with 11 additions and 6 deletions
+2 -1
View File
@@ -3077,7 +3077,8 @@ static size_t ZSTD_initCStream_stage2(ZSTD_CStream* zcs,
size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict)
{
if (!cdict) return ERROR(GENERIC); /* cannot handle NULL cdict (does not know what to do) */
{ ZSTD_parameters const params = ZSTD_getParamsFromCDict(cdict);
{ ZSTD_parameters params = ZSTD_getParamsFromCDict(cdict);
params.fParams.contentSizeFlag = 0;
zcs->cdict = cdict;
return ZSTD_initCStream_stage2(zcs, params, 0);
}