mirror of
https://github.com/curl/curl.git
synced 2026-08-25 14:23:39 +03:00
build: enable -Wformat-signedness, fix issues found
Adjust code to avoid `-Wformat-signedness` warnings, while making sure
that enums are always cast to a known type when passing them to `printf`
functions, to support compilers and compiler settings where enums are
not default-size signed ints.
- cast integers printed as hex to `unsigned`. (63 times, 20 of them in
`mbedtls.c`)
- cast misc enums to `int` for printing. (31 times)
- cast `CURL_LOCK_DATA_*` enums to `int`. (4 times)
- cast `CURL_FORMADD_*` enums to `int`. (13 times)
- cast `CURLSHE_*` enums to `int`. (3 times)
- cast `CURLUE_*` enums to `int`. (33 times)
- cast `CURLMSG_*` enums to `int`. (6 times)
- cast `CURLE_*` enums to `int`. (~380 times)
- unit1675: fix mask.
Follow-up to 7c34365cce #21879
Ref: #18343 (initial attempt)
Closes #20848
This commit is contained in:
parent
ae2986cdf0
commit
2f3fa479dd
162 changed files with 565 additions and 509 deletions
|
|
@ -1238,7 +1238,7 @@ out:
|
|||
cf->connected = TRUE;
|
||||
}
|
||||
CURL_TRC_CF(data, cf, "cf_socket_open() -> %d, fd=%" FMT_SOCKET_T,
|
||||
result, ctx->sock);
|
||||
(int)result, ctx->sock);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -1530,7 +1530,7 @@ static CURLcode cf_socket_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
|||
#endif
|
||||
|
||||
CURL_TRC_CF(data, cf, "send(len=%zu) -> %d, %zu",
|
||||
orig_len, result, *pnwritten);
|
||||
orig_len, (int)result, *pnwritten);
|
||||
cf->conn->sock[cf->sockindex] = fdsave;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1589,7 +1589,7 @@ static CURLcode cf_socket_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
|
|||
}
|
||||
}
|
||||
|
||||
CURL_TRC_CF(data, cf, "recv(len=%zu) -> %d, %zu", len, result, *pnread);
|
||||
CURL_TRC_CF(data, cf, "recv(len=%zu) -> %d, %zu", len, (int)result, *pnread);
|
||||
if(!result && !ctx->got_first_byte) {
|
||||
ctx->first_byte_at = *Curl_pgrs_now(data);
|
||||
ctx->got_first_byte = TRUE;
|
||||
|
|
@ -1899,7 +1899,8 @@ static CURLcode cf_udp_connect(struct Curl_cfilter *cf,
|
|||
if(ctx->sock == CURL_SOCKET_BAD) {
|
||||
result = cf_socket_open(cf, data);
|
||||
if(result) {
|
||||
CURL_TRC_CF(data, cf, "cf_udp_connect(), open failed -> %d", result);
|
||||
CURL_TRC_CF(data, cf, "cf_udp_connect(), open failed -> %d",
|
||||
(int)result);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -2132,7 +2133,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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue