From a0f358bd7f15d2c3a5d3e41bfe4ad647345ff4e8 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 9 Mar 2026 00:07:49 +0100 Subject: [PATCH] fixes --- lib/altsvc.c | 2 +- lib/cf-h2-proxy.c | 8 ++++---- lib/cf-https-connect.c | 2 +- lib/cf-ip-happy.c | 4 ++-- lib/cf-socket.c | 2 +- lib/content_encoding.c | 2 +- lib/cw-out.c | 2 +- lib/cw-pause.c | 11 ++++++----- lib/doh.c | 2 +- lib/ftp.c | 2 +- lib/http.c | 6 +++--- lib/http2.c | 26 +++++++++++++------------- lib/mime.c | 2 +- lib/mqtt.c | 2 +- lib/multi.c | 4 ++-- lib/multi_ev.c | 2 +- lib/rtsp.c | 4 ++-- lib/sendf.c | 8 ++++---- lib/setopt.c | 2 +- lib/smtp.c | 2 +- lib/socks.c | 14 +++++++------- lib/tftp.c | 8 ++++---- lib/vauth/digest.c | 5 +++-- lib/vssh/libssh2.c | 2 +- lib/vtls/openssl.c | 10 +++++----- lib/vtls/vtls.c | 2 +- lib/vtls/vtls_scache.c | 8 ++++---- lib/ws.c | 8 ++++---- 28 files changed, 77 insertions(+), 75 deletions(-) diff --git a/lib/altsvc.c b/lib/altsvc.c index e0834cb663..81b5379ad4 100644 --- a/lib/altsvc.c +++ b/lib/altsvc.c @@ -294,7 +294,7 @@ static CURLcode altsvc_out(struct altsvc *as, FILE *fp) "%s %s%s%s %u " "\"%d%02d%02d " "%02d:%02d:%02d\" " - "%u 0\n", /* prio still always zero */ + "%d 0\n", /* prio still always zero */ Curl_alpnid2str(as->src.alpnid), src6_pre, as->src.host, src6_post, as->src.port, diff --git a/lib/cf-h2-proxy.c b/lib/cf-h2-proxy.c index 4dd4f4ab35..2f8cc41dd5 100644 --- a/lib/cf-h2-proxy.c +++ b/lib/cf-h2-proxy.c @@ -627,7 +627,7 @@ static ssize_t tunnel_send_callback(nghttp2_session *session, if(ts->closed && Curl_bufq_is_empty(&ts->sendbuf)) *data_flags = NGHTTP2_DATA_FLAG_EOF; - CURL_TRC_CF(data, cf, "[%d] tunnel_send_callback -> %zd", + CURL_TRC_CF(data, cf, "[%d] tunnel_send_callback -> %zu", ts->stream_id, nread); return (nread > SSIZE_MAX) ? NGHTTP2_ERR_CALLBACK_FAILURE : (ssize_t)nread; @@ -675,7 +675,7 @@ static int proxy_h2_on_stream_close(nghttp2_session *session, if(stream_id != ctx->tunnel.stream_id) return 0; - CURL_TRC_CF(data, cf, "[%d] proxy_h2_on_stream_close, %s (err %d)", + CURL_TRC_CF(data, cf, "[%d] proxy_h2_on_stream_close, %s (err %u)", stream_id, nghttp2_http2_strerror(error_code), error_code); ctx->tunnel.closed = TRUE; ctx->tunnel.error = error_code; @@ -1159,7 +1159,7 @@ static CURLcode h2_handle_tunnel_close(struct Curl_cfilter *cf, *pnread = 0; if(ctx->tunnel.error) { - failf(data, "HTTP/2 stream %u reset by %s (error 0x%x %s)", + failf(data, "HTTP/2 stream %d reset by %s (error 0x%x %s)", ctx->tunnel.stream_id, ctx->tunnel.reset ? "server" : "curl", ctx->tunnel.error, nghttp2_http2_strerror(ctx->tunnel.error)); return CURLE_RECV_ERROR; @@ -1269,7 +1269,7 @@ static CURLcode cf_h2_proxy_send(struct Curl_cfilter *cf, } result = Curl_bufq_write(&ctx->tunnel.sendbuf, buf, len, pnwritten); - CURL_TRC_CF(data, cf, "cf_send(), bufq_write %d, %zd", result, *pnwritten); + CURL_TRC_CF(data, cf, "cf_send(), bufq_write %d, %zu", result, *pnwritten); if(result && (result != CURLE_AGAIN)) goto out; diff --git a/lib/cf-https-connect.c b/lib/cf-https-connect.c index 5434cd7ed6..00a5882370 100644 --- a/lib/cf-https-connect.c +++ b/lib/cf-https-connect.c @@ -625,7 +625,7 @@ static CURLcode cf_hc_adjust_pollset(struct Curl_cfilter *cf, continue; result = Curl_conn_cf_adjust_pollset(b->cf, data, ps); } - CURL_TRC_CF(data, cf, "adjust_pollset -> %d, %d socks", result, ps->n); + CURL_TRC_CF(data, cf, "adjust_pollset -> %d, %u socks", result, ps->n); } return result; } diff --git a/lib/cf-ip-happy.c b/lib/cf-ip-happy.c index 072f9b2c44..f63de79486 100644 --- a/lib/cf-ip-happy.c +++ b/lib/cf-ip-happy.c @@ -700,7 +700,7 @@ static CURLcode is_connected(struct Curl_cfilter *cf, port = conn->conn_to_port; else port = conn->remote_port; - curl_msnprintf(viamsg, sizeof(viamsg), "port %u", port); + curl_msnprintf(viamsg, sizeof(viamsg), "port %d", port); } failf(data, "Failed to connect to %s %s %s%s%safter " @@ -786,7 +786,7 @@ static CURLcode cf_ip_happy_adjust_pollset(struct Curl_cfilter *cf, if(!cf->connected) { result = cf_ip_ballers_pollset(&ctx->ballers, data, ps); - CURL_TRC_CF(data, cf, "adjust_pollset -> %d, %d socks", result, ps->n); + CURL_TRC_CF(data, cf, "adjust_pollset -> %d, %u socks", result, ps->n); } return result; } diff --git a/lib/cf-socket.c b/lib/cf-socket.c index 796c39075e..8c7782c30c 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -2052,7 +2052,7 @@ static CURLcode cf_tcp_accept_connect(struct Curl_cfilter *cf, CURL_TRC_CF(data, cf, "Checking for incoming on fd=%" FMT_SOCKET_T " ip=%s:%d", ctx->sock, ctx->ip.local_ip, ctx->ip.local_port); socketstate = SOCKET_READABLE(ctx->sock, 0); - CURL_TRC_CF(data, cf, "socket_check -> %x", socketstate); + CURL_TRC_CF(data, cf, "socket_check -> %x", (unsigned int)socketstate); switch(socketstate) { case -1: /* error */ /* let's die here */ diff --git a/lib/content_encoding.c b/lib/content_encoding.c index 32d32241f4..0224a8bfe9 100644 --- a/lib/content_encoding.c +++ b/lib/content_encoding.c @@ -751,7 +751,7 @@ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data, } if(Curl_cwriter_count(data, phase) + 1 >= MAX_ENCODE_STACK) { - failf(data, "Reject response due to more than %u content encodings", + failf(data, "Reject response due to more than %d content encodings", MAX_ENCODE_STACK); return CURLE_BAD_CONTENT_ENCODING; } diff --git a/lib/cw-out.c b/lib/cw-out.c index f841725e46..2af074e587 100644 --- a/lib/cw-out.c +++ b/lib/cw-out.c @@ -211,7 +211,7 @@ static CURLcode cw_out_cb_write(struct cw_out_ctx *ctx, } else if(nwritten != blen) { failf(data, "Failure writing output to destination, " - "passed %zu returned %zd", blen, nwritten); + "passed %zu returned %zu", blen, nwritten); return CURLE_WRITE_ERROR; } *pnwritten = nwritten; diff --git a/lib/cw-pause.c b/lib/cw-pause.c index ec611879d1..8a21101ee3 100644 --- a/lib/cw-pause.c +++ b/lib/cw-pause.c @@ -117,7 +117,8 @@ static CURLcode cw_pause_flush(struct Curl_easy *data, result = Curl_cwriter_write(data, cw_pause->next, (*plast)->type, (const char *)buf, wlen); CURL_TRC_WRITE(data, "[PAUSE] flushed %zu/%zu bytes, type=%x -> %d", - wlen, ctx->buf_total, (*plast)->type, result); + wlen, ctx->buf_total, (unsigned int)(*plast)->type, + result); Curl_bufq_skip(&(*plast)->b, wlen); DEBUGASSERT(ctx->buf_total >= wlen); ctx->buf_total -= wlen; @@ -128,7 +129,7 @@ static CURLcode cw_pause_flush(struct Curl_easy *data, result = Curl_cwriter_write(data, cw_pause->next, (*plast)->type, (const char *)buf, 0); CURL_TRC_WRITE(data, "[PAUSE] flushed 0/%zu bytes, type=%x -> %d", - ctx->buf_total, (*plast)->type, result); + ctx->buf_total, (unsigned int)(*plast)->type, result); } if(Curl_bufq_is_empty(&(*plast)->b)) { @@ -165,7 +166,7 @@ static CURLcode cw_pause_write(struct Curl_easy *data, wtype &= ~CLIENTWRITE_EOS; result = Curl_cwriter_write(data, writer->next, wtype, buf, wlen); CURL_TRC_WRITE(data, "[PAUSE] writing %zu/%zu bytes of type %x -> %d", - wlen, blen, wtype, result); + wlen, blen, (unsigned int)wtype, result); if(result) return result; buf += wlen; @@ -191,8 +192,8 @@ static CURLcode cw_pause_write(struct Curl_easy *data, result = Curl_bufq_cwrite(&ctx->buf->b, buf, blen, &nwritten); } CURL_TRC_WRITE(data, "[PAUSE] buffer %zu more bytes of type %x, " - "total=%zu -> %d", nwritten, type, ctx->buf_total + wlen, - result); + "total=%zu -> %d", nwritten, (unsigned int)type, + ctx->buf_total + wlen, result); if(result) return result; buf += nwritten; diff --git a/lib/doh.c b/lib/doh.c index f152401862..c6509c9198 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -319,7 +319,7 @@ static CURLcode doh_probe_run(struct Curl_easy *data, sizeof(doh_req->req_body), &doh_req->req_body_len); if(d) { - failf(data, "Failed to encode DoH packet [%d]", d); + failf(data, "Failed to encode DoH packet [%d]", (int)d); result = CURLE_OUT_OF_MEMORY; goto error; } diff --git a/lib/ftp.c b/lib/ftp.c index 318ccab719..a15744773a 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -732,7 +732,7 @@ static CURLcode getftpresponse(struct Curl_easy *data, } /* while there is buffer left and loop is requested */ pp->pending_resp = FALSE; - CURL_TRC_FTP(data, "getftpresponse -> result=%d, nread=%zd, ftpcode=%d", + CURL_TRC_FTP(data, "getftpresponse -> result=%d, nread=%zu, ftpcode=%d", result, *nreadp, *ftpcodep); return result; diff --git a/lib/http.c b/lib/http.c index 0f826f0596..34fa807d8d 100644 --- a/lib/http.c +++ b/lib/http.c @@ -1256,7 +1256,7 @@ CURLcode Curl_http_follow(struct Curl_easy *data, const char *newurl, curlx_free(portnum); } if(port != data->info.conn_remote_port) { - infof(data, "Clear auth, redirects to port from %u to %u", + infof(data, "Clear auth, redirects to port from %d to %d", data->info.conn_remote_port, port); clear = TRUE; } @@ -3761,13 +3761,13 @@ static CURLcode http_statusline(struct Curl_easy *data, /* no major version switch mid-connection */ if(k->httpversion_sent && (k->httpversion / 10 != k->httpversion_sent / 10)) { - failf(data, "Version mismatch (from HTTP/%u to HTTP/%u)", + failf(data, "Version mismatch (from HTTP/%d to HTTP/%d)", k->httpversion_sent / 10, k->httpversion / 10); return CURLE_WEIRD_SERVER_REPLY; } break; default: - failf(data, "Unsupported HTTP version (%u.%d) in response", + failf(data, "Unsupported HTTP version (%d.%d) in response", k->httpversion / 10, k->httpversion % 10); return CURLE_UNSUPPORTED_PROTOCOL; } diff --git a/lib/http2.c b/lib/http2.c index 54044bcb9d..7b1bab5ca8 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -877,7 +877,7 @@ static int push_promise(struct Curl_cfilter *cf, newstream->id, newhandle); if(rv) { - infof(data, "failed to set user_data for stream %u", + infof(data, "failed to set user_data for stream %d", newstream->id); DEBUGASSERT(0); discard_newhandle(cf, newhandle); @@ -1113,7 +1113,7 @@ int Curl_nghttp2_fr_print(const nghttp2_frame *frame, char *buffer, memcpy(scratch, frame->goaway.opaque_data, len); scratch[len] = '\0'; return curl_msnprintf(buffer, blen, - "FRAME[GOAWAY, error=%d, reason='%s', " + "FRAME[GOAWAY, error=%u, reason='%s', " "last_stream=%d]", frame->goaway.error_code, scratch, frame->goaway.last_stream_id); } @@ -1148,7 +1148,7 @@ static int on_frame_send(nghttp2_session *session, const nghttp2_frame *frame, if((frame->hd.type == NGHTTP2_GOAWAY) && !ctx->sent_goaway) { /* A GOAWAY not initiated by us, but by nghttp2 itself on detecting * a protocol error on the connection */ - failf(data, "nghttp2 shuts down connection with error %d: %s", + failf(data, "nghttp2 shuts down connection with error %u: %s", frame->goaway.error_code, nghttp2_http2_strerror(frame->goaway.error_code)); } @@ -1186,7 +1186,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, session, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS); ctx->enable_push = nghttp2_session_get_remote_settings( session, NGHTTP2_SETTINGS_ENABLE_PUSH) != 0; - CURL_TRC_CF(data, cf, "[0] MAX_CONCURRENT_STREAMS: %d", + CURL_TRC_CF(data, cf, "[0] MAX_CONCURRENT_STREAMS: %u", ctx->max_concurrent_streams); CURL_TRC_CF(data, cf, "[0] ENABLE_PUSH: %s", ctx->enable_push ? "TRUE" : "false"); @@ -1211,7 +1211,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, ctx->goaway_error = frame->goaway.error_code; ctx->remote_max_sid = frame->goaway.last_stream_id; if(data) { - infof(data, "received GOAWAY, error=%u, last_stream=%u", + infof(data, "received GOAWAY, error=%u, last_stream=%d", ctx->goaway_error, ctx->remote_max_sid); Curl_multi_connchanged(data->multi); } @@ -1341,7 +1341,7 @@ static int on_stream_close(nghttp2_session *session, int32_t stream_id, stream->reset = TRUE; if(stream->error) - CURL_TRC_CF(data_s, cf, "[%d] RESET: %s (err %d)", + CURL_TRC_CF(data_s, cf, "[%d] RESET: %s (err %u)", stream_id, nghttp2_http2_strerror(error_code), error_code); else CURL_TRC_CF(data_s, cf, "[%d] CLOSED", stream_id); @@ -1350,7 +1350,7 @@ static int on_stream_close(nghttp2_session *session, int32_t stream_id, /* remove `data_s` from the nghttp2 stream */ rv = nghttp2_session_set_stream_user_data(session, stream_id, 0); if(rv) { - infof(data_s, "http/2: failed to clear user_data for stream %u", + infof(data_s, "http/2: failed to clear user_data for stream %d", stream_id); DEBUGASSERT(0); } @@ -1522,7 +1522,7 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame, cf_h2_header_error(cf, data_s, stream, result); return NGHTTP2_ERR_CALLBACK_FAILURE; } - hlen = curl_msnprintf(buffer, sizeof(buffer), HTTP_PSEUDO_STATUS ":%u\r", + hlen = curl_msnprintf(buffer, sizeof(buffer), HTTP_PSEUDO_STATUS ":%d\r", stream->status_code); result = Curl_headers_push(data_s, buffer, hlen, CURLH_PSEUDO); if(result) { @@ -1709,7 +1709,7 @@ static CURLcode http2_handle_stream_close(struct Curl_cfilter *cf, stream->close_handled = TRUE; return CURLE_OK; } - failf(data, "HTTP/2 stream %u reset by %s (error 0x%x %s)", + failf(data, "HTTP/2 stream %d reset by %s (error 0x%x %s)", stream->id, stream->reset_by_server ? "server" : "curl", stream->error, nghttp2_http2_strerror(stream->error)); return stream->error ? CURLE_HTTP2_STREAM : @@ -2053,7 +2053,7 @@ static CURLcode cf_h2_body_send(struct Curl_cfilter *cf, return CURLE_OK; } /* Server closed before we got a response, this is an error */ - infof(data, "stream %u closed", stream->id); + infof(data, "stream %d closed", stream->id); return CURLE_SEND_ERROR; } @@ -2153,7 +2153,7 @@ static CURLcode h2_submit(struct h2_stream_ctx **pstream, } if(stream_id < 0) { - CURL_TRC_CF(data, cf, "send: nghttp2_submit_request error (%s)%u", + CURL_TRC_CF(data, cf, "send: nghttp2_submit_request error (%s)%d", nghttp2_strerror(stream_id), stream_id); result = CURLE_SEND_ERROR; goto out; @@ -2253,7 +2253,7 @@ static CURLcode cf_h2_send(struct Curl_cfilter *cf, struct Curl_easy *data, /* if the stream has been closed in egress handling (nghttp2 does that * when it does not like the headers, for example */ if(stream && stream->closed) { - infof(data, "stream %u closed", stream->id); + infof(data, "stream %d closed", stream->id); result = CURLE_SEND_ERROR; goto out; } @@ -2462,7 +2462,7 @@ static CURLcode cf_h2_ctx_open(struct Curl_cfilter *cf, rc = nghttp2_session_set_stream_user_data(ctx->h2, stream->id, data); if(rc) { - infof(data, "http/2: failed to set user_data for stream %u", + infof(data, "http/2: failed to set user_data for stream %d", stream->id); DEBUGASSERT(0); } diff --git a/lib/mime.c b/lib/mime.c index 157884a838..e987d0b30e 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -1930,7 +1930,7 @@ static CURLcode cr_mime_read(struct Curl_easy *data, else nread = Curl_mime_read(buf, 1, blen, ctx->part); - CURL_TRC_READ(data, "cr_mime_read(len=%zu), mime_read() -> %zd", + CURL_TRC_READ(data, "cr_mime_read(len=%zu), mime_read() -> %zu", blen, nread); switch(nread) { diff --git a/lib/mqtt.c b/lib/mqtt.c index 84fd272e21..8a1f5b1e96 100644 --- a/lib/mqtt.c +++ b/lib/mqtt.c @@ -427,7 +427,7 @@ static CURLcode mqtt_verify_connack(struct Curl_easy *data) if(ptr[0] != 0x00 || ptr[1] != 0x00) { failf(data, "Expected %02x%02x but got %02x%02x", - 0x00, 0x00, ptr[0], ptr[1]); + 0x00U, 0x00U, ptr[0], ptr[1]); curlx_dyn_reset(&mq->recvbuf); return CURLE_WEIRD_SERVER_REPLY; } diff --git a/lib/multi.c b/lib/multi.c index f6d719287f..70ad9822ca 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1194,7 +1194,7 @@ CURLMcode Curl_multi_pollset(struct Curl_easy *data, break; default: - failf(data, "multi_getsock: unexpected multi state %d", data->mstate); + failf(data, "multi_getsock: unexpected multi state %d", (int)data->mstate); DEBUGASSERT(0); break; } @@ -1624,7 +1624,7 @@ static CURLMcode multi_wait(struct Curl_multi *multi, timeout_ms = (int)timeout_internal; if(data) - CURL_TRC_M(data, "multi_wait(fds=%d, timeout=%d) tinternal=%ld", + CURL_TRC_M(data, "multi_wait(fds=%u, timeout=%d) tinternal=%ld", cpfds.n, timeout_ms, timeout_internal); #ifdef USE_WINSOCK diff --git a/lib/multi_ev.c b/lib/multi_ev.c index b98cda0c68..937e7ce48d 100644 --- a/lib/multi_ev.c +++ b/lib/multi_ev.c @@ -253,7 +253,7 @@ static CURLMcode mev_sh_entry_update(struct Curl_multi *multi, DEBUGASSERT(entry->writers + entry->readers); CURL_TRC_M(data, "ev update fd=%" FMT_SOCKET_T ", action '%s%s' -> '%s%s'" - " (%d/%d r/w)", s, + " (%u/%u r/w)", s, (last_action & CURL_POLL_IN) ? "IN" : "", (last_action & CURL_POLL_OUT) ? "OUT" : "", (cur_action & CURL_POLL_IN) ? "IN" : "", diff --git a/lib/rtsp.c b/lib/rtsp.c index 285126371c..3e0bbc661c 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -674,7 +674,7 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data, /* This could be the next response, no consume and return */ if(*pconsumed) { DEBUGF(infof(data, "RTP rtsp_filter_rtp[SKIP] RTSP/ prefix, " - "skipping %zd bytes of junk", *pconsumed)); + "skipping %zu bytes of junk", *pconsumed)); } rtspc->state = RTP_PARSE_SKIP; rtspc->in_header = TRUE; @@ -904,7 +904,7 @@ static CURLcode rtsp_rtp_write_resp(struct Curl_easy *data, * writer deal with it (it will report EXCESS and fail the transfer). */ DEBUGF(infof(data, "rtsp_rtp_write_resp(len=%zu, in_header=%d, done=%d, " "rtspc->state=%d, req.size=%" FMT_OFF_T ")", - blen, rtspc->in_header, data->req.done, rtspc->state, + blen, rtspc->in_header, data->req.done, (int)rtspc->state, data->req.size)); if(!result && (is_eos || blen)) { result = Curl_client_write(data, CLIENTWRITE_BODY | diff --git a/lib/sendf.c b/lib/sendf.c index 7c977d3b9e..d40ebfff4f 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -193,7 +193,7 @@ static CURLcode cw_download_write(struct Curl_easy *data, return CURLE_OK; result = Curl_cwriter_write(data, writer->next, type, buf, nbytes); CURL_TRC_WRITE(data, "download_write header(type=%x, blen=%zu) -> %d", - type, nbytes, result); + (unsigned int)type, nbytes, result); return result; } @@ -214,7 +214,7 @@ static CURLcode cw_download_write(struct Curl_easy *data, /* BODY arrives although we want none, bail out */ streamclose(data->conn, "ignoring body"); CURL_TRC_WRITE(data, "download_write body(type=%x, blen=%zu), " - "did not want a BODY", type, nbytes); + "did not want a BODY", (unsigned int)type, nbytes); data->req.download_done = TRUE; if(data->info.header_size) /* if headers have been received, this is fine */ @@ -258,7 +258,7 @@ static CURLcode cw_download_write(struct Curl_easy *data, if(!data->req.ignorebody && (nwrite || (type & CLIENTWRITE_EOS))) { result = Curl_cwriter_write(data, writer->next, type, buf, nwrite); CURL_TRC_WRITE(data, "download_write body(type=%x, blen=%zu) -> %d", - type, nbytes, result); + (unsigned int)type, nbytes, result); if(result) return result; } @@ -396,7 +396,7 @@ CURLcode Curl_client_write(struct Curl_easy *data, int type, const char *buf, result = Curl_cwriter_write(data, data->req.writer_stack, type, buf, len); CURL_TRC_WRITE(data, "client_write(type=%x, len=%zu) -> %d", - type, len, result); + (unsigned int)type, len, result); return result; } diff --git a/lib/setopt.c b/lib/setopt.c index dae4218b70..0c3ccb5a00 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -825,7 +825,7 @@ static CURLcode setopt_long_bool(struct Curl_easy *data, CURLoption option, if((arg > ok) || (arg < 0)) /* reserve other values for future use */ infof(data, "boolean setopt(%d) got unsupported argument %ld," - " treated as %d", option, arg, enabled); + " treated as %d", (int)option, arg, enabled); return CURLE_OK; } diff --git a/lib/smtp.c b/lib/smtp.c index 86fc883140..b5c425cd7c 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -431,7 +431,7 @@ static CURLcode cr_eob_read(struct Curl_easy *data, ctx->eos = TRUE; } *peos = (bool)ctx->eos; - DEBUGF(infof(data, "cr_eob_read(%zu) -> %d, %zd, %d", + DEBUGF(infof(data, "cr_eob_read(%zu) -> %d, %zu, %d", blen, result, *pnread, *peos)); return result; } diff --git a/lib/socks.c b/lib/socks.c index 8d1a4e9540..a51502a13e 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -419,7 +419,7 @@ static CURLproxycode socks4_check_resp(struct socks_state *sx, "[SOCKS] cannot complete SOCKS4 connection to %u.%u.%u.%u:%u. (%u)" ", request rejected or failed.", resp[4], resp[5], resp[6], resp[7], - ((resp[2] << 8) | resp[3]), resp[1]); + (unsigned int)((resp[2] << 8) | resp[3]), resp[1]); return CURLPX_REQUEST_FAILED; case 92: failf(data, @@ -427,7 +427,7 @@ static CURLproxycode socks4_check_resp(struct socks_state *sx, ", request rejected because SOCKS server cannot connect to " "identd on the client.", resp[4], resp[5], resp[6], resp[7], - ((resp[2] << 8) | resp[3]), resp[1]); + (unsigned int)((resp[2] << 8) | resp[3]), resp[1]); return CURLPX_IDENTD; case 93: failf(data, @@ -435,14 +435,14 @@ static CURLproxycode socks4_check_resp(struct socks_state *sx, ", request rejected because the client program and identd " "report different user-ids.", resp[4], resp[5], resp[6], resp[7], - ((resp[2] << 8) | resp[3]), resp[1]); + (unsigned int)((resp[2] << 8) | resp[3]), resp[1]); return CURLPX_IDENTD_DIFFER; default: failf(data, "[SOCKS] cannot complete SOCKS4 connection to %u.%u.%u.%u:%u. (%u)" ", Unknown.", resp[4], resp[5], resp[6], resp[7], - ((resp[2] << 8) | resp[3]), resp[1]); + (unsigned int)((resp[2] << 8) | resp[3]), resp[1]); return CURLPX_UNKNOWN_FAIL; } } @@ -1273,7 +1273,7 @@ static CURLcode socks_proxy_cf_connect(struct Curl_cfilter *cf, struct ip_quadruple ipquad; bool is_ipv6; if(!Curl_conn_cf_get_ip_info(cf->next, data, &is_ipv6, &ipquad)) - infof(data, "Opened %sSOCKS connection from %s port %u to %s port %u " + infof(data, "Opened %sSOCKS connection from %s port %d to %s port %d " "(via %s port %u)", (sockindex == SECONDARYSOCKET) ? "2nd " : "", ipquad.local_ip, ipquad.local_port, @@ -1308,11 +1308,11 @@ static CURLcode socks_cf_adjust_pollset(struct Curl_cfilter *cf, case SOCKS5_ST_REQ0_SEND: case SOCKS5_ST_AUTH_SEND: case SOCKS5_ST_REQ1_SEND: - CURL_TRC_CF(data, cf, "adjust pollset out (%d)", sx->state); + CURL_TRC_CF(data, cf, "adjust pollset out (%d)", (int)sx->state); result = Curl_pollset_set_out_only(data, ps, sock); break; default: - CURL_TRC_CF(data, cf, "adjust pollset in (%d)", sx->state); + CURL_TRC_CF(data, cf, "adjust pollset in (%d)", (int)sx->state); result = Curl_pollset_set_in_only(data, ps, sock); break; } diff --git a/lib/tftp.c b/lib/tftp.c index dd006fb1cf..780b5fd319 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -300,8 +300,8 @@ static CURLcode tftp_parse_option_ack(struct tftp_conn *state, return CURLE_TFTP_ILLEGAL; } - state->blksize = (int)blksize; - infof(data, "blksize parsed from OACK (%d) requested (%d)", + state->blksize = (unsigned int)blksize; + infof(data, "blksize parsed from OACK (%u) requested (%u)", state->blksize, state->requested_blksize); } else if(checkprefix(TFTP_OPTION_TSIZE, option)) { @@ -717,7 +717,7 @@ static CURLcode tftp_send_first(struct tftp_conn *state, result = tftp_option_add(state, &sbytes, sbytes, buf); /* add blksize option */ - curl_msnprintf(buf, sizeof(buf), "%d", state->requested_blksize); + curl_msnprintf(buf, sizeof(buf), "%u", state->requested_blksize); if(result == CURLE_OK) result = tftp_option_add(state, &sbytes, sbytes, TFTP_OPTION_BLKSIZE); if(result == CURLE_OK) @@ -869,7 +869,7 @@ static CURLcode tftp_state_machine(struct tftp_conn *state, infof(data, "%s", "TFTP finished"); break; default: - DEBUGF(infof(data, "STATE: %d", state->state)); + DEBUGF(infof(data, "STATE: %d", (int)state->state)); failf(data, "%s", "Internal state machine error"); result = CURLE_TFTP_ILLEGAL; break; diff --git a/lib/vauth/digest.c b/lib/vauth/digest.c index 5ecfd60aad..3bf9dc17d4 100644 --- a/lib/vauth/digest.c +++ b/lib/vauth/digest.c @@ -835,7 +835,8 @@ static CURLcode auth_create_digest_http_message( if(digest->qop) hashthis = curl_maprintf("%s:%s:%08x:%s:%s:%s", ha1, digest->nonce, - digest->nc, digest->cnonce, digest->qop, ha2); + (unsigned int)digest->nc, digest->cnonce, + digest->qop, ha2); else hashthis = curl_maprintf("%s:%s:%s", ha1, digest->nonce, ha2); @@ -900,7 +901,7 @@ static CURLcode auth_create_digest_http_message( nonce_quoted, uri_quoted, digest->cnonce, - digest->nc, + (unsigned int)digest->nc, digest->qop, request_digest); diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index e4d35bbdcf..f430815963 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -3186,7 +3186,7 @@ static CURLcode ssh_pollset(struct Curl_easy *data, if(waitfor & REQ_IO_SEND) flags |= CURL_POLL_OUT; DEBUGASSERT(flags); - CURL_TRC_SSH(data, "pollset, flags=%x", flags); + CURL_TRC_SSH(data, "pollset, flags=%x", (unsigned int)flags); return Curl_pollset_change(data, ps, sock, flags, 0); } /* While we still have a session, we listen incoming data. */ diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 71f792962d..4183ed5a9d 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -384,7 +384,7 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl) numcerts = sk_X509_num(sk); if(numcerts > MAX_ALLOWED_CERT_AMOUNT) { - failf(data, "%d certificates is more than allowed (%u)", (int)numcerts, + failf(data, "%d certificates is more than allowed (%d)", (int)numcerts, MAX_ALLOWED_CERT_AMOUNT); return CURLE_SSL_CONNECT_ERROR; } @@ -2065,7 +2065,7 @@ static CURLcode ossl_verifyhost(struct Curl_easy *data, break; default: DEBUGASSERT(0); - failf(data, "unexpected ssl peer type: %d", peer->type); + failf(data, "unexpected ssl peer type: %u", peer->type); return CURLE_PEER_FAILED_VERIFICATION; } @@ -2492,7 +2492,7 @@ static void ossl_trace(int direction, int ssl_ver, int content_type, verstr = "TLSv1.3"; break; default: - curl_msnprintf(unknown, sizeof(unknown), "(%x)", ssl_ver); + curl_msnprintf(unknown, sizeof(unknown), "(%x)", (unsigned int)ssl_ver); verstr = unknown; break; } @@ -3371,7 +3371,7 @@ ossl_init_session_and_alpns(struct ossl_ctx *octx, scs->alpn ? scs->alpn : "-"); octx->reused_session = TRUE; infof(data, "SSL verify result: %lx", - SSL_get_verify_result(octx->ssl)); + (unsigned long)SSL_get_verify_result(octx->ssl)); #ifdef HAVE_OPENSSL_EARLYDATA if(ssl_config->earlydata && scs->alpn && SSL_SESSION_get_max_early_data(ssl_session) && @@ -4768,7 +4768,7 @@ CURLcode Curl_ossl_check_peer_cert(struct Curl_cfilter *cf, ossl_verify = SSL_get_verify_result(octx->ssl); ssl_config->certverifyresult = ossl_verify; - infof(data, "OpenSSL verify result: %lx", ossl_verify); + infof(data, "OpenSSL verify result: %lx", (unsigned long)ossl_verify); verified = (ossl_verify == X509_V_OK); if(verified) diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index bed3a13ec8..9287c61484 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -1393,7 +1393,7 @@ static CURLcode ssl_cf_set_earlydata(struct Curl_cfilter *cf, if(blen > connssl->earlydata_max) blen = connssl->earlydata_max; result = Curl_bufq_write(&connssl->earlydata, buf, blen, &nwritten); - CURL_TRC_CF(data, cf, "ssl_cf_set_earlydata(len=%zu) -> %zd", + CURL_TRC_CF(data, cf, "ssl_cf_set_earlydata(len=%zu) -> %zu", blen, nwritten); if(result) return result; diff --git a/lib/vtls/vtls_scache.c b/lib/vtls/vtls_scache.c index 3977046168..7eb2949d3b 100644 --- a/lib/vtls/vtls_scache.c +++ b/lib/vtls/vtls_scache.c @@ -200,7 +200,7 @@ CURLcode Curl_ssl_peer_key_make(struct Curl_cfilter *cf, } if(ssl->version || ssl->version_max) { - r = curlx_dyn_addf(&buf, ":TLSVER-%d-%d", ssl->version, + r = curlx_dyn_addf(&buf, ":TLSVER-%d-%u", ssl->version, (ssl->version_max >> 16)); if(r) goto out; @@ -832,8 +832,8 @@ out: else CURL_TRC_SSLS(data, "added session for %s [proto=0x%x, " "valid_secs=%" FMT_OFF_T ", alpn=%s, earlydata=%zu, " - "quic_tp=%s], peer has %zu sessions now", - ssl_peer_key, s->ietf_tls_id, s->valid_until - now, + "quic_tp=%s], peer has %zu sessions now", ssl_peer_key, + (unsigned int)s->ietf_tls_id, s->valid_until - now, s->alpn, s->earlydata_max, s->quic_tp ? "yes" : "no", peer ? Curl_llist_count(&peer->sessions) : 0); return result; @@ -905,7 +905,7 @@ CURLcode Curl_ssl_scache_take(struct Curl_cfilter *cf, *ps = s; CURL_TRC_SSLS(data, "took session for %s [proto=0x%x, " "alpn=%s, earlydata=%zu, quic_tp=%s], %zu sessions remain", - ssl_peer_key, s->ietf_tls_id, s->alpn, + ssl_peer_key, (unsigned int)s->ietf_tls_id, s->alpn, s->earlydata_max, s->quic_tp ? "yes" : "no", Curl_llist_count(&peer->sessions)); } diff --git a/lib/ws.c b/lib/ws.c index e3b8f6ce9b..b4f67c7ca3 100644 --- a/lib/ws.c +++ b/lib/ws.c @@ -758,7 +758,7 @@ static CURLcode ws_cw_write(struct Curl_easy *data, } if((type & CLIENTWRITE_EOS) && !Curl_bufq_is_empty(&ctx->buf)) { - failf(data, "[WS] decode ending with %zd frame bytes remaining", + failf(data, "[WS] decode ending with %zu frame bytes remaining", Curl_bufq_len(&ctx->buf)); return CURLE_RECV_ERROR; } @@ -1049,9 +1049,9 @@ static CURLcode ws_enc_send(struct Curl_easy *data, if((curl_off_t)buflen > (ws->enc.payload_remain + (curl_off_t)ws->sendbuf_payload)) { /* too large buflen beyond payload length of frame */ - failf(data, "[WS] unaligned frame size (sending %zu instead of %" - FMT_OFF_T ")", - buflen, ws->enc.payload_remain + ws->sendbuf_payload); + failf(data, "[WS] unaligned frame size (sending %zu instead of " + "%" FMT_OFF_T ")", buflen, + (curl_off_t)(ws->enc.payload_remain + ws->sendbuf_payload)); return CURLE_BAD_FUNCTION_ARGUMENT; } }