Merge from trunk.
authorPadraig O'Sullivan <osullivan.padraig@gmail.com>
Tue, 4 Aug 2009 03:22:07 +0000 (23:22 -0400)
committerPadraig O'Sullivan <osullivan.padraig@gmail.com>
Tue, 4 Aug 2009 03:22:07 +0000 (23:22 -0400)
25 files changed:
libmemcached/memcached_analyze.c
libmemcached/memcached_auto.c
libmemcached/memcached_behavior.c
libmemcached/memcached_connect.c
libmemcached/memcached_delete.c
libmemcached/memcached_do.c
libmemcached/memcached_dump.c
libmemcached/memcached_flush.c
libmemcached/memcached_get.c
libmemcached/memcached_hash.c
libmemcached/memcached_hosts.c
libmemcached/memcached_io.c
libmemcached/memcached_parse.c
libmemcached/memcached_purge.c
libmemcached/memcached_quit.c
libmemcached/memcached_response.c
libmemcached/memcached_stats.c
libmemcached/memcached_storage.c
libmemcached/memcached_string.c
libmemcached/memcached_verbosity.c
libmemcached/murmur_hash.c
m4/lib-prefix.m4
m4/pandora_64bit.m4
m4/pandora_canonical.m4
m4/pandora_have_libpq.m4 [new file with mode: 0644]

