fix compilation warnings with recent compiler
authorOlivier Matz <zer0@droids-corp.org>
Wed, 9 Oct 2019 17:44:41 +0000 (19:44 +0200)
committerOlivier Matz <zer0@droids-corp.org>
Wed, 9 Oct 2019 17:44:41 +0000 (19:44 +0200)
src/ecoli_malloc.c
src/ecoli_murmurhash.c

index 5a022ae..e7f02df 100644 (file)
@@ -7,6 +7,7 @@
 #include <ecoli_malloc.h>
 
 #include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 #include <errno.h>
 
@@ -164,7 +165,10 @@ static int ec_malloc_testcase(void)
        ec_free_func(ptr);
        ptr = NULL;
 
-       ptr = ec_calloc(2, (size_t)-1);
+       /* here we use atoll() instead of a constant because we want to
+        * prevent the compiler to check the overflow at compilation
+        * time */
+       ptr = ec_calloc(2, atoll("0xffffffffffffffff"));
        EC_TEST_CHECK(ptr == NULL, "bad overflow check in ec_calloc\n");
 
        return testres;
index 7aafece..8b45f6e 100644 (file)
@@ -27,8 +27,8 @@ uint32_t ec_murmurhash3(const void *key, int len, uint32_t seed)
        k1 = 0;
 
        switch(len & 3) {
-       case 3: k1 ^= tail[2] << 16;
-       case 2: k1 ^= tail[1] << 8;
+       case 3: k1 ^= tail[2] << 16; /* fallthrough */
+       case 2: k1 ^= tail[1] << 8; /* fallthrough */
        case 1: k1 ^= tail[0];
                h1 = ec_murmurhash3_add32(h1, k1);
        };