From: Erwin Janssen Date: Thu, 1 Sep 2016 12:55:19 +0000 (+0200) Subject: Resolve three Wsign-conversion in agxbuf.c X-Git-Tag: untagged-897b348e31e4e52e8698~1^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=afd3d3da0ad9dab8194dafa41d26387efb219e04;p=graphviz 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. --- 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 {