From 4a2830e4a405402e8369816bc2915c98a01e7160 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Mon, 31 Mar 2008 13:44:42 +0000 Subject: [PATCH] compiler warning --- polygon/GenericPolygonClipperLibrary.cpp | 152 +++++++++++------------ 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/polygon/GenericPolygonClipperLibrary.cpp b/polygon/GenericPolygonClipperLibrary.cpp index 2e893a81f3..757f39108e 100644 --- a/polygon/GenericPolygonClipperLibrary.cpp +++ b/polygon/GenericPolygonClipperLibrary.cpp @@ -68,7 +68,7 @@ Copyright: (C) Advanced Interfaces Group, /* =========================================================================== - Macros + Macros =========================================================================== */ @@ -234,7 +234,7 @@ typedef struct bbox_shape /* Contour axis-aligned bounding box */ const h_state next_h_state[3][6]= { /* ABOVE BELOW CROSS */ - /* L R L R L R */ + /* L R L R L R */ /* NH */ {BH, TH, TH, BH, NH, NH}, /* BH */ {NH, NH, NH, NH, TH, TH}, /* TH */ {NH, NH, NH, NH, BH, BH} @@ -671,7 +671,7 @@ static void add_st_edge(st_node **st, it_node **it, edge_node *edge, den= ((*st)->xt - (*st)->xb) - (edge->xt - edge->xb); /* If new edge and ST edge don't cross */ - if ((edge->xt >= (*st)->xt) || (edge->dx == (*st)->dx) || + if ((edge->xt >= (*st)->xt) || (edge->dx == (*st)->dx) || (fabs(den) <= DBL_EPSILON)) { /* No intersection - insert edge here (before the ST edge) */ @@ -791,7 +791,7 @@ static void merge_left(polygon_node *p, polygon_node *q, polygon_node *list) q->proxy->v[LEFT]= p->proxy->v[LEFT]; /* Redirect any p->proxy references to q->proxy */ - + for (target= p->proxy; list; list= list->next) { if (list->proxy == target) @@ -914,7 +914,7 @@ static void new_tristrip(polygon_node **tn, edge_node *edge, (*tn)->v[LEFT]= NULL; (*tn)->v[RIGHT]= NULL; (*tn)->active= 1; - add_vertex(&((*tn)->v[LEFT]), x, y); + add_vertex(&((*tn)->v[LEFT]), x, y); edge->outp[ABOVE]= *tn; } else @@ -952,7 +952,7 @@ static bbox *create_contour_bboxes(gpc_polygon *p) box[c].ymax= p->contour[c].vertex[v].y; } } - return box; + return box; } @@ -986,10 +986,10 @@ static void minimax_test(gpc_polygon *subj, gpc_polygon *clip, gpc_op op) if (!overlap) /* Flag non contributing status by negating vertex count */ clip->contour[c].num_vertices = -clip->contour[c].num_vertices; - } + } if (op == GPC_INT) - { + { /* For each subject contour, search for any clip contour overlaps */ for (s= 0; s < subj->num_contours; s++) { @@ -1000,7 +1000,7 @@ static void minimax_test(gpc_polygon *subj, gpc_polygon *clip, gpc_op op) if (!overlap) /* Flag non contributing status by negating vertex count */ subj->contour[s].num_vertices = -subj->contour[s].num_vertices; - } + } } FREE(s_bbox); @@ -1065,7 +1065,7 @@ void gpc_write_polygon(FILE *fp, int write_hole_flags, gpc_polygon *p) if (write_hole_flags) fprintf(fp, "%d\n", p->hole[c]); - + for (v= 0; v < p->contour[c].num_vertices; v++) fprintf(fp, "% .*lf % .*lf\n", DBL_DIG, p->contour[c].vertex[v].x, @@ -1234,11 +1234,11 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, if (next_edge->bundle[ABOVE][next_edge->type]) { if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx) - && (e0->top.y != yb)) + && (e0->top.y != yb)) { - next_edge->bundle[ABOVE][ next_edge->type]^= + next_edge->bundle[ABOVE][ next_edge->type]^= e0->bundle[ABOVE][ next_edge->type]; - next_edge->bundle[ABOVE][!next_edge->type]= + next_edge->bundle[ABOVE][!next_edge->type]= e0->bundle[ABOVE][!next_edge->type]; next_edge->bstate[ABOVE]= BUNDLE_HEAD; e0->bundle[ABOVE][CLIP]= FALSE; @@ -1248,16 +1248,16 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, e0= next_edge; } } - + horiz[CLIP]= NH; horiz[SUBJ]= NH; /* Process each edge at this scanbeam boundary */ for (edge= aet; edge; edge= edge->next) { - exists[CLIP]= edge->bundle[ABOVE][CLIP] + + exists[CLIP]= edge->bundle[ABOVE][CLIP] + (edge->bundle[BELOW][CLIP] << 1); - exists[SUBJ]= edge->bundle[ABOVE][SUBJ] + + exists[SUBJ]= edge->bundle[ABOVE][SUBJ] + (edge->bundle[BELOW][SUBJ] << 1); if (exists[CLIP] || exists[SUBJ]) @@ -1281,7 +1281,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, && (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) && (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); - tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) + tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) && (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); break; case GPC_XOR: @@ -1292,7 +1292,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ^ (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) ^ (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); - tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) + tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) ^ (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); break; case GPC_UNION: @@ -1306,7 +1306,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, || (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) || (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); - tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) + tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) || (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); break; } @@ -1316,11 +1316,11 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, parity[SUBJ]^= edge->bundle[ABOVE][SUBJ]; /* Update horizontal state */ - if (exists[CLIP]) + if (exists[CLIP]) horiz[CLIP]= next_h_state[horiz[CLIP]] [((exists[CLIP] - 1) << 1) + parity[CLIP]]; - if (exists[SUBJ]) + if (exists[SUBJ]) horiz[SUBJ]= next_h_state[horiz[SUBJ]] [((exists[SUBJ] - 1) << 1) + parity[SUBJ]]; @@ -1389,10 +1389,10 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, break; case IMM: if (xb != px) - { + { add_right(cf, xb, yb); px= xb; - } + } merge_left(cf, edge->outp[BELOW], out_poly); edge->outp[BELOW]= NULL; add_local_min(&out_poly, edge, xb, yb); @@ -1400,10 +1400,10 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, break; case EMM: if (xb != px) - { + { add_left(cf, xb, yb); px= xb; - } + } merge_right(cf, edge->outp[BELOW], out_poly); edge->outp[BELOW]= NULL; add_local_min(&out_poly, edge, xb, yb); @@ -1444,7 +1444,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, /* Copy bundle head state to the adjacent tail edge if required */ if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge) - { + { if (prev_edge->bstate[BELOW] == BUNDLE_TAIL) { prev_edge->outp[BELOW]= edge->outp[BELOW]; @@ -1452,8 +1452,8 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, if (prev_edge->prev) if (prev_edge->prev->bstate[BELOW] == BUNDLE_TAIL) prev_edge->bstate[BELOW]= BUNDLE_HEAD; - } - } + } + } } else { @@ -1479,12 +1479,12 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, /* Only generate output for contributing intersections */ if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ]) && (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ])) - { + { p= e0->outp[ABOVE]; q= e1->outp[ABOVE]; ix= intersect->point.x; iy= intersect->point.y + yb; - + in[CLIP]= ( e0->bundle[ABOVE][CLIP] && !e0->bside[CLIP]) || ( e1->bundle[ABOVE][CLIP] && e1->bside[CLIP]) || (!e0->bundle[ABOVE][CLIP] && !e1->bundle[ABOVE][CLIP] @@ -1493,7 +1493,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, || ( e1->bundle[ABOVE][SUBJ] && e1->bside[SUBJ]) || (!e0->bundle[ABOVE][SUBJ] && !e1->bundle[ABOVE][SUBJ] && e0->bside[SUBJ] && e1->bside[SUBJ]); - + /* Determine quadrant occupancies */ switch (op) { @@ -1529,7 +1529,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); break; } - + vclass= tr + (tl << 1) + (br << 2) + (bl << 3); switch (vclass) @@ -1613,17 +1613,17 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, default: break; } /* End of switch */ - } /* End of contributing intersection conditional */ + } /* End of contributing intersection conditional */ /* Swap bundle sides in response to edge crossing */ if (e0->bundle[ABOVE][CLIP]) - e1->bside[CLIP]= !e1->bside[CLIP]; + e1->bside[CLIP]= !e1->bside[CLIP]; if (e1->bundle[ABOVE][CLIP]) - e0->bside[CLIP]= !e0->bside[CLIP]; + e0->bside[CLIP]= !e0->bside[CLIP]; if (e0->bundle[ABOVE][SUBJ]) - e1->bside[SUBJ]= !e1->bside[SUBJ]; + e1->bside[SUBJ]= !e1->bside[SUBJ]; if (e1->bundle[ABOVE][SUBJ]) - e0->bside[SUBJ]= !e0->bside[SUBJ]; + e0->bside[SUBJ]= !e0->bside[SUBJ]; /* Swap e0 and e1 bundles in the AET */ prev_edge= e0->prev; @@ -1694,7 +1694,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, edge->bundle[BELOW][CLIP]= edge->bundle[ABOVE][CLIP]; edge->bundle[BELOW][SUBJ]= edge->bundle[ABOVE][SUBJ]; edge->xb= edge->xt; - } + } edge->outp[ABOVE]= NULL; } } @@ -1722,7 +1722,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, MALLOC(result->contour[c].vertex, result->contour[c].num_vertices * sizeof(gpc_vertex), "vertex creation", gpc_vertex); - + v= result->contour[c].num_vertices - 1; for (vtx= poly->proxy->v[LEFT]; vtx; vtx= nv) { @@ -1788,7 +1788,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, polygon_node *tlist= NULL, *tn, *tnn, *p, *q; vertex_node *lt, *ltn, *rt, *rtn; h_state horiz[2]; - vertex_type cft; + vertex_type cft = vertex_type(-1); int in[2], exists[2], parity[2]= {LEFT, LEFT}; int s, v, contributing, search, scanbeam= 0, sbt_entries= 0; int vclass, bl, br, tl, tr; @@ -1891,12 +1891,12 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, if (next_edge->bundle[ABOVE][next_edge->type]) { if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx) - && (e0->top.y != yb)) + && (e0->top.y != yb)) { - next_edge->bundle[ABOVE][ next_edge->type]^= + next_edge->bundle[ABOVE][ next_edge->type]^= e0->bundle[ABOVE][ next_edge->type]; - next_edge->bundle[ABOVE][!next_edge->type]= - e0->bundle[ABOVE][!next_edge->type]; + next_edge->bundle[ABOVE][!next_edge->type]= + e0->bundle[ABOVE][!next_edge->type]; next_edge->bstate[ABOVE]= BUNDLE_HEAD; e0->bundle[ABOVE][CLIP]= FALSE; e0->bundle[ABOVE][SUBJ]= FALSE; @@ -1912,9 +1912,9 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, /* Process each edge at this scanbeam boundary */ for (edge= aet; edge; edge= edge->next) { - exists[CLIP]= edge->bundle[ABOVE][CLIP] + + exists[CLIP]= edge->bundle[ABOVE][CLIP] + (edge->bundle[BELOW][CLIP] << 1); - exists[SUBJ]= edge->bundle[ABOVE][SUBJ] + + exists[SUBJ]= edge->bundle[ABOVE][SUBJ] + (edge->bundle[BELOW][SUBJ] << 1); if (exists[CLIP] || exists[SUBJ]) @@ -1938,7 +1938,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, && (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) && (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); - tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) + tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) && (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); break; case GPC_XOR: @@ -1973,15 +1973,15 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, parity[SUBJ]^= edge->bundle[ABOVE][SUBJ]; /* Update horizontal state */ - if (exists[CLIP]) + if (exists[CLIP]) horiz[CLIP]= next_h_state[horiz[CLIP]] [((exists[CLIP] - 1) << 1) + parity[CLIP]]; - if (exists[SUBJ]) + if (exists[SUBJ]) horiz[SUBJ]= next_h_state[horiz[SUBJ]] [((exists[SUBJ] - 1) << 1) + parity[SUBJ]]; - + vclass= tr + (tl << 1) + (br << 2) + (bl << 3); if (contributing) @@ -2013,11 +2013,11 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, break; case IMN: if (cft == LED) - { + { if (cf->bot.y != yb) VERTEX(cf, BELOW, LEFT, cf->xb, yb); new_tristrip(&tlist, cf, cf->xb, yb); - } + } edge->outp[ABOVE]= cf->outp[ABOVE]; VERTEX(edge, ABOVE, RIGHT, xb, yb); break; @@ -2028,11 +2028,11 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, break; case IRI: if (cft == LED) - { + { if (cf->bot.y != yb) VERTEX(cf, BELOW, LEFT, cf->xb, yb); new_tristrip(&tlist, cf, cf->xb, yb); - } + } VERTEX(edge, BELOW, RIGHT, xb, yb); edge->outp[ABOVE]= NULL; break; @@ -2041,7 +2041,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, edge->outp[ABOVE]= NULL; cft= IMX; break; - case IMM: + case IMM: VERTEX(edge, BELOW, LEFT, xb, yb); edge->outp[ABOVE]= cf->outp[ABOVE]; if (xb != cf->xb) @@ -2064,25 +2064,25 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, case RED: edge->outp[ABOVE]= cf->outp[ABOVE]; if (cft == LED) - { + { if (cf->bot.y == yb) - { + { VERTEX(edge, BELOW, RIGHT, xb, yb); - } + } else - { + { if (edge->bot.y == yb) - { + { VERTEX(cf, BELOW, LEFT, cf->xb, yb); VERTEX(edge, BELOW, RIGHT, xb, yb); - } - } - } + } + } + } else - { + { VERTEX(edge, BELOW, RIGHT, xb, yb); VERTEX(edge, ABOVE, RIGHT, xb, yb); - } + } cf= NULL; break; default: @@ -2108,7 +2108,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, /* Copy bundle head state to the adjacent tail edge if required */ if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge) - { + { if (prev_edge->bstate[BELOW] == BUNDLE_TAIL) { prev_edge->outp[BELOW]= edge->outp[BELOW]; @@ -2116,8 +2116,8 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, if (prev_edge->prev) if (prev_edge->prev->bstate[BELOW] == BUNDLE_TAIL) prev_edge->bstate[BELOW]= BUNDLE_HEAD; - } - } + } + } } else { @@ -2131,7 +2131,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, if (scanbeam < sbt_entries) { /* === SCANBEAM INTERIOR PROCESSING ============================== */ - + build_intersection_table(&it, aet, dy); /* Process each node in the intersection table */ @@ -2143,7 +2143,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, /* Only generate output for contributing intersections */ if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ]) && (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ])) - { + { p= e0->outp[ABOVE]; q= e1->outp[ABOVE]; ix= intersect->point.x; @@ -2235,7 +2235,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, VERTEX(prev_edge, ABOVE, LEFT, px, iy); N_EDGE(next_edge, e1, ABOVE, nx, iy); VERTEX(next_edge, ABOVE, RIGHT, nx, iy); - new_tristrip(&tlist, prev_edge, px, iy); + new_tristrip(&tlist, prev_edge, px, iy); e1->outp[ABOVE]= prev_edge->outp[ABOVE]; VERTEX(e1, ABOVE, RIGHT, ix, iy); new_tristrip(&tlist, e0, ix, iy); @@ -2306,17 +2306,17 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, default: break; } /* End of switch */ - } /* End of contributing intersection conditional */ + } /* End of contributing intersection conditional */ /* Swap bundle sides in response to edge crossing */ if (e0->bundle[ABOVE][CLIP]) - e1->bside[CLIP]= !e1->bside[CLIP]; + e1->bside[CLIP]= !e1->bside[CLIP]; if (e1->bundle[ABOVE][CLIP]) - e0->bside[CLIP]= !e0->bside[CLIP]; + e0->bside[CLIP]= !e0->bside[CLIP]; if (e0->bundle[ABOVE][SUBJ]) - e1->bside[SUBJ]= !e1->bside[SUBJ]; + e1->bside[SUBJ]= !e1->bside[SUBJ]; if (e1->bundle[ABOVE][SUBJ]) - e0->bside[SUBJ]= !e0->bside[SUBJ]; + e0->bside[SUBJ]= !e0->bside[SUBJ]; /* Swap e0 and e1 bundles in the AET */ prev_edge= e0->prev;