lib: sync printf masks with uint32_t types

Also adjust a printf mask for signedness.

Fixing with MS-DOS DJGPP gcc 12.2.0:
```
lib/conncache.c:612:22: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:394:22: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:520:20: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:520:20: error: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:611:20: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:614:22: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:887:20: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:887:20: error: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:2719:26: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:2725:30: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:2729:28: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:3126:34: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:3348:34: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi.c:3991:28: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi_ev.c:343:24: error: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi_ev.c:413:24: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi_ev.c:584:36: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi_ntfy.c:113:34: error: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi_ntfy.c:113:34: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'}
lib/multi_ntfy.c:171:22: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'}
lib/url.c:883:22: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
lib/url.c:889:22: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
```

Bug: https://github.com/curl/curl/pull/20199#discussion_r2666363334
Follow-up to 4c9e4e99c1 #20208

Closes #20200
This commit is contained in:
Viktor Szakats 2026-01-06 23:50:48 +01:00
parent 4c9e4e99c1
commit e70436a88a
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
5 changed files with 30 additions and 23 deletions

View file

@ -391,7 +391,7 @@ static CURLMcode multi_xfers_add(struct Curl_multi *multi,
* to downsize the already resized ones. The sets continue
* to work properly when larger than the table, but not
* the other way around. */
CURL_TRC_M(data, "increasing xfer table size to %u", new_size);
CURL_TRC_M(data, "increasing xfer table size to %" PRIu32, new_size);
if(Curl_uint32_bset_resize(&multi->process, new_size) ||
Curl_uint32_bset_resize(&multi->dirty, new_size) ||
Curl_uint32_bset_resize(&multi->pending, new_size) ||
@ -517,8 +517,8 @@ CURLMcode curl_multi_add_handle(CURLM *m, CURL *d)
data->set.server_response_timeout;
multi->admin->set.no_signal = data->set.no_signal;
CURL_TRC_M(data, "added to multi, mid=%u, running=%u, total=%u",
data->mid, Curl_multi_xfers_running(multi),
CURL_TRC_M(data, "added to multi, mid=%" PRIu32 ", running=%u"
", total=%" PRIu32, data->mid, Curl_multi_xfers_running(multi),
Curl_uint32_tbl_count(&multi->xfers));
return CURLM_OK;
}
@ -608,10 +608,11 @@ static void multi_done_locked(struct connectdata *conn,
Curl_detach_connection(data);
CURL_TRC_M(data, "multi_done_locked, in use=%u", conn->attached_xfers);
CURL_TRC_M(data, "multi_done_locked, in use=%" PRIu32, conn->attached_xfers);
if(CONN_INUSE(conn)) {
/* Stop if still used. */
CURL_TRC_M(data, "Connection still in use %u, no more multi_done now!",
CURL_TRC_M(data,
"Connection still in use %" PRIu32 ", no more multi_done now!",
conn->attached_xfers);
return;
}
@ -884,8 +885,8 @@ CURLMcode curl_multi_remove_handle(CURLM *m, CURL *d)
return mresult;
}
CURL_TRC_M(data, "removed from multi, mid=%u, running=%u, total=%u",
mid, Curl_multi_xfers_running(multi),
CURL_TRC_M(data, "removed from multi, mid=%" PRIu32 ", running=%u"
", total=%" PRIu32, mid, Curl_multi_xfers_running(multi),
Curl_uint32_tbl_count(&multi->xfers));
return CURLM_OK;
}
@ -2716,17 +2717,19 @@ statemachine_end:
/* A sub transfer, not for msgsent to application */
struct Curl_easy *mdata;
CURL_TRC_M(data, "sub xfer done for master %u", data->master_mid);
CURL_TRC_M(data, "sub xfer done for master %" PRIu32,
data->master_mid);
mdata = Curl_multi_get_easy(multi, data->master_mid);
if(mdata) {
if(mdata->sub_xfer_done)
mdata->sub_xfer_done(mdata, data, result);
else
CURL_TRC_M(data, "master easy %u without sub_xfer_done callback.",
data->master_mid);
CURL_TRC_M(data, "master easy %" PRIu32
" without sub_xfer_done callback.", data->master_mid);
}
else {
CURL_TRC_M(data, "master easy %u already gone.", data->master_mid);
CURL_TRC_M(data, "master easy %" PRIu32 " already gone.",
data->master_mid);
}
}
else {
@ -3123,7 +3126,8 @@ static CURLMcode multi_run_dirty(struct multi_run_ctx *mrc)
}
}
else {
CURL_TRC_M(multi->admin, "multi_run_dirty, %u no longer found", mid);
CURL_TRC_M(multi->admin,
"multi_run_dirty, %" PRIu32 " no longer found", mid);
Curl_uint32_bset_remove(&multi->dirty, mid);
}
} while(Curl_uint32_bset_next(&multi->dirty, mid, &mid));
@ -3345,7 +3349,8 @@ static bool multi_has_dirties(struct Curl_multi *multi)
Curl_uint32_bset_remove(&multi->dirty, mid);
}
else {
CURL_TRC_M(multi->admin, "dirty transfer %u no longer found", mid);
CURL_TRC_M(multi->admin, "dirty transfer %" PRIu32 " no longer found",
mid);
Curl_uint32_bset_remove(&multi->dirty, mid);
}
} while(Curl_uint32_bset_next(&multi->dirty, mid, &mid));
@ -3988,8 +3993,8 @@ struct Curl_easy *Curl_multi_get_easy(struct Curl_multi *multi,
struct Curl_easy *data = Curl_uint32_tbl_get(&multi->xfers, mid);
if(data && GOOD_EASY_HANDLE(data))
return data;
CURL_TRC_M(multi->admin, "invalid easy handle in xfer table for mid=%u",
mid);
CURL_TRC_M(multi->admin,
"invalid easy handle in xfer table for mid=%" PRIu32, mid);
Curl_uint32_tbl_remove(&multi->xfers, mid);
return NULL;
}