Skip to content

Commit

Permalink
fix mingw -Wformat errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Dec 14, 2023
1 parent fe37473 commit c4c40b4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
2 changes: 2 additions & 0 deletions lib/cf-socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ struct Curl_sockaddr_ex;

#if SIZEOF_CURL_SOCKET_T < 8
# define CURL_FORMAT_SOCKET_T "d"
#elif define(__MINGW32__)
# define CURL_FORMAT_SOCKET_T "zd"
#else
# define CURL_FORMAT_SOCKET_T "qd"
#endif
Expand Down
14 changes: 9 additions & 5 deletions lib/easy.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,13 +480,15 @@ static int events_socket(struct Curl_easy *easy, /* easy handle */
ev->list = nxt;
free(m);
m = nxt;
infof(easy, "socket cb: socket %d REMOVED", s);
infof(easy, "socket cb: socket %" CURL_FORMAT_SOCKET_T
" REMOVED", s);
}
else {
/* The socket 's' is already being monitored, update the activity
mask. Convert from libcurl bitmask to the poll one. */
m->socket.events = socketcb2poll(what);
infof(easy, "socket cb: socket %d UPDATED as %s%s", s,
infof(easy, "socket cb: socket %" CURL_FORMAT_SOCKET_T
" UPDATED as %s%s", s,
(what&CURL_POLL_IN)?"IN":"",
(what&CURL_POLL_OUT)?"OUT":"");
}
Expand All @@ -510,7 +512,8 @@ static int events_socket(struct Curl_easy *easy, /* easy handle */
m->socket.events = socketcb2poll(what);
m->socket.revents = 0;
ev->list = m;
infof(easy, "socket cb: socket %d ADDED as %s%s", s,
infof(easy, "socket cb: socket %" CURL_FORMAT_SOCKET_T
" ADDED as %s%s", s,
(what&CURL_POLL_IN)?"IN":"",
(what&CURL_POLL_OUT)?"OUT":"");
}
Expand Down Expand Up @@ -599,8 +602,9 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
if(fds[i].revents) {
/* socket activity, tell libcurl */
int act = poll2cselect(fds[i].revents); /* convert */
infof(multi->easyp, "call curl_multi_socket_action(socket %d)",
fds[i].fd);
infof(multi->easyp,
"call curl_multi_socket_action(socket "
"%" CURL_FORMAT_SOCKET_T ")", fds[i].fd);
mcode = curl_multi_socket_action(multi, fds[i].fd, act,
&ev->running_handles);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/vauth/ntlm_sspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
&type_3_desc,
&attrs, &expiry);
if(status != SEC_E_OK) {
infof(data, "NTLM handshake failure (type-3 message): Status=%x",
infof(data, "NTLM handshake failure (type-3 message): Status=%lx",
status);

if(status == SEC_E_INSUFFICIENT_MEMORY)
Expand Down
8 changes: 4 additions & 4 deletions lib/vtls/schannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf,
cert_showfilename_error);
else
failf(data, "schannel: Failed to import cert file %s, "
"last error is 0x%x",
"last error is 0x%lx",
cert_showfilename_error, errorcode);
return CURLE_SSL_CERTPROBLEM;
}
Expand All @@ -677,7 +677,7 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf,

if(!client_certs[0]) {
failf(data, "schannel: Failed to get certificate from file %s"
", last error is 0x%x",
", last error is 0x%lx",
cert_showfilename_error, GetLastError());
CertCloseStore(cert_store, 0);
return CURLE_SSL_CERTPROBLEM;
Expand All @@ -690,8 +690,8 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf,
CERT_STORE_OPEN_EXISTING_FLAG | cert_store_name,
cert_store_path);
if(!cert_store) {
failf(data, "schannel: Failed to open cert store %x %s, "
"last error is 0x%x",
failf(data, "schannel: Failed to open cert store %lx %s, "
"last error is 0x%lx",
cert_store_name, cert_store_path, GetLastError());
free(cert_store_path);
curlx_unicodefree(cert_path);
Expand Down
4 changes: 2 additions & 2 deletions lib/vtls/schannel_verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store,
/* Sanity check that the cert_context object is the right type */
if(CERT_QUERY_CONTENT_CERT != actual_content_type) {
failf(data,
"schannel: unexpected content type '%d' when extracting "
"schannel: unexpected content type '%lu' when extracting "
"certificate from CA file '%s'",
actual_content_type, ca_file_text);
result = CURLE_SSL_CACERT_BADFILE;
Expand Down Expand Up @@ -753,7 +753,7 @@ CURLcode Curl_verify_certificate(struct Curl_cfilter *cf,
failf(data, "schannel: CertGetCertificateChain trust error"
" CERT_TRUST_REVOCATION_STATUS_UNKNOWN");
else
failf(data, "schannel: CertGetCertificateChain error mask: 0x%08x",
failf(data, "schannel: CertGetCertificateChain error mask: 0x%08lx",
dwTrustErrorMask);
result = CURLE_PEER_FAILED_VERIFICATION;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/vtls/x509asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ static int do_pubkey(struct Curl_easy *data, int certnum,
*/
const size_t len = ((pubkey->end - pubkey->beg - 2) * 4);
if(!certnum)
infof(data, " ECC Public Key (%lu bits)", len);
infof(data, " ECC Public Key (%zu bits)", len);
if(data->set.ssl.certinfo) {
char q[sizeof(len) * 8 / 3 + 1];
(void)msnprintf(q, sizeof(q), "%zu", len);
Expand Down Expand Up @@ -999,7 +999,7 @@ static int do_pubkey(struct Curl_easy *data, int certnum,
if(len > 32)
elem.beg = q; /* Strip leading zero bytes. */
if(!certnum)
infof(data, " RSA Public Key (%lu bits)", len);
infof(data, " RSA Public Key (%zu bits)", len);
if(data->set.ssl.certinfo) {
char r[sizeof(len) * 8 / 3 + 1];
msnprintf(r, sizeof(r), "%zu", len);
Expand Down

0 comments on commit c4c40b4

Please sign in to comment.