From: Amaury Denoyelle Date: Mon, 16 May 2022 09:09:05 +0000 (+0200) Subject: MINOR: ncbuf: fix warnings for testing build X-Git-Tag: v2.6-dev11~104 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f46393ac44002cebb89ff9510e64dc1f72cdb35f;p=thirdparty%2Fhaproxy.git MINOR: ncbuf: fix warnings for testing build 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. --- diff --git a/src/ncbuf.c b/src/ncbuf.c index bc636fa842..2b21a29a7a 100644 --- a/src/ncbuf.c +++ b/src/ncbuf.c @@ -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);