aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2010-06-08 10:19:39 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-06-08 10:19:39 +0200
commit7977bc3dfa7ed77d0a76834d7f1134b3e4a5c9cd (patch)
tree3d091e30f48db8791bfd6cb3dee674c2b19d097d
parent00fdafb0a18d39581cda2ade023bb29ccbf4038e (diff)
TFTP: fix warning for sendto() usage on non-POSIX systems
Older unixes want an 'int' instead of 'size_t' as the 3rd argumment so before this change it would cause warnings such as: There is an implicit conversion from "unsigned long" to "int"; rounding, sign extension, or loss of accuracy may result.
-rw-r--r--lib/tftp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/tftp.c b/lib/tftp.c
index 166954f85..c09aadc03 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -535,10 +535,12 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
sbytes += tftp_option_add(state, sbytes,
(char *)state->spacket.data+sbytes, buf );
+ /* the typecase for the 3rd argument is mostly for systems that do
+ not have a size_t argument, like older unixes that want an 'int' */
senddata = sendto(state->sockfd, (void *)state->spacket.data,
- sbytes, 0,
- state->conn->ip_addr->ai_addr,
- state->conn->ip_addr->ai_addrlen);
+ (SEND_TYPE_ARG3)sbytes, 0,
+ state->conn->ip_addr->ai_addr,
+ state->conn->ip_addr->ai_addrlen);
if(senddata != (ssize_t)sbytes) {
failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO));
}