]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Using ZSTD_MAX_WINDOWLOG instead of INT_MAX 2178/head
authorBimba Shrestha <bimbashrestha@fb.com>
Tue, 26 May 2020 16:23:26 +0000 (09:23 -0700)
committerBimba Shrestha <bimbashrestha@fb.com>
Tue, 26 May 2020 16:23:26 +0000 (09:23 -0700)
programs/fileio.c

index 46772e18865b9de4bd73208c4f6c3ae8a16de331..762439501cd82b43536a75a5ee0eadeff78bebfa 100644 (file)
@@ -771,9 +771,10 @@ static void FIO_adjustMemLimitForPatchFromMode(FIO_prefs_t* const prefs,
                                     unsigned long long const maxSrcFileSize)
 {
     unsigned long long maxSize = MAX(prefs->memLimit, MAX(dictSize, maxSrcFileSize));
+    unsigned const maxWindowSize = (1U << ZSTD_WINDOWLOG_MAX);
     assert(maxSize != UTIL_FILESIZE_UNKNOWN);
-    if (maxSize > INT_MAX)
-        EXM_THROW(42, "Can't handle files larger than %u GB\n", INT_MAX/(1 GB) + 1);
+    if (maxSize > maxWindowSize)
+        EXM_THROW(42, "Can't handle files larger than %u GB\n", maxWindowSize/(1 GB));
     FIO_setMemLimit(prefs, (unsigned)maxSize);
 }