mirror of
https://github.com/curl/curl.git
synced 2026-08-24 15:23:36 +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
|
|
@ -161,7 +161,7 @@ int main(int argc, char *argv[])
|
|||
/* win32_init must be called before other init routines. */
|
||||
result = win32_init();
|
||||
if(result) {
|
||||
errorf("(%d) Windows-specific init failed", result);
|
||||
errorf("(%d) Windows-specific init failed", (int)result);
|
||||
return (int)result;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -616,7 +616,7 @@ static CURLcode post_check_result(struct per_transfer *per, CURLcode result)
|
|||
if(!config->synthetic_error && result &&
|
||||
(!global->silent || global->showerror)) {
|
||||
const char *msg = per->errorbuffer;
|
||||
curl_mfprintf(tool_stderr, "curl: (%d) %s\n", result,
|
||||
curl_mfprintf(tool_stderr, "curl: (%d) %s\n", (int)result,
|
||||
msg[0] ? msg : curl_easy_strerror(result));
|
||||
if(result == CURLE_PEER_FAILED_VERIFICATION)
|
||||
fputs(CURL_CA_CERT_ERRORMSG, tool_stderr);
|
||||
|
|
@ -697,7 +697,7 @@ static CURLcode post_close_output(struct per_transfer *per,
|
|||
if(!result && rc) {
|
||||
/* something went wrong in the writing process */
|
||||
result = CURLE_WRITE_ERROR;
|
||||
errorf("curl: (%d) Failed writing body", result);
|
||||
errorf("curl: (%d) Failed writing body", (int)result);
|
||||
}
|
||||
if(result && config->rm_partial) {
|
||||
curlx_struct_stat st;
|
||||
|
|
@ -856,7 +856,7 @@ static CURLcode append2query(struct OperationConfig *config,
|
|||
if(uerr) {
|
||||
result = urlerr_cvt(uerr);
|
||||
errorf("(%d) Could not parse the URL, "
|
||||
"failed to set query", result);
|
||||
"failed to set query", (int)result);
|
||||
config->synthetic_error = TRUE;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ CURLcode tool_ssls_load(struct OperationConfig *config,
|
|||
result = curl_easy_ssls_import(easy, NULL, shmac, shmac_len, sdata,
|
||||
sdata_len);
|
||||
if(result) {
|
||||
warnf("import of session from line %d rejected(%d)", i, result);
|
||||
warnf("import of session from line %d rejected(%d)", i, (int)result);
|
||||
continue;
|
||||
}
|
||||
++imported;
|
||||
|
|
@ -179,7 +179,7 @@ static CURLcode tool_ssls_exp(CURL *easy, void *userptr,
|
|||
out:
|
||||
if(result)
|
||||
warnf("Warning: error saving SSL session for '%s': %d", session_key,
|
||||
result);
|
||||
(int)result);
|
||||
curlx_free(enc);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -564,7 +564,7 @@ void glob_show_error(struct URLGlob *glob, const char *url, FILE *error,
|
|||
t = glob->error;
|
||||
|
||||
/* send error description to the error-stream */
|
||||
curl_mfprintf(error, "curl: (%d) %s\n", result, t);
|
||||
curl_mfprintf(error, "curl: (%d) %s\n", (int)result, t);
|
||||
}
|
||||
|
||||
CURLcode glob_url(struct URLGlob *glob, const char *url, curl_off_t *urlnum,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue