From: Yann Collet Date: Sat, 22 Sep 2018 23:10:10 +0000 (-0700) Subject: enforce minimum compression level limit X-Git-Tag: v0.0.29~1^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=364041c6dd28b09e03ddd729d71f607d6936c5c6;p=thirdparty%2Fzstd.git enforce minimum compression level limit using ZSTD_minCLevel() --- diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 3d4548a4b..6b2c5d10a 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -37,8 +37,8 @@ #ifndef ZSTD_NODICT # include "dibio.h" /* ZDICT_cover_params_t, DiB_trainFromFiles() */ #endif -#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_maxCLevel */ -#include "zstd.h" /* ZSTD_VERSION_STRING */ +#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_minCLevel */ +#include "zstd.h" /* ZSTD_VERSION_STRING, ZSTD_maxCLevel */ /*-************************************ @@ -634,9 +634,11 @@ int main(int argCount, const char* argv[]) if (longCommandWArg(&argument, "--fast")) { /* Parse optional acceleration factor */ if (*argument == '=') { + U32 const maxFast = (U32)-ZSTD_minCLevel(); U32 fastLevel; ++argument; fastLevel = readU32FromChar(&argument); + if (fastLevel > maxFast) fastLevel = maxFast; if (fastLevel) { dictCLevel = cLevel = -(int)fastLevel; } else {