From 4fad1943a256fcfbbb74603ba22fe7377e59e003 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 24 Jul 2013 16:43:13 +0200 Subject: [PATCH] string formatting: fix 15+ printf-style format strings --- lib/ldap.c | 8 ++++---- lib/memdebug.c | 2 +- lib/multi.c | 12 ++++++------ lib/pipeline.c | 4 ++-- lib/rtsp.c | 2 +- lib/socks_sspi.c | 26 +++++++++++++------------- lib/url.c | 2 +- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/ldap.c b/lib/ldap.c index 833ffa445..235271578 100644 --- a/lib/ldap.c +++ b/lib/ldap.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2013, 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 @@ -260,7 +260,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:%hu", + failf(data, "LDAP local: Cannot connect to %s:%ld", conn->host.name, conn->port); status = CURLE_COULDNT_CONNECT; goto quit; @@ -301,7 +301,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:%hu", + failf(data, "LDAP local: Cannot connect to %s:%ld", 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:%hu", + failf(data, "LDAP local: Cannot connect to %s:%ld", conn->host.name, conn->port); status = CURLE_COULDNT_CONNECT; goto quit; diff --git a/lib/memdebug.c b/lib/memdebug.c index f9afae3a7..7d68af874 100644 --- a/lib/memdebug.c +++ b/lib/memdebug.c @@ -185,7 +185,7 @@ void *curl_domalloc(size_t wantedsize, int line, const char *source) } if(source) - curl_memlog("MEM %s:%d malloc(%zd) = %p\n", + curl_memlog("MEM %s:%d malloc(%zu) = %p\n", source, line, wantedsize, mem ? (void *)mem->mem : (void *)0); diff --git a/lib/multi.c b/lib/multi.c index cd1562020..3318e0d4c 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1231,12 +1231,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(data, "WAITDO: Conn %ld send pipe %zu inuse %d athead %d\n", + infof(data, "WAITDO: Conn %ld send pipe %zu inuse %s athead %s\n", easy->easy_conn->connection_id, easy->easy_conn->send_pipe->size, - easy->easy_conn->writechannel_inuse?1:0, + easy->easy_conn->writechannel_inuse?"TRUE":"FALSE", isHandleAtHead(data, - easy->easy_conn->send_pipe)?1:0); + easy->easy_conn->send_pipe)?"TRUE":"FALSE"); #endif if(!easy->easy_conn->writechannel_inuse && isHandleAtHead(data, @@ -1423,12 +1423,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } #ifdef DEBUGBUILD else { - infof(data, "WAITPERFORM: Conn %ld recv pipe %zu inuse %d athead %d\n", + infof(data, "WAITPERFORM: Conn %ld recv pipe %zu inuse %s athead %s\n", easy->easy_conn->connection_id, easy->easy_conn->recv_pipe->size, - easy->easy_conn->readchannel_inuse?1:0, + easy->easy_conn->readchannel_inuse?"TRUE":"FALSE", isHandleAtHead(data, - easy->easy_conn->recv_pipe)?1:0); + easy->easy_conn->recv_pipe)?"TRUE":"FALSE"); } #endif break; diff --git a/lib/pipeline.c b/lib/pipeline.c index 73ac9c5a3..418058afa 100644 --- a/lib/pipeline.c +++ b/lib/pipeline.c @@ -86,7 +86,7 @@ bool Curl_pipeline_penalized(struct SessionHandle *data, penalized = TRUE; infof(data, "Conn: %ld (%p) Receive pipe weight: (%" FORMAT_OFF_T - "/%zd), penalized: %s\n", + "/%zu), penalized: %s\n", conn->connection_id, (void *)conn, recv_size, conn->chunk.datasize, penalized?"TRUE":"FALSE"); return penalized; @@ -322,7 +322,7 @@ void print_pipeline(struct connectdata *conn) curr = cb_ptr->conn_list->head; while(curr) { conn = curr->ptr; - infof(data, "- Conn %ld (%p) send_pipe: %zd, recv_pipe: %zd\n", + infof(data, "- Conn %ld (%p) send_pipe: %zu, recv_pipe: %zu\n", conn->connection_id, (void *)conn, conn->send_pipe->size, diff --git a/lib/rtsp.c b/lib/rtsp.c index 9d7a9a94b..3dc14901b 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -668,7 +668,7 @@ static CURLcode rtsp_rtp_readwrite(struct SessionHandle *data, } if(rtp_dataleft != 0 && rtp[0] == '$') { - DEBUGF(infof(data, "RTP Rewinding %zu %s\n", rtp_dataleft, + DEBUGF(infof(data, "RTP Rewinding %zd %s\n", rtp_dataleft, *readmore ? "(READMORE)" : "")); /* Store the incomplete RTP packet for a "rewind" */ diff --git a/lib/socks_sspi.c b/lib/socks_sspi.c index b4b23e014..0313de333 100644 --- a/lib/socks_sspi.c +++ b/lib/socks_sspi.c @@ -6,7 +6,7 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2009, 2011, Markus Moeller, - * Copyright (C) 2012, Daniel Stenberg, , et al. + * Copyright (C) 2012 - 2013, 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 @@ -260,8 +260,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, /* ignore the first (VER) byte */ if(socksreq[1] == 255) { /* status / message type */ - failf(data, "User was rejected by the SOCKS5 server (%d %d).", - socksreq[0], socksreq[1]); + failf(data, "User was rejected by the SOCKS5 server (%u %u).", + (unsigned int)socksreq[0], (unsigned int)socksreq[1]); Curl_safefree(service_name); s_pSecFn->FreeCredentialsHandle(&cred_handle); s_pSecFn->DeleteSecurityContext(&sspi_context); @@ -269,8 +269,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, } if(socksreq[1] != 1) { /* status / messgae type */ - failf(data, "Invalid SSPI authentication response type (%d %d).", - socksreq[0], socksreq[1]); + failf(data, "Invalid SSPI authentication response type (%u %u).", + (unsigned int)socksreq[0], (unsigned int)socksreq[1]); Curl_safefree(service_name); s_pSecFn->FreeCredentialsHandle(&cred_handle); s_pSecFn->DeleteSecurityContext(&sspi_context); @@ -494,15 +494,15 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, /* ignore the first (VER) byte */ if(socksreq[1] == 255) { /* status / message type */ - failf(data, "User was rejected by the SOCKS5 server (%d %d).", - socksreq[0], socksreq[1]); + failf(data, "User was rejected by the SOCKS5 server (%u %u).", + (unsigned int)socksreq[0], (unsigned int)socksreq[1]); s_pSecFn->DeleteSecurityContext(&sspi_context); return CURLE_COULDNT_CONNECT; } if(socksreq[1] != 2) { /* status / message type */ - failf(data, "Invalid SSPI encryption response type (%d %d).", - socksreq[0], socksreq[1]); + failf(data, "Invalid SSPI encryption response type (%u %u).", + (unsigned int)socksreq[0], (unsigned int)socksreq[1]); s_pSecFn->DeleteSecurityContext(&sspi_context); return CURLE_COULDNT_CONNECT; } @@ -549,8 +549,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, } if(sspi_w_token[1].cbBuffer != 1) { - failf(data, "Invalid SSPI encryption response length (%d).", - sspi_w_token[1].cbBuffer); + failf(data, "Invalid SSPI encryption response length (%lu).", + (unsigned long)sspi_w_token[1].cbBuffer); s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer); s_pSecFn->DeleteSecurityContext(&sspi_context); @@ -563,8 +563,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, } else { if(sspi_w_token[0].cbBuffer != 1) { - failf(data, "Invalid SSPI encryption response length (%d).", - sspi_w_token[0].cbBuffer); + failf(data, "Invalid SSPI encryption response length (%lu).", + (unsigned long)sspi_w_token[0].cbBuffer); s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); s_pSecFn->DeleteSecurityContext(&sspi_context); return CURLE_COULDNT_CONNECT; diff --git a/lib/url.c b/lib/url.c index 347092d59..bc95c9a29 100644 --- a/lib/url.c +++ b/lib/url.c @@ -5336,7 +5336,7 @@ static CURLcode create_conn(struct SessionHandle *data, if(reuse && !force_reuse && IsPipeliningPossible(data, conn_temp)) { size_t pipelen = conn_temp->send_pipe->size + conn_temp->recv_pipe->size; if(pipelen > 0) { - infof(data, "Found connection %ld, with requests in the pipe (%zd)\n", + infof(data, "Found connection %ld, with requests in the pipe (%zu)\n", conn_temp->connection_id, pipelen); if(conn_temp->bundle->num_connections < max_host_connections &&