index 41fee38492aa39ad9867204e5533ca95b8d76c09..61cea334c8f5908f9c515d2d23bd1ef00e9c036f 100644 (file)
@@ -24,10 +24,10 @@ static void calc_oldest_node(memcached_analysis_st *result,
 
 static void calc_least_free_node(memcached_analysis_st *result,
                                  const uint32_t server_num,
-                                 const long max_allowed_bytes,
-                                 const long used_bytes)
+                                 const uint64_t max_allowed_bytes,
+                                 const uint64_t used_bytes)
 {
-  uint64_t remaining_bytes= (uint64_t)max_allowed_bytes - used_bytes;
+  uint64_t remaining_bytes= max_allowed_bytes - used_bytes;
 
   if (result->least_remaining_bytes == 0 ||
       remaining_bytes < result->least_remaining_bytes)
@@ -42,7 +42,7 @@ static void calc_average_item_size(memcached_analysis_st *result,
                                    const uint64_t total_bytes)
 {
   if (total_items > 0 && total_bytes > 0)
-    result->average_item_size= total_bytes / total_items;
+    result->average_item_size= (uint32_t) (total_bytes / total_items);
 }
 
 static void calc_hit_ratio(memcached_analysis_st *result,
@@ -55,7 +55,7 @@ static void calc_hit_ratio(memcached_analysis_st *result,
     return;
   }
 
-  double temp= (double)total_get_hits/total_get_cmds;
+  double temp= (double) (total_get_hits/total_get_cmds);
   result->pool_hit_ratio= temp * 100;
 }
 
@@ -84,7 +84,8 @@ memcached_analysis_st *memcached_analyze(memcached_st *memc,
     calc_largest_consumption(result, x, memc_stat[x].bytes);
     calc_oldest_node(result, x, memc_stat[x].uptime);
     calc_least_free_node(result, x,
-                         memc_stat[x].limit_maxbytes, memc_stat[x].bytes);
+                         memc_stat[x].limit_maxbytes, 
+                         memc_stat[x].bytes);
 
     total_get_hits+= memc_stat[x].get_hits;
     total_get_cmds+= memc_stat[x].cmd_get;
index 176cbcc908e3c3179beb73e2845d773662210891..c0c6269af7a71ce64f71d7c9e15a830fe9e1b0ed 100644 (file)
@@ -85,13 +85,13 @@ static memcached_return binary_incr_decr(memcached_st *ptr, uint8_t cmd,
 
   request.message.header.request.magic= PROTOCOL_BINARY_REQ;
   request.message.header.request.opcode= cmd;
-  request.message.header.request.keylen= htons(key_length);
+  request.message.header.request.keylen= htons((uint16_t) key_length);
   request.message.header.request.extlen= 20;
   request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
-  request.message.header.request.bodylen= htonl(key_length + request.message.header.request.extlen);  
+  request.message.header.request.bodylen= htonl((uint32_t) (key_length + request.message.header.request.extlen));
   request.message.body.delta= htonll(offset);
   request.message.body.initial= htonll(initial);
-  request.message.body.expiration= htonl(expiration);
+  request.message.body.expiration= htonl((uint32_t) expiration);
 
   if ((memcached_do(&ptr->hosts[server_key], request.bytes,
                     sizeof(request.bytes), 0)!=MEMCACHED_SUCCESS) ||
index aa80f8c209ba25090e014b8d75f282b8c5f787ab..5241c3c8f7eb700c0206fb8388682afc7601bddb 100644 (file)
@@ -28,13 +28,13 @@ memcached_return memcached_behavior_set(memcached_st *ptr,
     ptr->number_of_replicas= (uint32_t)data;
     break;
   case MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK:
-    ptr->io_msg_watermark= (int32_t)data;
+    ptr->io_msg_watermark= (uint32_t) data;
     break;
   case MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK:
-    ptr->io_bytes_watermark= (int32_t)data;
+    ptr->io_bytes_watermark= (uint32_t)data;
     break;
   case MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH:
-    ptr->io_key_prefetch = (int32_t)data;
+    ptr->io_key_prefetch = (uint32_t)data;
     break;
   case MEMCACHED_BEHAVIOR_SND_TIMEOUT:
     ptr->snd_timeout= (int32_t)data;
@@ -77,7 +77,7 @@ memcached_return memcached_behavior_set(memcached_st *ptr,
       ptr->distribution= (memcached_server_distribution)(data);
       if (ptr->distribution == MEMCACHED_DISTRIBUTION_RANDOM)
       {
-        srandom(time(NULL));
+        srandom((uint32_t) time(NULL));
       }
       run_distribution(ptr);
       break;
@@ -214,7 +214,7 @@ uint64_t memcached_behavior_get(memcached_st *ptr,
   case MEMCACHED_BEHAVIOR_DISTRIBUTION:
     return ptr->distribution;
   case MEMCACHED_BEHAVIOR_KETAMA:
-    return (ptr->distribution == MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA) ? 1 : 0;
+    return (ptr->distribution == MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA) ? (uint64_t) 1 : 0;
   case MEMCACHED_BEHAVIOR_HASH:
     return ptr->hash;
   case MEMCACHED_BEHAVIOR_KETAMA_HASH:
@@ -254,7 +254,7 @@ uint64_t memcached_behavior_get(memcached_st *ptr,
                      SO_SNDBUF, &sock_size, &sock_length))
         return 0; /* Zero means error */
 
-      return sock_size;
+      return (uint64_t) sock_size;
     }
   case MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE:
     {
@@ -270,7 +270,7 @@ uint64_t memcached_behavior_get(memcached_st *ptr,
                      SO_RCVBUF, &sock_size, &sock_length))
         return 0; /* Zero means error */
 
-      return sock_size;
+      return (uint64_t) sock_size;
     }
   case MEMCACHED_BEHAVIOR_USER_DATA:
     return MEMCACHED_FAILURE;
index 0d61f847bab0996e2de08a41ba333b47851b720c..93738f4aa3d9173b3fc59d9e53b958b0b4ea31c6 100644 (file)
@@ -152,7 +152,7 @@ static memcached_return unix_socket_connect(memcached_server_st *ptr)
     servAddr.sun_family= AF_UNIX;
     strcpy(servAddr.sun_path, ptr->hostname); /* Copy filename */
 
-    addrlen= strlen(servAddr.sun_path) + sizeof(servAddr.sun_family);
+    addrlen= (socklen_t) (strlen(servAddr.sun_path) + sizeof(servAddr.sun_family));
 
 test_connect:
     if (connect(ptr->fd, 
index 978ec29c1aaa183a2c2c8d4e8551a526bdafb056..8e732834199ef4667fed3d93299f5bde247c3597 100644 (file)
@@ -12,14 +12,14 @@ static inline memcached_return binary_delete(memcached_st *ptr,
                                              unsigned int server_key,
                                              const char *key, 
                                              size_t key_length,
-                                            int flush);
+                                            uint8_t flush);
 
 memcached_return memcached_delete_by_key(memcached_st *ptr, 
                                          const char *master_key, size_t master_key_length,
                                          const char *key, size_t key_length,
                                          time_t expiration)
 {
-  char to_write;
+  uint8_t to_write;
   size_t send_length;
   memcached_return rc;
   char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
@@ -36,7 +36,7 @@ memcached_return memcached_delete_by_key(memcached_st *ptr,
     return MEMCACHED_NO_SERVERS;
 
   server_key= memcached_generate_hash(ptr, master_key, master_key_length);
-  to_write= (ptr->flags & MEM_BUFFER_REQUESTS) ? 0 : 1;
+  to_write= (uint8_t) (ptr->flags & MEM_BUFFER_REQUESTS) ? 0 : 1;
   bool no_reply= (ptr->flags & MEM_NOREPLY);
      
   if (ptr->flags & MEM_BINARY_PROTOCOL) 
@@ -44,16 +44,16 @@ memcached_return memcached_delete_by_key(memcached_st *ptr,
   else 
   {
     if (expiration)
-      send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                            "delete %s%.*s %u%s\r\n",
-                            ptr->prefix_key,
-                            (int)key_length, key, 
-                            (uint32_t)expiration, no_reply ? " noreply" :"" );
+      send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
+                                     "delete %s%.*s %u%s\r\n",
+                                     ptr->prefix_key,
+                                     (int) key_length, key, 
+                                     (uint32_t)expiration, no_reply ? " noreply" :"" );
     else
-       send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                             "delete %s%.*s%s\r\n",
-                             ptr->prefix_key,
-                             (int)key_length, key, no_reply ? " noreply" :"");
+       send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
+                                      "delete %s%.*s%s\r\n",
+                                      ptr->prefix_key,
+                                      (int)key_length, key, no_reply ? " noreply" :"");
     
     if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE) 
     {
@@ -96,7 +96,7 @@ static inline memcached_return binary_delete(memcached_st *ptr,
                                              unsigned int server_key,
                                              const char *key, 
                                             size_t key_length,
-                                            int flush)
+                                            uint8_t flush)
 {
   protocol_binary_request_delete request= {.bytes= {0}};
 
@@ -107,7 +107,7 @@ static inline memcached_return binary_delete(memcached_st *ptr,
     request.message.header.request.opcode= PROTOCOL_BINARY_CMD_DELETE;
   request.message.header.request.keylen= htons((uint16_t)key_length);
   request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
-  request.message.header.request.bodylen= htonl(key_length);
+  request.message.header.request.bodylen= htonl((uint32_t) key_length);
 
   if (ptr->flags & MEM_USE_UDP && !flush)
   {
@@ -123,7 +123,7 @@ static inline memcached_return binary_delete(memcached_st *ptr,
   if ((memcached_do(&ptr->hosts[server_key], request.bytes, 
                     sizeof(request.bytes), 0) != MEMCACHED_SUCCESS) ||
       (memcached_io_write(&ptr->hosts[server_key], key, 
-                          key_length, flush) == -1)) 
+                          key_length, (char) flush) == -1)) 
   {
     memcached_io_reset(&ptr->hosts[server_key]);
     rc= MEMCACHED_WRITE_FAILURE;
@@ -142,7 +142,7 @@ static inline memcached_return binary_delete(memcached_st *ptr,
       memcached_server_st* server= &ptr->hosts[server_key];
       if ((memcached_do(server, (const char*)request.bytes, 
                         sizeof(request.bytes), 0) != MEMCACHED_SUCCESS) ||
-          (memcached_io_write(server, key, key_length, flush) == -1))
+          (memcached_io_write(server, key, key_length, (char) flush) == -1))
         memcached_io_reset(server);
       else
         memcached_server_response_decrement(server);
index b46805a02acc0c6219beb2620c7ef7bbf8b45929..46ca79b95a6e706d56af06c2e211d86799f54742 100644 (file)
@@ -23,7 +23,7 @@ memcached_return memcached_do(memcached_server_st *ptr, const void *command,
   if (ptr->type == MEMCACHED_CONNECTION_UDP && with_flush && ptr->write_buffer_offset > UDP_DATAGRAM_HEADER_LENGTH)
     memcached_io_write(ptr, NULL, 0, 1);
 
-  sent_length= memcached_io_write(ptr, command, command_length, with_flush);
+  sent_length= memcached_io_write(ptr, command, command_length, (char) with_flush);
 
   if (sent_length == -1 || (size_t)sent_length != command_length)
     rc= MEMCACHED_WRITE_FAILURE;
index 88fec3a8d1daeb19cc5e4f097cc4cb428f229f5f..393e140a557e50602876038b05b7500b25193d6f 100644 (file)
@@ -23,8 +23,8 @@ static memcached_return ascii_dump(memcached_st *ptr, memcached_dump_func *callb
     /* 256 I BELIEVE is the upper limit of slabs */
     for (x= 0; x < 256; x++)
     {
-      send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                            "stats cachedump %u 0 0\r\n", x);
+      send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
+                                     "stats cachedump %u 0 0\r\n", x);
 
       rc= memcached_do(&ptr->hosts[server_key], buffer, send_length, 1);
 
index 55a6ca716de10df28486015751548e3716c1dc01..1011b3f18a3e908233254b7dac9089b9bf36c107 100644 (file)
@@ -33,12 +33,12 @@ static memcached_return memcached_flush_textual(memcached_st *ptr,
   {
     bool no_reply= (ptr->flags & MEM_NOREPLY);
     if (expiration)
-      send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                            "flush_all %llu%s\r\n",
-                            (unsigned long long)expiration, no_reply ? " noreply" : "");
+      send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
+                                     "flush_all %llu%s\r\n",
+                                     (unsigned long long)expiration, no_reply ? " noreply" : "");
     else
-      send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                            "flush_all%s\r\n", no_reply ? " noreply" : "");
+      send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
+                                     "flush_all%s\r\n", no_reply ? " noreply" : "");
 
     rc= memcached_do(&ptr->hosts[x], buffer, send_length, 1);
 
@@ -63,7 +63,7 @@ static memcached_return memcached_flush_binary(memcached_st *ptr,
   request.message.header.request.extlen= 4;
   request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
   request.message.header.request.bodylen= htonl(request.message.header.request.extlen);
-  request.message.body.expiration= htonl(expiration);
+  request.message.body.expiration= htonl((uint32_t) expiration);
 
   for (x= 0; x < ptr->number_of_hosts; x++)
   {
index f00cfafbc261b94fa26ce27f838ebba2e5811f6a..ee4f68e7ecb0c006c4025f346340ba0941b41ca6 100644 (file)
@@ -59,7 +59,7 @@ char *memcached_get_by_key(memcached_st *ptr,
       {
         if (rc == MEMCACHED_BUFFERED)
         {
-          uint8_t latch; /* We use latch to track the state of the original socket */
+          uint64_t latch; /* We use latch to track the state of the original socket */
           latch= memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS);
           if (latch == 0)
             memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 1);
@@ -306,12 +306,12 @@ static memcached_return simple_binary_mget(memcached_st *ptr,
 
     request.message.header.request.keylen= htons((uint16_t)key_length[x]);
     request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
-    request.message.header.request.bodylen= htonl(key_length[x]);
+    request.message.header.request.bodylen= htonl((uint32_t) key_length[x]);
     
     if ((memcached_io_write(&ptr->hosts[server_key], request.bytes,
                             sizeof(request.bytes), 0) == -1) ||
         (memcached_io_write(&ptr->hosts[server_key], keys[x], 
-                            key_length[x], flush) == -1)) 
+                            key_length[x], (char) flush) == -1)) 
     {
       memcached_server_response_reset(&ptr->hosts[server_key]);
       rc= MEMCACHED_SOME_ERRORS;
@@ -405,12 +405,12 @@ static memcached_return replication_binary_mget(memcached_st *ptr,
 
       request.message.header.request.keylen= htons((uint16_t)key_length[x]);
       request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
-      request.message.header.request.bodylen= htonl(key_length[x]);
+      request.message.header.request.bodylen= htonl((uint32_t) key_length[x]);
 
       if ((memcached_io_write(&ptr->hosts[server], request.bytes,
                               sizeof(request.bytes), 0) == -1) ||
           (memcached_io_write(&ptr->hosts[server], keys[x],
-                              key_length[x], flush) == -1))
+                              key_length[x], (char) flush) == -1))
       {
         memcached_io_reset(&ptr->hosts[server]);
         dead_servers[server]= true;
index e3249c0624774f0d2b343a27e719153e36dd0a45..4956d18e0655e784bbb4e7a4b3c0200d4552bb77 100644 (file)
@@ -47,11 +47,11 @@ uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memca
     break;
   case MEMCACHED_HASH_FNV1A_64: 
     {
-      hash= FNV_64_INIT;
+      hash= (uint32_t) FNV_64_INIT;
       for (x= 0; x < key_length; x++) 
       {
         hash ^= key[x];
-        hash *= FNV_64_PRIME;
+        hash *= (uint32_t) FNV_64_PRIME;
       }
     }
     break;
@@ -146,7 +146,7 @@ static uint32_t dispatch_host(memcached_st *ptr, uint32_t hash)
   case MEMCACHED_DISTRIBUTION_MODULA:
     return hash % ptr->number_of_hosts;
   case MEMCACHED_DISTRIBUTION_RANDOM:
-    return random() % ptr->number_of_hosts;
+    return (uint32_t) random() % ptr->number_of_hosts;
   default:
     WATCHPOINT_ASSERT(0); /* We have added a distribution without extending the logic */
     return hash % ptr->number_of_hosts;
@@ -205,7 +205,7 @@ static uint32_t internal_generate_hash(const char *key, size_t key_length)
 
   while (key_length--) 
   {
-    value += *ptr++;
+    value += (uint32_t) *ptr++;
     value += (value << 10);
     value ^= (value >> 6);
   }
@@ -213,7 +213,7 @@ static uint32_t internal_generate_hash(const char *key, size_t key_length)
   value ^= (value >> 11);
   value += (value << 15); 
 
-  return value == 0 ? 1 : value;
+  return value == 0 ? 1 : (uint32_t) value;
 }
 
 static uint32_t internal_generate_md5(const char *key, size_t key_length)
index 2f1c4cc032e09a15183ee2e2d3217579f2042ab6..f56c89f17c5e2c1bc58b59f4732829e7da095421 100644 (file)
@@ -29,7 +29,7 @@ static void sort_hosts(memcached_st *ptr)
   if (ptr->number_of_hosts)
   {
     qsort(ptr->hosts, ptr->number_of_hosts, sizeof(memcached_server_st), compare_servers);
-    ptr->hosts[0].count= ptr->number_of_hosts;
+    ptr->hosts[0].count= (uint16_t) ptr->number_of_hosts;
   }
 }
 
@@ -111,8 +111,8 @@ memcached_return update_continuum(memcached_st *ptr)
   uint32_t pointer_per_server= MEMCACHED_POINTS_PER_SERVER;
   uint32_t pointer_per_hash= 1;
   uint64_t total_weight= 0;
-  uint32_t is_ketama_weighted= 0;
-  uint32_t is_auto_ejecting= 0;
+  uint64_t is_ketama_weighted= 0;
+  uint64_t is_auto_ejecting= 0;
   uint32_t points_per_server= 0;
   uint32_t live_servers= 0;
   struct timeval now;
@@ -146,7 +146,7 @@ memcached_return update_continuum(memcached_st *ptr)
     live_servers= ptr->number_of_hosts;
 
   is_ketama_weighted= memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED);
-  points_per_server= is_ketama_weighted ? MEMCACHED_POINTS_PER_SERVER_KETAMA : MEMCACHED_POINTS_PER_SERVER;
+  points_per_server= (uint32_t) (is_ketama_weighted ? MEMCACHED_POINTS_PER_SERVER_KETAMA : MEMCACHED_POINTS_PER_SERVER);
 
   if (live_servers == 0)
     return MEMCACHED_SUCCESS;
@@ -186,7 +186,7 @@ memcached_return update_continuum(memcached_st *ptr)
     if (is_ketama_weighted) 
     {
         float pct = (float)list[host_index].weight / (float)total_weight;
-        pointer_per_server= floorf(pct * MEMCACHED_POINTS_PER_SERVER_KETAMA / 4 * (float)live_servers + 0.0000000001) * 4;
+        pointer_per_server= (uint32_t) ((floorf((float) (pct * MEMCACHED_POINTS_PER_SERVER_KETAMA / 4 * (float)live_servers + 0.0000000001))) * 4);
         pointer_per_hash= 4;
 #ifdef DEBUG
         printf("ketama_weighted:%s|%d|%llu|%u\n", 
@@ -205,18 +205,18 @@ memcached_return update_continuum(memcached_st *ptr)
 
       if (list[host_index].port == MEMCACHED_DEFAULT_PORT)
       {
-        sort_host_length= snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH,
-                                   "%s-%d",
-                                   list[host_index].hostname,
-                                   pointer_index - 1);
+        sort_host_length= (size_t) snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH,
+                                            "%s-%d",
+                                            list[host_index].hostname,
+                                            pointer_index - 1);
 
       }
       else
       {
-        sort_host_length= snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH,
-                                   "%s:%d-%d", 
-                                   list[host_index].hostname,
-                                   list[host_index].port, pointer_index - 1);
+        sort_host_length= (size_t) snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH,
+                                            "%s:%d-%d", 
+                                            list[host_index].hostname,
+                                            list[host_index].port, pointer_index - 1);
       }
       WATCHPOINT_ASSERT(sort_host_length);
 
