From: Trond Norbye Date: Thu, 10 Sep 2009 10:57:11 +0000 (+0200) Subject: Fix compilation issues with gcc 4.4.1 on macosx X-Git-Tag: 0.32~3^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=f0c2cbb3c6cb62fae50fefe373e50590a6bd50c3;p=awesomized%2Flibmemcached Fix compilation issues with gcc 4.4.1 on macosx --- diff --git a/clients/execute.c b/clients/execute.c index a0e31ee9..e2548339 100644 --- a/clients/execute.c +++ b/clients/execute.c @@ -46,7 +46,7 @@ unsigned int execute_get(memcached_st *memc, pairs_st *pairs, unsigned int numbe uint32_t flags; unsigned int fetch_key; - fetch_key= (unsigned int)(random() % number_of); + fetch_key= (unsigned int)random() % number_of; value= memcached_get(memc, pairs[fetch_key].key, pairs[fetch_key].key_length, &value_length, &flags, &rc); diff --git a/clients/generator.c b/clients/generator.c index cd1a17bf..213246ba 100644 --- a/clients/generator.c +++ b/clients/generator.c @@ -47,9 +47,7 @@ void pairs_free(pairs_st *pairs) pairs_st *pairs_generate(uint64_t number_of, size_t value_length) { unsigned int x; - pairs_st *pairs; - - pairs= (pairs_st*)calloc(number_of + 1, sizeof(pairs_st)); + pairs_st *pairs= calloc((size_t)(number_of + 1), sizeof(pairs_st)); if (!pairs) goto error; diff --git a/clients/memstat.c b/clients/memstat.c index 37e18e22..e6783b68 100644 --- a/clients/memstat.c +++ b/clients/memstat.c @@ -169,11 +169,11 @@ static void run_analyzer(memcached_st *memc, memcached_stat_st *memc_stat, gettimeofday(&end_time, NULL); elapsed_time= timedif(end_time, start_time); - elapsed_time /= num_of_tests; + elapsed_time /= (long)num_of_tests; if (elapsed_time > slowest_time) { - slowest_server= x; + slowest_server= (long)x; slowest_time= elapsed_time; } diff --git a/libmemcached/memcached_auto.c b/libmemcached/memcached_auto.c index c0c6269a..084d7a38 100644 --- a/libmemcached/memcached_auto.c +++ b/libmemcached/memcached_auto.c @@ -63,7 +63,7 @@ static memcached_return memcached_auto(memcached_st *ptr, static memcached_return binary_incr_decr(memcached_st *ptr, uint8_t cmd, const char *key, size_t key_length, uint64_t offset, uint64_t initial, - time_t expiration, + uint32_t expiration, uint64_t *value) { unsigned int server_key; @@ -165,7 +165,8 @@ memcached_return memcached_increment_with_initial(memcached_st *ptr, LIBMEMCACHED_MEMCACHED_INCREMENT_WITH_INITIAL_START(); if (ptr->flags & MEM_BINARY_PROTOCOL) rc= binary_incr_decr(ptr, PROTOCOL_BINARY_CMD_INCREMENT, key, - key_length, offset, initial, expiration, value); + key_length, offset, initial, (uint32_t)expiration, + value); else rc= MEMCACHED_PROTOCOL_ERROR; @@ -189,7 +190,8 @@ memcached_return memcached_decrement_with_initial(memcached_st *ptr, LIBMEMCACHED_MEMCACHED_DECREMENT_WITH_INITIAL_START(); if (ptr->flags & MEM_BINARY_PROTOCOL) rc= binary_incr_decr(ptr, PROTOCOL_BINARY_CMD_DECREMENT, key, - key_length, offset, initial, expiration, value); + key_length, offset, initial, (uint32_t)expiration, + value); else rc= MEMCACHED_PROTOCOL_ERROR; diff --git a/tests/function.c b/tests/function.c index f4877a95..d3b67f0f 100644 --- a/tests/function.c +++ b/tests/function.c @@ -3344,7 +3344,7 @@ static memcached_return poll_timeout(memcached_st *memc) memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, timeout); - timeout= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT); + timeout= (size_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT); assert(timeout == 100);