diff options
author | Yann Collet <cyan@fb.com> | 2016-11-10 01:39:53 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2016-11-10 01:39:53 (GMT) |
commit | f34808e4ae183d049e5e13949941d44876fdb90c (patch) | |
tree | e3fc8736539048114fc00939abe7b2d92640c3d3 /programs/lz4cli.c | |
parent | 46f74d79b7b2ae17825a15168034126e70dcc6a0 (diff) | |
download | lz4-f34808e4ae183d049e5e13949941d44876fdb90c.zip lz4-f34808e4ae183d049e5e13949941d44876fdb90c.tar.gz lz4-f34808e4ae183d049e5e13949941d44876fdb90c.tar.bz2 |
fixed some static analyzer warning
Diffstat (limited to 'programs/lz4cli.c')
-rw-r--r-- | programs/lz4cli.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/programs/lz4cli.c b/programs/lz4cli.c index b8e34fa..1f6b391 100644 --- a/programs/lz4cli.c +++ b/programs/lz4cli.c @@ -498,9 +498,8 @@ int main(int argc, const char** argv) } DISPLAYLEVEL(3, WELCOME_MESSAGE); - if (mode == om_compress) DISPLAYLEVEL(4, "Blocks size : %i KB\n", blockSize>>10); + if ((mode == om_compress) || (mode == om_bench)) DISPLAYLEVEL(4, "Blocks size : %i KB\n", blockSize>>10); - /* No input filename ==> use stdin */ if (multiple_inputs) { input_filename = inFileNames[0]; #ifdef UTIL_HAS_CREATEFILELIST @@ -542,9 +541,10 @@ int main(int argc, const char** argv) while (!output_filename) { if (!IS_CONSOLE(stdout)) { output_filename=stdoutmark; break; } /* Default to stdout whenever possible (i.e. not a console) */ if (mode == om_auto) { /* auto-determine compression or decompression, based on file extension */ - size_t const inSize = strlen(input_filename); + size_t const inSize = strlen(input_filename); size_t const extSize = strlen(LZ4_EXTENSION); - if (!strcmp(input_filename+(inSize-extSize), LZ4_EXTENSION)) mode = om_decompress; + size_t const extStart= (inSize > extSize) ? inSize-extSize : 0; + if (!strcmp(input_filename+extStart, LZ4_EXTENSION)) mode = om_decompress; else mode = om_compress; } if (mode == om_compress) { /* compression to file */ |