From: Frederic Lecaille Date: Mon, 26 Aug 2024 09:18:15 +0000 (+0200) Subject: BUILD: quic: 32bits build broken by wrong integer conversions for printf() X-Git-Tag: v3.1-dev7~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=414e3aa6bc80d66a448dc25d8e50f4e457dc8711;p=thirdparty%2Fhaproxy.git BUILD: quic: 32bits build broken by wrong integer conversions for printf() Since these commits the 32bits build is broken due to several errors as follow: CC src/quic_cli.o src/quic_cli.c: In function ‘dump_quic_full’: src/quic_cli.c:285:94: error: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=] 285 | chunk_appendf(&trash, " [initl] rx.ackrng=%-6zu tx.inflight=%-6zu(%ld%%)\n", | ~~^ | | | long int | %lld 286 | pktns->rx.arngs.sz, pktns->tx.in_flight, 287 | pktns->tx.in_flight * 100 / qc->path->cwnd); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | uint64_t {aka long long unsigned int} Replace several %ld by %llu with ull as printf conversion in quic_clic.c and a %ld by %lld with (long long) as printf conversion in quic_cc_cubic.c. Thank you to Ilya (@chipitsine) for having reported this issue in GH #2689. Must be backported to 3.0. --- diff --git a/src/quic_cc_cubic.c b/src/quic_cc_cubic.c index 898476a2d3..bc9410af9c 100644 --- a/src/quic_cc_cubic.c +++ b/src/quic_cc_cubic.c @@ -667,9 +667,9 @@ static void quic_cc_cubic_state_cli(struct buffer *buf, const struct quic_cc_pat { struct cubic *c = quic_cc_priv(&path->cc); - chunk_appendf(buf, " cc: state=%s ssthresh=%u K=%u last_w_max=%u wdiff=%ld\n", + chunk_appendf(buf, " cc: state=%s ssthresh=%u K=%u last_w_max=%u wdiff=%lld\n", quic_cc_state_str(c->state), c->ssthresh, c->K, c->last_w_max, - (int64_t)(path->cwnd - c->last_w_max)); + (long long)(path->cwnd - c->last_w_max)); } struct quic_cc_algo quic_cc_algo_cubic = { diff --git a/src/quic_cli.c b/src/quic_cli.c index 3a1923e6c4..6d34a83126 100644 --- a/src/quic_cli.c +++ b/src/quic_cli.c @@ -282,23 +282,23 @@ static void dump_quic_full(struct show_quic_ctx *ctx, struct quic_conn *qc) if (ctx->fields & QUIC_DUMP_FLD_PKTNS) { pktns = qc->ipktns; if (pktns) { - chunk_appendf(&trash, " [initl] rx.ackrng=%-6zu tx.inflight=%-6zu(%ld%%)\n", + chunk_appendf(&trash, " [initl] rx.ackrng=%-6zu tx.inflight=%-6zu(%llu%%)\n", pktns->rx.arngs.sz, pktns->tx.in_flight, - pktns->tx.in_flight * 100 / qc->path->cwnd); + (ull)pktns->tx.in_flight * 100 / qc->path->cwnd); } pktns = qc->hpktns; if (pktns) { - chunk_appendf(&trash, " [hndshk] rx.ackrng=%-6zu tx.inflight=%-6zu(%ld%%)\n", + chunk_appendf(&trash, " [hndshk] rx.ackrng=%-6zu tx.inflight=%-6zu(%llu%%)\n", pktns->rx.arngs.sz, pktns->tx.in_flight, - pktns->tx.in_flight * 100 / qc->path->cwnd); + (ull)pktns->tx.in_flight * 100 / qc->path->cwnd); } pktns = qc->apktns; if (pktns) { - chunk_appendf(&trash, " [01rtt] rx.ackrng=%-6zu tx.inflight=%-6zu(%ld%%)\n", + chunk_appendf(&trash, " [01rtt] rx.ackrng=%-6zu tx.inflight=%-6zu(%llu%%)\n", pktns->rx.arngs.sz, pktns->tx.in_flight, - pktns->tx.in_flight * 100 / qc->path->cwnd); + (ull)pktns->tx.in_flight * 100 / qc->path->cwnd); } }