@@ -225,7 +225,7 @@ memcached_return update_continuum(memcached_st *ptr)
         unsigned int i;
         for (i = 0; i < pointer_per_hash; i++)
         {
-          value= ketama_server_hash(sort_host, sort_host_length, i);
+          value= ketama_server_hash(sort_host, (uint32_t) sort_host_length, (int) i);
           ptr->continuum[continuum_index].index= host_index;
           ptr->continuum[continuum_index++].value= value;
         }
@@ -289,7 +289,7 @@ memcached_return memcached_server_push(memcached_st *ptr, memcached_server_st *l
                                        list[x].port, list[x].weight, list[x].type);
     ptr->number_of_hosts++;
   }
-  ptr->hosts[0].count= ptr->number_of_hosts;
+  ptr->hosts[0].count= (uint16_t) ptr->number_of_hosts;
 
   return run_distribution(ptr);
 }
@@ -374,7 +374,7 @@ static memcached_return server_add(memcached_st *ptr, const char *hostname,
   /* TODO: Check return type */
   (void)memcached_server_create_with(ptr, &ptr->hosts[ptr->number_of_hosts], hostname, port, weight, type);
   ptr->number_of_hosts++;
-  ptr->hosts[0].count= ptr->number_of_hosts;
+  ptr->hosts[0].count= (uint16_t) ptr->number_of_hosts;
 
   return run_distribution(ptr);
 }
