]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ncbuf: fix warnings for testing build
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 16 May 2022 09:09:05 +0000 (11:09 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 16 May 2022 09:32:33 +0000 (11:32 +0200)
Using -Wall reveals several warning when building ncbuf testing API. One
of them was about the signedness mismatch. The other one was with an
incorrect print format.

src/ncbuf.c

index bc636fa8427375bc8ff9a5dca3e0f4da909cce47..2b21a29a7ace7a11ab70838057a98e4081aa5b48 100644 (file)
@@ -689,7 +689,7 @@ enum ncb_ret ncb_advance(struct ncbuf *buf, ncb_sz_t off)
 
 /* ******** testing API ******** */
 /* To build it :
- *   gcc -DSTANDALONE -lasan -I./include -o ncbuf src/ncbuf.c
+ *   gcc -Wall -DSTANDALONE -lasan -I./include -o ncbuf src/ncbuf.c
  */
 #ifdef STANDALONE
 
@@ -729,7 +729,7 @@ static struct rand_off *ncb_generate_rand_off(const struct ncbuf *buf)
 static void ncb_print_blk(const struct ncb_blk blk)
 {
        if (ncb_print) {
-               fprintf(stderr, "%s(%s): %2zu/%zu.\n",
+               fprintf(stderr, "%s(%s): %2u/%u.\n",
                        blk.flag & NCB_BK_F_GAP ? "GAP " : "DATA",
                        blk.flag & NCB_BK_F_FIN ? "F" : "-", blk.off, blk.sz);
        }
@@ -822,7 +822,7 @@ static int ncbuf_test(ncb_sz_t head, int reset, int print_delay)
        BUG_ON(!ncb_is_empty(&b));
        BUG_ON(ncb_is_full(&b));
 
-       b.area = bufarea;
+       b.area = (char *)bufarea;
        b.size = bufsize;
        b.head = head;
        NCB_INIT(&b);