Merge lp://staging/~mordred/libmemcached/pandora-build-write-strings into lp://staging/~tangent-org/libmemcached/trunk

Proposed by Monty Taylor
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~mordred/libmemcached/pandora-build-write-strings
Merge into: lp://staging/~tangent-org/libmemcached/trunk
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~mordred/libmemcached/pandora-build-write-strings
Reviewer Review Type Date Requested Status
Brian Aker Pending
Review via email: mp+9006@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Monty Taylor (mordred) wrote :

Build fixes for solaris. Also Padraig's build fixes.

Revision history for this message
Brian Aker (brianaker) wrote :
Download full text (44.1 KiB)

Hi!

After running this patch, the binary protocol breaks on mget test.

Cheers,
 -Brian

On Jul 18, 2009, at 3:10 PM, Monty Taylor wrote:

> Monty Taylor has proposed merging lp:~mordred/libmemcached/pandora-
> build-write-strings into lp:libmemcached.
>
> Requested reviews:
> Brian Aker (brianaker)
>
> Build fixes for solaris. Also Padraig's build fixes.
> --
> https://code.launchpad.net/~mordred/libmemcached/pandora-build-write-
> strings/+merge/9006
> You are requested to review the proposed merge of lp:~mordred/
> libmemcached/pandora-build-write-strings into lp:libmemcached.
> === modified file 'libmemcached/memcached_analyze.c'
> --- libmemcached/memcached_analyze.c 2009-06-14 21:24:48 +0000
> +++ libmemcached/memcached_analyze.c 2009-07-18 17:08:37 +0000
> @@ -24,10 +24,10 @@
>
> 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 @@
> 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 @@
> 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 @@
> 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;
>
> === modified file 'libmemcached/memcached_auto.c'
> --- libmemcached/memcached_auto.c 2009-07-08 13:38:34 +0000
> +++ libmemcached/memcached_auto.c 2009-07-18 17:09:05 +0000
> @@ -85,13 +85,13 @@
>
> 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 + req...

Revision history for this message
Brian Aker (brianaker) wrote :
Download full text (45.0 KiB)

Hi!

Also, should the uint8 be converted to 16 in the binary protocol?

I am wondering if the conversion to long for ketama may cause an algo
change.

Cheers,
 -Brian
On Jul 19, 2009, at 11:33 AM, Brian Aker wrote:

> Hi!
>
> After running this patch, the binary protocol breaks on mget test.
>
> Cheers,
> -Brian
>
> On Jul 18, 2009, at 3:10 PM, Monty Taylor wrote:
>
>> Monty Taylor has proposed merging lp:~mordred/libmemcached/pandora-
>> build-write-strings into lp:libmemcached.
>>
>> Requested reviews:
>> Brian Aker (brianaker)
>>
>> Build fixes for solaris. Also Padraig's build fixes.
>> --
>> https://code.launchpad.net/~mordred/libmemcached/pandora-build-write-
>> strings/+merge/9006
>> You are requested to review the proposed merge of lp:~mordred/
>> libmemcached/pandora-build-write-strings into lp:libmemcached.
>> === modified file 'libmemcached/memcached_analyze.c'
>> --- libmemcached/memcached_analyze.c 2009-06-14 21:24:48 +0000
>> +++ libmemcached/memcached_analyze.c 2009-07-18 17:08:37 +0000
>> @@ -24,10 +24,10 @@
>>
>> 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 @@
>> 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 @@
>> 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 @@
>> 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;
>>
>> === modified file 'libmemcached/memcached_auto.c'
>> --- libmemcached/memcached_auto.c 2009-07-08 13:38:34 +0000
>> +++ libmemcached/memcached_auto.c 2009-07-18 17:09:05 +0000
>> @@ -85,13 +85,13 @@
>>
>> 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.r...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libmemcached/memcached_analyze.c'
2--- libmemcached/memcached_analyze.c 2009-06-14 21:24:48 +0000
3+++ libmemcached/memcached_analyze.c 2009-07-18 17:08:37 +0000
4@@ -24,10 +24,10 @@
5
6 static void calc_least_free_node(memcached_analysis_st *result,
7 const uint32_t server_num,
8- const long max_allowed_bytes,
9- const long used_bytes)
10+ const uint64_t max_allowed_bytes,
11+ const uint64_t used_bytes)
12 {
13- uint64_t remaining_bytes= (uint64_t)max_allowed_bytes - used_bytes;
14+ uint64_t remaining_bytes= max_allowed_bytes - used_bytes;
15
16 if (result->least_remaining_bytes == 0 ||
17 remaining_bytes < result->least_remaining_bytes)
18@@ -42,7 +42,7 @@
19 const uint64_t total_bytes)
20 {
21 if (total_items > 0 && total_bytes > 0)
22- result->average_item_size= total_bytes / total_items;
23+ result->average_item_size= (uint32_t) (total_bytes / total_items);
24 }
25
26 static void calc_hit_ratio(memcached_analysis_st *result,
27@@ -55,7 +55,7 @@
28 return;
29 }
30
31- double temp= (double)total_get_hits/total_get_cmds;
32+ double temp= (double) (total_get_hits/total_get_cmds);
33 result->pool_hit_ratio= temp * 100;
34 }
35
36@@ -84,7 +84,8 @@
37 calc_largest_consumption(result, x, memc_stat[x].bytes);
38 calc_oldest_node(result, x, memc_stat[x].uptime);
39 calc_least_free_node(result, x,
40- memc_stat[x].limit_maxbytes, memc_stat[x].bytes);
41+ memc_stat[x].limit_maxbytes,
42+ memc_stat[x].bytes);
43
44 total_get_hits+= memc_stat[x].get_hits;
45 total_get_cmds+= memc_stat[x].cmd_get;
46
47=== modified file 'libmemcached/memcached_auto.c'
48--- libmemcached/memcached_auto.c 2009-07-08 13:38:34 +0000
49+++ libmemcached/memcached_auto.c 2009-07-18 17:09:05 +0000
50@@ -85,13 +85,13 @@
51
52 request.message.header.request.magic= PROTOCOL_BINARY_REQ;
53 request.message.header.request.opcode= cmd;
54- request.message.header.request.keylen= htons(key_length);
55+ request.message.header.request.keylen= htons((uint16_t) key_length);
56 request.message.header.request.extlen= 20;
57 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
58- request.message.header.request.bodylen= htonl(key_length + request.message.header.request.extlen);
59+ request.message.header.request.bodylen= htonl((uint32_t) (key_length + request.message.header.request.extlen));
60 request.message.body.delta= htonll(offset);
61 request.message.body.initial= htonll(initial);
62- request.message.body.expiration= htonl(expiration);
63+ request.message.body.expiration= htonl((uint32_t) expiration);
64
65 if ((memcached_do(&ptr->hosts[server_key], request.bytes,
66 sizeof(request.bytes), 0)!=MEMCACHED_SUCCESS) ||
67
68=== modified file 'libmemcached/memcached_behavior.c'
69--- libmemcached/memcached_behavior.c 2009-07-08 23:12:50 +0000
70+++ libmemcached/memcached_behavior.c 2009-07-18 17:09:22 +0000
71@@ -28,13 +28,13 @@
72 ptr->number_of_replicas= (uint32_t)data;
73 break;
74 case MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK:
75- ptr->io_msg_watermark= (int32_t)data;
76+ ptr->io_msg_watermark= (uint32_t) data;
77 break;
78 case MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK:
79- ptr->io_bytes_watermark= (int32_t)data;
80+ ptr->io_bytes_watermark= (uint32_t)data;
81 break;
82 case MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH:
83- ptr->io_key_prefetch = (int32_t)data;
84+ ptr->io_key_prefetch = (uint32_t)data;
85 break;
86 case MEMCACHED_BEHAVIOR_SND_TIMEOUT:
87 ptr->snd_timeout= (int32_t)data;
88@@ -77,7 +77,7 @@
89 ptr->distribution= (memcached_server_distribution)(data);
90 if (ptr->distribution == MEMCACHED_DISTRIBUTION_RANDOM)
91 {
92- srandom(time(NULL));
93+ srandom((uint32_t) time(NULL));
94 }
95 run_distribution(ptr);
96 break;
97@@ -214,7 +214,7 @@
98 case MEMCACHED_BEHAVIOR_DISTRIBUTION:
99 return ptr->distribution;
100 case MEMCACHED_BEHAVIOR_KETAMA:
101- return (ptr->distribution == MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA) ? 1 : 0;
102+ return (ptr->distribution == MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA) ? (uint64_t) 1 : 0;
103 case MEMCACHED_BEHAVIOR_HASH:
104 return ptr->hash;
105 case MEMCACHED_BEHAVIOR_KETAMA_HASH:
106@@ -254,7 +254,7 @@
107 SO_SNDBUF, &sock_size, &sock_length))
108 return 0; /* Zero means error */
109
110- return sock_size;
111+ return (uint64_t) sock_size;
112 }
113 case MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE:
114 {
115@@ -270,7 +270,7 @@
116 SO_RCVBUF, &sock_size, &sock_length))
117 return 0; /* Zero means error */
118
119- return sock_size;
120+ return (uint64_t) sock_size;
121 }
122 case MEMCACHED_BEHAVIOR_USER_DATA:
123 return MEMCACHED_FAILURE;
124
125=== modified file 'libmemcached/memcached_connect.c'
126--- libmemcached/memcached_connect.c 2009-05-19 20:32:02 +0000
127+++ libmemcached/memcached_connect.c 2009-07-18 17:09:41 +0000
128@@ -152,7 +152,7 @@
129 servAddr.sun_family= AF_UNIX;
130 strcpy(servAddr.sun_path, ptr->hostname); /* Copy filename */
131
132- addrlen= strlen(servAddr.sun_path) + sizeof(servAddr.sun_family);
133+ addrlen= (socklen_t) (strlen(servAddr.sun_path) + sizeof(servAddr.sun_family));
134
135 test_connect:
136 if (connect(ptr->fd,
137
138=== modified file 'libmemcached/memcached_delete.c'
139--- libmemcached/memcached_delete.c 2009-07-01 19:36:25 +0000
140+++ libmemcached/memcached_delete.c 2009-07-18 17:09:59 +0000
141@@ -12,14 +12,14 @@
142 unsigned int server_key,
143 const char *key,
144 size_t key_length,
145- int flush);
146+ uint8_t flush);
147
148 memcached_return memcached_delete_by_key(memcached_st *ptr,
149 const char *master_key, size_t master_key_length,
150 const char *key, size_t key_length,
151 time_t expiration)
152 {
153- char to_write;
154+ uint8_t to_write;
155 size_t send_length;
156 memcached_return rc;
157 char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
158@@ -36,7 +36,7 @@
159 return MEMCACHED_NO_SERVERS;
160
161 server_key= memcached_generate_hash(ptr, master_key, master_key_length);
162- to_write= (ptr->flags & MEM_BUFFER_REQUESTS) ? 0 : 1;
163+ to_write= (uint8_t) (ptr->flags & MEM_BUFFER_REQUESTS) ? 0 : 1;
164 bool no_reply= (ptr->flags & MEM_NOREPLY);
165
166 if (ptr->flags & MEM_BINARY_PROTOCOL)
167@@ -44,16 +44,16 @@
168 else
169 {
170 if (expiration)
171- send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
172- "delete %s%.*s %u%s\r\n",
173- ptr->prefix_key,
174- (int)key_length, key,
175- (uint32_t)expiration, no_reply ? " noreply" :"" );
176+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
177+ "delete %s%.*s %u%s\r\n",
178+ ptr->prefix_key,
179+ (int) key_length, key,
180+ (uint32_t)expiration, no_reply ? " noreply" :"" );
181 else
182- send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
183- "delete %s%.*s%s\r\n",
184- ptr->prefix_key,
185- (int)key_length, key, no_reply ? " noreply" :"");
186+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
187+ "delete %s%.*s%s\r\n",
188+ ptr->prefix_key,
189+ (int)key_length, key, no_reply ? " noreply" :"");
190
191 if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
192 {
193@@ -96,7 +96,7 @@
194 unsigned int server_key,
195 const char *key,
196 size_t key_length,
197- int flush)
198+ uint8_t flush)
199 {
200 protocol_binary_request_delete request= {.bytes= {0}};
201
202@@ -107,7 +107,7 @@
203 request.message.header.request.opcode= PROTOCOL_BINARY_CMD_DELETE;
204 request.message.header.request.keylen= htons((uint16_t)key_length);
205 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
206- request.message.header.request.bodylen= htonl(key_length);
207+ request.message.header.request.bodylen= htonl((uint32_t) key_length);
208
209 if (ptr->flags & MEM_USE_UDP && !flush)
210 {
211@@ -123,7 +123,7 @@
212 if ((memcached_do(&ptr->hosts[server_key], request.bytes,
213 sizeof(request.bytes), 0) != MEMCACHED_SUCCESS) ||
214 (memcached_io_write(&ptr->hosts[server_key], key,
215- key_length, flush) == -1))
216+ key_length, (char) flush) == -1))
217 {
218 memcached_io_reset(&ptr->hosts[server_key]);
219 rc= MEMCACHED_WRITE_FAILURE;
220@@ -142,7 +142,7 @@
221 memcached_server_st* server= &ptr->hosts[server_key];
222 if ((memcached_do(server, (const char*)request.bytes,
223 sizeof(request.bytes), 0) != MEMCACHED_SUCCESS) ||
224- (memcached_io_write(server, key, key_length, flush) == -1))
225+ (memcached_io_write(server, key, key_length, (char) flush) == -1))
226 memcached_io_reset(server);
227 else
228 memcached_server_response_decrement(server);
229
230=== modified file 'libmemcached/memcached_do.c'
231--- libmemcached/memcached_do.c 2009-03-09 21:59:06 +0000
232+++ libmemcached/memcached_do.c 2009-07-18 17:10:13 +0000
233@@ -23,7 +23,7 @@
234 if (ptr->type == MEMCACHED_CONNECTION_UDP && with_flush && ptr->write_buffer_offset > UDP_DATAGRAM_HEADER_LENGTH)
235 memcached_io_write(ptr, NULL, 0, 1);
236
237- sent_length= memcached_io_write(ptr, command, command_length, with_flush);
238+ sent_length= memcached_io_write(ptr, command, command_length, (char) with_flush);
239
240 if (sent_length == -1 || (size_t)sent_length != command_length)
241 rc= MEMCACHED_WRITE_FAILURE;
242
243=== modified file 'libmemcached/memcached_dump.c'
244--- libmemcached/memcached_dump.c 2009-07-07 21:57:24 +0000
245+++ libmemcached/memcached_dump.c 2009-07-18 17:10:35 +0000
246@@ -23,8 +23,8 @@
247 /* 256 I BELIEVE is the upper limit of slabs */
248 for (x= 0; x < 256; x++)
249 {
250- send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
251- "stats cachedump %u 0 0\r\n", x);
252+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
253+ "stats cachedump %u 0 0\r\n", x);
254
255 rc= memcached_do(&ptr->hosts[server_key], buffer, send_length, 1);
256
257
258=== modified file 'libmemcached/memcached_flush.c'
259--- libmemcached/memcached_flush.c 2009-03-09 21:59:06 +0000
260+++ libmemcached/memcached_flush.c 2009-07-18 17:10:56 +0000
261@@ -33,12 +33,12 @@
262 {
263 bool no_reply= (ptr->flags & MEM_NOREPLY);
264 if (expiration)
265- send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
266- "flush_all %llu%s\r\n",
267- (unsigned long long)expiration, no_reply ? " noreply" : "");
268+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
269+ "flush_all %llu%s\r\n",
270+ (unsigned long long)expiration, no_reply ? " noreply" : "");
271 else
272- send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
273- "flush_all%s\r\n", no_reply ? " noreply" : "");
274+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
275+ "flush_all%s\r\n", no_reply ? " noreply" : "");
276
277 rc= memcached_do(&ptr->hosts[x], buffer, send_length, 1);
278
279@@ -63,7 +63,7 @@
280 request.message.header.request.extlen= 4;
281 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
282 request.message.header.request.bodylen= htonl(request.message.header.request.extlen);
283- request.message.body.expiration= htonl(expiration);
284+ request.message.body.expiration= htonl((uint32_t) expiration);
285
286 for (x= 0; x < ptr->number_of_hosts; x++)
287 {
288
289=== modified file 'libmemcached/memcached_get.c'
290--- libmemcached/memcached_get.c 2009-07-15 18:26:30 +0000
291+++ libmemcached/memcached_get.c 2009-07-18 17:11:19 +0000
292@@ -59,7 +59,7 @@
293 {
294 if (rc == MEMCACHED_BUFFERED)
295 {
296- uint8_t latch; /* We use latch to track the state of the original socket */
297+ uint64_t latch; /* We use latch to track the state of the original socket */
298 latch= memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS);
299 if (latch == 0)
300 memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 1);
301@@ -306,12 +306,12 @@
302
303 request.message.header.request.keylen= htons((uint16_t)key_length[x]);
304 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
305- request.message.header.request.bodylen= htonl(key_length[x]);
306+ request.message.header.request.bodylen= htonl((uint32_t) key_length[x]);
307
308 if ((memcached_io_write(&ptr->hosts[server_key], request.bytes,
309 sizeof(request.bytes), 0) == -1) ||
310 (memcached_io_write(&ptr->hosts[server_key], keys[x],
311- key_length[x], flush) == -1))
312+ key_length[x], (char) flush) == -1))
313 {
314 memcached_server_response_reset(&ptr->hosts[server_key]);
315 rc= MEMCACHED_SOME_ERRORS;
316@@ -405,12 +405,12 @@
317
318 request.message.header.request.keylen= htons((uint16_t)key_length[x]);
319 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
320- request.message.header.request.bodylen= htonl(key_length[x]);
321+ request.message.header.request.bodylen= htonl((uint32_t) key_length[x]);
322
323 if ((memcached_io_write(&ptr->hosts[server], request.bytes,
324 sizeof(request.bytes), 0) == -1) ||
325 (memcached_io_write(&ptr->hosts[server], keys[x],
326- key_length[x], flush) == -1))
327+ key_length[x], (char) flush) == -1))
328 {
329 memcached_io_reset(&ptr->hosts[server]);
330 dead_servers[server]= true;
331
332=== modified file 'libmemcached/memcached_hash.c'
333--- libmemcached/memcached_hash.c 2009-07-01 16:18:18 +0000
334+++ libmemcached/memcached_hash.c 2009-07-18 17:11:32 +0000
335@@ -47,11 +47,11 @@
336 break;
337 case MEMCACHED_HASH_FNV1A_64:
338 {
339- hash= FNV_64_INIT;
340+ hash= (uint32_t) FNV_64_INIT;
341 for (x= 0; x < key_length; x++)
342 {
343 hash ^= key[x];
344- hash *= FNV_64_PRIME;
345+ hash *= (uint32_t) FNV_64_PRIME;
346 }
347 }
348 break;
349@@ -146,7 +146,7 @@
350 case MEMCACHED_DISTRIBUTION_MODULA:
351 return hash % ptr->number_of_hosts;
352 case MEMCACHED_DISTRIBUTION_RANDOM:
353- return random() % ptr->number_of_hosts;
354+ return (uint32_t) random() % ptr->number_of_hosts;
355 default:
356 WATCHPOINT_ASSERT(0); /* We have added a distribution without extending the logic */
357 return hash % ptr->number_of_hosts;
358@@ -201,11 +201,11 @@
359 static uint32_t internal_generate_hash(const char *key, size_t key_length)
360 {
361 const char *ptr= key;
362- uint32_t value= 0;
363+ int32_t value= 0;
364
365 while (key_length--)
366 {
367- value += *ptr++;
368+ value += (int32_t) *ptr++;
369 value += (value << 10);
370 value ^= (value >> 6);
371 }
372@@ -213,7 +213,7 @@
373 value ^= (value >> 11);
374 value += (value << 15);
375
376- return value == 0 ? 1 : value;
377+ return value == 0 ? 1 : (uint32_t) value;
378 }
379
380 static uint32_t internal_generate_md5(const char *key, size_t key_length)
381
382=== modified file 'libmemcached/memcached_hosts.c'
383--- libmemcached/memcached_hosts.c 2009-06-14 21:24:48 +0000
384+++ libmemcached/memcached_hosts.c 2009-07-18 17:11:59 +0000
385@@ -29,7 +29,7 @@
386 if (ptr->number_of_hosts)
387 {
388 qsort(ptr->hosts, ptr->number_of_hosts, sizeof(memcached_server_st), compare_servers);
389- ptr->hosts[0].count= ptr->number_of_hosts;
390+ ptr->hosts[0].count= (uint16_t) ptr->number_of_hosts;
391 }
392 }
393
394@@ -111,8 +111,8 @@
395 uint32_t pointer_per_server= MEMCACHED_POINTS_PER_SERVER;
396 uint32_t pointer_per_hash= 1;
397 uint64_t total_weight= 0;
398- uint32_t is_ketama_weighted= 0;
399- uint32_t is_auto_ejecting= 0;
400+ uint64_t is_ketama_weighted= 0;
401+ uint64_t is_auto_ejecting= 0;
402 uint32_t points_per_server= 0;
403 uint32_t live_servers= 0;
404 struct timeval now;
405@@ -146,7 +146,7 @@
406 live_servers= ptr->number_of_hosts;
407
408 is_ketama_weighted= memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED);
409- points_per_server= is_ketama_weighted ? MEMCACHED_POINTS_PER_SERVER_KETAMA : MEMCACHED_POINTS_PER_SERVER;
410+ points_per_server= (uint32_t) (is_ketama_weighted ? MEMCACHED_POINTS_PER_SERVER_KETAMA : MEMCACHED_POINTS_PER_SERVER);
411
412 if (live_servers == 0)
413 return MEMCACHED_SUCCESS;
414@@ -186,7 +186,7 @@
415 if (is_ketama_weighted)
416 {
417 float pct = (float)list[host_index].weight / (float)total_weight;
418- pointer_per_server= floorf(pct * MEMCACHED_POINTS_PER_SERVER_KETAMA / 4 * (float)live_servers + 0.0000000001) * 4;
419+ pointer_per_server= (uint32_t) ((floorf((float) (pct * MEMCACHED_POINTS_PER_SERVER_KETAMA / 4 * (float)live_servers + 0.0000000001))) * 4);
420 pointer_per_hash= 4;
421 #ifdef DEBUG
422 printf("ketama_weighted:%s|%d|%llu|%u\n",
423@@ -205,18 +205,18 @@
424
425 if (list[host_index].port == MEMCACHED_DEFAULT_PORT)
426 {
427- sort_host_length= snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH,
428- "%s-%d",
429- list[host_index].hostname,
430- pointer_index - 1);
431+ sort_host_length= (size_t) snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH,
432+ "%s-%d",
433+ list[host_index].hostname,
434+ pointer_index - 1);
435
436 }
437 else
438 {
439- sort_host_length= snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH,
440- "%s:%d-%d",
441- list[host_index].hostname,
442- list[host_index].port, pointer_index - 1);
443+ sort_host_length= (size_t) snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH,
444+ "%s:%d-%d",
445+ list[host_index].hostname,
446+ list[host_index].port, pointer_index - 1);
447 }
448 WATCHPOINT_ASSERT(sort_host_length);
449
450@@ -225,7 +225,7 @@
451 unsigned int i;
452 for (i = 0; i < pointer_per_hash; i++)
453 {
454- value= ketama_server_hash(sort_host, sort_host_length, i);
455+ value= ketama_server_hash(sort_host, (uint32_t) sort_host_length, (int) i);
456 ptr->continuum[continuum_index].index= host_index;
457 ptr->continuum[continuum_index++].value= value;
458 }
459@@ -289,7 +289,7 @@
460 list[x].port, list[x].weight, list[x].type);
461 ptr->number_of_hosts++;
462 }
463- ptr->hosts[0].count= ptr->number_of_hosts;
464+ ptr->hosts[0].count= (uint16_t) ptr->number_of_hosts;
465
466 return run_distribution(ptr);
467 }
468@@ -374,7 +374,7 @@
469 /* TODO: Check return type */
470 (void)memcached_server_create_with(ptr, &ptr->hosts[ptr->number_of_hosts], hostname, port, weight, type);
471 ptr->number_of_hosts++;
472- ptr->hosts[0].count= ptr->number_of_hosts;
473+ ptr->hosts[0].count= (uint16_t) ptr->number_of_hosts;
474
475 return run_distribution(ptr);
476 }
477@@ -445,7 +445,7 @@
478 memcached_server_create_with(NULL, &new_host_list[count-1], hostname, port, weight, MEMCACHED_CONNECTION_TCP);
479
480 /* Backwards compatibility hack */
481- new_host_list[0].count= count;
482+ new_host_list[0].count= (uint16_t) count;
483
484 *error= MEMCACHED_SUCCESS;
485 return new_host_list;
486
487=== modified file 'libmemcached/memcached_io.c'
488--- libmemcached/memcached_io.c 2009-06-14 21:24:48 +0000
489+++ libmemcached/memcached_io.c 2009-07-18 17:37:40 +0000
490@@ -146,8 +146,8 @@
491 }
492
493 ptr->io_bytes_sent = 0;
494- ptr->read_data_length= data_read;
495- ptr->read_buffer_length= data_read;
496+ ptr->read_data_length= (size_t) data_read;
497+ ptr->read_buffer_length= (size_t) data_read;
498 ptr->read_ptr= ptr->read_buffer;
499 }
500
501@@ -174,7 +174,7 @@
502 }
503
504 ptr->server_failure_counter= 0;
505- *nread = (size_t)(buffer_ptr - (char*)buffer);
506+ *nread = (ssize_t)(buffer_ptr - (char*)buffer);
507 return MEMCACHED_SUCCESS;
508 }
509
510@@ -242,7 +242,7 @@
511 return -1;
512 }
513
514- return original_length;
515+ return (ssize_t) original_length;
516 }
517
518 memcached_return memcached_io_close(memcached_server_st *ptr)
519@@ -408,11 +408,11 @@
520 return -1;
521 }
522
523- ptr->io_bytes_sent += sent_length;
524+ ptr->io_bytes_sent += (uint32_t) sent_length;
525
526 local_write_ptr+= sent_length;
527- write_length-= sent_length;
528- return_length+= sent_length;
529+ write_length-= (uint32_t) sent_length;
530+ return_length+= (uint32_t) sent_length;
531 }
532
533 WATCHPOINT_ASSERT(write_length == 0);
534@@ -426,7 +426,7 @@
535 else
536 ptr->write_buffer_offset= 0;
537
538- return return_length;
539+ return (ssize_t) return_length;
540 }
541
542 /*
543@@ -456,7 +456,7 @@
544 if (rc != MEMCACHED_SUCCESS)
545 return rc;
546
547- offset+= nread;
548+ offset+= (size_t) nread;
549 }
550
551 return MEMCACHED_SUCCESS;
552@@ -524,13 +524,13 @@
553 {
554 struct udp_datagram_header_st *header= (struct udp_datagram_header_st *)ptr->write_buffer;
555 uint16_t cur_req= get_udp_datagram_request_id(header);
556- uint16_t msg_num= get_msg_num_from_request_id(cur_req);
557- uint16_t thread_id= get_thread_id_from_request_id(cur_req);
558+ int msg_num= get_msg_num_from_request_id(cur_req);
559+ int thread_id= get_thread_id_from_request_id(cur_req);
560
561 if (((++msg_num) & UDP_REQUEST_ID_THREAD_MASK) != 0)
562 msg_num= 0;
563
564- header->request_id= htons(thread_id | msg_num);
565+ header->request_id= htons((uint16_t) (thread_id | msg_num));
566 }
567
568 memcached_return memcached_io_init_udp_header(memcached_server_st *ptr, uint16_t thread_id)
569@@ -539,7 +539,7 @@
570 return MEMCACHED_FAILURE;
571
572 struct udp_datagram_header_st *header= (struct udp_datagram_header_st *)ptr->write_buffer;
573- header->request_id= htons(generate_udp_request_thread_id(thread_id));
574+ header->request_id= htons((uint16_t) (generate_udp_request_thread_id(thread_id)));
575 header->num_datagrams= htons(1);
576 header->sequence_number= htons(0);
577
578
579=== modified file 'libmemcached/memcached_parse.c'
580--- libmemcached/memcached_parse.c 2009-07-06 17:20:04 +0000
581+++ libmemcached/memcached_parse.c 2009-07-18 17:37:40 +0000
582@@ -10,7 +10,7 @@
583 memcached_server_st *memcached_servers_parse(const char *server_strings)
584 {
585 char *string;
586- unsigned int port;
587+ uint32_t port;
588 uint32_t weight;
589 const char *begin_ptr;
590 const char *end_ptr;
591@@ -32,7 +32,7 @@
592
593 if (string)
594 {
595- memcpy(buffer, begin_ptr, string - begin_ptr);
596+ memcpy(buffer, begin_ptr, (size_t) (string - begin_ptr));
597 buffer[(unsigned int)(string - begin_ptr)]= 0;
598 begin_ptr= string+1;
599 }
600@@ -52,7 +52,7 @@
601
602 ptr++;
603
604- port= strtoul(ptr, (char **)NULL, 10);
605+ port= (uint32_t) strtoul(ptr, (char **)NULL, 10);
606
607 ptr2= index(ptr, ' ');
608 if (! ptr2)
609@@ -60,7 +60,7 @@
610 if (ptr2)
611 {
612 ptr2++;
613- weight = strtoul(ptr2, (char **)NULL, 10);
614+ weight = (uint32_t) strtoul(ptr2, (char **)NULL, 10);
615 }
616 }
617
618
619=== modified file 'libmemcached/memcached_purge.c'
620--- libmemcached/memcached_purge.c 2009-05-13 07:43:30 +0000
621+++ libmemcached/memcached_purge.c 2009-07-18 17:37:40 +0000
622@@ -42,7 +42,7 @@
623 * data to be sent from the server (the commands was in the output buffer
624 * and just flushed
625 */
626- long timeo= ptr->root->poll_timeout;
627+ int32_t timeo= ptr->root->poll_timeout;
628 ptr->root->poll_timeout= 2000;
629
630 result_ptr= memcached_result_create(ptr->root, &result);
631@@ -68,7 +68,7 @@
632 }
633
634 memcached_result_free(result_ptr);
635- ptr->root->poll_timeout=timeo;
636+ ptr->root->poll_timeout= timeo;
637 }
638 ptr->root->purging= 0;
639
640
641=== modified file 'libmemcached/memcached_quit.c'
642--- libmemcached/memcached_quit.c 2009-05-02 06:54:30 +0000
643+++ libmemcached/memcached_quit.c 2009-07-18 17:37:40 +0000
644@@ -43,7 +43,7 @@
645 memcached_io_close(ptr);
646
647 ptr->fd= -1;
648- ptr->write_buffer_offset= (ptr->type == MEMCACHED_CONNECTION_UDP) ? UDP_DATAGRAM_HEADER_LENGTH : 0 ;
649+ ptr->write_buffer_offset= (size_t) ((ptr->type == MEMCACHED_CONNECTION_UDP) ? UDP_DATAGRAM_HEADER_LENGTH : 0);
650 ptr->read_buffer_length= 0;
651 ptr->read_ptr= ptr->read_buffer;
652 memcached_server_response_reset(ptr);
653
654=== modified file 'libmemcached/memcached_response.c'
655--- libmemcached/memcached_response.c 2009-07-15 10:09:06 +0000
656+++ libmemcached/memcached_response.c 2009-07-18 17:37:40 +0000
657@@ -125,7 +125,7 @@
658 if (end_ptr == string_ptr)
659 goto read_error;
660 for (next_ptr= string_ptr; isdigit(*string_ptr); string_ptr++);
661- result->flags= strtoul(next_ptr, &string_ptr, 10);
662+ result->flags= (uint32_t) strtoul(next_ptr, &string_ptr, 10);
663
664 if (end_ptr == string_ptr)
665 goto read_error;
666@@ -250,7 +250,9 @@
667 memory in the struct, which is important, for something that
668 rarely should happen?
669 */
670- rel_ptr= (char *)ptr->root->call_realloc(ptr->root, ptr->cached_server_error, endptr - startptr + 1);
671+ rel_ptr= (char *)ptr->root->call_realloc(ptr->root,
672+ ptr->cached_server_error,
673+ (size_t) (endptr - startptr + 1));
674
675 if (rel_ptr == NULL)
676 {
677@@ -261,7 +263,7 @@
678 }
679 ptr->cached_server_error= rel_ptr;
680
681- memcpy(ptr->cached_server_error, startptr, endptr - startptr);
682+ memcpy(ptr->cached_server_error, startptr, (size_t) (endptr - startptr));
683 ptr->cached_server_error[endptr - startptr]= 0;
684 return MEMCACHED_SERVER_ERROR;
685 }
686@@ -461,7 +463,7 @@
687 size_t nr= (bodylen > SMALL_STRING_LEN) ? SMALL_STRING_LEN : bodylen;
688 if (memcached_safe_read(ptr, hole, nr) != MEMCACHED_SUCCESS)
689 return MEMCACHED_UNKNOWN_READ_FAILURE;
690- bodylen -= nr;
691+ bodylen-= (uint32_t) nr;
692 }
693
694 /* This might be an error from one of the quiet commands.. if
695
696=== modified file 'libmemcached/memcached_stats.c'
697--- libmemcached/memcached_stats.c 2009-07-16 12:11:04 +0000
698+++ libmemcached/memcached_stats.c 2009-07-18 17:37:40 +0000
699@@ -40,15 +40,15 @@
700 }
701 else if (!strcmp("pid", key))
702 {
703- memc_stat->pid= strtol(value, (char **)NULL, 10);
704+ memc_stat->pid= (uint32_t) strtol(value, (char **)NULL, 10);
705 }
706 else if (!strcmp("uptime", key))
707 {
708- memc_stat->uptime= strtol(value, (char **)NULL, 10);
709+ memc_stat->uptime= (uint32_t) strtol(value, (char **)NULL, 10);
710 }
711 else if (!strcmp("time", key))
712 {
713- memc_stat->time= strtol(value, (char **)NULL, 10);
714+ memc_stat->time= (uint32_t) strtol(value, (char **)NULL, 10);
715 }
716 else if (!strcmp("version", key))
717 {
718@@ -57,7 +57,7 @@
719 }
720 else if (!strcmp("pointer_size", key))
721 {
722- memc_stat->pointer_size= strtol(value, (char **)NULL, 10);
723+ memc_stat->pointer_size= (uint32_t) strtol(value, (char **)NULL, 10);
724 }
725 else if (!strcmp("rusage_user", key))
726 {
727@@ -65,8 +65,8 @@
728 for (walk_ptr= value; (!ispunct(*walk_ptr)); walk_ptr++);
729 *walk_ptr= 0;
730 walk_ptr++;
731- memc_stat->rusage_user_seconds= strtol(value, (char **)NULL, 10);
732- memc_stat->rusage_user_microseconds= strtol(walk_ptr, (char **)NULL, 10);
733+ memc_stat->rusage_user_seconds= (uint32_t) strtol(value, (char **)NULL, 10);
734+ memc_stat->rusage_user_microseconds= (uint32_t) strtol(walk_ptr, (char **)NULL, 10);
735 }
736 else if (!strcmp("rusage_system", key))
737 {
738@@ -74,52 +74,52 @@
739 for (walk_ptr= value; (!ispunct(*walk_ptr)); walk_ptr++);
740 *walk_ptr= 0;
741 walk_ptr++;
742- memc_stat->rusage_system_seconds= strtol(value, (char **)NULL, 10);
743- memc_stat->rusage_system_microseconds= strtol(walk_ptr, (char **)NULL, 10);
744+ memc_stat->rusage_system_seconds= (uint32_t) strtol(value, (char **)NULL, 10);
745+ memc_stat->rusage_system_microseconds= (uint32_t) strtol(walk_ptr, (char **)NULL, 10);
746 }
747 else if (!strcmp("curr_items", key))
748 {
749- memc_stat->curr_items= strtol(value, (char **)NULL, 10);
750+ memc_stat->curr_items= (uint32_t) strtol(value, (char **)NULL, 10);
751 }
752 else if (!strcmp("total_items", key))
753 {
754- memc_stat->total_items= strtol(value, (char **)NULL, 10);
755+ memc_stat->total_items= (uint32_t) strtol(value, (char **)NULL, 10);
756 }
757 else if (!strcmp("bytes_read", key))
758 {
759- memc_stat->bytes_read= strtoll(value, (char **)NULL, 10);
760+ memc_stat->bytes_read= (uint32_t) strtoll(value, (char **)NULL, 10);
761 }
762 else if (!strcmp("bytes_written", key))
763 {
764- memc_stat->bytes_written= strtoll(value, (char **)NULL, 10);
765+ memc_stat->bytes_written= (uint32_t) strtoll(value, (char **)NULL, 10);
766 }
767 else if (!strcmp("bytes", key))
768 {
769- memc_stat->bytes= strtoll(value, (char **)NULL, 10);
770+ memc_stat->bytes= (uint32_t) strtoll(value, (char **)NULL, 10);
771 }
772 else if (!strcmp("curr_connections", key))
773 {
774- memc_stat->curr_connections= strtoll(value, (char **)NULL, 10);
775+ memc_stat->curr_connections= (uint32_t) strtoll(value, (char **)NULL, 10);
776 }
777 else if (!strcmp("total_connections", key))
778 {
779- memc_stat->total_connections= strtoll(value, (char **)NULL, 10);
780+ memc_stat->total_connections= (uint32_t) strtoll(value, (char **)NULL, 10);
781 }
782 else if (!strcmp("connection_structures", key))
783 {
784- memc_stat->connection_structures= strtol(value, (char **)NULL, 10);
785+ memc_stat->connection_structures= (uint32_t) strtol(value, (char **)NULL, 10);
786 }
787 else if (!strcmp("cmd_get", key))
788 {
789- memc_stat->cmd_get= strtoll(value, (char **)NULL, 10);
790+ memc_stat->cmd_get= (uint64_t) strtoll(value, (char **)NULL, 10);
791 }
792 else if (!strcmp("cmd_set", key))
793 {
794- memc_stat->cmd_set= strtoll(value, (char **)NULL, 10);
795+ memc_stat->cmd_set= (uint64_t) strtoll(value, (char **)NULL, 10);
796 }
797 else if (!strcmp("get_hits", key))
798 {
799- memc_stat->get_hits= strtoll(value, (char **)NULL, 10);
800+ memc_stat->get_hits= (uint64_t) strtoll(value, (char **)NULL, 10);
801 }
802 else if (!strcmp("get_misses", key))
803 {
804@@ -131,11 +131,11 @@
805 }
806 else if (!strcmp("limit_maxbytes", key))
807 {
808- memc_stat->limit_maxbytes= strtoll(value, (char **)NULL, 10);
809+ memc_stat->limit_maxbytes= (uint64_t) strtoll(value, (char **)NULL, 10);
810 }
811 else if (!strcmp("threads", key))
812 {
813- memc_stat->threads= strtol(value, (char **)NULL, 10);
814+ memc_stat->threads= (uint32_t) strtol(value, (char **)NULL, 10);
815 }
816 else if (!(strcmp("delete_misses", key) == 0 ||/* New stats in the 1.3 beta */
817 strcmp("delete_hits", key) == 0 ||/* Just swallow them for now.. */
818@@ -162,7 +162,7 @@
819 const char *key, memcached_return *error)
820 {
821 char buffer[SMALL_STRING_LEN];
822- size_t length;
823+ int length;
824 char *ret;
825
826 *error= MEMCACHED_SUCCESS;
827@@ -217,8 +217,8 @@
828 return NULL;
829 }
830
831- ret= ptr->call_malloc(ptr, length + 1);
832- memcpy(ret, buffer, length);
833+ ret= ptr->call_malloc(ptr, (size_t) (length + 1));
834+ memcpy(ret, buffer, (size_t) length);
835 ret[length]= '\0';
836
837 return ret;
838@@ -239,14 +239,14 @@
839
840 if (args != NULL)
841 {
842- int len= strlen(args);
843+ size_t len= strlen(args);
844
845 rc= memcached_validate_key_length(len, true);
846 unlikely (rc != MEMCACHED_SUCCESS)
847 return rc;
848
849 request.message.header.request.keylen= htons((uint16_t)len);
850- request.message.header.request.bodylen= htonl(len);
851+ request.message.header.request.bodylen= htonl((uint32_t) len);
852
853 if ((memcached_do(&ptr->hosts[server_key], request.bytes,
854 sizeof(request.bytes), 0) != MEMCACHED_SUCCESS) ||
855@@ -305,11 +305,11 @@
856 size_t send_length;
857
858 if (args)
859- send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
860- "stats %s\r\n", args);
861+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
862+ "stats %s\r\n", args);
863 else
864- send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
865- "stats\r\n");
866+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
867+ "stats\r\n");
868
869 if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
870 return MEMCACHED_WRITE_FAILURE;
871
872=== modified file 'libmemcached/memcached_storage.c'
873--- libmemcached/memcached_storage.c 2009-07-08 13:38:34 +0000
874+++ libmemcached/memcached_storage.c 2009-07-18 17:37:40 +0000
875@@ -91,14 +91,14 @@
876 server_key= memcached_generate_hash(ptr, master_key, master_key_length);
877
878 if (cas)
879- write_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
880- "%s %s%.*s %u %llu %zu %llu%s\r\n",
881- storage_op_string(verb),
882- ptr->prefix_key,
883- (int)key_length, key, flags,
884- (unsigned long long)expiration, value_length,
885- (unsigned long long)cas,
886- (ptr->flags & MEM_NOREPLY) ? " noreply" : "");
887+ write_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
888+ "%s %s%.*s %u %llu %zu %llu%s\r\n",
889+ storage_op_string(verb),
890+ ptr->prefix_key,
891+ (int)key_length, key, flags,
892+ (unsigned long long)expiration, value_length,
893+ (unsigned long long)cas,
894+ (ptr->flags & MEM_NOREPLY) ? " noreply" : "");
895 else
896 {
897 char *buffer_ptr= buffer;
898@@ -118,11 +118,11 @@
899 buffer_ptr++;
900
901 write_length= (size_t)(buffer_ptr - buffer);
902- write_length+= snprintf(buffer_ptr, MEMCACHED_DEFAULT_COMMAND_SIZE,
903- "%u %llu %zu%s\r\n",
904- flags,
905- (unsigned long long)expiration, value_length,
906- (ptr->flags & MEM_NOREPLY) ? " noreply" : "");
907+ write_length+= (size_t) snprintf(buffer_ptr, MEMCACHED_DEFAULT_COMMAND_SIZE,
908+ "%u %llu %zu%s\r\n",
909+ flags,
910+ (unsigned long long)expiration, value_length,
911+ (ptr->flags & MEM_NOREPLY) ? " noreply" : "");
912 }
913
914 if (ptr->flags & MEM_USE_UDP && ptr->flags & MEM_BUFFER_REQUESTS)
915@@ -429,7 +429,7 @@
916 uint64_t cas,
917 memcached_storage_action verb)
918 {
919- char flush;
920+ uint8_t flush;
921 protocol_binary_request_set request= {.bytes= {0}};
922 size_t send_length= sizeof(request.bytes);
923 uint32_t server_key= memcached_generate_hash(ptr, master_key,
924@@ -450,13 +450,13 @@
925 request.message.body.expiration= htonl((uint32_t)expiration);
926 }
927
928- request.message.header.request.bodylen= htonl(key_length + value_length +
929- request.message.header.request.extlen);
930+ request.message.header.request.bodylen= htonl((uint32_t) (key_length + value_length +
931+ request.message.header.request.extlen));
932
933 if (cas)
934 request.message.header.request.cas= htonll(cas);
935
936- flush= ((server->root->flags & MEM_BUFFER_REQUESTS) && verb == SET_OP) ? 0 : 1;
937+ flush= (uint8_t) (((server->root->flags & MEM_BUFFER_REQUESTS) && verb == SET_OP) ? 0 : 1);
938
939 if ((server->root->flags & MEM_USE_UDP) && !flush)
940 {
941@@ -470,7 +470,7 @@
942 /* write the header */
943 if ((memcached_do(server, (const char*)request.bytes, send_length, 0) != MEMCACHED_SUCCESS) ||
944 (memcached_io_write(server, key, key_length, 0) == -1) ||
945- (memcached_io_write(server, value, value_length, flush) == -1))
946+ (memcached_io_write(server, value, value_length, (char) flush) == -1))
947 {
948 memcached_io_reset(server);
949 return MEMCACHED_WRITE_FAILURE;
950@@ -490,7 +490,7 @@
951 if ((memcached_do(srv, (const char*)request.bytes,
952 send_length, 0) != MEMCACHED_SUCCESS) ||
953 (memcached_io_write(srv, key, key_length, 0) == -1) ||
954- (memcached_io_write(srv, value, value_length, flush) == -1))
955+ (memcached_io_write(srv, value, value_length, (char) flush) == -1))
956 memcached_io_reset(srv);
957 else
958 memcached_server_response_decrement(srv);
959
960=== modified file 'libmemcached/memcached_string.c'
961--- libmemcached/memcached_string.c 2009-07-08 13:38:34 +0000
962+++ libmemcached/memcached_string.c 2009-07-18 17:37:40 +0000
963@@ -4,7 +4,7 @@
964 {
965 if (need && need > (size_t)(string->current_size - (size_t)(string->end - string->string)))
966 {
967- size_t current_offset= string->end - string->string;
968+ size_t current_offset= (size_t) (string->end - string->string);
969 char *new_value;
970 size_t adjust;
971 size_t new_size;
972
973=== modified file 'libmemcached/memcached_verbosity.c'
974--- libmemcached/memcached_verbosity.c 2009-05-13 21:40:19 +0000
975+++ libmemcached/memcached_verbosity.c 2009-07-18 17:37:40 +0000
976@@ -7,8 +7,8 @@
977 memcached_return rc;
978 char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
979
980- send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
981- "verbosity %u\r\n", verbosity);
982+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
983+ "verbosity %u\r\n", verbosity);
984 unlikely (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
985 return MEMCACHED_WRITE_FAILURE;
986
987
988=== modified file 'libmemcached/murmur_hash.c'
989--- libmemcached/murmur_hash.c 2009-06-14 21:24:48 +0000
990+++ libmemcached/murmur_hash.c 2009-07-18 17:37:40 +0000
991@@ -25,13 +25,13 @@
992 */
993
994 const unsigned int m= 0x5bd1e995;
995- const unsigned int seed= (0xdeadbeef * length);
996+ const size_t seed= (0xdeadbeef * length);
997 const int r= 24;
998
999
1000 // Initialize the hash to a 'random' value
1001
1002- unsigned int h= seed ^ length;
1003+ size_t h= seed ^ length;
1004
1005 // Mix 4 bytes at a time into the hash
1006
1007@@ -72,5 +72,5 @@
1008 h *= m;
1009 h ^= h >> 15;
1010
1011- return h;
1012+ return (uint32_t) h;
1013 }
1014
1015=== modified file 'm4/lib-prefix.m4'
1016--- m4/lib-prefix.m4 2009-07-16 02:58:56 +0000
1017+++ m4/lib-prefix.m4 2009-07-18 18:11:25 +0000
1018@@ -183,18 +183,13 @@
1019 dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
1020 dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
1021 dnl symlink is missing, so we set acl_libdirstem2 too.
1022- AC_MSG_CHECKING([if buildling 64-bit app])
1023- AC_RUN_IFELSE([
1024- AC_LANG_PROGRAM([
1025- ], [
1026- return sizeof(void*) == 8 ? 0 : 1;
1027- ])
1028- ], [
1029- gl_cv_solaris_64bit=yes
1030- ], [
1031- gl_cv_solaris_64bit=no
1032- ])
1033- AC_MSG_RESULT([$gl_cv_solaris_64bit])
1034+ AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
1035+ [AC_RUN_IFELSE([
1036+ AC_LANG_PROGRAM([], [[
1037+ return sizeof(void*) == 8 ? 0 : 1;
1038+ ]])
1039+ ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
1040+ ])
1041 if test $gl_cv_solaris_64bit = yes; then
1042 acl_libdirstem=lib/64
1043 case "$host_cpu" in
1044
1045=== modified file 'm4/pandora_64bit.m4'
1046--- m4/pandora_64bit.m4 2009-07-14 19:18:55 +0000
1047+++ m4/pandora_64bit.m4 2009-07-18 18:11:25 +0000
1048@@ -7,6 +7,8 @@
1049 dnl Macro: PANDORA_64BIT
1050 dnl ---------------------------------------------------------------------------
1051 AC_DEFUN([PANDORA_64BIT],[
1052+ AC_BEFORE([$0], [AC_LIB_PREFIX])
1053+
1054
1055 AC_ARG_ENABLE([64bit],[
1056 AS_HELP_STRING([--disable-64bit],
1057
1058=== modified file 'm4/pandora_canonical.m4'
1059--- m4/pandora_canonical.m4 2009-07-16 02:28:54 +0000
1060+++ m4/pandora_canonical.m4 2009-07-18 18:11:25 +0000
1061@@ -4,7 +4,7 @@
1062 dnl with or without modifications, as long as this notice is preserved.
1063
1064 dnl Which version of the canonical setup we're using
1065-AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.20])
1066+AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.22])
1067
1068 AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[
1069 dnl Force dependency tracking on for Sun Studio builds
1070@@ -59,6 +59,7 @@
1071
1072 AC_REQUIRE([AC_PROG_CC])
1073 AC_REQUIRE([PANDORA_MAC_GCC42])
1074+ AC_REQUIRE([PANDORA_64BIT])
1075
1076 dnl Once we can use a modern autoconf, we can use this
1077 dnl AC_PROG_CC_C99
1078@@ -66,6 +67,7 @@
1079 AC_PROG_CPP
1080 AM_PROG_CC_C_O
1081
1082+
1083 gl_USE_SYSTEM_EXTENSIONS
1084 m4_if(PCT_FORCE_GCC42, [yes], [
1085 AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION)
1086@@ -111,7 +113,6 @@
1087 PANDORA_CHECK_CXX_VERSION
1088
1089 PANDORA_OPTIMIZE
1090- PANDORA_64BIT
1091
1092 dnl We need to inject error into the cflags to test if visibility works or not
1093 save_CFLAGS="${CFLAGS}"
1094
1095=== added file 'm4/pandora_have_libpq.m4'
1096--- m4/pandora_have_libpq.m4 1970-01-01 00:00:00 +0000
1097+++ m4/pandora_have_libpq.m4 2009-07-18 18:11:25 +0000
1098@@ -0,0 +1,31 @@
1099+dnl Copyright (C) 2009 Sun Microsystems
1100+dnl This file is free software; Sun Microsystems
1101+dnl gives unlimited permission to copy and/or distribute it,
1102+dnl with or without modifications, as long as this notice is preserved.
1103+
1104+AC_DEFUN([_PANDORA_SEARCH_LIBPQ],[
1105+ AC_REQUIRE([AC_LIB_PREFIX])
1106+
1107+ dnl --------------------------------------------------------------------
1108+ dnl Check for libpq
1109+ dnl --------------------------------------------------------------------
1110+
1111+ AC_LIB_HAVE_LINKFLAGS(pq,,[
1112+ #include <libpq-fe.h>
1113+ ], [
1114+ PGconn *conn;
1115+ conn = PQconnectdb(NULL);
1116+ ])
1117+
1118+ AM_CONDITIONAL(HAVE_LIBPQ, [test "x${ac_cv_libpq}" = "xyes"])
1119+])
1120+
1121+AC_DEFUN([PANDORA_HAVE_LIBPQ],[
1122+ AC_REQUIRE([_PANDORA_SEARCH_LIBPQ])
1123+])
1124+
1125+AC_DEFUN([PANDORA_REQUIRE_LIBPQ],[
1126+ AC_REQUIRE([PANDORA_HAVE_LIBPQ])
1127+ AS_IF([test x$ac_cv_libpq = xno],
1128+ AC_MSG_ERROR([libpq is required for ${PACKAGE}]))
1129+])

Subscribers

People subscribed via source and target branches

to all changes: