]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
infof/failf calls: fix format specifiers
authorRikard Falkeborn <rikard.falkeborn@gmail.com>
Mon, 23 Nov 2020 21:42:07 +0000 (22:42 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 24 Nov 2020 12:18:41 +0000 (13:18 +0100)
Update a few format specifiers to match what is being printed.

Closes #6241

12 files changed:
lib/http.c
lib/http2.c
lib/ldap.c
lib/socks_gssapi.c
lib/vquic/ngtcp2.c
lib/vquic/quiche.c
lib/vssh/libssh2.c
lib/vtls/sectransp.c
src/tool_progress.c
tests/libtest/lib1558.c
tests/libtest/lib1915.c
tests/unit/unit1660.c

index d73f839017faca6340fe03a4da69779d40e2775a..c232ed41346002924c74a6deafdd5bf915c4743d 100644 (file)
@@ -4003,7 +4003,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
         infof(data, "Illegal STS header skipped\n");
 #ifdef DEBUGBUILD
       else
-        infof(data, "Parsed STS header fine (%d entries)\n",
+        infof(data, "Parsed STS header fine (%zu entries)\n",
               data->hsts->list.size);
 #endif
     }
index 6d3394f784e210bf578aa8f62ea3d17ad316eef8..b138fb4b0f6dbf8bfd870752dc1de70c3cae6473 100644 (file)
@@ -2070,7 +2070,7 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
 
     if(acc > MAX_ACC) {
       infof(conn->data, "http2_send: Warning: The cumulative length of all "
-            "headers exceeds %zu bytes and that could cause the "
+            "headers exceeds %d bytes and that could cause the "
             "stream to be rejected.\n", MAX_ACC);
     }
   }
@@ -2269,7 +2269,7 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
      data into stream->mem, overwriting data already there. */
   if(H2_BUFSIZE < nread) {
     failf(data, "connection buffer size is too small to store data following "
-                "HTTP Upgrade response header: buflen=%zu, datalen=%zu",
+                "HTTP Upgrade response header: buflen=%d, datalen=%zu",
           H2_BUFSIZE, nread);
     return CURLE_HTTP2;
   }
index f6c2b591506600e6bd85b97d3e87a3e86348710d..0a1f02d5b4e46d2a73dc6de83bc27c8cd0862d2f 100644 (file)
@@ -923,7 +923,7 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
       char *unescaped;
       CURLcode result;
 
