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

@ -610,7 +610,7 @@ static void cpool_discard_conn(struct cpool *cpool,
*/
if(CONN_INUSE(conn) && !aborted) {
CURL_TRC_M(data, "[CPOOL] not discarding #%" FMT_OFF_T
" still in use by %u transfers", conn->connection_id,
" still in use by %" PRIu32 " transfers", conn->connection_id,
conn->attached_xfers);
return;
}

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;
}

View file

@ -341,7 +341,7 @@ static CURLMcode mev_pollset_diff(struct Curl_multi *multi,
return CURLM_OUT_OF_MEMORY;
}
CURL_TRC_M(data, "ev entry fd=%" FMT_SOCKET_T ", added %s #%" FMT_OFF_T
", total=%u/%d (xfer/conn)", s,
", total=%" PRIu32 "/%d (xfer/conn)", s,
conn ? "connection" : "transfer",
conn ? conn->connection_id : data->mid,
Curl_uint32_spbset_count(&entry->xfers),
@ -411,7 +411,7 @@ static CURLMcode mev_pollset_diff(struct Curl_multi *multi,
if(mresult)
return mresult;
CURL_TRC_M(data, "ev entry fd=%" FMT_SOCKET_T ", removed transfer, "
"total=%u/%d (xfer/conn)", s,
"total=%" PRIu32 "/%d (xfer/conn)", s,
Curl_uint32_spbset_count(&entry->xfers),
entry->conn ? 1 : 0);
}
@ -581,7 +581,8 @@ void Curl_multi_ev_dirty_xfers(struct Curl_multi *multi,
Curl_multi_mark_dirty(data);
}
else {
CURL_TRC_M(multi->admin, "socket transfer %u no longer found", mid);
CURL_TRC_M(multi->admin,
"socket transfer %" PRIu32 " no longer found", mid);
Curl_uint32_spbset_remove(&entry->xfers, mid);
}
} while(Curl_uint32_spbset_next(&entry->xfers, mid, &mid));

View file

@ -110,7 +110,8 @@ static void mntfy_chunk_dispatch_all(struct Curl_multi *multi,
/* only when notification has not been disabled in the meantime */
if(data && Curl_uint32_bset_contains(&multi->ntfy.enabled, e->type)) {
/* this may cause new notifications to be added! */
CURL_TRC_M(multi->admin, "[NTFY] dispatch %d to xfer %u",
CURL_TRC_M(multi->admin,
"[NTFY] dispatch %" PRIu32 " to xfer %" PRIu32,
e->type, e->mid);
multi->ntfy.ntfy_cb(multi, e->type, data, multi->ntfy.ntfy_cb_data);
}
@ -168,7 +169,7 @@ void Curl_mntfy_add(struct Curl_easy *data, unsigned int type)
Curl_uint32_bset_contains(&multi->ntfy.enabled, (uint32_t)type)) {
/* append to list of outstanding notifications */
struct mntfy_chunk *tail = mntfy_non_full_tail(&multi->ntfy);
CURL_TRC_M(data, "[NTFY] add %d for xfer %u", type, data->mid);
CURL_TRC_M(data, "[NTFY] add %u for xfer %" PRIu32, type, data->mid);
if(tail)
mntfy_chunk_append(tail, data, (uint32_t)type);
else

View file

@ -881,12 +881,12 @@ static bool url_match_multiplex_limits(struct connectdata *conn,
if(conn->attached_xfers >=
Curl_multi_max_concurrent_streams(m->data->multi)) {
infof(m->data, "client side MAX_CONCURRENT_STREAMS reached"
", skip (%u)", conn->attached_xfers);
", skip (%" PRIu32 ")", conn->attached_xfers);
return FALSE;
}
if(conn->attached_xfers >=
Curl_conn_get_max_concurrent(m->data, conn, FIRSTSOCKET)) {
infof(m->data, "MAX_CONCURRENT_STREAMS reached, skip (%u)",
infof(m->data, "MAX_CONCURRENT_STREAMS reached, skip (%" PRIu32 ")",
conn->attached_xfers);
return FALSE;
}