From 6d2ccfed48558f171c2840c3aa479261050d084a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 24 Jul 2010 22:52:35 +0200 Subject: add_buffer_send: fix compiler warning Win64's 32 bit long but 64 bit size_t caused a warning that we avoid with a typecast. A small whitespace indent fix was also applied. Reported by: Adam Light --- lib/http.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'lib/http.c') diff --git a/lib/http.c b/lib/http.c index 93a5e3e33..ddec280f4 100644 --- a/lib/http.c +++ b/lib/http.c @@ -977,12 +977,15 @@ Curl_send_buffer *Curl_add_buffer_init(void) * Returns CURLcode */ CURLcode Curl_add_buffer_send(Curl_send_buffer *in, - struct connectdata *conn, - long *bytes_written, /* add the number of sent bytes - to this counter */ - size_t included_body_bytes, /* how much of the buffer - contains body data */ - int socketindex) + struct connectdata *conn, + + /* add the number of sent bytes to this + counter */ + long *bytes_written, + + /* how much of the buffer contains body data */ + size_t included_body_bytes, + int socketindex) { ssize_t amount; @@ -1069,7 +1072,10 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer *in, accordingly */ http->writebytecount += bodylen; - *bytes_written += amount; + /* 'amount' can never be a very large value here so typecasting it so a + signed 31 bit value should not cause problems even if ssize_t is + 64bit */ + *bytes_written += (long)amount; if(http) { if((size_t)amount != size) { @@ -1380,7 +1386,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, if(CURLE_OK == result) { /* Now send off the request */ result = Curl_add_buffer_send(req_buffer, conn, - &data->info.request_size, 0, sockindex); + &data->info.request_size, 0, sockindex); } req_buffer = NULL; if(result) -- cgit v1.2.3