summaryrefslogtreecommitdiffstats
path: root/lib/lz4frame.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-04-09 08:41:36 (GMT)
committerYann Collet <cyan@fb.com>2017-04-09 08:41:36 (GMT)
commite2c9b19122a19fa8a46a253e4ce556a5b75fa8b1 (patch)
treec713ab373bca1e02a55036432a90fe8782e31197 /lib/lz4frame.c
parent7eecd32c079cdf1afda8c00bba83dd3a1fee3f62 (diff)
downloadlz4-e2c9b19122a19fa8a46a253e4ce556a5b75fa8b1.zip
lz4-e2c9b19122a19fa8a46a253e4ce556a5b75fa8b1.tar.gz
lz4-e2c9b19122a19fa8a46a253e4ce556a5b75fa8b1.tar.bz2
lz4frame : Added negative compression levels
Diffstat (limited to 'lib/lz4frame.c')
-rw-r--r--lib/lz4frame.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index fc0c7b5..356be8a 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -517,14 +517,14 @@ static size_t LZ4F_compressBlock(void* dst, const void* src, size_t srcSize, com
static int LZ4F_localLZ4_compress_limitedOutput_withState(void* ctx, const char* src, char* dst, int srcSize, int dstCapacity, int level)
{
- (void) level;
- return LZ4_compress_fast_extState(ctx, src, dst, srcSize, dstCapacity, 1);
+ int const acceleration = (level < -1) ? -level : 1;
+ return LZ4_compress_fast_extState(ctx, src, dst, srcSize, dstCapacity, acceleration);
}
static int LZ4F_localLZ4_compress_limitedOutput_continue(void* ctx, const char* src, char* dst, int srcSize, int dstCapacity, int level)
{
- (void) level;
- return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, 1);
+ int const acceleration = (level < -1) ? -level : 1;
+ return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, acceleration);
}
static int LZ4F_localLZ4_compressHC_limitedOutput_continue(void* ctx, const char* src, char* dst, int srcSize, int dstSize, int level)
@@ -619,7 +619,7 @@ size_t LZ4F_compressUpdate(LZ4F_cctx* cctxPtr, void* dstBuffer, size_t dstCapaci
if (compressOptionsPtr->stableSrc) {
cctxPtr->tmpIn = cctxPtr->tmpBuff;
} else {
- int realDictSize = LZ4F_localSaveDict(cctxPtr);
+ int const realDictSize = LZ4F_localSaveDict(cctxPtr);
if (realDictSize==0) return err0r(LZ4F_ERROR_GENERIC);
cctxPtr->tmpIn = cctxPtr->tmpBuff + realDictSize;
}
@@ -629,7 +629,7 @@ size_t LZ4F_compressUpdate(LZ4F_cctx* cctxPtr, void* dstBuffer, size_t dstCapaci
if ((cctxPtr->tmpIn + blockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize) /* necessarily LZ4F_blockLinked && lastBlockCompressed==fromTmpBuffer */
&& !(cctxPtr->prefs.autoFlush))
{
- int realDictSize = LZ4F_localSaveDict(cctxPtr);
+ int const realDictSize = LZ4F_localSaveDict(cctxPtr);
cctxPtr->tmpIn = cctxPtr->tmpBuff + realDictSize;
}