BUILD/MINOR: trace: fix use of long type in a few printf format strings
authorWilly Tarreau <w@1wt.eu>
Wed, 27 Nov 2019 14:41:31 +0000 (15:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 27 Nov 2019 14:45:11 +0000 (15:45 +0100)
commite18f53e01c927273e65374f43ba3417cea136d01
treec7a2596613dcc27437cd6289482bb8fb2ab07bd7
parentbc7c03eba39ec9f0b94734399853bbece1e1a250
BUILD/MINOR: trace: fix use of long type in a few printf format strings

Building on a 32-bit platform produces these warnings in trace code:

src/stream.c: In function 'strm_trace':
src/stream.c:226:29: warning: format '%lu' expects argument of type 'long unsigned int', but argument 9 has type 'size_t {aka const unsigned int}' [-Wformat=]
   chunk_appendf(&trace_buf, " req=(%p .fl=0x%08x .ana=0x%08x .exp(r,w,a)=(%u,%u,%u) .o=%lu .tot=%llu .to_fwd=%u)",
                             ^
src/stream.c:229:29: warning: format '%lu' expects argument of type 'long unsigned int', but argument 9 has type 'size_t {aka const unsigned int}' [-Wformat=]
   chunk_appendf(&trace_buf, " res=(%p .fl=0x%08x .ana=0x%08x .exp(r,w,a)=(%u,%u,%u) .o=%lu .tot=%llu .to_fwd=%u)",
                             ^
src/mux_fcgi.c: In function 'fcgi_trace':
src/mux_fcgi.c:443:29: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka const unsigned int}' [-Wformat=]
   chunk_appendf(&trace_buf, " - VAL=%lu", *val);
                             ^
src/mux_h1.c: In function 'h1_trace':
src/mux_h1.c:290:29: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka const unsigned int}' [-Wformat=]
   chunk_appendf(&trace_buf, " - VAL=%lu", *val);
                             ^

Let's just cast the type to long. This should be backported to 2.1.
src/mux_fcgi.c
src/mux_h1.c
src/stream.c