From c433e65e2bdafe810f6a3e5be11ce1d18968b139 Mon Sep 17 00:00:00 2001 From: erg Date: Mon, 18 Aug 2008 22:38:03 +0000 Subject: [PATCH] Correctly fix uninitialized variable, as initially tried in revision 1.10. --- lib/neatogen/poly.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/lib/neatogen/poly.c b/lib/neatogen/poly.c index 5991add7d..dba05d031 100644 --- a/lib/neatogen/poly.c +++ b/lib/neatogen/poly.c @@ -208,14 +208,6 @@ void makeAddPoly(Poly * pp, Agnode_t * n, float xmargin, float ymargin) case SH_POLY: poly = (polygon_t *) ND_shape_info(n); sides = poly->sides; - if (sides >= 3) { /* real polygon */ - verts = N_GNEW(sides, Point); - for (i = 0; i < sides; i++) { - verts[i].x = PS2INCH(poly->vertices[i].x); - verts[i].y = PS2INCH(poly->vertices[i].y); - } - } else - verts = genRound(n, &sides, 0, 0); if (streq(ND_shape(n)->name, "box")) pp->kind = BOX; @@ -232,29 +224,27 @@ void makeAddPoly(Poly * pp, Agnode_t * n, float xmargin, float ymargin) /* To do an additive margin, we rely on knowing that * the vertices are CCW starting from the UR */ - verts[0].x += xmargin; - verts[0].y += ymargin; - verts[1].x -= xmargin; - verts[1].y += ymargin; - verts[2].x -= xmargin; - verts[2].y -= ymargin; - verts[3].x += xmargin; - verts[3].y -= ymargin; + verts[0].x = PS2INCH(poly->vertices[0].x) + xmargin; + verts[0].y = PS2INCH(poly->vertices[0].y) + ymargin; + verts[1].x = PS2INCH(poly->vertices[1].x) - xmargin; + verts[1].y = PS2INCH(poly->vertices[1].y) + ymargin; + verts[2].x = PS2INCH(poly->vertices[2].x) - xmargin; + verts[2].y = PS2INCH(poly->vertices[2].y) - ymargin; + verts[3].x = PS2INCH(poly->vertices[3].x) + xmargin; + verts[3].y = PS2INCH(poly->vertices[3].y) - ymargin; + } else { for (i = 0; i < sides; i++) { -#if 0 double h = LEN(poly->vertices[i].x,poly->vertices[i].y); verts[i].x = poly->vertices[i].x * (1.0 + xmargin/h); verts[i].y = poly->vertices[i].y * (1.0 + ymargin/h); verts[i].x = PS2INCH(verts[i].x); verts[i].y = PS2INCH(verts[i].y); -fprintf(stderr, "vert=%g,%g h=%g margin=%g,%g\n", - verts[i].x, verts[i].y, h, xmargin, ymargin); -#endif } } - } + } else + verts = genRound(n, &sides, xmargin, ymargin); break; case SH_RECORD: sides = 4; -- 2.40.0