]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: sink: address build warning on 32-bit architectures
authorWilly Tarreau <w@1wt.eu>
Tue, 2 Jun 2020 10:00:46 +0000 (12:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 2 Jun 2020 10:01:51 +0000 (12:01 +0200)
The recently added ring section post-processing added this bening
warning on 32-bit archs:

  src/sink.c: In function 'cfg_post_parse_ring':
  src/sink.c:994:15: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
      ha_warning("ring '%s' event max length '%u' exceeds size, forced to size '%lu'.\n",
               ^
Let's just cast b_size() to unsigned long here.

src/sink.c

index 9eca4814b7eb8bd5b0e12a4e71a92276c2a3683d..ff498b24d87850710e2bbac77552417d8962a1b9 100644 (file)
@@ -993,7 +993,7 @@ int cfg_post_parse_ring()
        if (cfg_sink && (cfg_sink->type == SINK_TYPE_BUFFER)) {
                if (cfg_sink->maxlen > b_size(&cfg_sink->ctx.ring->buf)) {
                        ha_warning("ring '%s' event max length '%u' exceeds size, forced to size '%lu'.\n",
-                                  cfg_sink->name, cfg_sink->maxlen, b_size(&cfg_sink->ctx.ring->buf));
+                                  cfg_sink->name, cfg_sink->maxlen, (unsigned long)b_size(&cfg_sink->ctx.ring->buf));
                        cfg_sink->maxlen = b_size(&cfg_sink->ctx.ring->buf);
                        err_code |= ERR_ALERT;
                }