1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

fix printf-style format strings

This commit is contained in:
Yang Tse 2010-02-04 19:44:31 +00:00
parent f47b84b57f
commit 7aef172a34
15 changed files with 50 additions and 49 deletions

View File

@ -397,13 +397,13 @@ static CURLcode bindlocal(struct connectdata *conn,
error, Curl_strerror(conn, error)); error, Curl_strerror(conn, error));
return CURLE_INTERFACE_FAILED; return CURLE_INTERFACE_FAILED;
} }
infof(data, "Local port: %d\n", port); infof(data, "Local port: %hu\n", port);
conn->bits.bound = TRUE; conn->bits.bound = TRUE;
return CURLE_OK; return CURLE_OK;
} }
if(--portnum > 0) { 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 */ port++; /* try next port */
/* We re-use/clobber the port variable here below */ /* We re-use/clobber the port variable here below */
if(sock->sa_family == AF_INET) if(sock->sa_family == AF_INET)

View File

@ -882,8 +882,8 @@ CURLcode Curl_convert_to_network(struct SessionHandle *data,
rc = data->set.convtonetwork(buffer, length); rc = data->set.convtonetwork(buffer, length);
if(rc != CURLE_OK) { if(rc != CURLE_OK) {
failf(data, failf(data,
"CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %i: %s", "CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %d: %s",
rc, curl_easy_strerror(rc)); (int)rc, curl_easy_strerror(rc));
} }
return(rc); return(rc);
} }
@ -943,8 +943,8 @@ CURLcode Curl_convert_from_network(struct SessionHandle *data,
rc = data->set.convfromnetwork(buffer, length); rc = data->set.convfromnetwork(buffer, length);
if(rc != CURLE_OK) { if(rc != CURLE_OK) {
failf(data, failf(data,
"CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %i: %s", "CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %d: %s",
rc, curl_easy_strerror(rc)); (int)rc, curl_easy_strerror(rc));
} }
return(rc); return(rc);
} }
@ -1004,8 +1004,8 @@ CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
rc = data->set.convfromutf8(buffer, length); rc = data->set.convfromutf8(buffer, length);
if(rc != CURLE_OK) { if(rc != CURLE_OK) {
failf(data, failf(data,
"CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %i: %s", "CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %d: %s",
rc, curl_easy_strerror(rc)); (int)rc, curl_easy_strerror(rc));
} }
return(rc); return(rc);
} }

View File

