]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fix some casting warnings
authorHavard Graff <havard.graff@gmail.com>
Tue, 24 Apr 2018 20:05:01 +0000 (22:05 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 7 May 2018 17:58:33 +0000 (19:58 +0200)
src/cleanup.c
src/conf.c
src/hashtable.c
src/snprintf.c
src/util.c

index 969b8d2bc80ba147d575be57291a15f46f67cc70..20dc77f78bc4bfe34bc7b10073e28ecfc1ffe742 100644 (file)
@@ -164,8 +164,8 @@ clean_up_dir(struct conf *conf, const char *dir, double limit_multiple)
        // When "max files" or "max cache size" is reached, one of the 16 cache
        // subdirectories is cleaned up. When doing so, files are deleted (in LRU
        // order) until the levels are below limit_multiple.
-       cache_size_threshold = round(conf->max_size * limit_multiple / 16);
-       files_in_cache_threshold = round(conf->max_files * limit_multiple / 16);
+       cache_size_threshold = (uint64_t)round(conf->max_size * limit_multiple / 16);
+       files_in_cache_threshold = (size_t)round(conf->max_files * limit_multiple / 16);
 
        num_files = 0;
        cache_size = 0;
index fbc06af77d100ecc3ad84bc5320479acd92c195f..0ba5e2c11fbb3a1d793b621a0a1b0bd0248e2525 100644 (file)
@@ -377,7 +377,7 @@ conf_free(struct conf *conf)
        free(conf->prefix_command);
        free(conf->prefix_command_cpp);
        free(conf->temporary_dir);
-       free(conf->item_origins);
+       free((void *)conf->item_origins); /* Workaround for MSVC warning */
        free(conf);
 }
 
index 02ab45427fadc890928e8e4b8583660b6e230c38..29cf78ab53582f00b561db2ac0f9a302c3cf6e57 100644 (file)
@@ -51,7 +51,7 @@ static const unsigned int primes[] = {
 805306457, 1610612741
 };
 const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]);
-const float max_load_factor = 0.65;
+const float max_load_factor = 0.65f;
 
 /*****************************************************************************/
 struct hashtable *
index b935ee930e34dfb5bf30bbcd6e5d600c25612042..bc72a5f3383ca49a7b9a2cf9a48c890734fff9af 100644 (file)
@@ -1202,7 +1202,7 @@ again:
         * Factor of ten with the number of digits needed for the fractional
         * part.  For example, if the precision is 3, the mask will be 1000.
         */
-       mask = mypow10(precision);
+       mask = (UINTMAX_T)mypow10(precision);
        /*
         * We "cheat" by converting the fractional part to integer by
         * multiplying by a factor of ten.
@@ -1454,7 +1454,7 @@ cast(LDOUBLE value)
        if (value >= UINTMAX_MAX)
                return UINTMAX_MAX;
 
-       result = value;
+       result = (UINTMAX_T)value;
        /*
         * At least on NetBSD/sparc64 3.0.2 and 4.99.30, casting long double to
         * an integer type converts e.g. 1.9 to 2 instead of 1 (which violates
index dcb8f658ecbd6231bbbd2967cc22a1fda0e625f7..e86323175119cbb2b8321d8ef911ff48a63686af 100644 (file)
@@ -983,7 +983,7 @@ parse_size_with_suffix(const char *str, uint64_t *size)
                // Default suffix: G.
                x *= 1000 * 1000 * 1000;
        }
-       *size = x;
+       *size = (uint64_t)x;
        return true;
 }