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.
This commit is contained in:
parent
a41df535f7
commit
6cf1f7d758
@ -555,6 +555,8 @@ static int LZ4HC_compress_generic (
|
|||||||
ctx->searchNum = LZ4HC_getSearchNum(cLevel);
|
ctx->searchNum = LZ4HC_getSearchNum(cLevel);
|
||||||
return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, 128, 0);
|
return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, 128, 0);
|
||||||
default:
|
default:
|
||||||
|
cLevel = 12;
|
||||||
|
/* pass-through */
|
||||||
case 12:
|
case 12:
|
||||||
ctx->searchNum = LZ4HC_getSearchNum(cLevel);
|
ctx->searchNum = LZ4HC_getSearchNum(cLevel);
|
||||||
return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, LZ4_OPT_NUM, 1);
|
return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, LZ4_OPT_NUM, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user