]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
passing streamSrcSize when set
authorBimba Shrestha <bimbashrestha@fb.com>
Thu, 18 Jun 2020 16:28:18 +0000 (09:28 -0700)
committerBimba Shrestha <bimbashrestha@fb.com>
Thu, 18 Jun 2020 16:28:18 +0000 (09:28 -0700)
programs/fileio.c

index e0f7fdef214af13b3982d7113d093e494e5220f4..390e8def5d2450a04b5518ebc685ee3c97458706 100644 (file)
@@ -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)