@ -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 requested bind address is not local. Use the address used for
* the control connection instead and restart the port loop * 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) ); Curl_strerror(conn, error) );
sslen = sizeof(ss); sslen = sizeof(ss);
@ -896,7 +896,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
continue; continue;
} }
else if(error != EADDRINUSE && error != EACCES) { 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) ); Curl_strerror(conn, error) );
sclose(portsock); sclose(portsock);
return CURLE_FTP_PORT_FAILED; 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| * 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, sa->sa_family == AF_INET?1:2,
myhost, port); myhost, port);
if(result) if(result)
@ -999,7 +999,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
source++; source++;
} }
*dest = 0; *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); result = Curl_pp_sendf(&ftpc->pp, "%s %s", mode[fcmd], tmp);
if(result) 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 */ (unsigned short)conn->port; /* we connect to the proxy's port */
if(!addr) { if(!addr) {
failf(data, "Can't resolve proxy host %s:%d", failf(data, "Can't resolve proxy host %s:%hu",
conn->proxy.name, connectport); conn->proxy.name, connectport);
return CURLE_FTP_CANT_GET_HOST; 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 */ connectport = newport; /* we connect to the remote port */
if(!addr) { 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; return CURLE_FTP_CANT_GET_HOST;
} }
} }
@ -2420,7 +2420,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
break; break;
default: default:
failf(data, "unsupported parameter to CURLOPT_FTPSSLAUTH: %d", 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 */ return CURLE_FAILED_INIT; /* we don't know what to do */
} }
PPSENDF(&ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]); 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); result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
/* end of transfer */ /* 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; return result;
} }

View File

@ -1305,7 +1305,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
char *host_port; char *host_port;
Curl_send_buffer *req_buffer; 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); hostname, remote_port);
if(data->req.newurl) { if(data->req.newurl) {
@ -1322,7 +1322,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
if(!req_buffer) if(!req_buffer)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
host_port = aprintf("%s:%d", hostname, remote_port); host_port = aprintf("%s:%hu", hostname, remote_port);
if(!host_port) { if(!host_port) {
free(req_buffer); free(req_buffer);
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
@ -1357,7 +1357,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
/* BLOCKING */ /* BLOCKING */
result = result =
Curl_add_bufferf(req_buffer, Curl_add_bufferf(req_buffer,
"CONNECT %s:%d HTTP/%s\r\n" "CONNECT %s:%hu HTTP/%s\r\n"
"%s" /* Host: */ "%s" /* Host: */
"%s" /* Proxy-Authorization */ "%s" /* Proxy-Authorization */
"%s" /* User-Agent */ "%s" /* User-Agent */
@ -1525,7 +1525,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
keepon = FALSE; keepon = FALSE;
} }
else else
infof(data, "Read %d bytes of chunk, continue\n", infof(data, "Read %zd bytes of chunk, continue\n",
tookcareof); tookcareof);
} }
} }
@ -1596,7 +1596,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
attention so that this is cleared again when this attention so that this is cleared again when this
function returns! */ function returns! */
k->ignorebody = TRUE; 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') { if(line_start[1] == '\n') {
/* this can only be a LF if the letter at index 0 /* this can only be a LF if the letter at index 0
@ -1615,7 +1615,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
keepon = FALSE; keepon = FALSE;
} }
else else
infof(data, "Read %d bytes of chunk, continue\n", infof(data, "Read %zd bytes of chunk, continue\n",
gotbytes); gotbytes);
} }
else { else {
@ -2284,7 +2284,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
host, host,
conn->bits.ipv6_ip?"]":""); conn->bits.ipv6_ip?"]":"");
else 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?"[":"", conn->bits.ipv6_ip?"[":"",
host, host,
conn->bits.ipv6_ip?"]":"", conn->bits.ipv6_ip?"]":"",

View File

@ -262,7 +262,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
} }
server = ldapssl_init(conn->host.name, (int)conn->port, 1); server = ldapssl_init(conn->host.name, (int)conn->port, 1);
if(server == NULL) { 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); conn->host.name, conn->port);
status = CURLE_COULDNT_CONNECT; status = CURLE_COULDNT_CONNECT;
goto quit; goto quit;
@ -302,7 +302,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
} }
server = ldap_init(conn->host.name, (int)conn->port); server = ldap_init(conn->host.name, (int)conn->port);
if(server == NULL) { 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); conn->host.name, conn->port);
status = CURLE_COULDNT_CONNECT; status = CURLE_COULDNT_CONNECT;
goto quit; goto quit;
@ -337,7 +337,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
} else { } else {
server = ldap_init(conn->host.name, (int)conn->port); server = ldap_init(conn->host.name, (int)conn->port);
if(server == NULL) { 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); conn->host.name, conn->port);
status = CURLE_COULDNT_CONNECT; status = CURLE_COULDNT_CONNECT;
goto quit; goto quit;

View File

@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -1219,7 +1219,7 @@ int main()
curl_mprintf("%3d %5d\n", 10, 1998); 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); puts(ptr);

View File

@ -567,7 +567,7 @@ static void debug_print_sock_hash(void *p)
struct Curl_sh_entry *sh = (struct Curl_sh_entry *)p; struct Curl_sh_entry *sh = (struct Curl_sh_entry *)p;
fprintf(stderr, " [easy %p/magic %x/socket %d]", 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 #endif
@ -1131,12 +1131,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
case CURLM_STATE_WAITDO: case CURLM_STATE_WAITDO:
/* Wait for our turn to DO when we're pipelining requests */ /* Wait for our turn to DO when we're pipelining requests */
#ifdef DEBUGBUILD #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->connectindex,
easy->easy_conn->send_pipe->size, easy->easy_conn->send_pipe->size,
easy->easy_conn->writechannel_inuse, easy->easy_conn->writechannel_inuse?1:0,
isHandleAtHead(easy->easy_handle, isHandleAtHead(easy->easy_handle,
easy->easy_conn->send_pipe)); easy->easy_conn->send_pipe)?1:0);
#endif #endif
if(!easy->easy_conn->writechannel_inuse && if(!easy->easy_conn->writechannel_inuse &&
isHandleAtHead(easy->easy_handle, isHandleAtHead(easy->easy_handle,
@ -1319,12 +1319,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
} }
#ifdef DEBUGBUILD #ifdef DEBUGBUILD
else { 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->connectindex,
easy->easy_conn->recv_pipe->size, easy->easy_conn->recv_pipe->size,
easy->easy_conn->readchannel_inuse, easy->easy_conn->readchannel_inuse?1:0,
isHandleAtHead(easy->easy_handle, isHandleAtHead(easy->easy_handle,
easy->easy_conn->recv_pipe)); easy->easy_conn->recv_pipe)?1:0);
} }
#endif #endif
break; break;

