From 11e65b5aa452bec811af8d104dbf58cacd17a9f5 Mon Sep 17 00:00:00 2001 From: ellson Date: Sun, 21 May 2006 17:47:43 +0000 Subject: [PATCH] Janitor - fix some "value computed is not used" warnings --- configure.ac | 6 +++++- lib/common/emit.c | 4 ++-- lib/common/htmllex.c | 10 +++++----- lib/common/psgen.c | 10 +++++----- lib/common/utils.c | 20 ++++++++++++-------- lib/common/xdgen.c | 7 ++++--- lib/graph/lexer.c | 4 ++-- tclpkg/gdtclft/Makefile.am | 2 ++ tclpkg/gdtclft/gdtclft.c | 6 ++++-- 9 files changed, 41 insertions(+), 28 deletions(-) diff --git a/configure.ac b/configure.ac index ef2f1fed7..e8c3c1311 100644 --- a/configure.ac +++ b/configure.ac @@ -727,7 +727,11 @@ if test "$HAVE_TCL" = "1"; then fi if test "$HAVE_TCL" = "1"; then - TCL_PKGINDEX="gdtclft/pkgIndex.tcl tcldot/pkgIndex.tcl tclpathplan/pkgIndex.tcl gv/pkgIndex.tcl" + if test "$HAVE_LIBGD" = "1"; then + TCL_PKGINDEX="gdtclft/pkgIndex.tcl tcldot/pkgIndex.tcl tclpathplan/pkgIndex.tcl gv/pkgIndex.tcl" + else + TCL_PKGINDEX="tcldot/pkgIndex.tcl tclpathplan/pkgIndex.tcl gv/pkgIndex.tcl" + fi else TCL_PKGINDEX="" fi diff --git a/lib/common/emit.c b/lib/common/emit.c index e69fca86f..b2997adf6 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -1618,7 +1618,7 @@ static bool is_style_delim(int c) static int style_token(char **s, agxbuf * xb) { char *p = *s; - int token; + int token, rc; char c; while (*p && (isspace(*p) || (*p == ','))) @@ -1634,7 +1634,7 @@ static int style_token(char **s, agxbuf * xb) default: token = SID; while (!is_style_delim(c = *p)) { - agxbputc(xb, c); + rc = agxbputc(xb, c); p++; } } diff --git a/lib/common/htmllex.c b/lib/common/htmllex.c index e9f5dd0ea..d0f6d53d1 100644 --- a/lib/common/htmllex.c +++ b/lib/common/htmllex.c @@ -574,8 +574,7 @@ static void endElement(void *user, const char *name) */ static void characterData(void *user, const char *s, int length) { - int i; - int cnt = 0; + int i, rc, cnt = 0; unsigned char c; if (state.inCell) { @@ -583,7 +582,7 @@ static void characterData(void *user, const char *s, int length) c = *s++; if (c >= ' ') { cnt++; - agxbputc(state.xb, c); + rc = agxbputc(state.xb, c); } } if (cnt) state.tok = T_string; @@ -670,6 +669,7 @@ static char *findNext(char *s, agxbuf* xb) { char* t = s + 1; char c; + int rc; if (*s == '<') { if ((*t == '!') && !strncmp(t + 1, "--", 2)) @@ -683,13 +683,13 @@ static char *findNext(char *s, agxbuf* xb) } else t++; } else { - agxbputc(xb, *s); + rc = agxbputc(xb, *s); while ((c = *t) && (c != '<')) { if ((c == '&') && (*(t+1) != '#')) { t = scanEntity(t + 1, xb); } else { - agxbputc(xb, c); + rc = agxbputc(xb, c); t++; } } diff --git a/lib/common/psgen.c b/lib/common/psgen.c index c523d2464..15e957418 100644 --- a/lib/common/psgen.c +++ b/lib/common/psgen.c @@ -338,6 +338,7 @@ char *ps_string(char *ins, int latin) char *s; char *base; static agxbuf xb; + int rc; if (latin) base = utf8ToLatin1 (ins); @@ -347,13 +348,12 @@ char *ps_string(char *ins, int latin) if (xb.buf == NULL) agxbinit (&xb, BUFSIZ, psbuf); - agxbputc (&xb, LPAREN); + rc = agxbputc (&xb, LPAREN); s = base; while (*s) { - if ((*s == LPAREN) || (*s == RPAREN) || (*s == '\\')) { - agxbputc (&xb, '\\'); - } - agxbputc (&xb, *s++); + if ((*s == LPAREN) || (*s == RPAREN) || (*s == '\\')) + rc = agxbputc (&xb, '\\'); + rc = agxbputc (&xb, *s++); } agxbputc (&xb, RPAREN); if (base != ins) free (base); diff --git a/lib/common/utils.c b/lib/common/utils.c index 605674e6a..691173cfb 100644 --- a/lib/common/utils.c +++ b/lib/common/utils.c @@ -1362,6 +1362,7 @@ latin1ToUTF8 (char* s) agxbuf xb; unsigned char buf[BUFSIZ]; unsigned int v; + int rc; agxbinit(&xb, BUFSIZ, buf); @@ -1373,15 +1374,16 @@ latin1ToUTF8 (char* s) v = htmlEntity (&s); if (!v) v = '&'; } - if (v < 0x7F) agxbputc(&xb, v); + if (v < 0x7F) + rc = agxbputc(&xb, v); else if (v < 0x07FF) { - agxbputc(&xb, (v >> 6) | 0xC0); - agxbputc(&xb, (v & 0x3F) | 0x80); + rc = agxbputc(&xb, (v >> 6) | 0xC0); + rc = agxbputc(&xb, (v & 0x3F) | 0x80); } else { - agxbputc(&xb, (v >> 12) | 0xE0); - agxbputc(&xb, ((v >> 6) & 0x3F) | 0x80); - agxbputc(&xb, (v & 0x3F) | 0x80); + rc = agxbputc(&xb, (v >> 12) | 0xE0); + rc = agxbputc(&xb, ((v >> 6) & 0x3F) | 0x80); + rc = agxbputc(&xb, (v & 0x3F) | 0x80); } } ns = strdup (agxbuse(&xb)); @@ -1402,16 +1404,18 @@ utf8ToLatin1 (char* s) unsigned char buf[BUFSIZ]; unsigned char c; unsigned char outc; + int rc; agxbinit(&xb, BUFSIZ, buf); while ((c = *(unsigned char*)s++)) { - if (c < 0x7F) agxbputc(&xb, c); + if (c < 0x7F) + rc = agxbputc(&xb, c); else { outc = (c & 0x03) << 6; c = *(unsigned char*)s++; outc = outc | (c & 0x3F); - agxbputc(&xb, outc); + rc = agxbputc(&xb, outc); } } ns = strdup (agxbuse(&xb)); diff --git a/lib/common/xdgen.c b/lib/common/xdgen.c index 345bbaa09..2417a9620 100644 --- a/lib/common/xdgen.c +++ b/lib/common/xdgen.c @@ -207,8 +207,9 @@ static void xd_textline(point p, textline_t * line) static void xd_ellipse(point p, int rx, int ry, int filled) { char buf[BUFSIZ]; + int rc; - agxbputc(xbufs[gvc->emit_state], (filled ? 'E' : 'e')); + rc = agxbputc(xbufs[gvc->emit_state], (filled ? 'E' : 'e')); sprintf(buf, " %d %d %d %d ", p.x, YDIR(p.y), rx, ry); agxbput(xbufs[gvc->emit_state], buf); } @@ -216,10 +217,10 @@ static void xd_ellipse(point p, int rx, int ry, int filled) static void xd_points(char c, point * A, int n) { char buf[BUFSIZ]; - int i; + int i, rc; point p; - agxbputc(xbufs[gvc->emit_state], c); + rc = agxbputc(xbufs[gvc->emit_state], c); sprintf(buf, " %d ", n); agxbput(xbufs[gvc->emit_state], buf); for (i = 0; i < n; i++) { diff --git a/lib/graph/lexer.c b/lib/graph/lexer.c index d2abd731d..ffe734e79 100644 --- a/lib/graph/lexer.c +++ b/lib/graph/lexer.c @@ -275,7 +275,7 @@ static char *lex_gets(void) static char *html_pair(char *p, agxbuf * tokp) { unsigned char c; - int depth = 1; + int rc, depth = 1; while (1) { while ((c = *p)) { @@ -285,7 +285,7 @@ static char *html_pair(char *p, agxbuf * tokp) return p; /* p points to closing > */ } else if (c == '<') depth++; - agxbputc(tokp, c); + rc = agxbputc(tokp, c); p++; } if ((p = lex_gets()) == NULL) { diff --git a/tclpkg/gdtclft/Makefile.am b/tclpkg/gdtclft/Makefile.am index 33a0cd882..f2c553b95 100644 --- a/tclpkg/gdtclft/Makefile.am +++ b/tclpkg/gdtclft/Makefile.am @@ -32,6 +32,7 @@ libgdtclft_la_LIBADD = \ $(top_builddir)/tclpkg/tclstubs/libtclstubs.la @GD_LIBS@ libgdtclft_la_LDFLAGS = -module -no-undefined +if WITH_LIBGD if WITH_TCL all-local: pkgIndex.tcl @@ -41,6 +42,7 @@ pkgIndex.tcl: libgdtclft.la test: echo 'load .libs/libgdtclft$(TCL_SHLIB_SUFFIX) Gdtclft ; cd tests ; source all' | tclsh8.3 endif +endif .n.pdf: groff -Tps -man $< | ps2pdf - - >$@ diff --git a/tclpkg/gdtclft/gdtclft.c b/tclpkg/gdtclft/gdtclft.c index f44020b45..af64b2ee0 100644 --- a/tclpkg/gdtclft/gdtclft.c +++ b/tclpkg/gdtclft/gdtclft.c @@ -60,7 +60,9 @@ static CmdFunc tclGdBrushCmd; static CmdFunc tclGdStyleCmd; static CmdFunc tclGdTileCmd; static CmdFunc tclGdPolygonCmd; +#ifdef HAVE_GD_PNG static CmdFunc tclGdWriteBufCmd; +#endif static ColCmdFunc tclGdColorNewCmd; static ColCmdFunc tclGdColorExactCmd; @@ -1431,6 +1433,7 @@ LPVOID reserved; /* Not used. */ #endif #endif +#ifdef HAVE_GD_PNG static int BufferSinkFunc(void *context, const char *buffer, int len) { BuffSinkContext *p = context; @@ -1454,7 +1457,6 @@ static int tclGdWriteBufCmd(Tcl_Interp * interp, GdData * gdData, int argc, Tcl_Obj * CONST objv[]) { -#ifdef HAVE_GD_PNG gdImagePtr im; Tcl_Obj *output; /* char *cmd; */ @@ -1490,6 +1492,6 @@ tclGdWriteBufCmd(Tcl_Interp * interp, GdData * gdData, int argc, if (Tcl_ObjSetVar2(interp, objv[3], NULL, output, 0) == NULL) return TCL_ERROR; else -#endif return TCL_OK; } +#endif -- 2.40.0