@@ -445,7 +445,7 @@ memcached_server_st *memcached_server_list_append_with_weight(memcached_server_s
   memcached_server_create_with(NULL, &new_host_list[count-1], hostname, port, weight, MEMCACHED_CONNECTION_TCP);
 
   /* Backwards compatibility hack */
-  new_host_list[0].count= count;
+  new_host_list[0].count= (uint16_t) count;
 
   *error= MEMCACHED_SUCCESS;
   return new_host_list;
index 69771d71f172c7f421c2aea792b3af1e9d2e7cdf..411040f68e6adccaa7bf602c021b84523fcb25c9 100644 (file)
@@ -146,8 +146,8 @@ memcached_return memcached_io_read(memcached_server_st *ptr,
       }
 
       ptr->io_bytes_sent = 0;
-      ptr->read_data_length= data_read;
-      ptr->read_buffer_length= data_read;
+      ptr->read_data_length= (size_t) data_read;
+      ptr->read_buffer_length= (size_t) data_read;
       ptr->read_ptr= ptr->read_buffer;
     }
 
@@ -174,7 +174,7 @@ memcached_return memcached_io_read(memcached_server_st *ptr,
   }
 
   ptr->server_failure_counter= 0;
-  *nread = (size_t)(buffer_ptr - (char*)buffer);
+  *nread = (ssize_t)(buffer_ptr - (char*)buffer);
   return MEMCACHED_SUCCESS;
 }
 
@@ -242,7 +242,7 @@ ssize_t memcached_io_write(memcached_server_st *ptr,
       return -1;
   }
 
-  return original_length;
+  return (ssize_t) original_length;
 }
 
 memcached_return memcached_io_close(memcached_server_st *ptr)
@@ -408,11 +408,11 @@ static ssize_t io_flush(memcached_server_st *ptr,
       return -1;
     }
 
-    ptr->io_bytes_sent += sent_length;
+    ptr->io_bytes_sent += (uint32_t) sent_length;
 
     local_write_ptr+= sent_length;
-    write_length-= sent_length;
-    return_length+= sent_length;
+    write_length-= (uint32_t) sent_length;
+    return_length+= (uint32_t) sent_length;
   }
 
   WATCHPOINT_ASSERT(write_length == 0);
