From: Bimba Shrestha Date: Thu, 18 Jun 2020 16:28:18 +0000 (-0700) Subject: passing streamSrcSize when set X-Git-Tag: v1.4.7~136^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6653321ba34f593e04dca5f57b3a22f9bdc91675;p=thirdparty%2Fzstd.git passing streamSrcSize when set --- diff --git a/programs/fileio.c b/programs/fileio.c index e0f7fdef2..390e8def5 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -839,8 +839,10 @@ static cRess_t FIO_createCResources(FIO_prefs_t* const prefs, /* need to update memLimit before calling createDictBuffer * because of memLimit check inside it */ - if (prefs->patchFromMode) - FIO_adjustParamsForPatchFromMode(prefs, &comprParams, UTIL_getFileSize(dictFileName), maxSrcFileSize, cLevel); + if (prefs->patchFromMode) { + unsigned long long const ssSize = (unsigned long long)prefs->streamSrcSize; + FIO_adjustParamsForPatchFromMode(prefs, &comprParams, UTIL_getFileSize(dictFileName), ssSize > 0 ? ssSize : maxSrcFileSize, cLevel); + } ress.dstBuffer = malloc(ress.dstBufferSize); ress.dictBufferSize = FIO_createDictBuffer(&ress.dictBuffer, dictFileName, prefs); /* works with dictFileName==NULL */ if (!ress.srcBuffer || !ress.dstBuffer)