From 1c5a6304a2ab4d8b8d3f30cc371df10e537431ae Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 11 Jun 2014 22:02:46 +0100 Subject: CLI : can select compression level > 9 --- lz4hc.h | 1 + programs/Makefile | 2 +- programs/lz4cli.c | 27 +++++++++++++-------------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lz4hc.h b/lz4hc.h index b810978..deb2394 100644 --- a/lz4hc.h +++ b/lz4hc.h @@ -104,6 +104,7 @@ They just use the externally allocated memory area instead of allocating their o /************************************** Streaming Functions **************************************/ +/* Note : these streaming functions still follows the older model */ void* LZ4_createHC (const char* inputBuffer); int LZ4_compressHC_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize); int LZ4_compressHC_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize); diff --git a/programs/Makefile b/programs/Makefile index 35bfd06..811dda2 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -165,6 +165,6 @@ test-mem: lz4 datagen rm tmp test-mem32: lz4c32 datagen -# unfortunately, valgrind doesn't work with non-native binary. If someone knows how to valgrind-test a 32-bits exe on a 64-bits system... +# unfortunately, valgrind doesn't seem to work with non-native binary. If someone knows how to do a valgrind-test on a 32-bits exe with a 64-bits system... endif diff --git a/programs/lz4cli.c b/programs/lz4cli.c index e05a9a9..fd2721d 100644 --- a/programs/lz4cli.c +++ b/programs/lz4cli.c @@ -344,6 +344,19 @@ int main(int argc, char** argv) if (*argument=='s') { displayLevel=1; continue; } // -s (silent mode) #endif // DISABLE_LZ4C_LEGACY_OPTIONS + if ((*argument>='0') && (*argument<='9')) + { + cLevel = 0; + while ((*argument >= '0') && (*argument <= '9')) + { + cLevel *= 10; + cLevel += *argument - '0'; + argument++; + } + argument--; + continue; + } + switch(argument[0]) { // Display help @@ -354,20 +367,6 @@ int main(int argc, char** argv) // Compression (default) case 'z': forceCompress = 1; break; - // Compression level - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': /* non documented (hidden) */ - cLevel=*argument -'0'; break; - // Use Legacy format (for Linux kernel compression) case 'l': legacy_format=1; break; -- cgit v0.12