summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRikard Falkeborn <rikard.falkeborn@gmail.com>2018-09-16 22:04:49 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-01-04 23:50:48 +0100
commitfa2d6ba84d7f87148738f3cbccf29016dd324f87 (patch)
tree7015e5aa21deac71011e72d36322dfbfc38423a2
parentc7c362a24c0247644f9fde05e8ea353af4a94b04 (diff)
downloadcurl-fa2d6ba84d7f87148738f3cbccf29016dd324f87.tar.gz
printf: fix format specifiers
Closes #3426
-rw-r--r--lib/doh.c4
-rw-r--r--lib/transfer.c4
-rw-r--r--lib/url.c4
-rw-r--r--lib/vtls/mbedtls.c4
-rw-r--r--src/tool_paramhlp.c7
-rw-r--r--tests/libtest/lib557.c2
-rw-r--r--tests/unit/unit1650.c14
7 files changed, 19 insertions, 20 deletions
diff --git a/lib/doh.c b/lib/doh.c
index 1e76c96f9..f06ed3311 100644
--- a/lib/doh.c
+++ b/lib/doh.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2018 - 2019, 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
@@ -160,7 +160,7 @@ static int Curl_doh_done(struct Curl_easy *doh, CURLcode result)
struct Curl_easy *data = doh->set.dohfor;
/* so one of the DOH request done for the 'data' transfer is now complete! */
data->req.doh.pending--;
- infof(data, "a DOH request is completed, %d to go\n", data->req.doh.pending);
+ infof(data, "a DOH request is completed, %u to go\n", data->req.doh.pending);
if(result)
infof(data, "DOH request %s\n", curl_easy_strerror(result));
diff --git a/lib/transfer.c b/lib/transfer.c
index 7483cf1f8..dd910d2ef 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2019, 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
@@ -318,7 +318,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
/* if we're not handling trailing data, proceed as usual */
if(data->state.trailers_state != TRAILERS_SENDING) {
hexlen = msnprintf(hexbuffer, sizeof(hexbuffer),
- "%x%s", nread, endofline_native);
+ "%zx%s", nread, endofline_native);
/* move buffer pointer */
data->req.upload_fromhere -= hexlen;
diff --git a/lib/url.c b/lib/url.c
index a95075c92..d6d5f8c5c 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2019, 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
@@ -2996,7 +2996,7 @@ static CURLcode parse_remote_port(struct Curl_easy *data,
char portbuf[16];
CURLUcode uc;
conn->remote_port = (unsigned short)data->set.use_port;
- msnprintf(portbuf, sizeof(portbuf), "%u", conn->remote_port);
+ msnprintf(portbuf, sizeof(portbuf), "%d", conn->remote_port);
uc = curl_url_set(data->state.uh, CURLUPART_PORT, portbuf, 0);
if(uc)
return CURLE_OUT_OF_MEMORY;
diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
index 88256a861..bb6a757bf 100644
--- a/lib/vtls/mbedtls.c
+++ b/lib/vtls/mbedtls.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2010 - 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com>
- * Copyright (C) 2012 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2019, 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
@@ -373,7 +373,7 @@ mbed_connect_step1(struct connectdata *conn,
}
}
- infof(data, "mbedTLS: Connecting to %s:%d\n", hostname, port);
+ infof(data, "mbedTLS: Connecting to %s:%ld\n", hostname, port);
mbedtls_ssl_config_init(&BACKEND->config);
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c
index 894d4d414..3a4286c67 100644
--- a/src/tool_paramhlp.c
+++ b/src/tool_paramhlp.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2019, 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
@@ -456,9 +456,8 @@ static CURLcode checkpasswd(const char *kind, /* for what purpose */
kind, *userpwd);
else
curlx_msnprintf(prompt, sizeof(prompt),
- "Enter %s password for user '%s' on URL #%"
- CURL_FORMAT_CURL_OFF_TU ":",
- kind, *userpwd, (curl_off_t) (i + 1));
+ "Enter %s password for user '%s' on URL #%zu:",
+ kind, *userpwd, i + 1);
/* get password */
getpass_r(prompt, passwd, sizeof(passwd));
diff --git a/tests/libtest/lib557.c b/tests/libtest/lib557.c
index 22ab9ec2e..e9415c432 100644
--- a/tests/libtest/lib557.c
+++ b/tests/libtest/lib557.c
@@ -1396,7 +1396,7 @@ static int _strlen_check(int linenumber, char *buf, size_t len)
size_t buflen = strlen(buf);
if(len != buflen) {
/* they shouldn't differ */
- printf("sprintf strlen:%d failed:\nwe '%d'\nsystem: '%d'\n",
+ printf("sprintf strlen:%d failed:\nwe '%zu'\nsystem: '%zu'\n",
linenumber, buflen, len);
return 1;
}
diff --git a/tests/unit/unit1650.c b/tests/unit/unit1650.c
index 4962bfac9..adc91236a 100644
--- a/tests/unit/unit1650.c
+++ b/tests/unit/unit1650.c
@@ -160,13 +160,13 @@ UNITTEST_START
int rc = doh_encode(req[i].name, req[i].type,
buffer, sizeof(buffer), &size);
if(rc != req[i].rc) {
- fprintf(stderr, "req %d: Expected return code %d got %d\n", i,
+ fprintf(stderr, "req %zu: Expected return code %d got %d\n", i,
req[i].rc, rc);
return 1;
}
else if(size != req[i].size) {
- fprintf(stderr, "req %d: Expected size %d got %d\n", i,
- (int)req[i].size, (int)size);
+ fprintf(stderr, "req %zu: Expected size %zu got %zu\n", i,
+ req[i].size, size);
fprintf(stderr, "DNS encode made: %s\n", hexdump(buffer, size));
return 2;
}
@@ -188,7 +188,7 @@ UNITTEST_START
rc = doh_decode((unsigned char *)resp[i].packet, resp[i].size,
resp[i].type, &d);
if(rc != resp[i].rc) {
- fprintf(stderr, "resp %d: Expected return code %d got %d\n", i,
+ fprintf(stderr, "resp %zu: Expected return code %d got %d\n", i,
resp[i].rc, rc);
return 4;
}
@@ -229,7 +229,7 @@ UNITTEST_START
}
de_cleanup(&d);
if(resp[i].out && strcmp((char *)buffer, resp[i].out)) {
- fprintf(stderr, "resp %d: Expected %s got %s\n", i,
+ fprintf(stderr, "resp %zu: Expected %s got %s\n", i,
resp[i].out, buffer);
return 1;
}
@@ -244,7 +244,7 @@ UNITTEST_START
rc = doh_decode((unsigned char *)full49, i, DNS_TYPE_A, &d);
if(!rc) {
/* none of them should work */
- fprintf(stderr, "%d: %d\n", i, rc);
+ fprintf(stderr, "%zu: %d\n", i, rc);
return 5;
}
}
@@ -257,7 +257,7 @@ UNITTEST_START
DNS_TYPE_A, &d);
if(!rc) {
/* none of them should work */
- fprintf(stderr, "2 %d: %d\n", i, rc);
+ fprintf(stderr, "2 %zu: %d\n", i, rc);
return 7;
}
}