Fix compilation issues with gcc 4.4.1 on macosx
authorTrond Norbye <trond.norbye@sun.com>
Thu, 10 Sep 2009 10:57:11 +0000 (12:57 +0200)
committerTrond Norbye <trond.norbye@sun.com>
Thu, 10 Sep 2009 10:57:11 +0000 (12:57 +0200)
clients/execute.c
clients/generator.c
clients/memstat.c
libmemcached/memcached_auto.c
tests/function.c

index a0e31ee9d51eab651a4e08cd269c2dc993ba15b7..e25483392e2876e51b61b202c684a437bd23f423 100644 (file)
@@ -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);
index cd1a17bfe71059fceb49fff382b7975220284b35..213246ba2206a3d84916c8503c43c089bc26e975 100644 (file)
@@ -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;
index 37e18e229c8e6e10193207d0aeb8d02687ca8712..e6783b68c095c7a8de4b2f88309a2ce5f53aceed 100644 (file)
@@ -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;
       }
 
index c0c6269af7a71ce64f71d7c9e15a830fe9e1b0ed..084d7a381c37deb2d30c0d6371f7ced08b9604f0 100644 (file)
@@ -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;
 
index f4877a953a333d7c0548fcb1072dc9b93335e390..d3b67f0ff4b320f59b6af25bfce78df785e3cafd 100644 (file)
@@ -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);