From 1e2ec9985e81dc3ffc8e2b24efb538f576bb7ddd Mon Sep 17 00:00:00 2001 From: ellson Date: Tue, 1 Feb 2011 20:30:32 +0000 Subject: [PATCH] add some explicit casts --- lib/cgraph/agerror.c | 2 +- lib/graph/agxbuf.c | 2 +- lib/graph/graph.c | 12 ++++++------ lib/graph/graphio.c | 4 ++-- lib/graph/lexer.c | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/cgraph/agerror.c b/lib/cgraph/agerror.c index 35841de5c..12236e7b5 100644 --- a/lib/cgraph/agerror.c +++ b/lib/cgraph/agerror.c @@ -37,7 +37,7 @@ char *aglasterr() fflush(agerrout); endpos = ftell(agerrout); len = endpos - aglast; - buf = malloc(len + 1); + buf = (char*)malloc(len + 1); fseek(agerrout, aglast, SEEK_SET); fread(buf, sizeof(char), len, agerrout); buf[len] = '\0'; diff --git a/lib/graph/agxbuf.c b/lib/graph/agxbuf.c index ae625671a..db983fdd4 100644 --- a/lib/graph/agxbuf.c +++ b/lib/graph/agxbuf.c @@ -54,7 +54,7 @@ int agxbmore(agxbuf * xb, unsigned int ssz) nsize = size + ssz; cnt = xb->ptr - xb->buf; if (xb->dyna) { - nbuf = realloc(xb->buf, nsize); + nbuf = (unsigned char*)realloc(xb->buf, nsize); } else { nbuf = N_GNEW(nsize, unsigned char); memcpy(nbuf, xb->buf, cnt); diff --git a/lib/graph/graph.c b/lib/graph/graph.c index f842b899c..861512a1f 100644 --- a/lib/graph/graph.c +++ b/lib/graph/graph.c @@ -412,13 +412,13 @@ void aginsert(Agraph_t * g, void *obj) { switch (TAG_OF(obj)) { case TAG_NODE: - agINSnode(g, obj); + agINSnode(g, (Agnode_t*)obj); break; case TAG_EDGE: - agINSedge(g, obj); + agINSedge(g, (Agedge_t*)obj); break; case TAG_GRAPH: - agINSgraph(g, obj); + agINSgraph(g, (Agraph_t*)obj); break; } } @@ -427,13 +427,13 @@ void agdelete(Agraph_t * g, void *obj) { switch (TAG_OF(obj)) { case TAG_NODE: - agDELnode(g, obj); + agDELnode(g, (Agnode_t*)obj); break; case TAG_EDGE: - agDELedge(g, obj); + agDELedge(g, (Agedge_t*)obj); break; case TAG_GRAPH: - agclose(obj); + agclose((Agraph_t*)obj); break; } } diff --git a/lib/graph/graphio.c b/lib/graph/graphio.c index 34f8e262e..9fdfc2cc7 100644 --- a/lib/graph/graphio.c +++ b/lib/graph/graphio.c @@ -226,9 +226,9 @@ static char *getoutputbuffer(char *str) req = MAX(2 * strlen(str) + 2, BUFSIZ); if (req > len) { if (rv) - rv = realloc(rv, req); + rv = (char*)realloc(rv, req); else - rv = malloc(req); + rv = (char*)malloc(req); len = req; } return rv; diff --git a/lib/graph/lexer.c b/lib/graph/lexer.c index 7a83a3348..94206526b 100644 --- a/lib/graph/lexer.c +++ b/lib/graph/lexer.c @@ -247,8 +247,8 @@ static char *lex_gets(void) /* make sure there is room for at least another SMALLBUF worth */ if (curlen + SMALLBUF >= LineBufSize) { LineBufSize += BUFSIZ; - AG.linebuf = realloc(AG.linebuf, LineBufSize); - TokenBuf = realloc(TokenBuf, LineBufSize); + AG.linebuf = (char*)realloc(AG.linebuf, LineBufSize); + TokenBuf = (char*)realloc(TokenBuf, LineBufSize); } /* off by one so we can back up in LineBuf */ @@ -505,7 +505,7 @@ char *aglasterr() fflush(agerrout); endpos = ftell(agerrout); len = endpos - aglast; - buf = malloc(len + 1); + buf = (char*)malloc(len + 1); fseek(agerrout, aglast, SEEK_SET); fread(buf, sizeof(char), len, agerrout); buf[len] = '\0'; -- 2.50.1