@@ -426,7 +426,7 @@ static ssize_t io_flush(memcached_server_st *ptr,
   else
     ptr->write_buffer_offset= 0;
 
-  return return_length;
+  return (ssize_t) return_length;
 }
 
 /* 
@@ -456,7 +456,7 @@ memcached_return memcached_safe_read(memcached_server_st *ptr,
     if (rc != MEMCACHED_SUCCESS)
       return rc;
 
-    offset+= nread;
+    offset+= (size_t) nread;
   }
 
   return MEMCACHED_SUCCESS;
@@ -524,13 +524,13 @@ static void increment_udp_message_id(memcached_server_st *ptr)
 {
   struct udp_datagram_header_st *header= (struct udp_datagram_header_st *)ptr->write_buffer;
   uint16_t cur_req= get_udp_datagram_request_id(header);
-  uint16_t msg_num= get_msg_num_from_request_id(cur_req);
-  uint16_t thread_id= get_thread_id_from_request_id(cur_req);
+  int msg_num= get_msg_num_from_request_id(cur_req);
+  int thread_id= get_thread_id_from_request_id(cur_req);
   
   if (((++msg_num) & UDP_REQUEST_ID_THREAD_MASK) != 0)
     msg_num= 0;
 
-  header->request_id= htons(thread_id | msg_num);
+  header->request_id= htons((uint16_t) (thread_id | msg_num));
 }
 
 memcached_return memcached_io_init_udp_header(memcached_server_st *ptr, uint16_t thread_id)
@@ -539,7 +539,7 @@ memcached_return memcached_io_init_udp_header(memcached_server_st *ptr, uint16_t
     return MEMCACHED_FAILURE;
 
   struct udp_datagram_header_st *header= (struct udp_datagram_header_st *)ptr->write_buffer;
-  header->request_id= htons(generate_udp_request_thread_id(thread_id));
+  header->request_id= htons((uint16_t) (generate_udp_request_thread_id(thread_id)));
   header->num_datagrams= htons(1);
   header->sequence_number= htons(0);
 
index ca1a08e61e0401f0b7749fdff6598f804acff4f4..ec695cfa897f606f55d9fc8d2bb16f66880af5dc 100644 (file)
@@ -10,7 +10,7 @@
 memcached_server_st *memcached_servers_parse(const char *server_strings)
 {
   char *string;
-  unsigned int port;
+  uint32_t port;
   uint32_t weight;
   const char *begin_ptr;
   const char *end_ptr;
@@ -32,7 +32,7 @@ memcached_server_st *memcached_servers_parse(const char *server_strings)
 
     if (string)
     {
-      memcpy(buffer, begin_ptr, string - begin_ptr);
+      memcpy(buffer, begin_ptr, (size_t) (string - begin_ptr));
       buffer[(unsigned int)(string - begin_ptr)]= 0;
       begin_ptr= string+1;
     }
@@ -52,7 +52,7 @@ memcached_server_st *memcached_servers_parse(const char *server_strings)
 
       ptr++;
 
-      port= strtoul(ptr, (char **)NULL, 10);
+      port= (uint32_t) strtoul(ptr, (char **)NULL, 10);
 
       ptr2= index(ptr, ' ');
       if (! ptr2)
@@ -60,7 +60,7 @@ memcached_server_st *memcached_servers_parse(const char *server_strings)
       if (ptr2)
       {
         ptr2++;
-        weight = strtoul(ptr2, (char **)NULL, 10);
+        weight = (uint32_t) strtoul(ptr2, (char **)NULL, 10);
       }
     }
 
index 624f624571643779a8af78ab1da810764fa35054..40c8ad61a5af5d0e956e2a4c246601d9fcf1acf3 100644 (file)
@@ -42,7 +42,7 @@ memcached_return memcached_purge(memcached_server_st *ptr)
      * data to be sent from the server (the commands was in the output buffer
      * and just flushed
      */
-    long timeo= ptr->root->poll_timeout;
+    int32_t timeo= ptr->root->poll_timeout;
     ptr->root->poll_timeout= 2000;
 
     result_ptr= memcached_result_create(ptr->root, &result);
@@ -68,7 +68,7 @@ memcached_return memcached_purge(memcached_server_st *ptr)
     }
 
     memcached_result_free(result_ptr);
-    ptr->root->poll_timeout=timeo;
+    ptr->root->poll_timeout= timeo;
   }
   ptr->root->purging= 0;
 
index c202d43365debe8817580ad344f7cb6bdc6d5694..9a200a1ee935041b6386a82aacb6d00e505bdd25 100644 (file)
@@ -43,7 +43,7 @@ void memcached_quit_server(memcached_server_st *ptr, uint8_t io_death)
     memcached_io_close(ptr);
 
     ptr->fd= -1;
-    ptr->write_buffer_offset= (ptr->type == MEMCACHED_CONNECTION_UDP) ? UDP_DATAGRAM_HEADER_LENGTH : 0 ;
+    ptr->write_buffer_offset= (size_t) ((ptr->type == MEMCACHED_CONNECTION_UDP) ? UDP_DATAGRAM_HEADER_LENGTH : 0);
     ptr->read_buffer_length= 0;
     ptr->read_ptr= ptr->read_buffer;
     memcached_server_response_reset(ptr);
