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.

(cherry picked from commit 414e3aa6bc)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
This commit is contained in:
Frederic Lecaille 2024-08-26 11:18:15 +02:00 committed by Christopher Faulet
parent fa72729511
commit 5ad7493933
2 changed files with 8 additions and 8 deletions

View File

@ -647,9 +647,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 = {

View File

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