From d65cf7889b4ce669876f9e05442fd09f6fe40e37 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 28 Jan 2010 15:34:18 +0000 Subject: [PATCH] fix printf-style format strings --- lib/connect.c | 4 ++-- lib/cookie.c | 3 ++- lib/multi.c | 6 +++--- lib/rtsp.c | 2 +- lib/speedcheck.c | 4 ++-- lib/ssluse.c | 5 ++--- lib/tftp.c | 17 +++++++++-------- lib/transfer.c | 2 +- lib/url.c | 8 ++++---- 9 files changed, 26 insertions(+), 25 deletions(-) diff --git a/lib/connect.c b/lib/connect.c index 3ae38c990..35c3d4855 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -581,7 +581,7 @@ CURLcode Curl_is_connected(struct connectdata *conn, data->state.os_errno = error; infof(data, "Connection failed\n"); if(trynextip(conn, sockindex, connected)) { - failf(data, "Failed connect to %s:%d; %s", + failf(data, "Failed connect to %s:%ld; %s", conn->host.name, conn->port, Curl_strerror(conn, error)); code = CURLE_COULDNT_CONNECT; } @@ -601,7 +601,7 @@ CURLcode Curl_is_connected(struct connectdata *conn, if(trynextip(conn, sockindex, connected)) { error = SOCKERRNO; data->state.os_errno = error; - failf(data, "Failed connect to %s:%d; %s", + failf(data, "Failed connect to %s:%ld; %s", conn->host.name, conn->port, Curl_strerror(conn, error)); code = CURLE_COULDNT_CONNECT; } diff --git a/lib/cookie.c b/lib/cookie.c index e117b0869..ca08d5fb2 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -681,7 +681,8 @@ Curl_cookie_add(struct SessionHandle *data, if(c->running) /* Only show this when NOT reading the cookies from a file */ - infof(data, "%s cookie %s=\"%s\" for domain %s, path %s, expire %d\n", + infof(data, "%s cookie %s=\"%s\" for domain %s, path %s, " + "expire %" FORMAT_OFF_T "\n", replace_old?"Replaced":"Added", co->name, co->value, co->domain, co->path, co->expires); diff --git a/lib/multi.c b/lib/multi.c index 5ccadc2a8..d9414b9eb 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -923,7 +923,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* Handle the case when the pipe breaks, i.e., the connection we're using gets cleaned up and we're left with nothing. */ if(easy->easy_handle->state.pipe_broke) { - infof(easy->easy_handle, "Pipe broke: handle 0x%x, url = %s\n", + infof(easy->easy_handle, "Pipe broke: handle 0x%p, url = %s\n", easy, easy->easy_handle->state.path); if(easy->state != CURLM_STATE_COMPLETED) { @@ -1131,7 +1131,7 @@ 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 %d send pipe %d inuse %d athead %d\n", + infof(easy->easy_handle, "Conn %ld send pipe %d inuse %d athead %d\n", easy->easy_conn->connectindex, easy->easy_conn->send_pipe->size, easy->easy_conn->writechannel_inuse, @@ -1319,7 +1319,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } #ifdef DEBUGBUILD else { - infof(easy->easy_handle, "Conn %d recv pipe %d inuse %d athead %d\n", + infof(easy->easy_handle, "Conn %ld recv pipe %d inuse %d athead %d\n", easy->easy_conn->connectindex, easy->easy_conn->recv_pipe->size, easy->easy_conn->readchannel_inuse, diff --git a/lib/rtsp.c b/lib/rtsp.c index f81f60608..fd02018fe 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -380,7 +380,7 @@ CURLcode Curl_rtsp(struct connectdata *conn, bool *done) result = Curl_add_bufferf(req_buffer, "%s %s RTSP/1.0\r\n" /* Request Stream-URI RTSP/1.0 */ - "CSeq: %d\r\n", /* CSeq */ + "CSeq: %ld\r\n", /* CSeq */ (p_request ? p_request : ""), p_stream_uri, rtsp->CSeq_sent); if(result) diff --git a/lib/speedcheck.c b/lib/speedcheck.c index aa57ccd59..9f801e1fc 100644 --- a/lib/speedcheck.c +++ b/lib/speedcheck.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -54,7 +54,7 @@ CURLcode Curl_speedcheck(struct SessionHandle *data, /* we have been this slow for long enough, now die */ failf(data, "Operation too slow. " - "Less than %d bytes/sec transfered the last %d seconds", + "Less than %ld bytes/sec transfered the last %ld seconds", data->set.low_speed_limit, data->set.low_speed_time); return CURLE_OPERATION_TIMEDOUT; diff --git a/lib/ssluse.c b/lib/ssluse.c index b7475c029..1626b7ac5 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -483,8 +483,7 @@ int cert_stuff(struct connectdata *conn, return 0; } if (!SSL_CTX_add_client_CA(ctx, sk_X509_value(ca, i))) { - failf(data, "cannot add certificate to client CA list", - cert_file); + failf(data, "cannot add certificate to client CA list"); EVP_PKEY_free(pri); X509_free(x509); return 0; @@ -1735,7 +1734,7 @@ ossl_connect_step2(struct connectdata *conn, int sockindex) * the SO_ERROR is also lost. */ if(CURLE_SSL_CONNECT_ERROR == rc && errdetail == 0) { - failf(data, "Unknown SSL protocol error in connection to %s:%d ", + failf(data, "Unknown SSL protocol error in connection to %s:%ld ", conn->host.name, conn->port); return rc; } diff --git a/lib/tftp.c b/lib/tftp.c index 134fd41c0..dee97c514 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -273,8 +273,8 @@ static CURLcode tftp_set_timeouts(tftp_state_data_t *state) state->retry_time=1; infof(state->conn->data, - "set timeouts for state %d; Total %d, retry %d maxtry %d\n", - state->state, (state->max_time-state->start_time), + "set timeouts for state %d; Total %ld, retry %d maxtry %d\n", + state->state, (long)(state->max_time-state->start_time), state->retry_time, state->retry_max); /* init RX time */ @@ -385,7 +385,7 @@ static CURLcode tftp_parse_option_ack(tftp_state_data_t *state, /* could realloc pkt buffers here, but the spec doesn't call out * support for the server requesting a bigger blksize than the client * requests */ - failf(data, "%s (%d)", + failf(data, "%s (%ld)", "server requested blksize larger than allocated", blksize); return CURLE_TFTP_ILLEGAL; } @@ -403,7 +403,7 @@ static CURLcode tftp_parse_option_ack(tftp_state_data_t *state, return CURLE_TFTP_ILLEGAL; } Curl_pgrsSetDownloadSize(data, tsize); - infof(data, "%s (%d)\n", "tsize parsed from OACK", tsize); + infof(data, "%s (%ld)\n", "tsize parsed from OACK", tsize); } } @@ -643,7 +643,8 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) /* Increment the retry count and fail if over the limit */ state->retries++; infof(data, - "Timeout waiting for block %d ACK. Retries = %d\n", state->retries); + "Timeout waiting for block %d ACK. Retries = %d\n", + state->block+1, state->retries); if(state->retries > state->retry_max) { state->error = TFTP_ERR_TIMEOUT; state->state = TFTP_STATE_FIN; @@ -761,7 +762,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) /* Increment the retry counter and log the timeout */ state->retries++; infof(data, "Timeout waiting for block %d ACK. " - " Retries = %d\n", state->retries); + " Retries = %d\n", state->block+1, state->retries); /* Decide if we've had enough */ if(state->retries > state->retry_max) { state->error = TFTP_ERR_TIMEOUT; @@ -1149,8 +1150,8 @@ static long tftp_state_timeout(struct connectdata *conn, tftp_event_t *event) time(¤t); if(current > state->max_time) { - DEBUGF(infof(conn->data, "timeout: %d > %d\n", - current, state->max_time)); + DEBUGF(infof(conn->data, "timeout: %ld > %ld\n", + (long)current, (long)state->max_time)); state->error = TFTP_ERR_TIMEOUT; state->state = TFTP_STATE_FIN; return(0); diff --git a/lib/transfer.c b/lib/transfer.c index fe30e914a..bf52044a0 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1617,7 +1617,7 @@ CURLcode Curl_follow(struct SessionHandle *data, if(type == FOLLOW_REDIR) { if((data->set.maxredirs != -1) && (data->set.followlocation >= data->set.maxredirs)) { - failf(data,"Maximum (%d) redirects followed", data->set.maxredirs); + failf(data,"Maximum (%ld) redirects followed", data->set.maxredirs); return CURLE_TOO_MANY_REDIRECTS; } diff --git a/lib/url.c b/lib/url.c index 26ad8b78c..34626e69a 100644 --- a/lib/url.c +++ b/lib/url.c @@ -2830,7 +2830,7 @@ ConnectionExists(struct SessionHandle *data, if(dead) { check->data = data; - infof(data, "Connection #%d seems to be dead!\n", i); + infof(data, "Connection #%ld seems to be dead!\n", i); Curl_disconnect(check); /* disconnect resources */ data->state.connc->connects[i]=NULL; /* nothing here */ @@ -3056,7 +3056,7 @@ ConnectionStore(struct SessionHandle *data, /* there was no room available, kill one */ i = ConnectionKillOne(data); if(-1 != i) - infof(data, "Connection (#%d) was killed to make room (holds %d)\n", + infof(data, "Connection (#%ld) was killed to make room (holds %ld)\n", i, data->state.connc->num); else infof(data, "This connection did not fit in the connection cache\n"); @@ -3137,7 +3137,7 @@ static CURLcode ConnectPlease(struct SessionHandle *data, #ifndef CURL_DISABLE_VERBOSE_STRINGS char *hostname = conn->bits.proxy?conn->proxy.name:conn->host.name; - infof(data, "About to connect() to %s%s port %d (#%d)\n", + infof(data, "About to connect() to %s%s port %ld (#%ld)\n", conn->bits.proxy?"proxy ":"", hostname, conn->port, conn->connectindex); #else @@ -3172,7 +3172,7 @@ static CURLcode ConnectPlease(struct SessionHandle *data, #ifndef CURL_DISABLE_VERBOSE_STRINGS static void verboseconnect(struct connectdata *conn) { - infof(conn->data, "Connected to %s (%s) port %d (#%d)\n", + infof(conn->data, "Connected to %s (%s) port %ld (#%ld)\n", conn->bits.proxy ? conn->proxy.dispname : conn->host.dispname, conn->ip_addr_str, conn->port, conn->connectindex); }