fix printf-style format strings
authorYang Tse <yangsita@gmail.com>
Thu, 28 Jan 2010 15:34:18 +0000 (15:34 +0000)
committerYang Tse <yangsita@gmail.com>
Thu, 28 Jan 2010 15:34:18 +0000 (15:34 +0000)
lib/connect.c
lib/cookie.c
lib/multi.c
lib/rtsp.c
lib/speedcheck.c
lib/ssluse.c
lib/tftp.c
lib/transfer.c
lib/url.c

index 3ae38c9..35c3d48 100644 (file)
@@ -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;
     }
index e117b08..ca08d5f 100644 (file)
@@ -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);
 
index 5ccadc2..d9414b9 100644 (file)
@@ -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,
index f81f606..fd02018 100644 (file)
@@ -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)
index aa57ccd..9f801e1 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2006, 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
@@ -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;
index b7475c0..1626b7a 100644 (file)
@@ -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;
       }
index 134fd41..dee97c5 100644 (file)
@@ -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(&current);
   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);
index fe30e91..bf52044 100644 (file)
@@ -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;
     }
 
index 26ad8b7..34626e6 100644 (file)
--- 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);
 }