From: Glen Low Date: Mon, 5 Oct 2015 06:04:40 +0000 (+0800) Subject: Fix clang compile warnings X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~94^2^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e59355a73237a22e12055ad32577f87278dfee2;p=graphviz Fix clang compile warnings --- diff --git a/cmd/gvpr/gvprmain.c b/cmd/gvpr/gvprmain.c index 5f7ef581c..6d234d12e 100644 --- a/cmd/gvpr/gvprmain.c +++ b/cmd/gvpr/gvprmain.c @@ -63,7 +63,7 @@ static int iofread(void *chan, char *buf, int bufsize) return read(sffileno((Sfio_t *) chan), buf, bufsize); } -static int ioputstr(void *chan, char *str) +static int ioputstr(void *chan, const char *str) { return sfputr((Sfio_t *) chan, str, -1); } @@ -82,7 +82,7 @@ main (int argc, char* argv[]) { Agraph_t* gs[2]; Agraph_t* g = agread (sfstdin, &gprDisc); - int rv, i; + int rv; gvpropts opts; gs[0] = g; diff --git a/cmd/tools/gc.c b/cmd/tools/gc.c index d45b72931..adf4ed84d 100644 --- a/cmd/tools/gc.c +++ b/cmd/tools/gc.c @@ -326,7 +326,7 @@ static void emit(Agraph_t * g, int root, int cl_count) static int eval(Agraph_t * g, int root) { Agraph_t *subg; - int cl_count; + int cl_count = 0; if (root && !(GTYPE(g) & gtype)) return 1; @@ -335,10 +335,8 @@ static int eval(Agraph_t * g, int root) aginit(g, AGNODE, "nodeinfo", sizeof(Agnodeinfo_t), TRUE); } - if ((flags & CL) && root) { - cl_count = 0; - agapply(g, (Agobj_t *) g, cntCluster, &cl_count, 0); - } + if ((flags & CL) && root) + agapply(g, (Agobj_t *) g, cntCluster, &cl_count, 0); emit(g, root, cl_count); diff --git a/lib/cgraph/agxbuf.h b/lib/cgraph/agxbuf.h index 36203f2ce..e5e3e3d00 100644 --- a/lib/cgraph/agxbuf.h +++ b/lib/cgraph/agxbuf.h @@ -71,7 +71,7 @@ extern "C" { * Null-terminates buffer; resets and returns pointer to data; * char* agxbuse(agxbuf* xb) */ -#define agxbuse(X) (agxbputc(X,'\0'),(char*)((X)->ptr = (X)->buf)) +#define agxbuse(X) ((void)agxbputc(X,'\0'),(char*)((X)->ptr = (X)->buf)) /* agxbstart: * Return pointer to beginning of buffer. diff --git a/lib/circogen/circular.c b/lib/circogen/circular.c index 395034a82..22e71431e 100644 --- a/lib/circogen/circular.c +++ b/lib/circogen/circular.c @@ -149,8 +149,10 @@ void prData(Agnode_t * n, int pass) pname = ""; if (BLOCK(n)) bname = agnameof(BLOCK(n)->sub_graph); - else + else { pname = ""; + bname = ""; + } fprintf(stderr, "%s: %x %s %s ", agnameof(n), FLAGS(n), pname, bname); switch (pass) { case 0: diff --git a/lib/common/htmllex.c b/lib/common/htmllex.c index c4a1dd99b..f8a38bb2e 100644 --- a/lib/common/htmllex.c +++ b/lib/common/htmllex.c @@ -883,6 +883,7 @@ int htmllineno() #endif } +/* #ifdef DEBUG static void printTok(int tok) { @@ -997,6 +998,7 @@ static void printTok(int tok) } #endif +*/ int htmllex() { diff --git a/lib/common/htmltable.c b/lib/common/htmltable.c index fddc93f79..1ea18c1c9 100644 --- a/lib/common/htmltable.c +++ b/lib/common/htmltable.c @@ -1953,8 +1953,9 @@ void printTxt(htmltxt_t * txt, int ind) fprintf(stderr, "[%d] %d items\n", i, txt->spans[i].nitems); for (j = 0; j < txt->spans[i].nitems; j++) { indent(ind + 2); - fprintf(stderr, "[%d] (%f) \"%s\" ", - j, txt->spans[i].items[j].size, + fprintf(stderr, "[%d] (%f,%f) \"%s\" ", + j, txt->spans[i].items[j].size.x, + txt->spans[i].items[j].size.y, txt->spans[i].items[j].str); if (txt->spans[i].items[j].font) fprintf(stderr, "font %s color %s size %f\n", diff --git a/lib/common/routespl.c b/lib/common/routespl.c index c0e500a02..37342ea06 100644 --- a/lib/common/routespl.c +++ b/lib/common/routespl.c @@ -64,41 +64,6 @@ static void printboxes(int boxn, boxf* boxes) Show_boxes[Show_cnt+1] = NULL; } -static void psprintpolypts(Ppoint_t * p, int sz) -{ - int i; - - fprintf(stderr, "%%!\n"); - fprintf(stderr, "%% constraint poly\n"); - fprintf(stderr, "newpath\n"); - for (i = 0; i < sz; i++) - fprintf(stderr, "%f %f %s\n", p[i].x, p[i].y, - (i == 0 ? "moveto" : "lineto")); - fprintf(stderr, "closepath stroke\n"); -} -static void psprintpoint(point p) -{ - fprintf(stderr, "gsave\n"); - fprintf(stderr, - "newpath %d %d moveto %d %d 2 0 360 arc closepath fill stroke\n", - p.x, p.y, p.x, p.y); - fprintf(stderr, "/Times-Roman findfont 4 scalefont setfont\n"); - fprintf(stderr, "%d %d moveto (\\(%d,%d\\)) show\n", p.x + 5, p.y + 5, - p.x, p.y); - fprintf(stderr, "grestore\n"); -} -static void psprintpointf(pointf p) -{ - fprintf(stderr, "gsave\n"); - fprintf(stderr, - "newpath %.5g %.5g moveto %.5g %.5g 2 0 360 arc closepath fill stroke\n", - p.x, p.y, p.x, p.y); - fprintf(stderr, "/Times-Roman findfont 4 scalefont setfont\n"); - fprintf(stderr, "%.5g %.5g moveto (\\(%.5g,%.5g\\)) show\n", p.x + 5, p.y + 5, - p.x, p.y); - fprintf(stderr, "grestore\n"); -} - static void psprintspline(Ppolyline_t spl) { char buf[BUFSIZ]; diff --git a/lib/common/shapes.c b/lib/common/shapes.c index 0567e4569..e2e43523d 100644 --- a/lib/common/shapes.c +++ b/lib/common/shapes.c @@ -3463,38 +3463,6 @@ static void pos_reclbl(field_t * f, pointf ul, int sides) } } -#ifdef DEBUG -static void indent(int l) -{ - int i; - for (i = 0; i < l; i++) - fputs(" ", stderr); -} - -static void prbox(boxf b) -{ - fprintf(stderr, "((%.5g,%.5g),(%.5g,%.5g))\n", b.LL.x, b.LL.y, b.UR.x, - b.UR.y); -} - -static void dumpL(field_t * info, int level) -{ - int i; - - indent(level); - if (info->n_flds == 0) { - fprintf(stderr, "Label \"%s\" ", info->lp->text); - prbox(info->b); - } else { - fprintf(stderr, "Tbl "); - prbox(info->b); - for (i = 0; i < info->n_flds; i++) { - dumpL(info->fld[i], level + 1); - } - } -} -#endif - /* syntax of labels: foo|bar|baz or foo|(recursive|label)|baz */ static void record_init(node_t * n) { diff --git a/lib/common/taper.c b/lib/common/taper.c index 25d831f86..bdfd03804 100644 --- a/lib/common/taper.c +++ b/lib/common/taper.c @@ -156,6 +156,7 @@ insertArr (vararr_t* arr, pointf p, double l) arr->pts[arr->cnt++].lengthsofar = l; } +/* #ifdef DEBUG static void printArr (vararr_t* arr, FILE* fp) @@ -170,6 +171,7 @@ printArr (vararr_t* arr, FILE* fp) } } #endif +*/ static void fixArr (vararr_t* arr) diff --git a/lib/common/utils.c b/lib/common/utils.c index 544d5cc1b..48e547b39 100644 --- a/lib/common/utils.c +++ b/lib/common/utils.c @@ -257,8 +257,8 @@ edge_t *debug_getedge(graph_t * g, char *s0, char *s1) else return NULL; } -Agraphinfo_t* GD_info(g) { return ((Agraphinfo_t*)AGDATA(g));} -Agnodeinfo_t* ND_info(n) { return ((Agnodeinfo_t*)AGDATA(n));} +Agraphinfo_t* GD_info(graph_t * g) { return ((Agraphinfo_t*)AGDATA(g));} +Agnodeinfo_t* ND_info(node_t * n) { return ((Agnodeinfo_t*)AGDATA(n));} #endif #if !defined(MSWIN32) && !defined(WIN32) diff --git a/lib/dotgen/compound.c b/lib/dotgen/compound.c index dbbc27526..bcf2d70fc 100644 --- a/lib/dotgen/compound.c +++ b/lib/dotgen/compound.c @@ -184,7 +184,7 @@ findVertical(pointf * pts, double tmin, double tmax, return -1.0; /* if 1 crossing and on the line x == xcoord (within 0.005 point) */ - if ((no_cross == 1) && (abs(pts[3].x - xcoord) <= 0.005)) { + if ((no_cross == 1) && (fabs(pts[3].x - xcoord) <= 0.005)) { if ((ymin <= pts[3].y) && (pts[3].y <= ymax)) { return tmax; } else @@ -226,7 +226,7 @@ findHorizontal(pointf * pts, double tmin, double tmax, return -1.0; /* if 1 crossing and on the line y == ycoord (within 0.005 point) */ - if ((no_cross == 1) && (abs(pts[3].y - ycoord) <= 0.005)) { + if ((no_cross == 1) && (fabs(pts[3].y - ycoord) <= 0.005)) { if ((xmin <= pts[3].x) && (pts[3].x <= xmax)) { return tmax; } else diff --git a/lib/dotgen/dotinit.c b/lib/dotgen/dotinit.c index 5b751be93..c7c5fa864 100644 --- a/lib/dotgen/dotinit.c +++ b/lib/dotgen/dotinit.c @@ -200,29 +200,6 @@ fastn (graph_t * g) for (u = GD_nlist(g); u; u = ND_next(u)) cnt++; return cnt; } - -static void -dumpRanks (graph_t * g) -{ - int i, j; - node_t* u; - rank_t *rank = GD_rank(g); - int rcnt = 0; - for (i = GD_minrank(g); i <= GD_maxrank(g); i++) { - fprintf (stderr, "[%d] :", i); - for (j = 0; j < rank[i].n; j++) { - u = rank[i].v[j]; - rcnt++; - if (streq(agnameof(u),"virtual")) - fprintf (stderr, " %x", u); - else - fprintf (stderr, " %s", agnameof(u)); - - } - fprintf (stderr, "\n"); - } - fprintf (stderr, "count %d rank count = %d\n", fastn(g), rcnt); -} #endif diff --git a/lib/dotgen/mincross.c b/lib/dotgen/mincross.c index 07d1fe80d..920453324 100644 --- a/lib/dotgen/mincross.c +++ b/lib/dotgen/mincross.c @@ -47,11 +47,6 @@ static adjmatrix_t *new_matrix(int i, int j); static void free_matrix(adjmatrix_t * p); static int ordercmpf(int *i0, int *i1); #ifdef DEBUG -static int gd_minrank(Agraph_t *g) {return GD_minrank(g);} -static int gd_maxrank(Agraph_t *g) {return GD_maxrank(g);} -static rank_t *gd_rank(Agraph_t *g, int r) {return &GD_rank(g)[r];} -static int nd_order(Agnode_t *v) { return ND_order(v); } - void check_rs(graph_t * g, int null_ok); void check_order(void); void check_vlists(graph_t * g); @@ -69,84 +64,6 @@ static edge_t **TE_list; static int *TI_list; static boolean ReMincross; -#ifdef DEBUG -static void indent(graph_t* g) -{ - if (g->parent) { - fprintf (stderr, " "); - indent(g->parent); - } -} - -static char* nname(node_t* v) -{ - static char buf[1000]; - if (ND_node_type(v)) { - if (ND_ranktype(v) == CLUSTER) - sprintf (buf, "v%s_%p", agnameof(ND_clust(v)), v); - else - sprintf (buf, "v_%p", v); - } else - sprintf (buf, "%s", agnameof(v)); - return buf; -} -static void dumpg (graph_t* g) -{ - int j, i, r; - node_t* v; - edge_t* e; - - fprintf (stderr, "digraph A {\n"); - for (r = GD_minrank(g); r <= GD_maxrank(g); r++) { - fprintf (stderr, " subgraph {rank=same "); - for (i = 0; i < GD_rank(g)[r].n; i++) { - v = GD_rank(g)[r].v[i]; - if (i > 0) - fprintf (stderr, " -> %s", nname(v)); - else - fprintf (stderr, "%s", nname(v)); - } - if (i > 1) fprintf (stderr, " [style=invis]}\n"); - else fprintf (stderr, " }\n"); - } - for (r = GD_minrank(g); r < GD_maxrank(g); r++) { - for (i = 0; i < GD_rank(g)[r].n; i++) { - v = GD_rank(g)[r].v[i]; - for (j = 0; (e = ND_out(v).list[j]); j++) { - fprintf (stderr, "%s -> ", nname(v)); - fprintf (stderr, "%s\n", nname(aghead(e))); - } - } - } - fprintf (stderr, "}\n"); -} -static void dumpr (graph_t* g, int edges) -{ - int j, i, r; - node_t* v; - edge_t* e; - - for (r = GD_minrank(g); r <= GD_maxrank(g); r++) { - fprintf (stderr, "[%d] ", r); - for (i = 0; i < GD_rank(g)[r].n; i++) { - v = GD_rank(g)[r].v[i]; - fprintf (stderr, "%s(%.02f,%d) ", nname(v), saveorder(v),ND_order(v)); - } - fprintf (stderr, "\n"); - } - if (edges == 0) return; - for (r = GD_minrank(g); r < GD_maxrank(g); r++) { - for (i = 0; i < GD_rank(g)[r].n; i++) { - v = GD_rank(g)[r].v[i]; - for (j = 0; (e = ND_out(v).list[j]); j++) { - fprintf (stderr, "%s -> ", nname(v)); - fprintf (stderr, "%s\n", nname(aghead(e))); - } - } - } -} -#endif - typedef struct { Agrec_t h; int x, lo, hi; @@ -1920,7 +1837,7 @@ void check_rs(graph_t * g, int null_ok) if (null_ok == FALSE) abort(); } else { - fprintf(stderr, "%s(%d)\t", agnameof(v), ND_mval(v)); + fprintf(stderr, "%s(%f)\t", agnameof(v), ND_mval(v)); assert(ND_rank(v) == r); assert(v != prev); prev = v; diff --git a/lib/dotgen/position.c b/lib/dotgen/position.c index 987242b0b..df0cfcab3 100644 --- a/lib/dotgen/position.c +++ b/lib/dotgen/position.c @@ -34,28 +34,6 @@ static void make_lrvn(graph_t * g); static void contain_nodes(graph_t * g); static boolean idealsize(graph_t * g, double); -#ifdef DEBUG -static void -dumpNS (graph_t * g) -{ - node_t* n = GD_nlist(g); - elist el; - edge_t* e; - int i; - - while (n) { - el = ND_out(n); - for (i = 0; i < el.size; i++) { - e = el.list[i]; - fprintf (stderr, "%s(%x) -> ", agnameof(agtail(e)),agtail(e)); - fprintf (stderr, "%s(%x) : %d\n", agnameof(aghead(e)), aghead(e), - ED_minlen(e)); - } - n = ND_next(n); - } -} -#endif - static double largeMinlen (double l) { diff --git a/lib/fdpgen/clusteredges.c b/lib/fdpgen/clusteredges.c index f5540f9b6..85f52148b 100644 --- a/lib/fdpgen/clusteredges.c +++ b/lib/fdpgen/clusteredges.c @@ -41,27 +41,6 @@ typedef struct { */ #define INIT_SZ 100 -#ifdef DEBUG -static void dumpObj(Ppoly_t * p) -{ - int j; - Ppoint_t pt; - for (j = 0; j < p->pn; j++) { - pt = p->ps[j]; - fprintf(stderr, " %.5g %.5g", pt.x, pt.y); - } - fputs("\n", stderr); -} - -static void dumpObjlist(objlist * l) -{ - int i; - for (i = 0; i < l->cnt; i++) { - dumpObj(l->obs[i]); - } -} -#endif - static void addObj(objlist * l, Ppoly_t * obj) { if (l->sz == l->cnt) { diff --git a/lib/fdpgen/dbg.c b/lib/fdpgen/dbg.c index 8fa8e3940..ca0a9693a 100644 --- a/lib/fdpgen/dbg.c +++ b/lib/fdpgen/dbg.c @@ -203,7 +203,7 @@ double ArrowScale = 1.0; #define ARROW_WIDTH 5 /* #define DEGREES(rad) ((rad)/M_PI * 180.0) */ -static char *plog = "%%!PS-Adobe-2.0\n\n\ +static char *plog = "%!PS-Adobe-2.0\n\n\ /Times-Roman findfont 14 scalefont setfont\n\ /lLabel {\n\ \tmoveto\n\ @@ -283,7 +283,7 @@ static void pswrite(Agraph_t * g, FILE * fp, int expMode) double arrow_w, arrow_l; int portColor; - fprintf(fp, plog); + fprintf(fp, "%s", plog); /* if (agisdirected (g) && DoArrow) { @@ -470,7 +470,7 @@ static void pswrite(Agraph_t * g, FILE * fp, int expMode) } } - fprintf(fp, elog); + fprintf(fp, "%s", elog); } void outputGraph(Agraph_t * g, FILE * fp, int expMode) diff --git a/lib/gvpr/compile.c b/lib/gvpr/compile.c index 60f9a2570..03fd0d6a8 100644 --- a/lib/gvpr/compile.c +++ b/lib/gvpr/compile.c @@ -192,23 +192,6 @@ static int posOf(Agnode_t* np, int idx, double* v) } -#ifdef DEBUG -static char *symName(Expr_t * ex, int op) -{ - if (op >= MINNAME && op <= MAXNAME) - return gprnames[op]; - else { - Sfio_t *sf = sfstropen(); - char *s; - - sfprintf(sf, "", op); - s = exstring(ex, sfstruse(sf)); - sfclose(sf); - return s; - } -} -#endif - /* xargs: * Convert string argument to graph to type of graph desired. * u => undirected diff --git a/lib/neatogen/adjust.c b/lib/neatogen/adjust.c index 3b4ffae62..ad6031eba 100644 --- a/lib/neatogen/adjust.c +++ b/lib/neatogen/adjust.c @@ -672,7 +672,7 @@ double *getSizes(Agraph_t * g, pointf pad, int* n_elabels, int** elabels) { Agnode_t *n; real *sizes = N_GNEW(2 * agnnodes(g), real); - int i, nedge_nodes; + int i, nedge_nodes = 0; int* elabs; for (n = agfstnode(g); n; n = agnxtnode(g, n)) { @@ -1140,9 +1140,11 @@ removeOverlapWith (graph_t * G, adjust_data* am) break; case AM_PUSH: /* scanAdjust (G, 1); */ + ret = 0; break; case AM_PUSHPULL: /* scanAdjust (G, 0); */ + ret = 0; break; case AM_PORTHO_YX: case AM_PORTHO: @@ -1153,6 +1155,7 @@ removeOverlapWith (graph_t * G, adjust_data* am) case AM_ORTHOXY: case AM_ORTHOYX: cAdjust(G, am->mode); + ret = 0; break; case AM_COMPRESS: ret = scAdjust(G, -1); @@ -1173,6 +1176,7 @@ removeOverlapWith (graph_t * G, adjust_data* am) default: /* to silence warnings */ if ((am->mode != AM_VOR) && (am->mode != AM_SCALE)) agerr(AGWARN, "Unhandled adjust option %s\n", am->print); + ret = 0; break; } /* fprintf (stderr, "%s %.4f sec\n", am->print, elapsed_sec()); */ diff --git a/lib/neatogen/constraint.c b/lib/neatogen/constraint.c index 711117841..025e09d50 100644 --- a/lib/neatogen/constraint.c +++ b/lib/neatogen/constraint.c @@ -154,51 +154,6 @@ static void mapGraphs(graph_t * g, graph_t * cg, distfn dist) } } -#ifdef DEBUG -static int -indegree (graph_t * g, node_t *n) -{ - edge_t *e; - int cnt = 0; - for (e = agfstin(g,n); e; e = agnxtin(g,e)) cnt++; - return cnt; -} - -static int -outdegree (graph_t * g, node_t *n) -{ - edge_t *e; - int cnt = 0; - for (e = agfstout(g,n); e; e = agnxtout(g,e)) cnt++; - return cnt; -} - -static void -validate(graph_t * g) -{ - node_t *n; - edge_t *e; - int i, cnt; - - cnt = 0; - for (n = GD_nlist(g);n; n = ND_next(n)) { - assert(outdegree(g,n) == ND_out(n).size); - for (i = 0; (e = ND_out(n).list[i]); i++) { - assert(agtail(e) == n); - assert( e == agfindedge(g, n, aghead(e))); - } - assert(indegree(g,n) == ND_in(n).size); - for (i = 0; (e = ND_in(n).list[i]); i++) { - assert(aghead(e) == n); - assert( e == agfindedge(g, agtail(e), n)); - } - cnt++; - } - - assert (agnnodes(g) == cnt); -} -#endif - #ifdef OLD static node_t *newNode(graph_t * g) { diff --git a/lib/neatogen/fPQ.h b/lib/neatogen/fPQ.h index 5fe0041f3..d95d48f9f 100644 --- a/lib/neatogen/fPQ.h +++ b/lib/neatogen/fPQ.h @@ -164,21 +164,5 @@ PQupdate (PQ* pq, PQTYPE n, PQVTYPE d) #endif } -#ifdef DEBUG - -static void -PQprint (PQ* pq) -{ - int i; - PQTYPE n; - - fprintf (stderr, "Q: "); - for (i = 1; i <= pq->PQcnt; i++) { - n = pq->pq[i]; - fprintf (stderr, "(%d:%f) ", N_IDX(pq,n), N_VAL(pq,n)); - } - fprintf (stderr, "\n"); -} -#endif #endif diff --git a/lib/neatogen/neatosplines.c b/lib/neatogen/neatosplines.c index 7b2a35626..27a40f203 100644 --- a/lib/neatogen/neatosplines.c +++ b/lib/neatogen/neatosplines.c @@ -558,9 +558,12 @@ static int _spline_edges(graph_t * g, expand_t* pmargin, int edgetype) vconfig_t *vconfig = 0; path *P = NULL; int useEdges = (Nop > 1); - router_t* rtr = 0; int legal = 0; +#ifdef HAVE_GTS + router_t* rtr = 0; +#endif + /* build configuration */ if (edgetype >= ET_PLINE) { obs = N_NEW(agnnodes(g), Ppoly_t *); diff --git a/lib/neatogen/stress.c b/lib/neatogen/stress.c index a543b58e8..a96a77a81 100644 --- a/lib/neatogen/stress.c +++ b/lib/neatogen/stress.c @@ -741,7 +741,7 @@ float *mdsModel(vtx_data * graph, int nG) int i, j, e; float *Dij; int shift = 0; - double delta; + double delta = 0.0; if (graph->ewgts == NULL) return 0; @@ -865,19 +865,6 @@ float *compute_apsp_artifical_weights_packed(vtx_data * graph, int n) return Dij; } -#ifdef DEBUG -static void dumpMatrix(float *Dij, int n) -{ - int i, j, count = 0; - for (i = 0; i < n; i++) { - for (j = i; j < n; j++) { - fprintf(stderr, "%.02f ", Dij[count++]); - } - fputs("\n", stderr); - } -} -#endif - /* Accumulator type for diagonal of Laplacian. Needs to be as large * as possible. Use long double; configure to double if necessary. */ diff --git a/lib/ortho/ortho.c b/lib/ortho/ortho.c index 47a6f2181..3f6052c9f 100644 --- a/lib/ortho/ortho.c +++ b/lib/ortho/ortho.c @@ -474,7 +474,7 @@ addLoop (sgraph* sg, cell* cp, snode* dp, snode* sp) ocp = onp->cells[0]; } p = sidePt (onp, ocp); - wt = abs(p.x - midp.x) + abs(p.y - midp.y); + wt = fabs(p.x - midp.x) + fabs(p.y - midp.y); if (onTop) createSEdge (sg, sp, onp, 0); /* FIX weight */ else @@ -504,7 +504,7 @@ addNodeEdges (sgraph* sg, cell* cp, snode* np) else ocp = onp->cells[0]; p = sidePt (onp, ocp); - wt = abs(p.x - midp.x) + abs(p.y - midp.y); + wt = fabs(p.x - midp.x) + fabs(p.y - midp.y); createSEdge (sg, np, onp, 0); /* FIX weight */ } sg->nnodes++; diff --git a/lib/ortho/partition.c b/lib/ortho/partition.c index 1bb668690..e860f0e03 100644 --- a/lib/ortho/partition.c +++ b/lib/ortho/partition.c @@ -655,6 +655,8 @@ monotonate_trapezoids(int nsegs, segment_t*seg, trap_t* tr, size = traverse_polygon (visited, decomp, 0, seg, tr, 0, tr_start, tr[tr_start].u0, flip, TR_FROM_UP); else if (tr[tr_start].d0 > 0) size = traverse_polygon (visited, decomp, 0, seg, tr, 0, tr_start, tr[tr_start].d0, flip, TR_FROM_DN); + else + size = 0; free (visited); free (mchain); @@ -685,36 +687,6 @@ rectIntersect (boxf *d, const boxf *r0, const boxf *r1) return 1; } -#ifdef DEBUG -static void -dumpTrap (trap_t* tr, int n) -{ - int i; - for (i = 1; i <= n; i++) { - tr++; - fprintf (stderr, "%d : %d %d (%f,%f) (%f,%f) %d %d %d %d\n", i, - tr->lseg, tr->rseg, tr->hi.x, tr->hi.y, tr->lo.x, tr->lo.y, - tr->u0, tr->u1, tr->d0, tr->d1); - fprintf (stderr, " %d %d %d %d\n", tr->sink, tr->usave, - tr->uside, tr->state); - } - fprintf (stderr, "====\n"); -} - -static void -dumpSegs (segment_t* sg, int n) -{ - int i; - for (i = 1; i <= n; i++) { - sg++; - fprintf (stderr, "%d : (%f,%f) (%f,%f) %d %d %d %d %d\n", i, - sg->v0.x, sg->v0.y, sg->v1.x, sg->v1.y, - sg->is_inserted, sg->root0, sg->root1, sg->next, sg->prev); - } - fprintf (stderr, "====\n"); -} -#endif - boxf* partition (cell* cells, int ncells, int* nrects, boxf bb) { diff --git a/lib/pathplan/cvt.c b/lib/pathplan/cvt.c index 6c2462092..b5516ab2a 100644 --- a/lib/pathplan/cvt.c +++ b/lib/pathplan/cvt.c @@ -239,6 +239,8 @@ static void printDad(int *vis, int n) } #endif +#ifdef GASP + static Ppoint_t Bezpt[1000]; static int Bezctr; @@ -297,8 +299,6 @@ static void append_bezier(Ppoint_t * bezier) } } -#ifdef GASP - FILE *GASPout = stderr; static void gasp_print_point(Ppoint_t p) diff --git a/lib/vmalloc/vmbest.c b/lib/vmalloc/vmbest.c index 77589dadd..608a71319 100644 --- a/lib/vmalloc/vmbest.c +++ b/lib/vmalloc/vmbest.c @@ -44,9 +44,9 @@ static int Vmcheck = 0; /* 1 if checking */ /* Check to see if a block is in the free tree */ #if __STD_C -static vmintree(Block_t * node, Block_t * b) +static int vmintree(Block_t * node, Block_t * b) #else -static vmintree(node, b) +static int vmintree(node, b) Block_t *node; Block_t *b; #endif @@ -65,9 +65,9 @@ Block_t *b; /* Check to see if a block is known to be free */ #if __STD_C -static vmisfree(Vmdata_t * vd, Block_t * b) +static int vmisfree(Vmdata_t * vd, Block_t * b) #else -static vmisfree(vd, b) +static int vmisfree(vd, b) Vmdata_t *vd; Block_t *b; #endif @@ -89,9 +89,9 @@ Block_t *b; /* check to see if the tree is in good shape */ #if __STD_C -static vmchktree(Block_t * node) +static int vmchktree(Block_t * node) #else -static vmchktree(node) +static int vmchktree(node) Block_t *node; #endif { @@ -115,9 +115,9 @@ Block_t *node; } #if __STD_C -static vmonlist(Block_t * list, Block_t * b) +static int vmonlist(Block_t * list, Block_t * b) #else -static vmonlist(list, b) +static int vmonlist(list, b) Block_t *list; Block_t *b; #endif @@ -129,9 +129,9 @@ Block_t *b; } #if __STD_C -static vmcheck(Vmdata_t * vd, size_t size, int wild) +static int vmcheck(Vmdata_t * vd, size_t size, int wild) #else -static vmcheck(vd, size, wild) +static int vmcheck(vd, size, wild) Vmdata_t *vd; size_t size; /* if > 0, checking that no large free block >size */ int wild; /* if != 0, do above but allow wild to be >size */ diff --git a/plugin/core/gvrender_core_pic.c b/plugin/core/gvrender_core_pic.c index 68547831f..293f47b0c 100644 --- a/plugin/core/gvrender_core_pic.c +++ b/plugin/core/gvrender_core_pic.c @@ -26,6 +26,7 @@ #include "agxbuf.h" #include "utils.h" #include "color.h" +#include "colorprocs.h" #include "const.h" @@ -36,7 +37,6 @@ typedef enum { FORMAT_PIC, } format_type; -static int BezierSubdivision = 10; static int onetime = TRUE; static double Fontscale; @@ -68,10 +68,6 @@ static void unsupported(char *s) { agerr(AGWARN, "%s%s unsupported\n", picgen_msghdr, s); } -static void warn(char *s) -{ - agerr(AGWARN, "%s%s\n", picgen_msghdr, s); -} /* troff font mapping */ typedef struct { @@ -137,49 +133,6 @@ static char *picfontname(char *psname) return rv; } -static void pic_set_color(GVJ_t *job, char *name) -{ - gvcolor_t color; - - colorxlate(name, &color, HSVA_DOUBLE); - /* just v used to set grayscale value */ - gvprintf(job, "setfillval %f\n", color.u.HSVA[2]); -} - -static void pic_set_style(GVJ_t *job, char **s) -{ - const char *line, *p; - char skip = 0; - char buf[BUFSIZ]; - - buf[0] = '\0'; - gvprintf(job, "define attrs%d %%", 0); - while ((p = line = *s++)) { - while (*p) - p++; - p++; - while (*p) { - if (!strcmp(line, "setlinewidth")) { /* a hack to handle the user-defined (PS) style spec in proc3d.gv */ - long n = atol(p); - - sprintf(buf, - "oldlinethick = linethick;linethick = %ld * scalethickness / %.0f\n", - n, Fontscale); - skip = 1; - } else - gvprintf(job, " %s", p); - while (*p) - p++; - p++; - } - if (!skip) - gvprintf(job, " %s", line); - skip = 0; - } - gvprintf(job, " %%\n"); - gvprintf(job, "%s", buf); -} - static void picptarray(GVJ_t *job, pointf * A, int n, int close) { int i; @@ -234,39 +187,6 @@ static char *pic_string(char *s) return buf; } -static int picColorResolve(int *new, int r, int g, int b) -{ -#define maxColors 256 - static int top = 0; - static short red[maxColors], green[maxColors], blue[maxColors]; - int c; - int ct = -1; - long rd, gd, bd, dist; - long mindist = 3 * 255 * 255; /* init to max poss dist */ - - *new = 0; /* in case it is not a new color */ - for (c = 0; c < top; c++) { - rd = (long) (red[c] - r); - gd = (long) (green[c] - g); - bd = (long) (blue[c] - b); - dist = rd * rd + gd * gd + bd * bd; - if (dist < mindist) { - if (dist == 0) - return c; /* Return exact match color */ - mindist = dist; - ct = c; - } - } - /* no exact match. We now know closest, but first try to allocate exact */ - if (top++ == maxColors) - return ct; /* Return closest available color */ - red[c] = r; - green[c] = g; - blue[c] = b; - *new = 1; /* flag new color */ - return c; /* Return newly allocated color */ -} - static void pic_line_style(obj_state_t *obj, int *line_style, double *style_val) { switch (obj->pen) { @@ -479,18 +399,18 @@ static void pic_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start, { obj_state_t *obj = job->obj; - int object_code = 3; /* always 3 for spline */ +// int object_code = 3; /* always 3 for spline */ int sub_type; int line_style; /* solid, dotted, dashed */ - int thickness = obj->penwidth; - int pen_color = obj->pencolor.u.index; +// int thickness = obj->penwidth; +// int pen_color = obj->pencolor.u.index; int fill_color = obj->fillcolor.u.index; - int pen_style = 0; /* not used */ +// int pen_style = 0; /* not used */ int area_fill; double style_val; - int cap_style = 0; - int forward_arrow = 0; - int backward_arrow = 0; +// int cap_style = 0; +// int forward_arrow = 0; +// int backward_arrow = 0; int npoints = n; int i; @@ -566,21 +486,21 @@ static void pic_polygon(GVJ_t * job, pointf * A, int n, int filled) { obj_state_t *obj = job->obj; - int object_code = 2; /* always 2 for polyline */ - int sub_type = 3; /* always 3 for polygon */ +// int object_code = 2; /* always 2 for polyline */ +// int sub_type = 3; /* always 3 for polygon */ int line_style; /* solid, dotted, dashed */ - int thickness = obj->penwidth; - int pen_color = obj->pencolor.u.index; - int fill_color = obj->fillcolor.u.index; - int pen_style = 0; /* not used */ - int area_fill = filled ? 20 : -1; +// int thickness = obj->penwidth; +// int pen_color = obj->pencolor.u.index; +// int fill_color = obj->fillcolor.u.index; +// int pen_style = 0; /* not used */ +// int area_fill = filled ? 20 : -1; double style_val; - int join_style = 0; - int cap_style = 0; - int radius = 0; - int forward_arrow = 0; - int backward_arrow = 0; - int npoints = n + 1; +// int join_style = 0; +// int cap_style = 0; +// int radius = 0; +// int forward_arrow = 0; +// int backward_arrow = 0; +// int npoints = n + 1; pic_line_style(obj, &line_style, &style_val); @@ -596,21 +516,21 @@ static void pic_polyline(GVJ_t * job, pointf * A, int n) { obj_state_t *obj = job->obj; - int object_code = 2; /* always 2 for polyline */ - int sub_type = 1; /* always 1 for polyline */ +// int object_code = 2; /* always 2 for polyline */ +// int sub_type = 1; /* always 1 for polyline */ int line_style; /* solid, dotted, dashed */ - int thickness = obj->penwidth; - int pen_color = obj->pencolor.u.index; - int fill_color = 0; - int pen_style = 0; /* not used */ - int area_fill = 0; +// int thickness = obj->penwidth; +// int pen_color = obj->pencolor.u.index; +// int fill_color = 0; +// int pen_style = 0; /* not used */ +// int area_fill = 0; double style_val; - int join_style = 0; - int cap_style = 0; - int radius = 0; - int forward_arrow = 0; - int backward_arrow = 0; - int npoints = n; +// int join_style = 0; +// int cap_style = 0; +// int radius = 0; +// int forward_arrow = 0; +// int backward_arrow = 0; +// int npoints = n; pic_line_style(obj, &line_style, &style_val); diff --git a/plugin/core/gvrender_core_tk.c b/plugin/core/gvrender_core_tk.c index 446217846..fd2d397a9 100644 --- a/plugin/core/gvrender_core_tk.c +++ b/plugin/core/gvrender_core_tk.c @@ -57,52 +57,52 @@ static void tkgen_print_tags(GVJ_t *job) char *ObjType; unsigned int ObjId; obj_state_t *obj = job->obj; - void *ObjFlag; + int ObjFlag; switch (obj->emit_state) { case EMIT_NDRAW: ObjType = "node"; ObjFlag = 1; - ObjId = obj->u.n; + ObjId = AGID(obj->u.n); break; case EMIT_NLABEL: ObjType = "node"; ObjFlag = 0; - ObjId = obj->u.n; + ObjId = AGID(obj->u.n); break; case EMIT_EDRAW: case EMIT_TDRAW: case EMIT_HDRAW: ObjType = "edge"; ObjFlag = 1; - ObjId = obj->u.e; + ObjId = AGID(obj->u.e); break; case EMIT_ELABEL: case EMIT_TLABEL: case EMIT_HLABEL: ObjType = "edge"; ObjFlag = 0; - ObjId = obj->u.e; + ObjId = AGID(obj->u.e); break; case EMIT_GDRAW: ObjType = "graph"; ObjFlag = 1; - ObjId = obj->u.g; + ObjId = AGID(obj->u.g); break; case EMIT_GLABEL: ObjFlag = 0; ObjType = "graph label"; - ObjId = obj->u.g; + ObjId = AGID(obj->u.g); break; case EMIT_CDRAW: ObjType = "graph"; ObjFlag = 1; - ObjId = obj->u.sg; + ObjId = AGID(obj->u.sg); break; case EMIT_CLABEL: ObjType = "graph"; ObjFlag = 0; - ObjId = obj->u.sg; + ObjId = AGID(obj->u.sg); break; default: assert (0);