Using ZSTD_MAX_WINDOWLOG instead of INT_MAX

This commit is contained in:
Bimba Shrestha 2020-05-26 09:23:26 -07:00
parent 01b38ef162
commit f847909cf2

View 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);
}