On Wed, Nov 29, 2023 at 02:46:08PM +0100, Stefano
Brivio wrote:
According to gcc, PRIu32 matches the type of the
argument we're
printing here on both 64 and 32-bits architectures. According to
Clang, though, that's not the case, as the result of the sum is an
unsigned long on 64-bit.
Use the z modifier, given that we're summing uint32_t to size_t, and
the result is at most promoted to size_t.
Heh, sorry, obviously hadn't read this patch when I commented on this
spot in the first one. The problem here is that the final promoted
type depends on whether size_t is wider than uint32_t or not, which
can vary with architecture.
That said, I doubt we're likely to support anything with a size_t
strictly *less* than 32-bits, so %zu is probably safe.
Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
---
packet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packet.c b/packet.c
index 12ac76b..ccfc846 100644
--- a/packet.c
+++ b/packet.c
@@ -106,7 +106,7 @@ void *packet_get_do(const struct pool *p, size_t idx, size_t offset,
if (p->pkt[idx].offset + len + offset > p->buf_size) {
if (func) {
- trace("packet offset plus length %lu from size %zu, "
+ trace("packet offset plus length %zu from size %zu, "
"%s:%i", p->pkt[idx].offset + len + offset,
p->buf_size, func, line);
}