View File

@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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. */ /* 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; return -1;
} }
@ -406,7 +406,7 @@ ssize_t Curl_qsossl_send(struct connectdata * conn, int sockindex,
} }
/* An SSL error. */ /* An SSL error. */
failf(conn->data, "SSL_Write() returned error %d", failf(conn->data, "SSL_Write() returned error %s",
SSL_Strerror(rc, NULL)); SSL_Strerror(rc, NULL));
return -1; return -1;
} }

View File

@ -343,8 +343,8 @@ static CURLcode pausewrite(struct SessionHandle *data,
/* mark the connection as RECV paused */ /* mark the connection as RECV paused */
k->keepon |= KEEP_RECV_PAUSE; k->keepon |= KEEP_RECV_PAUSE;
DEBUGF(infof(data, "Pausing with %d bytes in buffer for type %02x\n", DEBUGF(infof(data, "Pausing with %zu bytes in buffer for type %02x\n",
(int)len, type)); len, type));
return CURLE_OK; return CURLE_OK;
} }
@ -426,7 +426,7 @@ CURLcode Curl_client_write(struct connectdata *conn,
return pausewrite(data, type, ptr, len); return pausewrite(data, type, ptr, len);
if(wrote != 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; return CURLE_WRITE_ERROR;
} }
} }

View File

@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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) if(!socks5_resolve_local && hostname_len > 255)
{ {
infof(conn->data,"SOCKS5: server resolving disabled for hostnames of " 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; socks5_resolve_local = TRUE;
} }

View File

@ -965,7 +965,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
err = libssh2_sftp_last_error(sshc->sftp_session); err = libssh2_sftp_last_error(sshc->sftp_session);
result = sftp_libssh2_error_to_CURLE(err); result = sftp_libssh2_error_to_CURLE(err);
sshc->actualcode = result?result:CURLE_SSH; 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); state(conn, SSH_STOP);
break; break;
} }
@ -2491,7 +2492,7 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done)
#ifdef CURL_LIBSSH2_DEBUG #ifdef CURL_LIBSSH2_DEBUG
libssh2_trace(ssh->ssh_session, ~0); 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 */ #endif /* CURL_LIBSSH2_DEBUG */
state(conn, SSH_S_STARTUP); state(conn, SSH_S_STARTUP);

View File

@ -729,7 +729,7 @@ static void printsub(struct SessionHandle *data,
else if(CURL_TELCMD_OK(i)) else if(CURL_TELCMD_OK(i))
infof(data, "%s ", CURL_TELCMD(i)); infof(data, "%s ", CURL_TELCMD(i));
else else
infof(data, "%d ", i); infof(data, "%u ", i);
if(CURL_TELOPT_OK(j)) if(CURL_TELOPT_OK(j))
infof(data, "%s", CURL_TELOPT(j)); infof(data, "%s", CURL_TELOPT(j));
else if(CURL_TELCMD_OK(j)) else if(CURL_TELCMD_OK(j))

View File

@ -274,7 +274,7 @@ static CURLcode tftp_set_timeouts(tftp_state_data_t *state)
infof(state->conn->data, infof(state->conn->data,
"set timeouts for state %d; Total %ld, retry %d maxtry %d\n", "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); state->retry_time, state->retry_max);
/* init RX time */ /* init RX time */

View File

@ -583,7 +583,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
failf(data, "Failed writing data"); failf(data, "Failed writing data");
return CURLE_WRITE_ERROR; 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; return CURLE_RECV_ERROR;
} }
else if(CHUNKE_STOP == res) { else if(CHUNKE_STOP == res) {

View File

@ -4234,7 +4234,7 @@ static CURLcode parse_remote_port(struct SessionHandle *data,
* are stripped off. It would be better to work directly from the * are stripped off. It would be better to work directly from the
* original URL and simply replace the port part of it. * 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->host.name,
conn->bits.ipv6_ip?"]":"", conn->remote_port, conn->bits.ipv6_ip?"]":"", conn->remote_port,
isftp?"/":"", data->state.path); isftp?"/":"", data->state.path);