index ba0691b504a39590c67184d830e2c1753222cec4..f617f27f9a14379b8c6b4276e2b7318ead302a69 100644 (file)
@@ -125,7 +125,7 @@ static memcached_return textual_value_fetch(memcached_server_st *ptr,
   if (end_ptr == string_ptr)
     goto read_error;
   for (next_ptr= string_ptr; isdigit(*string_ptr); string_ptr++);
-  result->flags= strtoul(next_ptr, &string_ptr, 10);
+  result->flags= (uint32_t) strtoul(next_ptr, &string_ptr, 10);
 
   if (end_ptr == string_ptr)
     goto read_error;
@@ -250,7 +250,9 @@ static memcached_return textual_read_one_response(memcached_server_st *ptr,
             memory in the struct, which is important, for something that
             rarely should happen?
           */
-         rel_ptr= (char *)ptr->root->call_realloc(ptr->root, ptr->cached_server_error, endptr - startptr + 1);
+         rel_ptr= (char *)ptr->root->call_realloc(ptr->root, 
+                                                   ptr->cached_server_error, 
+                                                   (size_t) (endptr - startptr + 1));
 
           if (rel_ptr == NULL)
           {
@@ -261,7 +263,7 @@ static memcached_return textual_read_one_response(memcached_server_st *ptr,
           }
          ptr->cached_server_error= rel_ptr;
 
-         memcpy(ptr->cached_server_error, startptr, endptr - startptr);
+         memcpy(ptr->cached_server_error, startptr, (size_t) (endptr - startptr));
          ptr->cached_server_error[endptr - startptr]= 0;
          return MEMCACHED_SERVER_ERROR;
        }
@@ -461,7 +463,7 @@ static memcached_return binary_read_one_response(memcached_server_st *ptr,
       size_t nr= (bodylen > SMALL_STRING_LEN) ? SMALL_STRING_LEN : bodylen;
       if (memcached_safe_read(ptr, hole, nr) != MEMCACHED_SUCCESS)
         return MEMCACHED_UNKNOWN_READ_FAILURE;
-      bodylen -= nr;
+      bodylen-= (uint32_t) nr;
     }
 
     /* This might be an error from one of the quiet commands.. if
index 84008908dfbe7a0237be3e39d73bc34cff03ade5..0f4a97f75675446f1e5f8e00c06494f47c166634 100644 (file)
@@ -40,15 +40,15 @@ static memcached_return set_data(memcached_stat_st *memc_stat, char *key, char *
   }
   else if (!strcmp("pid", key))
   {
-    memc_stat->pid= strtol(value, (char **)NULL, 10);
+    memc_stat->pid= (uint32_t) strtol(value, (char **)NULL, 10);
   }
   else if (!strcmp("uptime", key))
   {
-    memc_stat->uptime= strtol(value, (char **)NULL, 10);
+    memc_stat->uptime= (uint32_t) strtol(value, (char **)NULL, 10);
   }
   else if (!strcmp("time", key))
   {
-    memc_stat->time= strtol(value, (char **)NULL, 10);
+    memc_stat->time= (uint32_t) strtol(value, (char **)NULL, 10);
   }
   else if (!strcmp("version", key))
   {
@@ -57,7 +57,7 @@ static memcached_return set_data(memcached_stat_st *memc_stat, char *key, char *
   }
   else if (!strcmp("pointer_size", key))
   {
-    memc_stat->pointer_size= strtol(value, (char **)NULL, 10);
+    memc_stat->pointer_size= (uint32_t) strtol(value, (char **)NULL, 10);
   }
   else if (!strcmp("rusage_user", key))
   {
@@ -65,8 +65,8 @@ static memcached_return set_data(memcached_stat_st *memc_stat, char *key, char *
     for (walk_ptr= value; (!ispunct(*walk_ptr)); walk_ptr++);
     *walk_ptr= 0;
     walk_ptr++;
-    memc_stat->rusage_user_seconds= strtol(value, (char **)NULL, 10);
-    memc_stat->rusage_user_microseconds= strtol(walk_ptr, (char **)NULL, 10);
+    memc_stat->rusage_user_seconds= (uint32_t) strtol(value, (char **)NULL, 10);
+    memc_stat->rusage_user_microseconds= (uint32_t) strtol(walk_ptr, (char **)NULL, 10);
   }
   else if (!strcmp("rusage_system", key))
   {
@@ -74,52 +74,52 @@ static memcached_return set_data(memcached_stat_st *memc_stat, char *key, char *
     for (walk_ptr= value; (!ispunct(*walk_ptr)); walk_ptr++);
     *walk_ptr= 0;
     walk_ptr++;
-    memc_stat->rusage_system_seconds= strtol(value, (char **)NULL, 10);
-    memc_stat->rusage_system_microseconds= strtol(walk_ptr, (char **)NULL, 10);
+    memc_stat->rusage_system_seconds= (uint32_t) strtol(value, (char **)NULL, 10);
+    memc_stat->rusage_system_microseconds= (uint32_t) strtol(walk_ptr, (char **)NULL, 10);
   }
   else if (!strcmp("curr_items", key))
   {
-    memc_stat->curr_items= strtol(value, (char **)NULL, 10); 
+    memc_stat->curr_items= (uint32_t) strtol(value, (char **)NULL, 10); 
   }
   else if (!strcmp("total_items", key))
   {
-    memc_stat->total_items= strtol(value, (char **)NULL, 10);
+    memc_stat->total_items= (uint32_t) strtol(value, (char **)NULL, 10);
   }
   else if (!strcmp("bytes_read", key))
   {
-    memc_stat->bytes_read= strtoll(value, (char **)NULL, 10);
+    memc_stat->bytes_read= (uint32_t) strtoll(value, (char **)NULL, 10);
   }
   else if (!strcmp("bytes_written", key))
   {
-    memc_stat->bytes_written= strtoll(value, (char **)NULL, 10);
+    memc_stat->bytes_written= (uint32_t) strtoll(value, (char **)NULL, 10);
   }
   else if (!strcmp("bytes", key))
   {
-    memc_stat->bytes= strtoll(value, (char **)NULL, 10);
+    memc_stat->bytes= (uint32_t) strtoll(value, (char **)NULL, 10);
   }
   else if (!strcmp("curr_connections", key))
   {
-    memc_stat->curr_connections= strtoll(value, (char **)NULL, 10);
+    memc_stat->curr_connections= (uint32_t) strtoll(value, (char **)NULL, 10);
   }
   else if (!strcmp("total_connections", key))
   {
-    memc_stat->total_connections= strtoll(value, (char **)NULL, 10);
+    memc_stat->total_connections= (uint32_t) strtoll(value, (char **)NULL, 10);
   }
   else if (!strcmp("connection_structures", key))
   {
-    memc_stat->connection_structures= strtol(value, (char **)NULL, 10);
+    memc_stat->connection_structures= (uint32_t) strtol(value, (char **)NULL, 10);
   }
   else if (!strcmp("cmd_get", key))
   {
-    memc_stat->cmd_get= strtoll(value, (char **)NULL, 10);
+    memc_stat->cmd_get= (uint64_t) strtoll(value, (char **)NULL, 10);
   }
   else if (!strcmp("cmd_set", key))
   {
-    memc_stat->cmd_set= strtoll(value, (char **)NULL, 10);
+    memc_stat->cmd_set= (uint64_t) strtoll(value, (char **)NULL, 10);
   }
   else if (!strcmp("get_hits", key))
   {
-    memc_stat->get_hits= strtoll(value, (char **)NULL, 10);
+    memc_stat->get_hits= (uint64_t) strtoll(value, (char **)NULL, 10);
   }
   else if (!strcmp("get_misses", key))
   {
@@ -131,11 +131,11 @@ static memcached_return set_data(memcached_stat_st *memc_stat, char *key, char *
   }
   else if (!strcmp("limit_maxbytes", key))
   {
-    memc_stat->limit_maxbytes= strtoll(value, (char **)NULL, 10);
+    memc_stat->limit_maxbytes= (uint64_t) strtoll(value, (char **)NULL, 10);
   }
   else if (!strcmp("threads", key))
   {
-    memc_stat->threads= strtol(value, (char **)NULL, 10);
+    memc_stat->threads= (uint32_t) strtol(value, (char **)NULL, 10);
   }
   else if (!(strcmp("delete_misses", key) == 0 ||/* New stats in the 1.3 beta */
              strcmp("delete_hits", key) == 0 ||/* Just swallow them for now.. */
@@ -162,7 +162,7 @@ char *memcached_stat_get_value(memcached_st *ptr, memcached_stat_st *memc_stat,
                                const char *key, memcached_return *error)
 {
   char buffer[SMALL_STRING_LEN];
-  size_t length;
+  int length;
   char *ret;
 
   *error= MEMCACHED_SUCCESS;
@@ -217,8 +217,8 @@ char *memcached_stat_get_value(memcached_st *ptr, memcached_stat_st *memc_stat,
     return NULL;
   }
 
-  ret= ptr->call_malloc(ptr, length + 1);
-  memcpy(ret, buffer, length);
+  ret= ptr->call_malloc(ptr, (size_t) (length + 1));
+  memcpy(ret, buffer, (size_t) length);
   ret[length]= '\0';
 
   return ret;
@@ -239,14 +239,14 @@ static memcached_return binary_stats_fetch(memcached_st *ptr,
 
   if (args != NULL) 
   {
-    int len= strlen(args);
+    size_t len= strlen(args);
 
     rc= memcached_validate_key_length(len, true);
     unlikely (rc != MEMCACHED_SUCCESS)
       return rc;
 
     request.message.header.request.keylen= htons((uint16_t)len);
-    request.message.header.request.bodylen= htonl(len);
+    request.message.header.request.bodylen= htonl((uint32_t) len);
       
     if ((memcached_do(&ptr->hosts[server_key], request.bytes, 
                       sizeof(request.bytes), 0) != MEMCACHED_SUCCESS) ||
@@ -305,11 +305,11 @@ static memcached_return ascii_stats_fetch(memcached_st *ptr,
   size_t send_length;
 
   if (args)
-    send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                          "stats %s\r\n", args);
+    send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
+                                   "stats %s\r\n", args);
   else
-    send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                          "stats\r\n");
+    send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
+                                   "stats\r\n");
 
   if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
     return MEMCACHED_WRITE_FAILURE;
index e10f85f0e0597b977663da098d90f64fd6af0c87..ecefc56674134a47b1e4dc545be9d5a6c02db2d4 100644 (file)
@@ -91,14 +91,14 @@ static inline memcached_return memcached_send(memcached_st *ptr,
   server_key= memcached_generate_hash(ptr, master_key, master_key_length);
 
   if (cas)
-    write_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                           "%s %s%.*s %u %llu %zu %llu%s\r\n", 
-                           storage_op_string(verb),
-                           ptr->prefix_key,
-                           (int)key_length, key, flags, 
-                           (unsigned long long)expiration, value_length, 
-                           (unsigned long long)cas,
-                           (ptr->flags & MEM_NOREPLY) ? " noreply" : "");
+    write_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
+                                    "%s %s%.*s %u %llu %zu %llu%s\r\n", 
+                                    storage_op_string(verb),
+                                    ptr->prefix_key,
+                                    (int)key_length, key, flags, 
+                                    (unsigned long long)expiration, value_length, 
+                                    (unsigned long long)cas,
+                                    (ptr->flags & MEM_NOREPLY) ? " noreply" : "");
   else
   {
     char *buffer_ptr= buffer;
@@ -118,11 +118,11 @@ static inline memcached_return memcached_send(memcached_st *ptr,
     buffer_ptr++;
 
     write_length= (size_t)(buffer_ptr - buffer);
-    write_length+= snprintf(buffer_ptr, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                           "%u %llu %zu%s\r\n", 
-                           flags, 
-                           (unsigned long long)expiration, value_length,
-                           (ptr->flags & MEM_NOREPLY) ? " noreply" : "");
+    write_length+= (size_t) snprintf(buffer_ptr, MEMCACHED_DEFAULT_COMMAND_SIZE, 
+                                     "%u %llu %zu%s\r\n", 
+                                     flags, 
+                                     (unsigned long long)expiration, value_length,
+                                     (ptr->flags & MEM_NOREPLY) ? " noreply" : "");
   }
 
   if (ptr->flags & MEM_USE_UDP && ptr->flags & MEM_BUFFER_REQUESTS)
@@ -429,7 +429,7 @@ static memcached_return memcached_send_binary(memcached_st *ptr,
                                               uint64_t cas,
                                               memcached_storage_action verb)
 {
-  char flush;
+  uint8_t flush;
   protocol_binary_request_set request= {.bytes= {0}};
   size_t send_length= sizeof(request.bytes);
   uint32_t server_key= memcached_generate_hash(ptr, master_key, 
@@ -450,13 +450,13 @@ static memcached_return memcached_send_binary(memcached_st *ptr,
     request.message.body.expiration= htonl((uint32_t)expiration);
   }
   
-  request.message.header.request.bodylen= htonl(key_length + value_length + 
-                                               request.message.header.request.extlen);
+  request.message.header.request.bodylen= htonl((uint32_t) (key_length + value_length + 
+                                               request.message.header.request.extlen));
   
   if (cas)
     request.message.header.request.cas= htonll(cas);
   
-  flush= ((server->root->flags & MEM_BUFFER_REQUESTS) && verb == SET_OP) ? 0 : 1;
+  flush= (uint8_t) (((server->root->flags & MEM_BUFFER_REQUESTS) && verb == SET_OP) ? 0 : 1);
 
   if ((server->root->flags & MEM_USE_UDP) && !flush)
   {
@@ -470,7 +470,7 @@ static memcached_return memcached_send_binary(memcached_st *ptr,
   /* write the header */
   if ((memcached_do(server, (const char*)request.bytes, send_length, 0) != MEMCACHED_SUCCESS) ||
       (memcached_io_write(server, key, key_length, 0) == -1) ||
-      (memcached_io_write(server, value, value_length, flush) == -1)) 
+      (memcached_io_write(server, value, value_length, (char) flush) == -1)) 
   {
     memcached_io_reset(server);
     return MEMCACHED_WRITE_FAILURE;
@@ -490,7 +490,7 @@ static memcached_return memcached_send_binary(memcached_st *ptr,
       if ((memcached_do(srv, (const char*)request.bytes, 
                         send_length, 0) != MEMCACHED_SUCCESS) ||
           (memcached_io_write(srv, key, key_length, 0) == -1) ||
-          (memcached_io_write(srv, value, value_length, flush) == -1))
+          (memcached_io_write(srv, value, value_length, (char) flush) == -1))
         memcached_io_reset(srv);
       else
         memcached_server_response_decrement(srv);
index 5b9e9281620e3e063bce34597e14765c0c397041..614343c8c087d7703d6273b2e774fbc29b8c0eaa 100644 (file)
@@ -4,7 +4,7 @@ memcached_return memcached_string_check(memcached_string_st *string, size_t need
 {
   if (need && need > (size_t)(string->current_size - (size_t)(string->end - string->string)))
   {
-    size_t current_offset= string->end - string->string;
+    size_t current_offset= (size_t) (string->end - string->string);
     char *new_value;
     size_t adjust;
     size_t new_size;
index 43132786c801ed355f3bddf6dcd116210adc197e..fd56316d34a7df45fc26435c63b33df32bf3fb78 100644 (file)
@@ -7,8 +7,8 @@ memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbosity)
   memcached_return rc;
   char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
 
-  send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                        "verbosity %u\r\n", verbosity);
+  send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
+                                 "verbosity %u\r\n", verbosity);
   unlikely (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
     return MEMCACHED_WRITE_FAILURE;
 
index edb9e7772afe8191801185aff9f8ae393b3440da..b95134408d287270b17508af10f2325f9d6035c4 100644 (file)
@@ -25,13 +25,13 @@ uint32_t murmur_hash(const char *key, size_t length)
   */
 
   const unsigned int m= 0x5bd1e995;
-  const unsigned int seed= (0xdeadbeef * length);
+  const size_t seed= (0xdeadbeef * length);
   const int r= 24;
 
 
   // Initialize the hash to a 'random' value
 
-  unsigned int h= seed ^ length;
+  size_t h= seed ^ length;
 
   // Mix 4 bytes at a time into the hash
 
@@ -72,5 +72,5 @@ uint32_t murmur_hash(const char *key, size_t length)
   h *= m;
   h ^= h >> 15;
 
-  return h;
+  return (uint32_t) h;
 }
index 1c4d68cbedcfe592892cd7d171c9668383037176..bab0cb7f01f94db62cfb139d3e63f834a31afe39 100644 (file)
@@ -183,18 +183,13 @@ AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
       dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
       dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
       dnl symlink is missing, so we set acl_libdirstem2 too.
-      AC_MSG_CHECKING([if buildling 64-bit app])
-      AC_RUN_IFELSE([
-         AC_LANG_PROGRAM([
-         ], [
-           return sizeof(void*) == 8 ? 0 : 1;
-         ])            
-      ], [
-         gl_cv_solaris_64bit=yes
-      ], [
-         gl_cv_solaris_64bit=no
-      ])
-      AC_MSG_RESULT([$gl_cv_solaris_64bit])
+      AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
+        [AC_RUN_IFELSE([
+           AC_LANG_PROGRAM([], [[
+             return sizeof(void*) == 8 ? 0 : 1;
+           ]])            
+           ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
+        ])
       if test $gl_cv_solaris_64bit = yes; then
         acl_libdirstem=lib/64
         case "$host_cpu" in
index 44ec4c0064dd0a26b9b6893bf529ce452da76f52..99db56e004cac6f309e563a4b95a42a5b9b34d7b 100644 (file)
@@ -7,6 +7,8 @@ dnl ---------------------------------------------------------------------------
 dnl Macro: PANDORA_64BIT
 dnl ---------------------------------------------------------------------------
 AC_DEFUN([PANDORA_64BIT],[
+  AC_BEFORE([$0], [AC_LIB_PREFIX])
+
 
   AC_ARG_ENABLE([64bit],[
     AS_HELP_STRING([--disable-64bit],
index 65e1d128c86f7b8f2ac4df2c120ce98747074958..90ea6da8a7c1f5dab97640ecc77bc25920217072 100644 (file)
@@ -4,7 +4,7 @@ dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl Which version of the canonical setup we're using
-AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.20])
+AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.22])
 
 AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[
   dnl Force dependency tracking on for Sun Studio builds
@@ -59,6 +59,7 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   
   AC_REQUIRE([AC_PROG_CC])
   AC_REQUIRE([PANDORA_MAC_GCC42])
+  AC_REQUIRE([PANDORA_64BIT])
 
   dnl Once we can use a modern autoconf, we can use this
   dnl AC_PROG_CC_C99
@@ -66,6 +67,7 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   AC_PROG_CPP
   AM_PROG_CC_C_O
 
+
   gl_USE_SYSTEM_EXTENSIONS
   m4_if(PCT_FORCE_GCC42, [yes], [
     AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION)
@@ -111,7 +113,6 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   PANDORA_CHECK_CXX_VERSION
 
   PANDORA_OPTIMIZE
-  PANDORA_64BIT
 
   dnl We need to inject error into the cflags to test if visibility works or not
   save_CFLAGS="${CFLAGS}"
diff --git a/m4/pandora_have_libpq.m4 b/m4/pandora_have_libpq.m4
new file mode 100644 (file)
index 0000000..86ccb49
--- /dev/null
@@ -0,0 +1,31 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([_PANDORA_SEARCH_LIBPQ],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  dnl --------------------------------------------------------------------
+  dnl  Check for libpq
+  dnl --------------------------------------------------------------------
+
+  AC_LIB_HAVE_LINKFLAGS(pq,,[
+    #include <libpq-fe.h>
+  ], [
+    PGconn *conn;
+    conn = PQconnectdb(NULL);
+  ])
+  
+  AM_CONDITIONAL(HAVE_LIBPQ, [test "x${ac_cv_libpq}" = "xyes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_LIBPQ],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBPQ])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBPQ],[
+  AC_REQUIRE([PANDORA_HAVE_LIBPQ])
+  AS_IF([test x$ac_cv_libpq = xno],
+      AC_MSG_ERROR([libpq is required for ${PACKAGE}]))
+])