aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-02-04 19:44:31 +0000
committerYang Tse <yangsita@gmail.com>2010-02-04 19:44:31 +0000
commit7aef172a347a0422a0968fde9c487639ff673383 (patch)
tree56ffb38d50520aa2a62aefa24a592381ecec4193
parentf47b84b57ff74915820d26efc30459158bbe5c9c (diff)
fix printf-style format strings
-rw-r--r--lib/connect.c4
-rw-r--r--lib/easy.c12
-rw-r--r--lib/ftp.c16
-rw-r--r--lib/http.c14
-rw-r--r--lib/ldap.c6
-rw-r--r--lib/mprintf.c4
-rw-r--r--lib/multi.c14
-rw-r--r--lib/qssl.c6
-rw-r--r--lib/sendf.c6
-rw-r--r--lib/socks.c4
-rw-r--r--lib/ssh.c5
-rw-r--r--lib/telnet.c2
-rw-r--r--lib/tftp.c2
-rw-r--r--lib/transfer.c2
-rw-r--r--lib/url.c2
15 files changed, 50 insertions, 49 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 1d2947488..5e94b8673 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -397,13 +397,13 @@ static CURLcode bindlocal(struct connectdata *conn,
error, Curl_strerror(conn, error));
return CURLE_INTERFACE_FAILED;
}
- infof(data, "Local port: %d\n", port);
+ infof(data, "Local port: %hu\n", port);
conn->bits.bound = TRUE;
return CURLE_OK;
}
if(--portnum > 0) {
- infof(data, "Bind to local port %d failed, trying next\n", port);
+ infof(data, "Bind to local port %hu failed, trying next\n", port);
port++; /* try next port */
/* We re-use/clobber the port variable here below */
if(sock->sa_family == AF_INET)
diff --git a/lib/easy.c b/lib/easy.c
index 06cd3fb50..a90e0bd3a 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -882,8 +882,8 @@ CURLcode Curl_convert_to_network(struct SessionHandle *data,
rc = data->set.convtonetwork(buffer, length);
if(rc != CURLE_OK) {
failf(data,
- "CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %i: %s",
- rc, curl_easy_strerror(rc));
+ "CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %d: %s",
+ (int)rc, curl_easy_strerror(rc));
}
return(rc);
}
@@ -943,8 +943,8 @@ CURLcode Curl_convert_from_network(struct SessionHandle *data,
rc = data->set.convfromnetwork(buffer, length);
if(rc != CURLE_OK) {
failf(data,
- "CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %i: %s",
- rc, curl_easy_strerror(rc));
+ "CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %d: %s",
+ (int)rc, curl_easy_strerror(rc));
}
return(rc);
}
@@ -1004,8 +1004,8 @@ CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
rc = data->set.convfromutf8(buffer, length);
if(rc != CURLE_OK) {
failf(data,
- "CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %i: %s",
- rc, curl_easy_strerror(rc));
+ "CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %d: %s",
+ (int)rc, curl_easy_strerror(rc));
}
return(rc);
}
diff --git a/lib/ftp.c b/lib/ftp.c
index 6a9573ab5..862b3402f 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -882,7 +882,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
/* The requested bind address is not local. Use the address used for
* the control connection instead and restart the port loop
*/
- failf(data, "bind(port=%i) failed: %s", port,
+ failf(data, "bind(port=%hu) failed: %s", port,
Curl_strerror(conn, error) );
sslen = sizeof(ss);
@@ -896,7 +896,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
continue;
}
else if(error != EADDRINUSE && error != EACCES) {
- failf(data, "bind(port=%i) failed: %s", port,
+ failf(data, "bind(port=%hu) failed: %s", port,
Curl_strerror(conn, error) );
sclose(portsock);
return CURLE_FTP_PORT_FAILED;
@@ -978,7 +978,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
* EPRT |2|1080::8:800:200C:417A|5282|
*/
- result = Curl_pp_sendf(&ftpc->pp, "%s |%d|%s|%d|", mode[fcmd],
+ result = Curl_pp_sendf(&ftpc->pp, "%s |%d|%s|%hu|", mode[fcmd],
sa->sa_family == AF_INET?1:2,
myhost, port);
if(result)
@@ -999,7 +999,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
source++;
}
*dest = 0;
- snprintf(dest, 20, ",%d,%d", port>>8, port&0xff);
+ snprintf(dest, 20, ",%d,%d", (int)(port>>8), (int)(port&0xff));
result = Curl_pp_sendf(&ftpc->pp, "%s %s", mode[fcmd], tmp);
if(result)
@@ -1623,7 +1623,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
(unsigned short)conn->port; /* we connect to the proxy's port */
if(!addr) {
- failf(data, "Can't resolve proxy host %s:%d",
+ failf(data, "Can't resolve proxy host %s:%hu",
conn->proxy.name, connectport);
return CURLE_FTP_CANT_GET_HOST;
}
@@ -1638,7 +1638,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
connectport = newport; /* we connect to the remote port */
if(!addr) {
- failf(data, "Can't resolve new host %s:%d", newhost, connectport);
+ failf(data, "Can't resolve new host %s:%hu", newhost, connectport);
return CURLE_FTP_CANT_GET_HOST;
}
}
@@ -2420,7 +2420,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
break;
default:
failf(data, "unsupported parameter to CURLOPT_FTPSSLAUTH: %d",
- data->set.ftpsslauth);
+ (int)data->set.ftpsslauth);
return CURLE_FAILED_INIT; /* we don't know what to do */
}
PPSENDF(&ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]);
@@ -3367,7 +3367,7 @@ static CURLcode ftp_nextconnect(struct connectdata *conn)
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
/* end of transfer */
- DEBUGF(infof(data, "DO-MORE phase ends with %d\n", result));
+ DEBUGF(infof(data, "DO-MORE phase ends with %d\n", (int)result));
return result;
}
diff --git a/lib/http.c b/lib/http.c
index 15943202e..9820b8f62 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1305,7 +1305,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
char *host_port;
Curl_send_buffer *req_buffer;
- infof(data, "Establish HTTP proxy tunnel to %s:%d\n",
+ infof(data, "Establish HTTP proxy tunnel to %s:%hu\n",
hostname, remote_port);
if(data->req.newurl) {
@@ -1322,7 +1322,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
if(!req_buffer)
return CURLE_OUT_OF_MEMORY;
- host_port = aprintf("%s:%d", hostname, remote_port);
+ host_port = aprintf("%s:%hu", hostname, remote_port);
if(!host_port) {
free(req_buffer);
return CURLE_OUT_OF_MEMORY;
@@ -1357,7 +1357,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
/* BLOCKING */
result =
Curl_add_bufferf(req_buffer,
- "CONNECT %s:%d HTTP/%s\r\n"
+ "CONNECT %s:%hu HTTP/%s\r\n"
"%s" /* Host: */
"%s" /* Proxy-Authorization */
"%s" /* User-Agent */
@@ -1525,7 +1525,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
keepon = FALSE;
}
else
- infof(data, "Read %d bytes of chunk, continue\n",
+ infof(data, "Read %zd bytes of chunk, continue\n",
tookcareof);
}
}
@@ -1596,7 +1596,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
attention so that this is cleared again when this
function returns! */
k->ignorebody = TRUE;
- infof(data, "%d bytes of chunk left\n", gotbytes-i);
+ infof(data, "%zd bytes of chunk left\n", gotbytes-i);
if(line_start[1] == '\n') {
/* this can only be a LF if the letter at index 0
@@ -1615,7 +1615,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
keepon = FALSE;
}
else
- infof(data, "Read %d bytes of chunk, continue\n",
+ infof(data, "Read %zd bytes of chunk, continue\n",
gotbytes);
}
else {
@@ -2284,7 +2284,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
host,
conn->bits.ipv6_ip?"]":"");
else
- conn->allocptr.host = aprintf("Host: %s%s%s:%d\r\n",
+ conn->allocptr.host = aprintf("Host: %s%s%s:%hu\r\n",
conn->bits.ipv6_ip?"[":"",
host,
conn->bits.ipv6_ip?"]":"",
diff --git a/lib/ldap.c b/lib/ldap.c
index 1b86e5925..fcd56b9e9 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -262,7 +262,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
}
server = ldapssl_init(conn->host.name, (int)conn->port, 1);
if(server == NULL) {
- failf(data, "LDAP local: Cannot connect to %s:%d",
+ failf(data, "LDAP local: Cannot connect to %s:%hu",
conn->host.name, conn->port);
status = CURLE_COULDNT_CONNECT;
goto quit;
@@ -302,7 +302,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
}
server = ldap_init(conn->host.name, (int)conn->port);
if(server == NULL) {
- failf(data, "LDAP local: Cannot connect to %s:%d",
+ failf(data, "LDAP local: Cannot connect to %s:%hu",
conn->host.name, conn->port);
status = CURLE_COULDNT_CONNECT;
goto quit;
@@ -337,7 +337,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
} else {
server = ldap_init(conn->host.name, (int)conn->port);
if(server == NULL) {
- failf(data, "LDAP local: Cannot connect to %s:%d",
+ failf(data, "LDAP local: Cannot connect to %s:%hu",
conn->host.name, conn->port);
status = CURLE_COULDNT_CONNECT;
goto quit;
diff --git a/lib/mprintf.c b/lib/mprintf.c
index ceafb5197..b0f1a9267 100644
--- a/lib/mprintf.c
+++ b/lib/mprintf.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1999 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1999 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -1219,7 +1219,7 @@ int main()
curl_mprintf("%3d %5d\n", 10, 1998);
- ptr=curl_maprintf("test this then baby %s%s%s%s%s%s %d %d %d loser baby get a hit in yer face now!", "", "pretty long string pretty long string pretty long string pretty long string pretty long string", "/", "/", "/", "pretty long string", 1998, 1999, 2001);
+ ptr=curl_maprintf("test this then baby %s%s%s%s%s%s %d %d %d loser baby get a kiss in yer face now!", "", "pretty long string pretty long string pretty long string pretty long string pretty long string", "/", "/", "/", "pretty long string", 1998, 1999, 2001);
puts(ptr);
diff --git a/lib/multi.c b/lib/multi.c
index 02f84aa7d..e4e1ce8c9 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -567,7 +567,7 @@ static void debug_print_sock_hash(void *p)
struct Curl_sh_entry *sh = (struct Curl_sh_entry *)p;
fprintf(stderr, " [easy %p/magic %x/socket %d]",
- (void *)sh->easy, sh->easy->magic, sh->socket);
+ (void *)sh->easy, sh->easy->magic, (int)sh->socket);
}
#endif
@@ -1131,12 +1131,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
case CURLM_STATE_WAITDO:
/* Wait for our turn to DO when we're pipelining requests */
#ifdef DEBUGBUILD
- infof(easy->easy_handle, "Conn %ld send pipe %d inuse %d athead %d\n",
+ infof(easy->easy_handle, "Conn %ld send pipe %zu inuse %d athead %d\n",
easy->easy_conn->connectindex,
easy->easy_conn->send_pipe->size,
- easy->easy_conn->writechannel_inuse,
+ easy->easy_conn->writechannel_inuse?1:0,
isHandleAtHead(easy->easy_handle,
- easy->easy_conn->send_pipe));
+ easy->easy_conn->send_pipe)?1:0);
#endif
if(!easy->easy_conn->writechannel_inuse &&
isHandleAtHead(easy->easy_handle,
@@ -1319,12 +1319,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
}
#ifdef DEBUGBUILD
else {
- infof(easy->easy_handle, "Conn %ld recv pipe %d inuse %d athead %d\n",
+ infof(easy->easy_handle, "Conn %ld recv pipe %zu inuse %d athead %d\n",
easy->easy_conn->connectindex,
easy->easy_conn->recv_pipe->size,
- easy->easy_conn->readchannel_inuse,
+ easy->easy_conn->readchannel_inuse?1:0,
isHandleAtHead(easy->easy_handle,
- easy->easy_conn->recv_pipe));
+ easy->easy_conn->recv_pipe)?1:0);
}
#endif
break;
diff --git a/lib/qssl.c b/lib/qssl.c
index 5ef8037db..a45b9a180 100644
--- a/lib/qssl.c
+++ b/lib/qssl.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -289,7 +289,7 @@ static int Curl_qsossl_close_one(struct ssl_connect_data * conn,
}
/* An SSL error. */
- failf(data, "SSL_Destroy() returned error %d", SSL_Strerror(rc, NULL));
+ failf(data, "SSL_Destroy() returned error %s", SSL_Strerror(rc, NULL));
return -1;
}
@@ -406,7 +406,7 @@ ssize_t Curl_qsossl_send(struct connectdata * conn, int sockindex,
}
/* An SSL error. */
- failf(conn->data, "SSL_Write() returned error %d",
+ failf(conn->data, "SSL_Write() returned error %s",
SSL_Strerror(rc, NULL));
return -1;
}
diff --git a/lib/sendf.c b/lib/sendf.c
index e2afd7170..0d6764cbf 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -343,8 +343,8 @@ static CURLcode pausewrite(struct SessionHandle *data,
/* mark the connection as RECV paused */
k->keepon |= KEEP_RECV_PAUSE;
- DEBUGF(infof(data, "Pausing with %d bytes in buffer for type %02x\n",
- (int)len, type));
+ DEBUGF(infof(data, "Pausing with %zu bytes in buffer for type %02x\n",
+ len, type));
return CURLE_OK;
}
@@ -426,7 +426,7 @@ CURLcode Curl_client_write(struct connectdata *conn,
return pausewrite(data, type, ptr, len);
if(wrote != len) {
- failf(data, "Failed writing body (%d != %d)", (int)wrote, (int)len);
+ failf(data, "Failed writing body (%zu != %zu)", wrote, len);
return CURLE_WRITE_ERROR;
}
}
diff --git a/lib/socks.c b/lib/socks.c
index a1ead128f..d68c3df34 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -393,7 +393,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
if(!socks5_resolve_local && hostname_len > 255)
{
infof(conn->data,"SOCKS5: server resolving disabled for hostnames of "
- "length > 255 [actual len=%d]\n", hostname_len);
+ "length > 255 [actual len=%zu]\n", hostname_len);
socks5_resolve_local = TRUE;
}
diff --git a/lib/ssh.c b/lib/ssh.c
index edc89fde8..a143f3bb9 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -965,7 +965,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
err = libssh2_sftp_last_error(sshc->sftp_session);
result = sftp_libssh2_error_to_CURLE(err);
sshc->actualcode = result?result:CURLE_SSH;
- DEBUGF(infof(data, "error = %d makes libcurl = %d\n", err, result));
+ DEBUGF(infof(data, "error = %d makes libcurl = %d\n",
+ err, (int)result));
state(conn, SSH_STOP);
break;
}
@@ -2491,7 +2492,7 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done)
#ifdef CURL_LIBSSH2_DEBUG
libssh2_trace(ssh->ssh_session, ~0);
- infof(data, "SSH socket: %d\n", sock);
+ infof(data, "SSH socket: %d\n", (int)sock);
#endif /* CURL_LIBSSH2_DEBUG */
state(conn, SSH_S_STARTUP);
diff --git a/lib/telnet.c b/lib/telnet.c
index 335bfe03b..0a8737521 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -729,7 +729,7 @@ static void printsub(struct SessionHandle *data,
else if(CURL_TELCMD_OK(i))
infof(data, "%s ", CURL_TELCMD(i));
else
- infof(data, "%d ", i);
+ infof(data, "%u ", i);
if(CURL_TELOPT_OK(j))
infof(data, "%s", CURL_TELOPT(j));
else if(CURL_TELCMD_OK(j))
diff --git a/lib/tftp.c b/lib/tftp.c
index dee97c514..cbf6dc842 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -274,7 +274,7 @@ static CURLcode tftp_set_timeouts(tftp_state_data_t *state)
infof(state->conn->data,
"set timeouts for state %d; Total %ld, retry %d maxtry %d\n",
- state->state, (long)(state->max_time-state->start_time),
+ (int)state->state, (long)(state->max_time-state->start_time),
state->retry_time, state->retry_max);
/* init RX time */
diff --git a/lib/transfer.c b/lib/transfer.c
index b8bb9d8cf..2bfcb1762 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -583,7 +583,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
failf(data, "Failed writing data");
return CURLE_WRITE_ERROR;
}
- failf(data, "Received problem %d in the chunky parser", res);
+ failf(data, "Received problem %d in the chunky parser", (int)res);
return CURLE_RECV_ERROR;
}
else if(CHUNKE_STOP == res) {
diff --git a/lib/url.c b/lib/url.c
index 34626e69a..8340e52c0 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -4234,7 +4234,7 @@ static CURLcode parse_remote_port(struct SessionHandle *data,
* are stripped off. It would be better to work directly from the
* original URL and simply replace the port part of it.
*/
- url = aprintf("%s://%s%s%s:%d%s%s", conn->handler->scheme,
+ url = aprintf("%s://%s%s%s:%hu%s%s", conn->handler->scheme,
conn->bits.ipv6_ip?"[":"", conn->host.name,
conn->bits.ipv6_ip?"]":"", conn->remote_port,
isftp?"/":"", data->state.path);