From: Matthew Fernandez Date: Thu, 8 Sep 2022 00:27:49 +0000 (-0700) Subject: dotgen adjustregularpath: perform computation in double range X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6972e67b69ff56fd845436f45f281da2de24cdf;p=graphviz dotgen adjustregularpath: perform computation in double range The truncation/rounding to `int` within this function appears unintentional. --- diff --git a/lib/dotgen/dotsplines.c b/lib/dotgen/dotsplines.c index 160d521cc..de3b47652 100644 --- a/lib/dotgen/dotsplines.c +++ b/lib/dotgen/dotsplines.c @@ -2221,18 +2221,18 @@ void refineregularends(edge_t *left, edge_t *right, pathend_t *endp, int dir, static void adjustregularpath(path * P, int fb, int lb) { boxf *bp1, *bp2; - int i, x; + int i; for (i = fb-1; i < lb+1; i++) { bp1 = &P->boxes[i]; if ((i - fb) % 2 == 0) { if (bp1->LL.x >= bp1->UR.x) { - x = (bp1->LL.x + bp1->UR.x) / 2; + double x = (bp1->LL.x + bp1->UR.x) / 2; bp1->LL.x = x - HALFMINW, bp1->UR.x = x + HALFMINW; } } else { if (bp1->LL.x + MINW > bp1->UR.x) { - x = (bp1->LL.x + bp1->UR.x) / 2; + double x = (bp1->LL.x + bp1->UR.x) / 2; bp1->LL.x = x - HALFMINW, bp1->UR.x = x + HALFMINW; } }