From afd3d3da0ad9dab8194dafa41d26387efb219e04 Mon Sep 17 00:00:00 2001 From: Erwin Janssen Date: Thu, 1 Sep 2016 14:55:19 +0200 Subject: [PATCH] Resolve three Wsign-conversion in agxbuf.c These three warnings could be resolved without making functional changes in the code. Also initialized the three local variables in this function to zero. --- lib/cgraph/agxbuf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/cgraph/agxbuf.c b/lib/cgraph/agxbuf.c index 3b2bd3a7c..a2a71df01 100644 --- a/lib/cgraph/agxbuf.c +++ b/lib/cgraph/agxbuf.c @@ -43,16 +43,16 @@ void agxbinit(agxbuf * xb, unsigned int hint, unsigned char *init) */ int agxbmore(agxbuf * xb, size_t ssz) { - size_t cnt; /* current no. of characters in buffer */ - size_t size; /* current buffer size */ - size_t nsize; /* new buffer size */ - unsigned char *nbuf; /* new buffer */ + size_t cnt = 0; /* current no. of characters in buffer */ + size_t size = 0; /* current buffer size */ + size_t nsize = 0; /* new buffer size */ + unsigned char *nbuf; /* new buffer */ - size = xb->eptr - xb->buf; + size = (size_t) (xb->eptr - xb->buf); nsize = 2 * size; - if (size + (int)ssz > nsize) + if (size + ssz > nsize) nsize = size + ssz; - cnt = xb->ptr - xb->buf; + cnt = (size_t) (xb->ptr - xb->buf); if (xb->dyna) { nbuf = realloc(xb->buf, nsize); } else { -- 2.50.1