]> granicus.if.org Git - graphviz/commitdiff
dotgen _dot_splines: fix truncation to int during intermediate calculations
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 18 Aug 2022 02:31:44 +0000 (19:31 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 23 Aug 2022 04:38:16 +0000 (21:38 -0700)
Like the prior commit, the problem fixed in this commit seems to have been a
mistake in ebd6191b0eec6e23d96c92aaa06212de339207e3 in not updating these
variables to doubles when transitioning to double-based points. Squashes 5
-Wfloat-conversion warnings.

lib/dotgen/dotsplines.c

index bc8de68841f4393afe8fffd7c441a29a310184e1..a8f6027ec175e85db40385a051731bfe98f8a4f9 100644 (file)
@@ -488,7 +488,8 @@ static void _dot_splines(graph_t * g, int normalize)
                free (edgelist);
        }
        else if (agtail(e0) == aghead(e0)) {
-           int b, sizey, r;
+           int b, r;
+           double sizey;
            n = agtail(e0);
            r = ND_rank(n);
            if (r == GD_maxrank(g)) {
@@ -501,8 +502,8 @@ static void _dot_splines(graph_t * g, int normalize)
                sizey = ND_coord(n).y - ND_coord(GD_rank(g)[r+1].v[0]).y;
            }
            else {
-               int upy = ND_coord(GD_rank(g)[r-1].v[0]).y - ND_coord(n).y;
-               int dwny = ND_coord(n).y - ND_coord(GD_rank(g)[r+1].v[0]).y;
+               double upy = ND_coord(GD_rank(g)[r-1].v[0]).y - ND_coord(n).y;
+               double dwny = ND_coord(n).y - ND_coord(GD_rank(g)[r+1].v[0]).y;
                sizey = MIN(upy, dwny);
            }
            makeSelfEdge(edges, ind, cnt, sd.Multisep, sizey / 2, &sinfo);