summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2019-05-29 20:14:52 (GMT)
committerYann Collet <cyan@fb.com>2019-05-29 20:14:52 (GMT)
commit76116495bfd2096f06c923ebe865c59e42f32b07 (patch)
treecc52a0d4c70bd6c4879d4209d798fff0b438c198
parentc5bcb4d68b44bd276523cd354424b89efe511b76 (diff)
downloadlz4-76116495bfd2096f06c923ebe865c59e42f32b07.zip
lz4-76116495bfd2096f06c923ebe865c59e42f32b07.tar.gz
lz4-76116495bfd2096f06c923ebe865c59e42f32b07.tar.bz2
some more minor conversion warnings fixes
-rw-r--r--Makefile2
-rw-r--r--lib/lz4.c8
-rw-r--r--tests/fuzzer.c10
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 */