diff --git a/CMake/PickyWarnings.cmake b/CMake/PickyWarnings.cmake index aca79ec947..6d445159f4 100644 --- a/CMake/PickyWarnings.cmake +++ b/CMake/PickyWarnings.cmake @@ -250,7 +250,7 @@ if(PICKY_COMPILER) if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.1) OR (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0)) list(APPEND _picky_enable - -Wno-format-signedness # clang 19.1 gcc 5.1 appleclang 17.0 # In clang-cl enums are signed ints by default + -Wformat-signedness # clang 19.1 gcc 5.1 appleclang 17.0 # In clang-cl enums are signed ints by default ) endif() if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21.1) OR @@ -306,7 +306,7 @@ if(PICKY_COMPILER) if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0) list(APPEND _picky_enable -Warray-bounds=2 # clang 2.9 gcc 5.0 (clang default: -Warray-bounds) - -Wno-format-signedness # clang 19.1 gcc 5.1 appleclang 17.0 + -Wformat-signedness # clang 19.1 gcc 5.1 appleclang 17.0 ) endif() if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0) diff --git a/docs/examples/sslbackend.c b/docs/examples/sslbackend.c index e10eaaa217..8989d67bb3 100644 --- a/docs/examples/sslbackend.c +++ b/docs/examples/sslbackend.c @@ -54,7 +54,7 @@ int main(int argc, const char **argv) for(i = 0; list[i]; i++) printf("SSL backend #%d: '%s' (ID: %d)\n", - i, list[i]->name, list[i]->id); + i, list[i]->name, (int)list[i]->id); return 0; } diff --git a/docs/examples/websocket.c b/docs/examples/websocket.c index ec445d88ed..953c2f358f 100644 --- a/docs/examples/websocket.c +++ b/docs/examples/websocket.c @@ -94,7 +94,7 @@ retry: else { /* some other frame arrived. */ fprintf(stderr, "ws: received frame of %u bytes rflags %x\n", - (unsigned int)rlen, meta->flags); + (unsigned int)rlen, (unsigned int)meta->flags); goto retry; } } diff --git a/include/curl/curl.h b/include/curl/curl.h index 6961a6c4c1..ba90162c6c 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -516,6 +516,7 @@ typedef int (*curl_prereq_callback)(void *clientp, */ typedef enum { + CURLE_SIGNED = -1, /* to ensure signed type, never use! */ CURLE_OK = 0, CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ CURLE_FAILED_INIT, /* 2 */ @@ -2605,7 +2606,8 @@ struct curl_forms { * ***************************************************************************/ typedef enum { - CURL_FORMADD_OK CURL_DEPRECATED(7.56.0, ""), /* 1st, no error */ + CURL_FORMADD_SIGNED = -1, /* to ensure signed type, never use! */ + CURL_FORMADD_OK CURL_DEPRECATED(7.56.0, "") = 0, /* no error */ CURL_FORMADD_MEMORY CURL_DEPRECATED(7.56.0, ""), CURL_FORMADD_OPTION_TWICE CURL_DEPRECATED(7.56.0, ""), @@ -3024,6 +3026,7 @@ typedef enum { /* Different data locks for a single share */ typedef enum { + CURL_LOCK_DATA_SIGNED = -1, /* to ensure signed type, never use! */ CURL_LOCK_DATA_NONE = 0, /* CURL_LOCK_DATA_SHARE is used internally to say that the locking is made * to change the internal state of the share itself. @@ -3055,7 +3058,8 @@ typedef void (*curl_unlock_function)(CURL *handle, void *userptr); typedef enum { - CURLSHE_OK, /* all is fine */ + CURLSHE_SIGNED = -1, /* to ensure signed type, never use! */ + CURLSHE_OK = 0, /* all is fine */ CURLSHE_BAD_OPTION, /* 1 */ CURLSHE_IN_USE, /* 2 */ CURLSHE_INVALID, /* 3 */ diff --git a/include/curl/multi.h b/include/curl/multi.h index 060b73eeec..47cba28126 100644 --- a/include/curl/multi.h +++ b/include/curl/multi.h @@ -87,7 +87,8 @@ typedef enum { #define CURLPIPE_MULTIPLEX 2L typedef enum { - CURLMSG_NONE, /* first, not used */ + CURLMSG_SIGNED = -1, /* to ensure signed type, never use! */ + CURLMSG_NONE = 0, /* first, not used */ CURLMSG_DONE, /* This easy handle has completed. 'result' contains the CURLcode of the transfer */ CURLMSG_LAST /* last, not used */ diff --git a/include/curl/urlapi.h b/include/curl/urlapi.h index b1f3a2316b..fb633871a5 100644 --- a/include/curl/urlapi.h +++ b/include/curl/urlapi.h @@ -32,7 +32,8 @@ extern "C" { /* the error codes for the URL API */ typedef enum { - CURLUE_OK, + CURLUE_SIGNED = -1, /* to ensure signed type, never use! */ + CURLUE_OK = 0, CURLUE_BAD_HANDLE, /* 1 */ CURLUE_BAD_PARTPOINTER, /* 2 */ CURLUE_MALFORMED_INPUT, /* 3 */ 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..c41a7442db 100644 --- a/lib/cf-ip-happy.c +++ b/lib/cf-ip-happy.c @@ -403,7 +403,7 @@ evaluate: } if(bs->running) CURL_TRC_CF(data, cf, "checked connect attempts: " - "%d ongoing, %d inconclusive", ongoing, inconclusive); + "%u ongoing, %u inconclusive", ongoing, inconclusive); /* no attempt connected yet, start another one? */ if(!ongoing) { @@ -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/curl_gssapi.c b/lib/curl_gssapi.c index 650d1908d0..8182ae7d0a 100644 --- a/lib/curl_gssapi.c +++ b/lib/curl_gssapi.c @@ -260,7 +260,7 @@ static OM_uint32 stub_gss_init_sec_context( used = curl_msnprintf(token, length, "%s:%.*s:%d:", creds, (int)target_desc.length, (const char *)target_desc.value, - ctx->sent); + (int)ctx->sent); gss_release_buffer(&minor_status, &target_desc); } diff --git a/lib/curlx/strerr.c b/lib/curlx/strerr.c index b53173c578..1d1e40d164 100644 --- a/lib/curlx/strerr.c +++ b/lib/curlx/strerr.c @@ -268,7 +268,7 @@ const char *curlx_strerror(int err, char *buf, size_t buflen) !get_winsock_error(err, buf, buflen) && #endif !curlx_get_winapi_error((DWORD)err, buf, buflen)) - SNPRINTF(buf, buflen, "Unknown error %d (%#x)", err, err); + SNPRINTF(buf, buflen, "Unknown error %d (%#x)", err, (unsigned int)err); #else /* !_WIN32 */ #if defined(HAVE_STRERROR_R) && defined(HAVE_POSIX_STRERROR_R) 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/http_chunks.c b/lib/http_chunks.c index aa45c79e38..6f9cc446f0 100644 --- a/lib/http_chunks.c +++ b/lib/http_chunks.c @@ -153,7 +153,8 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data, if(ch->hexindex == 0) { /* This is illegal data, we received junk where we expected a hexadecimal digit. */ - failf(data, "chunk hex-length char not a hex digit: 0x%x", *buf); + failf(data, "chunk hex-length char not a hex digit: 0x%x", + (unsigned int)*buf); ch->state = CHUNK_FAILED; ch->last_code = CHUNKE_ILLEGAL_HEX; return CURLE_RECV_ERROR; diff --git a/lib/imap.c b/lib/imap.c index ccfbeb72c4..5ef2a2cb21 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -1452,8 +1452,8 @@ static CURLcode imap_state_fetch_resp(struct Curl_easy *data, if(result) return result; - infof(data, "Written %zu bytes, %" FMT_OFF_TU - " bytes are left for transfer", chunk, size - chunk); + infof(data, "Written %zu bytes, %" FMT_OFF_T + " bytes are left for transfer", chunk, (curl_off_t)(size - chunk)); /* Have we used the entire overflow or part of it?*/ if(pp->overflow > chunk) { 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..eaf59e97c1 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, (unsigned char)ptr[0], (unsigned char)ptr[1]); curlx_dyn_reset(&mq->recvbuf); return CURLE_WEIRD_SERVER_REPLY; } diff --git a/lib/multi.c b/lib/multi.c index f6d719287f..014066bdea 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1194,7 +1194,8 @@ 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 +1625,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..2f601a8335 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; } @@ -2916,6 +2916,6 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...) va_end(arg); if(result == CURLE_BAD_FUNCTION_ARGUMENT) - failf(data, "setopt 0x%x got bad argument", option); + failf(data, "setopt 0x%x got bad argument", (unsigned int)option); return result; } 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/strerror.c b/lib/strerror.c index 1e97c2829d..7d27e8661e 100644 --- a/lib/strerror.c +++ b/lib/strerror.c @@ -404,6 +404,7 @@ const char *curl_share_strerror(CURLSHcode error) case CURLSHE_NOT_BUILT_IN: return "Feature not enabled in this library"; + case CURLSHE_SIGNED: case CURLSHE_LAST: break; } @@ -517,6 +518,7 @@ const char *curl_url_strerror(CURLUcode error) case CURLUE_TOO_LARGE: return "A value or data field is larger than allowed"; + case CURLUE_SIGNED: case CURLUE_LAST: break; } @@ -647,14 +649,15 @@ const char *Curl_sspi_strerror(SECURITY_STATUS err, char *buf, size_t buflen) "SEC_E_ILLEGAL_MESSAGE (0x%08lx) - This error usually " "occurs when a fatal SSL/TLS alert is received (e.g. " "handshake failed). More detail may be available in " - "the Windows System event log.", err); + "the Windows System event log.", (unsigned long)err); } else { char msgbuf[256]; if(curlx_get_winapi_error((DWORD)err, msgbuf, sizeof(msgbuf))) - curl_msnprintf(buf, buflen, "%s (0x%08lx) - %s", txt, err, msgbuf); + curl_msnprintf(buf, buflen, "%s (0x%08lx) - %s", txt, (unsigned long)err, + msgbuf); else - curl_msnprintf(buf, buflen, "%s (0x%08lx)", txt, err); + curl_msnprintf(buf, buflen, "%s (0x%08lx)", txt, (unsigned long)err); } #else /* CURLVERBOSE */ if(err == SEC_E_OK) 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/url.c b/lib/url.c index c8a1fb276e..352826915b 100644 --- a/lib/url.c +++ b/lib/url.c @@ -1815,7 +1815,7 @@ static CURLcode setup_connection_internals(struct Curl_easy *data, /* IPv6 addresses with a scope_id (0 is default == global) have a * printable representation with a '%' suffix. */ if(conn->scope_id) - conn->destination = curl_maprintf("[%s:%u]%%%d", hostname, port, + conn->destination = curl_maprintf("[%s:%u]%%%u", hostname, port, conn->scope_id); else #endif 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/vauth/digest_sspi.c b/lib/vauth/digest_sspi.c index f0b6780fca..6a6fc28800 100644 --- a/lib/vauth/digest_sspi.c +++ b/lib/vauth/digest_sspi.c @@ -458,7 +458,8 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, if(status == SEC_E_OK) output_token_len = chlg_buf[4].cbBuffer; else { /* delete the context so a new one can be made */ - infof(data, "digest_sspi: MakeSignature failed, error 0x%08lx", status); + infof(data, "digest_sspi: MakeSignature failed, error 0x%08lx", + (unsigned long)status); Curl_pSecFn->DeleteSecurityContext(digest->http_context); curlx_safefree(digest->http_context); } diff --git a/lib/vauth/ntlm_sspi.c b/lib/vauth/ntlm_sspi.c index 4c41eb21f4..0b623dee7b 100644 --- a/lib/vauth/ntlm_sspi.c +++ b/lib/vauth/ntlm_sspi.c @@ -296,7 +296,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data, &attrs, NULL); if(status != SEC_E_OK) { infof(data, "NTLM handshake failure (type-3 message): Status=0x%08lx", - status); + (unsigned long)status); if(status == SEC_E_INSUFFICIENT_MEMORY) return CURLE_OUT_OF_MEMORY; diff --git a/lib/vquic/curl_ngtcp2.c b/lib/vquic/curl_ngtcp2.c index 04c6ed1fee..51b60432b0 100644 --- a/lib/vquic/curl_ngtcp2.c +++ b/lib/vquic/curl_ngtcp2.c @@ -1141,7 +1141,7 @@ static int cb_h3_recv_data(nghttp3_conn *conn, int64_t stream3_id, if(stream->rx_offset_max < stream->rx_offset) stream->rx_offset_max = stream->rx_offset; - CURL_TRC_CF(data, cf, "[%" PRId64 "] DATA len=%zu, rx win=%" PRId64, + CURL_TRC_CF(data, cf, "[%" PRId64 "] DATA len=%zu, rx win=%" PRIu64, stream->id, blen, stream->rx_offset_max - stream->rx_offset); cf_ngtcp2_upd_rx_win(cf, data, stream); return 0; @@ -1587,7 +1587,7 @@ static nghttp3_ssize cb_h3_read_req_body(nghttp3_conn *conn, int64_t stream_id, } CURL_TRC_CF(data, cf, "[%" PRId64 "] read req body -> " - "%d vecs%s with %zu (buffered=%zu, left=%" FMT_OFF_T ")", + "%d vecs%s with %zd (buffered=%zu, left=%" FMT_OFF_T ")", stream->id, (int)nvecs, *pflags == NGHTTP3_DATA_FLAG_EOF ? " EOF" : "", nwritten, Curl_bufq_len(&stream->sendbuf), @@ -1850,7 +1850,7 @@ static CURLcode cf_ngtcp2_recv_pkts(const unsigned char *buf, size_t buflen, if(ecn) CURL_TRC_CF(pktx->data, pktx->cf, "vquic_recv(len=%zu, gso=%zu, ecn=%x)", - buflen, gso_size, ecn); + buflen, gso_size, (unsigned int)ecn); ngtcp2_addr_init(&path.local, (struct sockaddr *)&ctx->q.local_addr, ctx->q.local_addrlen); ngtcp2_addr_init(&path.remote, (struct sockaddr *)remote_addr, @@ -2244,8 +2244,8 @@ static CURLcode cf_ngtcp2_shutdown(struct Curl_cfilter *cf, (uint8_t *)buffer, sizeof(buffer), &ctx->last_error, pktx.ts); CURL_TRC_CF(data, cf, "start shutdown(err_type=%d, err_code=%" - PRIu64 ") -> %d", ctx->last_error.type, - ctx->last_error.error_code, (int)nwritten); + PRIu64 ") -> %zd", (int)ctx->last_error.type, + ctx->last_error.error_code, (ssize_t)nwritten); /* there are cases listed in ngtcp2 documentation where this call * may fail. Since we are doing a connection shutdown as graceful * as we can, such an error is ignored here. */ @@ -2412,7 +2412,7 @@ static int quic_gtls_handshake_cb(gnutls_session_t session, unsigned int htype, DEBUGASSERT(data); if(!data) return 0; - CURL_TRC_CF(data, cf, "SSL message: %s %s [%d]", + CURL_TRC_CF(data, cf, "SSL message: %s %s [%u]", incoming ? "<-" : "->", gtls_hs_msg_name(htype), htype); switch(htype) { case GNUTLS_HANDSHAKE_NEW_SESSION_TICKET: { @@ -2771,7 +2771,7 @@ out: result = CURLE_COULDNT_CONNECT; if(cerr) { CURL_TRC_CF(data, cf, "connect error, type=%d, code=%" PRIu64, - cerr->type, cerr->error_code); + (int)cerr->type, cerr->error_code); switch(cerr->type) { case NGTCP2_CCERR_TYPE_VERSION_NEGOTIATION: CURL_TRC_CF(data, cf, "error in version negotiation"); diff --git a/lib/vquic/curl_quiche.c b/lib/vquic/curl_quiche.c index 8a24e1f6a5..23b9b8d9b0 100644 --- a/lib/vquic/curl_quiche.c +++ b/lib/vquic/curl_quiche.c @@ -514,10 +514,14 @@ static void cf_quiche_process_ev(struct Curl_cfilter *cf, struct h3_stream_ctx *stream, quiche_h3_event *ev) { + enum quiche_h3_event_type type; + if(!stream) return; - switch(quiche_h3_event_type(ev)) { + type = quiche_h3_event_type(ev); + + switch(type) { case QUICHE_H3_EVENT_HEADERS: { struct cb_ctx cb_ctx; stream->resp_got_header = TRUE; @@ -563,7 +567,7 @@ static void cf_quiche_process_ev(struct Curl_cfilter *cf, default: CURL_TRC_CF(data, cf, "[%" PRIu64 "] recv, unhandled event %d", - stream->id, quiche_h3_event_type(ev)); + stream->id, (int)type); break; } } @@ -1051,7 +1055,7 @@ static CURLcode h3_open_stream(struct Curl_cfilter *cf, goto out; } else { - CURL_TRC_CF(data, cf, "send_request(%s) -> %" PRIu64, + CURL_TRC_CF(data, cf, "send_request(%s) -> %" PRId64, Curl_bufref_ptr(&data->state.url), rv); } result = CURLE_SEND_ERROR; diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index 44094e466c..adc2587f47 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -2403,7 +2403,7 @@ static CURLcode myssh_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/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/gtls.c b/lib/vtls/gtls.c index 1b581cda88..9b6a4fab2e 100644 --- a/lib/vtls/gtls.c +++ b/lib/vtls/gtls.c @@ -127,7 +127,7 @@ static ssize_t gtls_pull(void *s, void *buf, size_t blen) } result = Curl_conn_cf_recv(cf->next, data, buf, blen, &nread); - CURL_TRC_CF(data, cf, "glts_pull(len=%zu) -> %d, %zd", blen, result, nread); + CURL_TRC_CF(data, cf, "glts_pull(len=%zu) -> %d, %zu", blen, result, nread); backend->gtls.io_result = result; if(result) { /* !checksrc! disable ERRNOVAR 1 */ @@ -793,7 +793,7 @@ static int gtls_handshake_cb(gnutls_session_t session, unsigned int htype, if(when) { /* after message has been processed */ struct Curl_easy *data = CF_DATA_CURRENT(cf); if(data) { - CURL_TRC_CF(data, cf, "handshake: %s message type %d", + CURL_TRC_CF(data, cf, "handshake: %s message type %u", incoming ? "incoming" : "outgoing", htype); switch(htype) { case GNUTLS_HANDSHAKE_NEW_SESSION_TICKET: { @@ -1619,7 +1619,7 @@ CURLcode Curl_gtls_verifyserver(struct Curl_cfilter *cf, if(data->set.ssl.certinfo && chain.certs) { if(chain.num_certs > MAX_ALLOWED_CERT_AMOUNT) { - failf(data, "%u certificates is more than allowed (%u)", + failf(data, "%u certificates is more than allowed (%d)", chain.num_certs, MAX_ALLOWED_CERT_AMOUNT); result = CURLE_SSL_CONNECT_ERROR; goto out; diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c index 1cac66041d..06586cb8f1 100644 --- a/lib/vtls/mbedtls.c +++ b/lib/vtls/mbedtls.c @@ -425,7 +425,7 @@ static void mbed_extract_certinfo(struct Curl_easy *data, cert_count++; if(cert_count > MAX_ALLOWED_CERT_AMOUNT) { - infof(data, "Certificates is more than allowed (%u), skipping certinfo", + infof(data, "Certificates is more than allowed (%d), skipping certinfo", MAX_ALLOWED_CERT_AMOUNT); return; } @@ -464,7 +464,8 @@ static int mbed_verify_cb(void *ptr, mbedtls_x509_crt *crt, mbedtls_x509_crt_verify_info(buf, sizeof(buf), "", *flags); failf(data, "mbedTLS: %s", buf); #else - failf(data, "mbedTLS: certificate verification error 0x%08x", *flags); + failf(data, "mbedTLS: certificate verification error 0x%08x", + (unsigned int)*flags); #endif } @@ -529,7 +530,7 @@ static CURLcode mbed_load_cacert(struct Curl_cfilter *cf, if(ret < 0) { mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); failf(data, "mbedTLS: error importing CA cert blob: (-0x%04X) %s", - -ret, errorbuf); + (unsigned int)-ret, errorbuf); return CURLE_SSL_CERTPROBLEM; } } @@ -541,7 +542,7 @@ static CURLcode mbed_load_cacert(struct Curl_cfilter *cf, if(ret < 0) { mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); failf(data, "mbedTLS: error reading CA cert file %s: (-0x%04X) %s", - ssl_cafile, -ret, errorbuf); + ssl_cafile, (unsigned int)-ret, errorbuf); return CURLE_SSL_CACERT_BADFILE; } #else @@ -557,7 +558,7 @@ static CURLcode mbed_load_cacert(struct Curl_cfilter *cf, if(ret < 0) { mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); failf(data, "mbedTLS: error reading CA cert path %s: (-0x%04X) %s", - ssl_capath, -ret, errorbuf); + ssl_capath, (unsigned int)-ret, errorbuf); if(verifypeer) return CURLE_SSL_CACERT_BADFILE; @@ -595,7 +596,7 @@ static CURLcode mbed_load_clicert(struct Curl_cfilter *cf, if(ret) { mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); failf(data, "mbedTLS: error reading client cert file %s: (-0x%04X) %s", - ssl_cert, -ret, errorbuf); + ssl_cert, (unsigned int)-ret, errorbuf); return CURLE_SSL_CERTPROBLEM; } @@ -642,7 +643,7 @@ static CURLcode mbed_load_clicert(struct Curl_cfilter *cf, if(ret) { mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); failf(data, "mbedTLS: error reading client cert blob: (-0x%04X) %s", - -ret, errorbuf); + (unsigned int)-ret, errorbuf); return CURLE_SSL_CERTPROBLEM; } } @@ -689,7 +690,7 @@ static CURLcode mbed_load_privkey(struct Curl_cfilter *cf, if(ret) { mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); failf(data, "mbedTLS: error reading private key %s: (-0x%04X) %s", - ssl_config->key, -ret, errorbuf); + ssl_config->key, (unsigned int)-ret, errorbuf); return CURLE_SSL_CERTPROBLEM; } #else @@ -728,7 +729,7 @@ static CURLcode mbed_load_privkey(struct Curl_cfilter *cf, if(ret) { mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); failf(data, "mbedTLS: error parsing private key: (-0x%04X) %s", - -ret, errorbuf); + (unsigned int)-ret, errorbuf); return CURLE_SSL_CERTPROBLEM; } } @@ -757,7 +758,7 @@ static CURLcode mbed_load_crl(struct Curl_cfilter *cf, if(ret) { mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); failf(data, "mbedTLS: error reading CRL file %s: (-0x%04X) %s", - ssl_crlfile, -ret, errorbuf); + ssl_crlfile, (unsigned int)-ret, errorbuf); return CURLE_SSL_CRL_BADFILE; } @@ -852,7 +853,7 @@ static CURLcode mbed_configure_ssl(struct Curl_cfilter *cf, if(ret) { mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); failf(data, "mbedTLS: ssl_setup failed: " - "(-0x%04X) %s", -ret, errorbuf); + "(-0x%04X) %s", (unsigned int)-ret, errorbuf); return CURLE_SSL_CONNECT_ERROR; } @@ -903,12 +904,12 @@ static CURLcode mbed_configure_ssl(struct Curl_cfilter *cf, ret = mbedtls_ssl_session_load(&session, sc_session->sdata, sc_session->sdata_len); if(ret) { - failf(data, "SSL session error loading: -0x%x", -ret); + failf(data, "SSL session error loading: -0x%x", (unsigned int)-ret); } else { ret = mbedtls_ssl_set_session(&backend->ssl, &session); if(ret) - failf(data, "SSL session error setting: -0x%x", -ret); + failf(data, "SSL session error setting: -0x%x", (unsigned int)-ret); else infof(data, "SSL reusing session ID"); } @@ -1046,7 +1047,7 @@ static CURLcode mbed_connect_step2(struct Curl_cfilter *cf, mbedtls_ssl_get_version_number(&backend->ssl)); mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); failf(data, "ssl_handshake returned: (-0x%04X) %s", - -ret, errorbuf); + (unsigned int)-ret, errorbuf); return CURLE_SSL_CONNECT_ERROR; } @@ -1158,7 +1159,7 @@ static CURLcode mbed_new_session(struct Curl_cfilter *cf, ret = mbedtls_ssl_get_session(&backend->ssl, &session); msession_alloced = (ret != MBEDTLS_ERR_SSL_ALLOC_FAILED); if(ret) { - failf(data, "mbedtls_ssl_get_session returned -0x%x", -ret); + failf(data, "mbedtls_ssl_get_session returned -0x%x", (unsigned int)-ret); result = CURLE_SSL_CONNECT_ERROR; goto out; } @@ -1177,7 +1178,7 @@ static CURLcode mbed_new_session(struct Curl_cfilter *cf, ret = mbedtls_ssl_session_save(&session, sdata, slen, &slen); if(ret) { - failf(data, "failed to serialize session: -0x%x", -ret); + failf(data, "failed to serialize session: -0x%x", (unsigned int)-ret); goto out; } @@ -1229,7 +1230,7 @@ static CURLcode mbed_send(struct Curl_cfilter *cf, struct Curl_easy *data, } else { CURL_TRC_CF(data, cf, "mbedtls_ssl_write(len=%zu) -> -0x%04X", - len, -nwritten); + len, (unsigned int)-nwritten); switch(nwritten) { #ifdef MBEDTLS_SSL_PROTO_TLS1_3 case MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET: @@ -1297,7 +1298,8 @@ static CURLcode mbedtls_shutdown(struct Curl_cfilter *cf, connssl->io_need = CURL_SSL_IO_NEED_SEND; goto out; default: - CURL_TRC_CF(data, cf, "mbedtls_shutdown error -0x%04X", -ret); + CURL_TRC_CF(data, cf, "mbedtls_shutdown error -0x%04X", + (unsigned int)-ret); result = CURLE_RECV_ERROR; goto out; } @@ -1338,7 +1340,8 @@ static CURLcode mbedtls_shutdown(struct Curl_cfilter *cf, connssl->io_need = CURL_SSL_IO_NEED_SEND; } else { - CURL_TRC_CF(data, cf, "mbedtls_shutdown error -0x%04X", -ret); + CURL_TRC_CF(data, cf, "mbedtls_shutdown error -0x%04X", + (unsigned int)-ret); result = CURLE_RECV_ERROR; } @@ -1388,7 +1391,7 @@ static CURLcode mbed_recv(struct Curl_cfilter *cf, struct Curl_easy *data, else { char errorbuf[128]; CURL_TRC_CF(data, cf, "mbedtls_ssl_read(len=%zu) -> -0x%04X", - buffersize, -nread); + buffersize, (unsigned int)-nread); switch(nread) { #ifdef MBEDTLS_SSL_SESSION_TICKETS case MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET: @@ -1408,7 +1411,8 @@ static CURLcode mbed_recv(struct Curl_cfilter *cf, struct Curl_easy *data, break; default: mbedtls_strerror(nread, errorbuf, sizeof(errorbuf)); - failf(data, "ssl_read returned: (-0x%04X) %s", -nread, errorbuf); + failf(data, "ssl_read returned: (-0x%04X) %s", (unsigned int)-nread, + errorbuf); result = CURLE_RECV_ERROR; break; } diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 71f792962d..4fb9a96960 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -279,7 +279,7 @@ static CURLcode get_pkey_rsa(struct Curl_easy *data, #else RSA_get0_key(rsa, &n, &e, NULL); #endif /* HAVE_EVP_PKEY_GET_PARAMS */ - BIO_printf(mem, "%d", n ? BN_num_bits(n) : 0); + BIO_printf(mem, "%d", (int)(n ? BN_num_bits(n) : 0)); result = push_certinfo(data, mem, "RSA Public Key", i); if(!result) { result = print_pubkey_BN(rsa, n, i); @@ -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; } @@ -415,7 +415,7 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl) if(result) break; - BIO_printf(mem, "%lx", X509_get_version(x)); + BIO_printf(mem, "%lx", (unsigned long)X509_get_version(x)); result = push_certinfo(data, mem, "Version", i); if(result) break; @@ -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: %d", (int)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/rustls.c b/lib/vtls/rustls.c index fcd4f7289e..c7677a6269 100644 --- a/lib/vtls/rustls.c +++ b/lib/vtls/rustls.c @@ -373,7 +373,7 @@ static CURLcode cr_send(struct Curl_cfilter *cf, struct Curl_easy *data, *pnwritten += (ssize_t)plainwritten; out: - CURL_TRC_CF(data, cf, "rustls_send(len=%zu) -> %d, %zd", + CURL_TRC_CF(data, cf, "rustls_send(len=%zu) -> %d, %zu", plainlen, result, *pnwritten); return result; } @@ -1142,7 +1142,7 @@ static CURLcode cr_connect(struct Curl_cfilter *cf, struct Curl_easy *data, DEBUGASSERT(backend); - CURL_TRC_CF(data, cf, "cr_connect, state=%d", connssl->state); + CURL_TRC_CF(data, cf, "cr_connect, state=%d", (int)connssl->state); *done = FALSE; #ifdef USE_ECH @@ -1217,7 +1217,7 @@ static CURLcode cr_connect(struct Curl_cfilter *cf, struct Curl_easy *data, while(rustls_connection_get_peer_certificate(rconn, num_certs)) { num_certs++; if(num_certs > MAX_ALLOWED_CERT_AMOUNT) { - failf(data, "%zu certificates is more than allowed (%u)", + failf(data, "%zu certificates is more than allowed (%d)", num_certs, MAX_ALLOWED_CERT_AMOUNT); return CURLE_SSL_CONNECT_ERROR; } diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index 05bd6a5194..fb5ff0e9d8 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -1670,7 +1670,7 @@ static CURLcode schannel_connect_step3(struct Curl_cfilter *cf, traverse_cert_store(ccert_context, cert_counter_callback, &certs_count); if(certs_count > MAX_ALLOWED_CERT_AMOUNT) { - failf(data, "%d certificates is more than allowed (%u)", + failf(data, "%d certificates is more than allowed (%d)", certs_count, MAX_ALLOWED_CERT_AMOUNT); CertFreeCertificateContext(ccert_context); return CURLE_SSL_CONNECT_ERROR; diff --git a/lib/vtls/schannel_verify.c b/lib/vtls/schannel_verify.c index 3e0130c8e9..9be6fe311c 100644 --- a/lib/vtls/schannel_verify.c +++ b/lib/vtls/schannel_verify.c @@ -290,7 +290,7 @@ static CURLcode add_certs_file_to_store(HCERTSTORE trust_store, } if(file_size.QuadPart > MAX_CAFILE_SIZE) { - failf(data, "schannel: CA file exceeds max size of %u bytes", + failf(data, "schannel: CA file exceeds max size of %d bytes", MAX_CAFILE_SIZE); result = CURLE_SSL_CACERT_BADFILE; goto cleanup; 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/vtls/x509asn1.c b/lib/vtls/x509asn1.c index 7b83dd542a..0d8d83e0f7 100644 --- a/lib/vtls/x509asn1.c +++ b/lib/vtls/x509asn1.c @@ -607,7 +607,7 @@ static CURLcode UTime2str(struct dynbuf *store, } tzl = end - tzp; - return curlx_dyn_addf(store, "%u%.2s-%.2s-%.2s %.2s:%.2s:%.2s %.*s", + return curlx_dyn_addf(store, "%d%.2s-%.2s-%.2s %.2s:%.2s:%.2s %.*s", 20 - (*beg >= '5'), beg, beg + 2, beg + 4, beg + 6, beg + 8, sec, (int)tzl, tzp); 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; } } diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4 index 4bb7196eae..5607952878 100644 --- a/m4/curl-compilers.m4 +++ b/m4/curl-compilers.m4 @@ -940,7 +940,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [ fi dnl clang 19 or later if test "$compiler_num" -ge "1901"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-format-signedness" + CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [format-signedness]) fi dnl clang 20 or later if test "$compiler_num" -ge "2001"; then @@ -1134,7 +1134,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [ dnl Only gcc 5 or later if test "$compiler_num" -ge "500"; then tmp_CFLAGS="$tmp_CFLAGS -Warray-bounds=2" - tmp_CFLAGS="$tmp_CFLAGS -Wno-format-signedness" + CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [format-signedness]) fi dnl Only gcc 6 or later diff --git a/src/config2setopts.c b/src/config2setopts.c index 171ba6986a..9138b3b147 100644 --- a/src/config2setopts.c +++ b/src/config2setopts.c @@ -519,7 +519,7 @@ static CURLcode cookie_setopts(struct OperationConfig *config, CURL *curl) ISBLANK(cl->data[0]) ? "" : " ", cl->data); if(result) { warnf("skipped provided cookie, the cookie header " - "would go over %u bytes", MAX_COOKIE_LINE); + "would go over %d bytes", MAX_COOKIE_LINE); return result; } } diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 30163561ea..176d3ebc38 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -2255,7 +2255,7 @@ static ParameterError opt_file(struct OperationConfig *config, break; case C_CONFIG: /* --config */ if(--max_recursive < 0) { - errorf("Max config file recursion level reached (%u)", + errorf("Max config file recursion level reached (%d)", CONFIG_MAX_LEVELS); err = PARAM_BAD_USE; } diff --git a/src/tool_writeout.c b/src/tool_writeout.c index 3e9fbee590..ad8c77c962 100644 --- a/src/tool_writeout.c +++ b/src/tool_writeout.c @@ -67,8 +67,8 @@ static int writeTime(FILE *stream, const struct writeoutvar *wovar, if(use_json) curl_mfprintf(stream, "\"%s\":", wovar->name); - curl_mfprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU - ".%06" CURL_FORMAT_CURL_OFF_TU, secs, us); + curl_mfprintf(stream, "%" CURL_FORMAT_CURL_OFF_T + ".%06" CURL_FORMAT_CURL_OFF_T, secs, us); } else { if(use_json) diff --git a/src/var.c b/src/var.c index a149751d9f..79ff888dbb 100644 --- a/src/var.c +++ b/src/var.c @@ -394,7 +394,7 @@ ParameterError setvariable(const char *input) line++; nlen = line - name; if(!nlen || (nlen >= MAX_VAR_LEN)) { - warnf("Bad variable name length (%zd), skipping", nlen); + warnf("Bad variable name length (%zu), skipping", nlen); return PARAM_OK; } if(import) { diff --git a/tests/libtest/cli_h2_upgrade_extreme.c b/tests/libtest/cli_h2_upgrade_extreme.c index d0aade56f6..62aa0bc361 100644 --- a/tests/libtest/cli_h2_upgrade_extreme.c +++ b/tests/libtest/cli_h2_upgrade_extreme.c @@ -79,8 +79,8 @@ static CURLcode test_cli_h2_upgrade_extreme(const char *URL) curl_easy_setopt(curl, CURLOPT_WRITEDATA, NULL); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_msnprintf(range, sizeof(range), - "%" CURL_FORMAT_CURL_OFF_TU "-" - "%" CURL_FORMAT_CURL_OFF_TU, + "%" CURL_FORMAT_CURL_OFF_T "-" + "%" CURL_FORMAT_CURL_OFF_T, (curl_off_t)0, (curl_off_t)16384); curl_easy_setopt(curl, CURLOPT_RANGE, range); diff --git a/tests/libtest/cli_hx_download.c b/tests/libtest/cli_hx_download.c index fca5a7dec1..074881206e 100644 --- a/tests/libtest/cli_hx_download.c +++ b/tests/libtest/cli_hx_download.c @@ -199,7 +199,7 @@ static int my_progress_d_cb(void *userdata, (struct rustls_connection *)tls->internals); assert(v); curl_mfprintf(stderr, "[t-%zu] info rustls TLS version 0x%x\n", - t->idx, v); + t->idx, (unsigned int)v); break; } #endif @@ -214,13 +214,13 @@ static int my_progress_d_cb(void *userdata, assert(sspi_status == SEC_E_OK); (void)sspi_status; curl_mfprintf(stderr, "[t-%zu] info Schannel TLS version 0x%08lx\n", - t->idx, info.dwProtocol); + t->idx, (unsigned long)info.dwProtocol); break; } #endif default: curl_mfprintf(stderr, "[t-%zu] info SSL_PTR backend=%d, ptr=%p\n", - t->idx, tls->backend, tls->internals); + t->idx, (int)tls->backend, tls->internals); break; } } diff --git a/tests/libtest/cli_ws_data.c b/tests/libtest/cli_ws_data.c index 57c8cebb14..80b007ec72 100644 --- a/tests/libtest/cli_ws_data.c +++ b/tests/libtest/cli_ws_data.c @@ -37,13 +37,13 @@ static CURLcode test_ws_data_m2_check_recv(const struct curl_ws_frame *frame, if(frame->flags & CURLWS_CLOSE) { curl_mfprintf(stderr, "recv_data: unexpected CLOSE frame from server, " "got %zu bytes, offset=%zu, rflags %x\n", - nread, r_offset, frame->flags); + nread, r_offset, (unsigned int)frame->flags); return CURLE_RECV_ERROR; } if(!r_offset && !(frame->flags & CURLWS_BINARY)) { curl_mfprintf(stderr, "recv_data: wrong frame, got %zu bytes, offset=%zu, " "rflags %x\n", - nread, r_offset, frame->flags); + nread, r_offset, (unsigned int)frame->flags); return CURLE_RECV_ERROR; } if(frame->offset != (curl_off_t)r_offset) { @@ -104,7 +104,7 @@ static CURLcode test_ws_data_m2_echo(const char *url, curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */ result = curl_easy_perform(curl); - curl_mfprintf(stderr, "curl_easy_perform() returned %u\n", result); + curl_mfprintf(stderr, "curl_easy_perform() returned %d\n", result); if(result != CURLE_OK) goto out; diff --git a/tests/libtest/cli_ws_pingpong.c b/tests/libtest/cli_ws_pingpong.c index 5f932d1bcc..2ed12c8cab 100644 --- a/tests/libtest/cli_ws_pingpong.c +++ b/tests/libtest/cli_ws_pingpong.c @@ -78,7 +78,7 @@ static CURLcode test_cli_ws_pingpong(const char *URL) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */ result = curl_easy_perform(curl); - curl_mfprintf(stderr, "curl_easy_perform() returned %u\n", result); + curl_mfprintf(stderr, "curl_easy_perform() returned %d\n", result); if(result == CURLE_OK) result = pingpong(curl, payload); diff --git a/tests/libtest/first.c b/tests/libtest/first.c index 9a82b7ee6e..1093ddef7b 100644 --- a/tests/libtest/first.c +++ b/tests/libtest/first.c @@ -163,7 +163,7 @@ CURLcode ws_send_ping(CURL *curl, const char *send_payload) size_t sent; CURLcode result = curl_ws_send(curl, send_payload, strlen(send_payload), &sent, 0, CURLWS_PING); - curl_mfprintf(stderr, "ws: curl_ws_send returned %u, sent %zu\n", + curl_mfprintf(stderr, "ws: curl_ws_send returned %d, sent %zu\n", result, sent); return result; } @@ -175,14 +175,14 @@ CURLcode ws_recv_pong(CURL *curl, const char *expected_payload) char buffer[256]; CURLcode result = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta); if(result) { - curl_mfprintf(stderr, "ws: curl_ws_recv returned %u, received %zu\n", + curl_mfprintf(stderr, "ws: curl_ws_recv returned %d, received %zu\n", result, rlen); return result; } if(!(meta->flags & CURLWS_PONG)) { curl_mfprintf(stderr, "recv_pong: wrong frame, got %zu bytes rflags %x\n", - rlen, meta->flags); + rlen, (unsigned int)meta->flags); return CURLE_RECV_ERROR; } @@ -201,7 +201,7 @@ void ws_close(CURL *curl) { size_t sent; CURLcode result = curl_ws_send(curl, "", 0, &sent, 0, CURLWS_CLOSE); - curl_mfprintf(stderr, "ws: curl_ws_send returned %u, sent %zu\n", + curl_mfprintf(stderr, "ws: curl_ws_send returned %d, sent %zu\n", result, sent); } #endif /* CURL_DISABLE_WEBSOCKETS */ @@ -286,5 +286,5 @@ int main(int argc, const char **argv) /* Regular program status codes are limited to 0..127 and 126 and 127 have * special meanings by the shell, so limit a normal return code to 125 */ - return (int)result <= 125 ? (int)result : 125; + return result <= 125 ? result : 125; } diff --git a/tests/libtest/lib1558.c b/tests/libtest/lib1558.c index 4077cb8eb1..3ac933092c 100644 --- a/tests/libtest/lib1558.c +++ b/tests/libtest/lib1558.c @@ -47,7 +47,7 @@ static CURLcode test_lib1558(const char *URL) goto test_cleanup; } - curl_mprintf("Protocol: %lx\n", protocol); + curl_mprintf("Protocol: %lx\n", (unsigned long)protocol); curl_easy_cleanup(curl); curl_global_cleanup(); diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c index 0e203dd96f..943d813619 100644 --- a/tests/libtest/lib1560.c +++ b/tests/libtest/lib1560.c @@ -1914,41 +1914,41 @@ static int get_nothing(void) rc = curl_url_get(u, CURLUPART_SCHEME, &p, 0); if(rc != CURLUE_NO_SCHEME) - curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__); + curl_mfprintf(stderr, "unexpected return code line %d\n", __LINE__); rc = curl_url_get(u, CURLUPART_HOST, &p, 0); if(rc != CURLUE_NO_HOST) - curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__); + curl_mfprintf(stderr, "unexpected return code line %d\n", __LINE__); rc = curl_url_get(u, CURLUPART_USER, &p, 0); if(rc != CURLUE_NO_USER) - curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__); + curl_mfprintf(stderr, "unexpected return code line %d\n", __LINE__); rc = curl_url_get(u, CURLUPART_PASSWORD, &p, 0); if(rc != CURLUE_NO_PASSWORD) - curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__); + curl_mfprintf(stderr, "unexpected return code line %d\n", __LINE__); rc = curl_url_get(u, CURLUPART_OPTIONS, &p, 0); if(rc != CURLUE_NO_OPTIONS) - curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__); + curl_mfprintf(stderr, "unexpected return code line %d\n", __LINE__); rc = curl_url_get(u, CURLUPART_PATH, &p, 0); if(rc != CURLUE_OK) - curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__); + curl_mfprintf(stderr, "unexpected return code line %d\n", __LINE__); else curl_free(p); rc = curl_url_get(u, CURLUPART_QUERY, &p, 0); if(rc != CURLUE_NO_QUERY) - curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__); + curl_mfprintf(stderr, "unexpected return code line %d\n", __LINE__); rc = curl_url_get(u, CURLUPART_FRAGMENT, &p, 0); if(rc != CURLUE_NO_FRAGMENT) - curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__); + curl_mfprintf(stderr, "unexpected return code line %d\n", __LINE__); rc = curl_url_get(u, CURLUPART_ZONEID, &p, 0); if(rc != CURLUE_NO_ZONEID) - curl_mfprintf(stderr, "unexpected return code %u on line %u\n", rc, + curl_mfprintf(stderr, "unexpected return code %d on line %d\n", rc, __LINE__); curl_url_cleanup(u); @@ -1981,17 +1981,17 @@ static int clear_url(void) for(i = 0; clear_url_list[i].in && !error; i++) { rc = curl_url_set(u, clear_url_list[i].part, clear_url_list[i].in, 0); if(rc != CURLUE_OK) - curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__); + curl_mfprintf(stderr, "unexpected return code line %d\n", __LINE__); rc = curl_url_set(u, CURLUPART_URL, NULL, 0); if(rc != CURLUE_OK) - curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__); + curl_mfprintf(stderr, "unexpected return code line %d\n", __LINE__); rc = curl_url_get(u, clear_url_list[i].part, &p, 0); if(rc != clear_url_list[i].ucode || (clear_url_list[i].out && strcmp(p, clear_url_list[i].out) != 0)) { - curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__); + curl_mfprintf(stderr, "unexpected return code line %d\n", __LINE__); error++; } if(rc == CURLUE_OK) @@ -2046,7 +2046,7 @@ static int huge(void) rc = curl_url_set(urlp, CURLUPART_URL, total, CURLU_NON_SUPPORT_SCHEME); if((!i && (rc != CURLUE_BAD_SCHEME)) || (i && rc)) { - curl_mprintf("URL %u: failed to parse [%s]\n", i, total); + curl_mprintf("URL %d: failed to parse [%s]\n", i, total); error++; } @@ -2054,7 +2054,7 @@ static int huge(void) if(!rc) { curl_url_get(urlp, part[i], &partp, 0); if(!partp || strcmp(partp, &bigpart[1 - (i == 4)])) { - curl_mprintf("URL %u part %u: failure\n", i, part[i]); + curl_mprintf("URL %d part %d: failure\n", i, (int)part[i]); error++; } curl_free(partp); diff --git a/tests/libtest/lib1565.c b/tests/libtest/lib1565.c index 5cf49ad0b6..e6c266a7e5 100644 --- a/tests/libtest/lib1565.c +++ b/tests/libtest/lib1565.c @@ -129,7 +129,7 @@ static CURLcode test_lib1565(const char *URL) } else { curl_mfprintf(stderr, - "%s:%d Got an unexpected message from curl: %i\n", + "%s:%d Got an unexpected message from curl: %d\n", __FILE__, __LINE__, message->msg); result = TEST_ERR_MAJOR_BAD; goto test_cleanup; diff --git a/tests/libtest/lib1597.c b/tests/libtest/lib1597.c index 78b2bba4c2..5e3fab8cad 100644 --- a/tests/libtest/lib1597.c +++ b/tests/libtest/lib1597.c @@ -100,7 +100,7 @@ static CURLcode test_lib1597(const char *URL) break; } } - curl_mprintf("Tested %u strings\n", i); + curl_mprintf("Tested %d strings\n", i); test_cleanup: curl_easy_cleanup(curl); diff --git a/tests/libtest/lib1918.c b/tests/libtest/lib1918.c index 1c8ccb78f9..4932c1cfa6 100644 --- a/tests/libtest/lib1918.c +++ b/tests/libtest/lib1918.c @@ -38,11 +38,11 @@ static CURLcode test_lib1918(const char *URL) if(ename->id != o->id) { curl_mprintf("name lookup id %d does not match %d\n", - ename->id, o->id); + (int)ename->id, (int)o->id); } else if(eid->id != o->id) { curl_mprintf("ID lookup %d does not match %d\n", - ename->id, o->id); + (int)ename->id, (int)o->id); } } curl_global_cleanup(); diff --git a/tests/libtest/lib1947.c b/tests/libtest/lib1947.c index 4fe2bf5801..88a6336dbe 100644 --- a/tests/libtest/lib1947.c +++ b/tests/libtest/lib1947.c @@ -63,7 +63,7 @@ static CURLcode test_lib1947(const char *URL) if(h) count++; } while(h); - curl_mprintf("count = %u\n", count); + curl_mprintf("count = %d\n", count); /* perform another request - without redirect */ easy_setopt(curl, CURLOPT_URL, libtest_arg2); @@ -81,7 +81,7 @@ static CURLcode test_lib1947(const char *URL) if(h) count++; } while(h); - curl_mprintf("count = %u\n", count); + curl_mprintf("count = %d\n", count); test_cleanup: curl_easy_cleanup(curl); diff --git a/tests/libtest/lib2032.c b/tests/libtest/lib2032.c index e87eb5ecad..0dd498c9bb 100644 --- a/tests/libtest/lib2032.c +++ b/tests/libtest/lib2032.c @@ -153,7 +153,7 @@ static CURLcode test_lib2032(const char *URL) /* libntlmconnect */ multi_perform(multi, &running); curl_mfprintf(stderr, "%s:%d running %d state %d\n", - __FILE__, __LINE__, running, state); + __FILE__, __LINE__, running, (int)state); abort_on_test_timeout(); @@ -177,7 +177,8 @@ static CURLcode test_lib2032(const char *URL) /* libntlmconnect */ } state = num_handles < MAX_EASY_HANDLES ? ReadyForNewHandle : NoMoreHandles; - curl_mfprintf(stderr, "%s:%d new state %d\n", __FILE__, __LINE__, state); + curl_mfprintf(stderr, "%s:%d new state %d\n", + __FILE__, __LINE__, (int)state); } multi_timeout(multi, &timeout); diff --git a/tests/libtest/lib2302.c b/tests/libtest/lib2302.c index ef8990fc17..692d86cf02 100644 --- a/tests/libtest/lib2302.c +++ b/tests/libtest/lib2302.c @@ -48,7 +48,7 @@ static void flush_data(struct ws_data *wd) curl_mprintf("\n"); if(wd->has_meta) - curl_mprintf("RECFLAGS: %x\n", wd->meta_flags); + curl_mprintf("RECFLAGS: %x\n", (unsigned int)wd->meta_flags); else curl_mfprintf(stderr, "RECFLAGS: NULL\n"); wd->blen = 0; diff --git a/tests/libtest/lib2304.c b/tests/libtest/lib2304.c index fd2a29da6c..3386a0753b 100644 --- a/tests/libtest/lib2304.c +++ b/tests/libtest/lib2304.c @@ -34,7 +34,7 @@ static CURLcode recv_any(CURL *curl) return result; curl_mfprintf(stderr, "recv_any: got %zu bytes rflags %x\n", rlen, - meta->flags); + (unsigned int)meta->flags); return CURLE_OK; } diff --git a/tests/libtest/lib2405.c b/tests/libtest/lib2405.c index d65196e236..eee6e91237 100644 --- a/tests/libtest/lib2405.c +++ b/tests/libtest/lib2405.c @@ -332,7 +332,7 @@ static CURLcode empty_multi_test(void) } else if(fd_count > 0) { curl_mfprintf(stderr, "curl_multi_waitfds(), empty, returned non-zero " - "count of waitfds: %d.\n", fd_count); + "count of waitfds: %u.\n", fd_count); result = TEST_ERR_FAILURE; goto test_cleanup; } @@ -354,7 +354,7 @@ static CURLcode empty_multi_test(void) } else if(fd_count > 1) { curl_mfprintf(stderr, "curl_multi_waitfds() returned > 1 count of " - "waitfds: %d.\n", fd_count); + "waitfds: %u.\n", fd_count); result = TEST_ERR_FAILURE; goto test_cleanup; } @@ -381,15 +381,15 @@ static CURLcode test_lib2405(const char *URL) if(testnum == 2405) { /* HTTP1, expected 3 waitfds - one for each transfer + wakeup */ - test_run_check(TEST_USE_HTTP1, 3); + test_run_check(TEST_USE_HTTP1, 3U); } #ifdef USE_HTTP2 else { /* 2407 */ /* HTTP2, expected 3 waitfds - one for each transfer + wakeup */ - test_run_check(TEST_USE_HTTP2, 3); + test_run_check(TEST_USE_HTTP2, 3U); /* HTTP2 with multiplexing, expected 2 waitfds - transfers + wakeup */ - test_run_check(TEST_USE_HTTP2_MPLEX, 2); + test_run_check(TEST_USE_HTTP2_MPLEX, 2U); } #endif diff --git a/tests/server/dnsd.c b/tests/server/dnsd.c index 485be0d573..ee3aa52eb1 100644 --- a/tests/server/dnsd.c +++ b/tests/server/dnsd.c @@ -388,7 +388,7 @@ create_resp(int qid, const struct sockaddr *addr, curl_socklen_t addrlen, for(a = 0; a < ancount_a; a++) { const unsigned char *store = ipv4_pref; add_answer(bytes, &i, store, sizeof(ipv4_pref), QTYPE_A); - logmsg("[%d] response A (%x) '%s'", qid, QTYPE_A, + logmsg("[%d] response A (%x) '%s'", qid, (unsigned int)QTYPE_A, curlx_inet_ntop(AF_INET, store, addrbuf, sizeof(addrbuf))); } if(!ancount_a) @@ -400,7 +400,7 @@ create_resp(int qid, const struct sockaddr *addr, curl_socklen_t addrlen, for(a = 0; a < ancount_aaaa; a++) { const unsigned char *store = ipv6_pref; add_answer(bytes, &i, store, sizeof(ipv6_pref), QTYPE_AAAA); - logmsg("[%d] response AAAA (%x) '%s'", qid, QTYPE_AAAA, + logmsg("[%d] response AAAA (%x) '%s'", qid, (unsigned int)QTYPE_AAAA, curlx_inet_ntop(AF_INET6, store, addrbuf, sizeof(addrbuf))); } if(!ancount_aaaa) diff --git a/tests/server/mqttd.c b/tests/server/mqttd.c index 7b5c7c8043..ae9f080fb5 100644 --- a/tests/server/mqttd.c +++ b/tests/server/mqttd.c @@ -155,7 +155,7 @@ static void logprotocol(mqttdir dir, } fprintf(output, "%s %s %x %s\n", dir == FROM_CLIENT ? "client" : "server", - prefix, (int)remlen, data); + prefix, (unsigned int)remlen, data); } /* return 0 on success */ @@ -522,7 +522,7 @@ static curl_socket_t mqttit(curl_socket_t fd) /* check the length of the payload */ if((ssize_t)payload_len != (rc - 12)) { logmsg("Payload length mismatch, expected %zx got %zx", - rc - 12, payload_len); + (size_t)(rc - 12), payload_len); goto end; } /* check the length of the client ID */ diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index 61d81aeff7..94d6324251 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -1066,7 +1066,7 @@ static bool juggle(curl_socket_t *sockfdp, snprintf((char *)buffer, sizeof(buffer), "%s/%hu\n", ipv_inuse, server_port); buffer_len = (ssize_t)strlen((const char *)buffer); - snprintf(data, sizeof(data), "PORT\n%04x\n", (int)buffer_len); + snprintf(data, sizeof(data), "PORT\n%04x\n", (unsigned int)buffer_len); if(!write_stdout(data, 10)) return FALSE; if(!write_stdout(buffer, buffer_len)) @@ -1143,7 +1143,7 @@ static bool juggle(curl_socket_t *sockfdp, nread_socket = sread(sockfd, buffer, sizeof(buffer)); if(nread_socket > 0) { - snprintf(data, sizeof(data), "DATA\n%04x\n", (int)nread_socket); + snprintf(data, sizeof(data), "DATA\n%04x\n", (unsigned int)nread_socket); if(!write_stdout(data, 10)) return FALSE; if(!write_stdout(buffer, nread_socket)) diff --git a/tests/server/sws.c b/tests/server/sws.c index cc7adaf052..ba7ca152ce 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -1130,7 +1130,7 @@ static int sws_get_request(curl_socket_t sock, struct sws_httprequest *req) sizeof(req->reqbuf) - 1 - req->offset); if(got > 0) { req->offset += got; - logmsg("Got %zu bytes from client", got); + logmsg("Got %zd bytes from client", got); } if((got == -1) && @@ -1794,7 +1794,7 @@ http_connect_cleanup: static void http_upgrade(struct sws_httprequest *req) { (void)req; - logmsg("Upgraded to ... %u", req->upgrade_request); + logmsg("Upgraded to ... %d", (int)req->upgrade_request); /* left to implement */ } diff --git a/tests/server/util.c b/tests/server/util.c index a765f1898f..3a76d27697 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -436,7 +436,7 @@ static LRESULT CALLBACK main_window_proc(HWND hwnd, UINT uMsg, break; } if(signum) { - logmsg("main_window_proc: %d -> %d", uMsg, signum); + logmsg("main_window_proc: %u -> %d", uMsg, signum); raise(signum); } } @@ -671,7 +671,7 @@ int bind_unix_socket(curl_socket_t sock, const char *unix_socket, memset(sau, 0, sizeof(struct sockaddr_un)); sau->sun_family = AF_UNIX; if(len >= sizeof(sau->sun_path) - 1) { - logmsg("Too long unix socket domain path (%zd)", len); + logmsg("Too long unix socket domain path (%zu)", len); return -1; } curlx_strcopy(sau->sun_path, sizeof(sau->sun_path), unix_socket, len); diff --git a/tests/test1119.pl b/tests/test1119.pl index 9004696f6f..8db19ef6c0 100755 --- a/tests/test1119.pl +++ b/tests/test1119.pl @@ -179,8 +179,10 @@ for my $e (sort @syms) { # *_LAST and *_LASTENTRY are just suffix for the placeholders used for the # last entry in many enum series. # + # *_SIGNED is a suffix to make enums a signed type. + # - if($e =~ /(OBSOLETE|CURLE_RESERVED|^CURL_EXTERN|^CURLINC_|_LAST\z|_LASTENTRY\z|^CURL_TEMP_)/) { + if($e =~ /(OBSOLETE|CURLE_RESERVED|^CURL_EXTERN|^CURLINC_|_LAST\z|_LASTENTRY\z|_SIGNED\z|^CURL_TEMP_)/) { $ignored++; next; } diff --git a/tests/test1477.pl b/tests/test1477.pl index 6a4476bee1..4fe8c3ad3f 100755 --- a/tests/test1477.pl +++ b/tests/test1477.pl @@ -49,7 +49,7 @@ sub scanheader { $line++; if($_ =~ /^ (CURL(E|UE|SHE|HE|M)_[A-Z0-9_]*)/) { my ($name)=($1); - if(($name !~ /(OBSOLETE|CURLE_RESERVED)/) && ($name !~ /_LAST\z/)) { + if(($name !~ /(OBSOLETE|CURLE_RESERVED)/) && ($name !~ /(_LAST|_SIGNED)\z/)) { push @hnames, $name; if($wherefrom{$name}) { print STDERR "double: $name\n"; diff --git a/tests/tunit/tool1621.c b/tests/tunit/tool1621.c index 35ac1a3b87..6965d14706 100644 --- a/tests/tunit/tool1621.c +++ b/tests/tunit/tool1621.c @@ -71,7 +71,7 @@ static CURLcode test_tool1621(const char *arg) const char *url = tests[i].input; char *stripped = stripcredentials(url); const char *strippedstr = stripped ? stripped : "(null)"; - curl_mprintf("Test %u got input \"%s\", output: \"%s\", " + curl_mprintf("Test %d got input \"%s\", output: \"%s\", " "expected: \"%s\"\n", i, tests[i].input, strippedstr, tests[i].output); diff --git a/tests/tunit/tool1623.c b/tests/tunit/tool1623.c index a79ccc97c4..e15aab8904 100644 --- a/tests/tunit/tool1623.c +++ b/tests/tunit/tool1623.c @@ -104,14 +104,14 @@ static CURLcode test_tool1623(const char *arg) ParameterError err = GetSizeParameter(check[i].input, &output); if(err != check[i].err) curl_mprintf("'%s' unexpectedly returned %d \n", - check[i].input, err); + check[i].input, (int)err); else if(check[i].amount != output) curl_mprintf("'%s' unexpectedly gave %" FMT_OFF_T "\n", check[i].input, output); else { #if 0 /* enable for debugging */ if(err) - curl_mprintf("'%s' returned %d\n", check[i].input, err); + curl_mprintf("'%s' returned %d\n", check[i].input, (int)err); else curl_mprintf("'%s' == %" FMT_OFF_T "\n", check[i].input, output); #endif diff --git a/tests/unit/unit1302.c b/tests/unit/unit1302.c index e840486511..353e162c32 100644 --- a/tests/unit/unit1302.c +++ b/tests/unit/unit1302.c @@ -144,8 +144,7 @@ static CURLcode test_unit1302(const char *arg) /* then verify decode */ result = curlx_base64_decode(e->output, &decoded, &dlen); if(result != CURLE_OK) { - curl_mfprintf(stderr, "Test %u URL decode returned %d\n", i, - (int)result); + curl_mfprintf(stderr, "Test %u URL decode returned %d\n", i, result); unitfail++; } if(dlen != e->ilen) { @@ -191,7 +190,7 @@ static CURLcode test_unit1302(const char *arg) if(result != CURLE_BAD_CONTENT_ENCODING) { curl_mfprintf(stderr, "Test %u URL bad decoded badly. " "Returned '%d', expected '%d'\n", - i, (int)result, CURLE_BAD_CONTENT_ENCODING); + i, result, CURLE_BAD_CONTENT_ENCODING); unitfail++; } } diff --git a/tests/unit/unit1323.c b/tests/unit/unit1323.c index c705dc96eb..86eb4e25cc 100644 --- a/tests/unit/unit1323.c +++ b/tests/unit/unit1323.c @@ -45,7 +45,7 @@ static CURLcode test_unit1323(const char *arg) for(i = 0; i < CURL_ARRAYSIZE(tests); i++) { timediff_t result = curlx_timediff_ms(tests[i].first, tests[i].second); if(result != tests[i].result) { - curl_mprintf("%ld.%06u to %ld.%06u got %" FMT_TIMEDIFF_T + curl_mprintf("%ld.%06d to %ld.%06d got %" FMT_TIMEDIFF_T ", but expected %" FMT_TIMEDIFF_T "\n", (long)tests[i].first.tv_sec, tests[i].first.tv_usec, diff --git a/tests/unit/unit1650.c b/tests/unit/unit1650.c index f634cb4af2..4c58d8330c 100644 --- a/tests/unit/unit1650.c +++ b/tests/unit/unit1650.c @@ -155,7 +155,7 @@ static CURLcode test_unit1650(const char *arg) buffer, sizeof(buffer), &size); if(rc != req[i].rc) { curl_mfprintf(stderr, "req %zu: Expected return code %d got %d\n", i, - req[i].rc, rc); + (int)req[i].rc, (int)rc); abort_if(rc != req[i].rc, "return code"); } if(size != req[i].size) { @@ -184,7 +184,7 @@ static CURLcode test_unit1650(const char *arg) resp[i].type, &d); if(rc != resp[i].rc) { curl_mfprintf(stderr, "resp %zu: Expected return code %d got %d\n", i, - resp[i].rc, rc); + (int)resp[i].rc, (int)rc); abort_if(rc != resp[i].rc, "return code"); } len = sizeof(buffer); @@ -240,7 +240,7 @@ static CURLcode test_unit1650(const char *arg) i, CURL_DNS_TYPE_A, &d); if(!rc) { /* none of them should work */ - curl_mfprintf(stderr, "%zu: %d\n", i, rc); + curl_mfprintf(stderr, "%zu: %d\n", i, (int)rc); abort_if(!rc, "error rc"); } } @@ -254,7 +254,7 @@ static CURLcode test_unit1650(const char *arg) sizeof(full49) - i - 1, CURL_DNS_TYPE_A, &d); if(!rc) { /* none of them should work */ - curl_mfprintf(stderr, "2 %zu: %d\n", i, rc); + curl_mfprintf(stderr, "2 %zu: %d\n", i, (int)rc); abort_if(!rc, "error rc"); } } @@ -272,7 +272,8 @@ static CURLcode test_unit1650(const char *arg) curl_msnprintf((char *)buffer, sizeof(buffer), "%u.%u.%u.%u", p[0], p[1], p[2], p[3]); if(rc || strcmp((const char *)buffer, "127.0.0.1")) { - curl_mfprintf(stderr, "bad address decoded: %s, rc == %d\n", buffer, rc); + curl_mfprintf(stderr, "bad address decoded: %s, rc == %d\n", buffer, + (int)rc); abort_if(rc || strcmp((const char *)buffer, "127.0.0.1"), "bad address"); } fail_if(d.numcname, "bad cname counter"); diff --git a/tests/unit/unit1652.c b/tests/unit/unit1652.c index 13c1b0175a..7d940df055 100644 --- a/tests/unit/unit1652.c +++ b/tests/unit/unit1652.c @@ -102,7 +102,7 @@ static CURLcode test_unit1652(const char *arg) fail_unless(verify(output, input) == 0, "Simple string test"); /* Injecting a few different variables with a format */ - Curl_infof(easy, "%s %u testing %lu", input, 42, 43L); + Curl_infof(easy, "%s %d testing %ld", input, 42, 43L); fail_unless(verify(output, "Simple Test 42 testing 43\n") == 0, "Format string"); diff --git a/tests/unit/unit1658.c b/tests/unit/unit1658.c index fa281fe3ea..41cfb48d79 100644 --- a/tests/unit/unit1658.c +++ b/tests/unit/unit1658.c @@ -46,7 +46,7 @@ static void rrresults(struct Curl_https_rrinfo *rr, CURLcode res) { char *p = rrbuffer; const char *pend = rrbuffer + sizeof(rrbuffer); - curl_msnprintf(rrbuffer, sizeof(rrbuffer), "r:%d|", (int)res); + curl_msnprintf(rrbuffer, sizeof(rrbuffer), "r:%d|", res); p += strlen(rrbuffer); if(rr) { diff --git a/tests/unit/unit1660.c b/tests/unit/unit1660.c index b42a0bae7a..6b4f69880d 100644 --- a/tests/unit/unit1660.c +++ b/tests/unit/unit1660.c @@ -132,7 +132,7 @@ static CURLcode test_unit1660(const char *arg) continue; } else if(result) { - curl_mprintf("Input %u: error %d\n", i, (int)result); + curl_mprintf("Input %d: error %d\n", i, result); continue; } } diff --git a/tests/unit/unit1664.c b/tests/unit/unit1664.c index 4a94b6975e..17a04a37f2 100644 --- a/tests/unit/unit1664.c +++ b/tests/unit/unit1664.c @@ -61,7 +61,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = wordparse[i]; const char *orgline = line; int rc = curlx_str_word(&line, &out, 7); - curl_mprintf("%u: (\"%s\") %d, \"%.*s\" [%d], line %d\n", + curl_mprintf("%d: (\"%s\") %d, \"%.*s\" [%d], line %d\n", i, orgline, rc, (int)out.len, out.str, (int)out.len, (int)(line - orgline)); } @@ -72,7 +72,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = wordparse[i]; const char *orgline = line; int rc = curlx_str_until(&line, &out, 7, 'd'); - curl_mprintf("%u: (\"%s\") %d, \"%.*s\" [%d], line %d\n", + curl_mprintf("%d: (\"%s\") %d, \"%.*s\" [%d], line %d\n", i, orgline, rc, (int)out.len, out.str, (int)out.len, (int)(line - orgline)); } @@ -105,7 +105,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = qwords[i]; const char *orgline = line; int rc = curlx_str_quotedword(&line, &out, 7); - curl_mprintf("%u: (\"%s\") %d, \"%.*s\" [%d], line %d\n", + curl_mprintf("%d: (\"%s\") %d, \"%.*s\" [%d], line %d\n", i, orgline, rc, (int)out.len, out.str, (int)out.len, (int)(line - orgline)); } @@ -127,7 +127,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = single[i]; const char *orgline = line; int rc = curlx_str_single(&line, 'a'); - curl_mprintf("%u: (\"%s\") %d, line %d\n", + curl_mprintf("%d: (\"%s\") %d, line %d\n", i, orgline, rc, (int)(line - orgline)); } } @@ -150,7 +150,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = single[i]; const char *orgline = line; int rc = curlx_str_singlespace(&line); - curl_mprintf("%u: (\"%s\") %d, line %d\n", + curl_mprintf("%d: (\"%s\") %d, line %d\n", i, orgline, rc, (int)(line - orgline)); } } @@ -171,7 +171,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = single[i]; const char *orgline = line; int rc = curlx_str_single(&line, 'a'); - curl_mprintf("%u: (\"%s\") %d, line %d\n", + curl_mprintf("%d: (\"%s\") %d, line %d\n", i, orgline, rc, (int)(line - orgline)); } } @@ -198,7 +198,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_number(&line, &num, 1235); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } } @@ -230,7 +230,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i].str; const char *orgline = line; int rc = curlx_str_number(&line, &num, nums[i].max); - curl_mprintf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T + curl_mprintf("%d: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n", i, orgline, nums[i].max, rc, num); } @@ -270,7 +270,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i].str; const char *orgline = line; int rc = curlx_str_hex(&line, &num, nums[i].max); - curl_mprintf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T + curl_mprintf("%d: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n", i, orgline, nums[i].max, rc, num); } @@ -305,7 +305,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i].str; const char *orgline = line; int rc = curlx_str_octal(&line, &num, nums[i].max); - curl_mprintf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T + curl_mprintf("%d: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n", i, orgline, nums[i].max, rc, num); } @@ -341,7 +341,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_number(&line, &num, CURL_OFF_T_MAX); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } } @@ -366,8 +366,8 @@ static CURLcode test_unit1664(const char *arg) const char *line = newl[i]; const char *orgline = line; int rc = curlx_str_newline(&line); - curl_mprintf("%u: (%%%02x) %d, line %d\n", - i, *orgline, rc, (int)(line - orgline)); + curl_mprintf("%d: (%%%02x) %d, line %d\n", + i, (unsigned int)*orgline, rc, (int)(line - orgline)); } } @@ -393,7 +393,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_hex(&line, &num, 0x1235); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } } @@ -420,7 +420,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_octal(&line, &num, 01235); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } } @@ -444,7 +444,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_octal(&line, &num, CURL_OFF_T_MAX); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } } @@ -480,7 +480,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_hex(&line, &num, CURL_OFF_T_MAX); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } } diff --git a/tests/unit/unit1675.c b/tests/unit/unit1675.c index 25616c6727..2a1d39de37 100644 --- a/tests/unit/unit1675.c +++ b/tests/unit/unit1675.c @@ -185,7 +185,7 @@ static CURLcode test_unit1675(const char *arg) uc = urlencode_str(&out, tests[i].in, strlen(tests[i].in), tests[i].relative, tests[i].query); if(uc || strcmp(curlx_dyn_ptr(&out), tests[i].out)) { - curl_mfprintf(stderr, "urlencode_str('%s', query=%d) failed:" + curl_mfprintf(stderr, "urlencode_str('%s', query=%u) failed:" " expected '%s', got '%s'\n", tests[i].in, tests[i].query, tests[i].out, uc ? "error" : curlx_dyn_ptr(&out)); diff --git a/tests/unit/unit2603.c b/tests/unit/unit2603.c index 15ec12c41d..195f796a60 100644 --- a/tests/unit/unit2603.c +++ b/tests/unit/unit2603.c @@ -82,7 +82,7 @@ static void parse_success(const struct tcase *t) in_consumed += nread; if(nread != buflen) { if(!p.done) { - curl_mfprintf(stderr, "only %zd/%zu consumed for: '%s'\n", + curl_mfprintf(stderr, "only %zu/%zu consumed for: '%s'\n", nread, buflen, buf); fail("not all consumed"); } diff --git a/tests/unit/unit2604.c b/tests/unit/unit2604.c index 040874aff3..2143413713 100644 --- a/tests/unit/unit2604.c +++ b/tests/unit/unit2604.c @@ -86,7 +86,7 @@ static CURLcode test_unit2604(const char *arg) char *path; const char *cp = i == 0 ? cp0 : list[i].cp; CURLcode result = Curl_get_pathname(&cp, &path, list[i].home); - curl_mprintf("%u - Curl_get_pathname(\"%s\", ... \"%s\") == %u\n", i, + curl_mprintf("%d - Curl_get_pathname(\"%s\", ... \"%s\") == %d\n", i, list[i].cp, list[i].home, list[i].result); if(result != list[i].result) { curl_mprintf("... returned %d\n", result); diff --git a/tests/unit/unit2605.c b/tests/unit/unit2605.c index 0f6e8cb009..d26c8a1299 100644 --- a/tests/unit/unit2605.c +++ b/tests/unit/unit2605.c @@ -78,7 +78,7 @@ static CURLcode test_unit2605(const char *arg) curl_off_t start; curl_off_t size; CURLcode result; - curl_mprintf("%u: '%s' (file size: %" FMT_OFF_T ")\n", i, list[i].r, + curl_mprintf("%d: '%s' (file size: %" FMT_OFF_T ")\n", i, list[i].r, list[i].filesize); result = Curl_ssh_range(curl, list[i].r, list[i].filesize, &start, &size); diff --git a/tests/unit/unit3200.c b/tests/unit/unit3200.c index 3566163705..3e1b06a0aa 100644 --- a/tests/unit/unit3200.c +++ b/tests/unit/unit3200.c @@ -92,7 +92,7 @@ static CURLcode test_unit3200(const char *arg) fp = curlx_fopen(arg, "rb"); abort_unless(fp != NULL, "Cannot open testfile"); - curl_mfprintf(stderr, "Test %zd...", i); + curl_mfprintf(stderr, "Test %zu...", i); switch(i) { case 0: result = Curl_get_line(&buf, fp, &eof);