]> granicus.if.org Git - graphviz/commitdiff
dotgen make_flat_labeled_edge: fix truncation to int during intermediate ops
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 18 Aug 2022 02:46:02 +0000 (19:46 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 23 Aug 2022 04:38:16 +0000 (21:38 -0700)
Like the prior commits, 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 1
-Wfloat-conversion warnings.

lib/dotgen/dotsplines.c

index 77f8297608d5c51d0deae3ad8b94b917e0ac8c62..c285800d9f124697ce72a020dd21c6bfce7e736c 100644 (file)
@@ -1468,7 +1468,7 @@ make_flat_labeled_edge(graph_t* g, spline_info_t* sp, path* P, edge_t* e, int et
     bool ps_needs_free = false;
     pathend_t tend, hend;
     boxf lb;
-    int i, pn, ydelta;
+    int i, pn;
     edge_t *f;
     pointf points[7];
 
@@ -1498,8 +1498,8 @@ make_flat_labeled_edge(graph_t* g, spline_info_t* sp, path* P, edge_t* e, int et
        lb.LL.x = ND_coord(ln).x - ND_lw(ln);
        lb.UR.x = ND_coord(ln).x + ND_rw(ln);
        lb.UR.y = ND_coord(ln).y + ND_ht(ln)/2;
-       ydelta = ND_coord(ln).y - GD_rank(g)[ND_rank(tn)].ht1 -
-               ND_coord(tn).y + GD_rank(g)[ND_rank(tn)].ht2;
+       double ydelta = ND_coord(ln).y - GD_rank(g)[ND_rank(tn)].ht1 -
+                       ND_coord(tn).y + GD_rank(g)[ND_rank(tn)].ht2;
        ydelta /= 6;
        lb.LL.y = lb.UR.y - MAX(5,ydelta);