-      LDAP_TRACE(("attr[%d] '%s'\n", i, attributes[i]));
+      LDAP_TRACE(("attr[%zu] '%s'\n", i, attributes[i]));
 
       /* Unescape the attribute */
       result = Curl_urldecode(conn->data, attributes[i], 0, &unescaped, NULL,
index 9818a34667d8214e3b1fe8dd6844a13205175a36..a96579692b188e1d8af38283fae194c3d7caae4a 100644 (file)
@@ -493,7 +493,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
     gss_release_buffer(&gss_status, &gss_recv_token);
 
     if(gss_w_token.length != 1) {
-      failf(data, "Invalid GSS-API encryption response length (%d).",
+      failf(data, "Invalid GSS-API encryption response length (%zu).",
             gss_w_token.length);
       gss_release_buffer(&gss_status, &gss_w_token);
       gss_delete_sec_context(&gss_status, &gss_context, NULL);
@@ -505,7 +505,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
   }
   else {
     if(gss_recv_token.length != 1) {
-      failf(data, "Invalid GSS-API encryption response length (%d).",
+      failf(data, "Invalid GSS-API encryption response length (%zu).",
             gss_recv_token.length);
       gss_release_buffer(&gss_status, &gss_recv_token);
       gss_delete_sec_context(&gss_status, &gss_context, NULL);
index 24703564c586ce714e9ab115addda5400ddd6d8e..c75df6310210a22dfb93fdb171810ece0fa31e4d 100644 (file)
@@ -1571,7 +1571,7 @@ static CURLcode http_request(struct connectdata *conn, const void *mem,
 
     if(acc > MAX_ACC) {
       infof(data, "http_request: Warning: The cumulative length of all "
-            "headers exceeds %zu bytes and that could cause the "
+            "headers exceeds %d bytes and that could cause the "
             "stream to be rejected.\n", MAX_ACC);
     }
   }
@@ -1741,7 +1741,7 @@ static CURLcode ng_process_ingress(struct connectdata *conn,
       if(SOCKERRNO == EAGAIN || SOCKERRNO == EWOULDBLOCK)
         break;
 
-      failf(conn->data, "ngtcp2: recvfrom() unexpectedly returned %d", recvd);
+      failf(conn->data, "ngtcp2: recvfrom() unexpectedly returned %zd", recvd);
       return CURLE_RECV_ERROR;
     }
 
index 2b7a693af15ed1aa9764cf7d972886353a856896..3d97396634c162157563282fe29f1e3042f82aed 100644 (file)
@@ -358,7 +358,7 @@ static CURLcode process_ingress(struct connectdata *conn, int sockfd,
       break;
 
     if(recvd < 0) {
-      failf(conn->data, "quiche: recv() unexpectedly returned %d "
+      failf(conn->data, "quiche: recv() unexpectedly returned %zd "
             "(errno: %d, socket %d)", recvd, SOCKERRNO, sockfd);
       return CURLE_RECV_ERROR;
     }
@@ -368,7 +368,7 @@ static CURLcode process_ingress(struct connectdata *conn, int sockfd,
       break;
 
     if(recvd < 0) {
-      failf(conn->data, "quiche_conn_recv() == %d", recvd);
+      failf(conn->data, "quiche_conn_recv() == %zd", recvd);
       return CURLE_RECV_ERROR;
     }
   } while(1);
@@ -762,7 +762,7 @@ static CURLcode http_request(struct connectdata *conn, const void *mem,
 
     if(acc > MAX_ACC) {
       infof(data, "http_request: Warning: The cumulative length of all "
-            "headers exceeds %zu bytes and that could cause the "
+            "headers exceeds %d bytes and that could cause the "
             "stream to be rejected.\n", MAX_ACC);
     }
   }
index aee9a8a673386046d24ac6c413fd403c5ac41e74..a69bcda9957f7b386976bb6188ae8126b3883f33 100644 (file)
@@ -1265,7 +1265,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
              a time-out or similar */
           result = CURLE_SSH;
         sshc->actualcode = result;
-        DEBUGF(infof(data, "error = %d makes libcurl = %d\n",
+        DEBUGF(infof(data, "error = %lu makes libcurl = %d\n",
                      sftperr, (int)result));
         state(conn, SSH_STOP);
         break;
@@ -1945,7 +1945,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
           sshc->actualcode = CURLE_SSH;
           sftperr = LIBSSH2_FX_OK;
         }
-        failf(data, "Upload failed: %s (%d/%d)",
+        failf(data, "Upload failed: %s (%lu/%d)",
               sftperr != LIBSSH2_FX_OK ?
               sftp_libssh2_strerror(sftperr):"ssh error",
               sftperr, rc);
index 4854aa6a58abf209d4eb439d1147c3ba4ce8e319..8ef60cb1f397766e6e430b20697b3e559edc076b 100644 (file)
@@ -1970,7 +1970,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
     else {
       CURLcode result;
       ssl_sessionid =
-        aprintf("%s:%d:%d:%s:%hu", ssl_cafile,
+        aprintf("%s:%d:%d:%s:%ld", ssl_cafile,
                 verifypeer, SSL_CONN_CONFIG(verifyhost), hostname, port);
       ssl_sessionid_len = strlen(ssl_sessionid);
 
@@ -2189,7 +2189,7 @@ static CURLcode verify_cert(const char *cafile, struct Curl_easy *data,
     if(res < 0) {
       free(certbuf);
       CFRelease(array);
-      failf(data, "SSL: invalid CA certificate #%d (offset %d) in bundle",
+      failf(data, "SSL: invalid CA certificate #%d (offset %zu) in bundle",
             n, offset);
       return CURLE_SSL_CACERT_BADFILE;
     }
index 9bc304c7eba6753a404616497b2914a05b0350fe..b18f635963c4d1023188553169397a0aade92d1e 100644 (file)
@@ -227,11 +227,11 @@ bool progress_meter(struct GlobalConfig *global,
     }
     if(dlknown && all_dltotal)
       /* TODO: handle integer overflow */
-      msnprintf(dlpercen, sizeof(dlpercen), "%3d",
+      msnprintf(dlpercen, sizeof(dlpercen), "%3" CURL_FORMAT_CURL_OFF_T,
                 all_dlnow * 100 / all_dltotal);
     if(ulknown && all_ultotal)
       /* TODO: handle integer overflow */
-      msnprintf(ulpercen, sizeof(ulpercen), "%3d",
+      msnprintf(ulpercen, sizeof(ulpercen), "%3" CURL_FORMAT_CURL_OFF_T,
                 all_ulnow * 100 / all_ultotal);
 
     /* get the transfer speed, the higher of the two */
index 4fb32b46892a2e4cd6cf364510d259489efd7f6b..610339b638ba494985bce01265644f4f03608dd3 100644 (file)
@@ -49,7 +49,7 @@ int test(char *URL)
     goto test_cleanup;
   }
 
-  printf("Protocol: %x\n", protocol);
+  printf("Protocol: %lx\n", protocol);
 
   curl_easy_cleanup(curl);
   curl_global_cleanup();
index d1c755abf8591866bb6d501498858ffd709db735..4e632d3abe05688d0a15b4742587c898b1e80293 100644 (file)
@@ -63,7 +63,7 @@ static CURLSTScode hstswrite(CURL *easy, struct curl_hstsentry *e,
 {
   (void)easy;
   (void)userp;
-  printf("[%u/%u] %s %s\n", i->index, i->total, e->name, e->expire);
+  printf("[%zu/%zu] %s %s\n", i->index, i->total, e->name, e->expire);
   return CURLSTS_OK;
 }
 
index e13310ec23dd56075b08972137343e8f2c10a930..3e9b1a40e9b5570383031a204c193642418f75d0 100644 (file)
@@ -152,7 +152,7 @@ UNITTEST_START
     showsts(e, chost);
   }
 
-  printf("Number of entries: %d\n", h->list.size);
+  printf("Number of entries: %zu\n", h->list.size);
 
   /* verify that it is exists for 7 seconds */
   chost = "expire.example";