summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2017-04-30 05:33:39 (GMT)
committerGitHub <noreply@github.com>2017-04-30 05:33:39 (GMT)
commit11bfedb6c3b30b71c54e15ecbde9fab396d444e5 (patch)
tree45d6f739827a141cb2df0a59380627f5a7d79aa7
parent37ef330cd8780accf07f872ed465962a56bb8be7 (diff)
parent6cf1f7d758c23d6033d388eabbbb50380c364d2e (diff)
downloadlz4-11bfedb6c3b30b71c54e15ecbde9fab396d444e5.zip
lz4-11bfedb6c3b30b71c54e15ecbde9fab396d444e5.tar.gz
lz4-11bfedb6c3b30b71c54e15ecbde9fab396d444e5.tar.bz2
Merge pull request #349 from svpv/master
clamp hc levels > 12 + minor fixes in comments
-rw-r--r--lib/lz4hc.c2
-rw-r--r--lib/lz4hc.h4
-rw-r--r--programs/lz4cli.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index ac15d20..16fe029 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -555,6 +555,8 @@ static int LZ4HC_compress_generic (
ctx->searchNum = LZ4HC_getSearchNum(cLevel);
return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, 128, 0);
default:
+ cLevel = 12;
+ /* pass-through */
case 12:
ctx->searchNum = LZ4HC_getSearchNum(cLevel);
return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, LZ4_OPT_NUM, 1);
diff --git a/lib/lz4hc.h b/lib/lz4hc.h
index 2e3880d..c4284c0 100644
--- a/lib/lz4hc.h
+++ b/lib/lz4hc.h
@@ -58,8 +58,8 @@ extern "C" {
* `dst` must be already allocated.
* Compression is guaranteed to succeed if `dstCapacity >= LZ4_compressBound(srcSize)` (see "lz4.h")
* Max supported `srcSize` value is LZ4_MAX_INPUT_SIZE (see "lz4.h")
- * `compressionLevel` : Recommended values are between 4 and 9, although any value between 1 and LZ4HC_MAX_CLEVEL will work.
- * Values >LZ4HC_MAX_CLEVEL behave the same as LZ4HC_MAX_CLEVEL.
+ * `compressionLevel` : Recommended values are between 4 and 9, although any value between 1 and LZ4HC_CLEVEL_MAX will work.
+ * Values >LZ4HC_CLEVEL_MAX behave the same as LZ4HC_CLEVEL_MAX.
* @return : the number of bytes written into 'dst'
* or 0 if compression fails.
*/
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 329ca0b..10aa5aa 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -49,7 +49,7 @@
#include <string.h> /* strcmp, strlen */
#include "bench.h" /* BMK_benchFile, BMK_SetNbIterations, BMK_SetBlocksize, BMK_SetPause */
#include "lz4io.h" /* LZ4IO_compressFilename, LZ4IO_decompressFilename, LZ4IO_compressMultipleFilenames */
-#include "lz4hc.h" /* LZ4HC_DEFAULT_CLEVEL */
+#include "lz4hc.h" /* LZ4HC_CLEVEL_MAX */
#include "lz4.h" /* LZ4_VERSION_STRING */