diff options
author | Yann Collet <yann.collet.73@gmail.com> | 2015-04-01 14:53:08 (GMT) |
---|---|---|
committer | Yann Collet <yann.collet.73@gmail.com> | 2015-04-01 14:53:08 (GMT) |
commit | 28e237e954098c418f048a871aa53199d92314f4 (patch) | |
tree | 990e4712dc0b63ac1e9ae10d8b8b55235de533a4 /lib/lz4.c | |
parent | 89eee0d28b2b7c5954e1cb0dce60542e4c597130 (diff) | |
download | lz4-28e237e954098c418f048a871aa53199d92314f4.zip lz4-28e237e954098c418f048a871aa53199d92314f4.tar.gz lz4-28e237e954098c418f048a871aa53199d92314f4.tar.bz2 |
simplified LZ4_compress_limitedOutput()
Diffstat (limited to 'lib/lz4.c')
-rw-r--r-- | lib/lz4.c | 19 |
1 files changed, 3 insertions, 16 deletions
@@ -771,26 +771,13 @@ int LZ4_compress_withState (void* state, const char* source, char* dest, int inp int LZ4_compress_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize) { #if (HEAPMODE) - void* ctx = ALLOCATOR(LZ4_STREAMSIZE_U64, 8); /* Aligned on 8-bytes boundaries */ + void* ctx = ALLOCATOR(LZ4_STREAMSIZE_U64, 8); /* malloc-calloc aligned on 8-bytes boundaries */ #else U64 ctx[LZ4_STREAMSIZE_U64] = {0}; /* Ensure data is aligned on 8-bytes boundaries */ #endif - int result; - if (maxOutputSize >= LZ4_compressBound(inputSize)) - { - if (inputSize < LZ4_64Klimit) - result = LZ4_compress_generic((void*)ctx, source, dest, inputSize, 0, notLimited, byU16, noDict, noDictIssue, 1); - else - result = LZ4_compress_generic((void*)ctx, source, dest, inputSize, 0, notLimited, LZ4_64bits() ? byU32 : byPtr, noDict, noDictIssue, 1); - } - else - { - if (inputSize < LZ4_64Klimit) - result = LZ4_compress_generic((void*)ctx, source, dest, inputSize, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, 1); - else - result = LZ4_compress_generic((void*)ctx, source, dest, inputSize, maxOutputSize, limitedOutput, LZ4_64bits() ? byU32 : byPtr, noDict, noDictIssue, 1); - } + int result = LZ4_compress_limitedOutput_withState(ctx, source, dest, inputSize, maxOutputSize); + #if (HEAPMODE) FREEMEM(ctx); #endif |