]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: htx: fix fprintf format inconsistency on 32-bit platforms
authorWilly Tarreau <w@1wt.eu>
Mon, 26 Nov 2018 18:35:30 +0000 (19:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 26 Nov 2018 18:37:32 +0000 (19:37 +0100)
Building on 32 bits gives this :

  include/proto/htx.h: In function 'htx_dump':
  include/proto/htx.h:443:25: warning: format '%lu' expects argument of type 'long unsigned int', but argument 8 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
         fprintf(stderr, "htx:%p [ size=%u - data=%u - used=%u - wrap=%s - extra=%lu]\n",
                         ^
In htx_dump(), fprintf() uses %lu but the value is an uint64_t so it
doesn't match on 32-bit. Let's cast this to unsigned long long and use
%llu instead.

include/proto/htx.h

index 91a2086a33077ab20880aa8df9b29a0c1507dbfd..dd525fed3e2460a89337baa312b9a89b0730d0a5 100644 (file)
@@ -443,7 +443,7 @@ static inline void htx_dump(struct htx *htx)
         fprintf(stderr, "htx:%p [ size=%u - data=%u - used=%u - wrap=%s - extra=%lu]\n",
                 htx, htx->size, htx->data, htx->used,
                 (!htx->used || htx->tail+1 == htx->wrap) ? "NO" : "YES",
-               htx->extra);
+               (unsigned long)htx->extra);
         fprintf(stderr, "\thead=%d - tail=%u - front=%u - wrap=%u\n",
                 htx_get_head(htx), htx->tail, htx->front, htx->wrap);