summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.c
diff options
context:
space:
mode:
authorAlexey Tourbin <alexey.tourbin@gmail.com>2017-04-29 12:52:51 (GMT)
committerAlexey Tourbin <alexey.tourbin@gmail.com>2017-04-29 13:33:15 (GMT)
commit6cf1f7d758c23d6033d388eabbbb50380c364d2e (patch)
tree45d6f739827a141cb2df0a59380627f5a7d79aa7 /lib/lz4hc.c
parenta41df535f709fcb6ccba079dd4d630c4ec4f7151 (diff)
downloadlz4-6cf1f7d758c23d6033d388eabbbb50380c364d2e.zip
lz4-6cf1f7d758c23d6033d388eabbbb50380c364d2e.tar.gz
lz4-6cf1f7d758c23d6033d388eabbbb50380c364d2e.tar.bz2
lz4hc.c: clamp compression levels > 12
I noticed that, while 'lz4 -12' works fine, 'lz4 -13' does not compress at all. $ cat </etc/passwd |wc -c 2565 $ lz4 -12 </etc/passwd |wc -c 1456 $ lz4 -13 </etc/passwd |wc -c 2584 Perhaps the best way to fix this is to clamp the compression level in the LZ4HC_compress_generic routine.
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r--lib/lz4hc.c2
1 files changed, 2 insertions, 0 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);