From 76116495bfd2096f06c923ebe865c59e42f32b07 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 29 May 2019 13:14:52 -0700 Subject: some more minor conversion warnings fixes --- Makefile | 2 +- lib/lz4.c | 8 ++++---- tests/fuzzer.c | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index e24cec5..3e55046 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ allmost: lib lz4 .PHONY: lib lib-release liblz4.a lib: liblz4.a lib lib-release liblz4.a: - @$(MAKE) -C $(LZ4DIR) $@ + @CFLAGS="$(CFLAGS)" $(MAKE) -C $(LZ4DIR) $@ .PHONY: lz4 lz4-release lz4 : liblz4.a diff --git a/lib/lz4.c b/lib/lz4.c index a198a03..4451bfc 100644 --- a/lib/lz4.c +++ b/lib/lz4.c @@ -462,7 +462,7 @@ static unsigned LZ4_NbCommonBytes (reg_t val) _BitScanForward64( &r, (U64)val ); return (int)(r>>3); # elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_ctzll((U64)val) >> 3); + return (unsigned)__builtin_ctzll((U64)val) >> 3; # else static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, 0, 3, 1, 3, 1, 4, 2, 7, @@ -480,7 +480,7 @@ static unsigned LZ4_NbCommonBytes (reg_t val) _BitScanForward( &r, (U32)val ); return (int)(r>>3); # elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_ctz((U32)val) >> 3); + return (unsigned)__builtin_ctz((U32)val) >> 3; # else static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, @@ -496,7 +496,7 @@ static unsigned LZ4_NbCommonBytes (reg_t val) _BitScanReverse64( &r, val ); return (unsigned)(r>>3); # elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_clzll((U64)val) >> 3); + return (unsigned)__builtin_clzll((U64)val) >> 3; # else static const U32 by32 = sizeof(val)*4; /* 32 on 64 bits (goal), 16 on 32 bits. Just to avoid some static analyzer complaining about shift by 32 on 32-bits target. @@ -513,7 +513,7 @@ static unsigned LZ4_NbCommonBytes (reg_t val) _BitScanReverse( &r, (unsigned long)val ); return (unsigned)(r>>3); # elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT) - return (__builtin_clz((U32)val) >> 3); + return (unsigned)__builtin_clz((U32)val) >> 3; # else unsigned r; if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; } diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 8107cb8..9225e5b 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -1015,10 +1015,10 @@ static void FUZ_unitTests(int compressionLevel) /* in-place compression test */ DISPLAYLEVEL(3, "in-place compression using LZ4_compress_default() :"); - { size_t const sampleSize = 65 KB; - size_t const maxCSize = LZ4_COMPRESSBOUND(sampleSize); - size_t const outSize = LZ4_COMPRESS_INPLACE_BUFFER_SIZE(maxCSize); - size_t const startIndex = outSize - sampleSize; + { int const sampleSize = 65 KB; + int const maxCSize = LZ4_COMPRESSBOUND(sampleSize); + int const outSize = LZ4_COMPRESS_INPLACE_BUFFER_SIZE(maxCSize); + int const startIndex = outSize - sampleSize; char* const startInput = testCompressed + startIndex; XXH32_hash_t const crcOrig = XXH32(testInput, sampleSize, 0); int cSize; @@ -1028,7 +1028,7 @@ static void FUZ_unitTests(int compressionLevel) cSize = LZ4_compress_default(startInput, testCompressed, sampleSize, maxCSize); assert(cSize != 0); /* ensure compression is successful */ assert(maxCSize < INT_MAX); - assert(cSize <= (int)maxCSize); + assert(cSize <= maxCSize); /* decompress and verify */ { int const dSize = LZ4_decompress_safe(testCompressed, testVerify, cSize, testInputSize); assert(dSize == (int)sampleSize); /* correct size */ -- cgit v0.12