]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: quic: 32-bits compilation issue with %zu in quic_rx_pkts_del()
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 22 Feb 2023 16:24:23 +0000 (17:24 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 24 Feb 2023 08:23:07 +0000 (09:23 +0100)
This issue arrived with this commit:
    1dbeb35f8 MINOR: quic: Add new traces about by connection RX buffer handling

and revealed by the GH CI as follows:

   src/quic_conn.c: In function â\80\98quic_rx_pkts_delâ\80\99:
    include/haproxy/trace.h:134:65: error: format â\80\98%zuâ\80\99 expects argument of type â\80\98size_tâ\80\99,
    but argument 6 has type â\80\98uint64_tâ\80\99 {aka â\80\98long long unsigned intâ\80\99} [-Werror=format=]
    _msg_len = snprintf(_msg, sizeof(_msg), (fmt), ##args);

Replace all %zu printf integer format by %llu.

Must be backported to 2.7 where the previous is supposed to be backported.

src/quic_conn.c

index 3de0d90054dfde2c0437cec77f1c6a9317510d7e..290df7179592bdc544770a17a19530a2b646907e 100644 (file)
@@ -6585,16 +6585,16 @@ static inline void quic_rx_pkts_del(struct quic_conn *qc)
 
        list_for_each_entry_safe(pkt, pktback, &qc->rx.pkt_list, qc_rx_pkt_list) {
                TRACE_PRINTF(TRACE_LEVEL_DEVELOPER, QUIC_EV_CONN_LPKT, qc, 0, 0, 0,
-                            "pkt #%lld(type=%d,len=%zu,rawlen=%zu,refcnt=%u) (diff: %zd)",
+                            "pkt #%lld(type=%d,len=%llu,rawlen=%llu,refcnt=%u) (diff: %zd)",
                             (long long)pkt->pn_node.key,
-                            pkt->type, pkt->len, pkt->raw_len, pkt->refcnt,
+                            pkt->type, (ull)pkt->len, (ull)pkt->raw_len, pkt->refcnt,
                             (unsigned char *)b_head(&qc->rx.buf) - pkt->data);
                if (pkt->data != (unsigned char *)b_head(&qc->rx.buf)) {
                        size_t cdata;
 
                        cdata = b_contig_data(&qc->rx.buf, 0);
                        TRACE_PRINTF(TRACE_LEVEL_DEVELOPER, QUIC_EV_CONN_LPKT, qc, 0, 0, 0,
-                                    "cdata=%zu *b_head()=0x%x", cdata, *b_head(&qc->rx.buf));
+                                    "cdata=%llu *b_head()=0x%x", (ull)cdata, *b_head(&qc->rx.buf));
                        if (cdata && !*b_head(&qc->rx.buf)) {
                                /* Consume the remaining data */
                                b_del(&qc->rx.buf, cdata);
@@ -6662,7 +6662,7 @@ static void qc_rx_pkt_handle(struct quic_conn *qc, struct quic_rx_packet *pkt,
        b_cspace = b_contig_space(&qc->rx.buf);
        if (b_cspace < pkt->len) {
                TRACE_PRINTF(TRACE_LEVEL_DEVELOPER, QUIC_EV_CONN_LPKT, qc, 0, 0, 0,
-                            "bspace=%zu pkt->len=%zu", b_cspace, pkt->len);
+                            "bspace=%llu pkt->len=%llu", (ull)b_cspace, (ull)pkt->len);
                /* Do not consume buf if space not at the end. */
                if (b_tail(&qc->rx.buf) + b_cspace < b_wrap(&qc->rx.buf)) {
                        TRACE_PROTO("Packet dropped",