]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
ensured compression level is maxed at ZSTD_maxCLevel()
authorYann Collet <cyan@fb.com>
Fri, 17 Aug 2018 23:01:56 +0000 (16:01 -0700)
committerYann Collet <cyan@fb.com>
Fri, 17 Aug 2018 23:01:56 +0000 (16:01 -0700)
programs/fileio.c

index 68b2f1593b9b32d10dd16a96b22f693248ca7226..02da1df95b4c721489c4da84b46399948b2e4992 100644 (file)
@@ -860,10 +860,11 @@ FIO_compressZstdFrame(const cRess_t* ressPtr,
                             DISPLAYLEVEL(6, "slower speed , higher compression \n")
                             compressionLevel ++;
                             compressionLevel += (compressionLevel == 0);   /* skip 0 */
+                            if (compressionLevel > ZSTD_maxCLevel()) compressionLevel = ZSTD_maxCLevel();
                             ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_compressionLevel, (unsigned)compressionLevel);
                         }
                         if (speedChange == faster) {
-                            DISPLAYLEVEL(6, "slower speed , higher compression \n")
+                            DISPLAYLEVEL(6, "faster speed , lighter compression \n")
                             compressionLevel --;
                             compressionLevel -= (compressionLevel == 0);   /* skip 0 */
                             ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_compressionLevel, (unsigned)compressionLevel);