]> granicus.if.org Git - graphviz/commitdiff
common record_path: fix truncation to int during path calculation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 18 Aug 2022 02:17:34 +0000 (19:17 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 23 Aug 2022 04:38:16 +0000 (21:38 -0700)
This looks to have been a typo in ebd6191b0eec6e23d96c92aaa06212de339207e3 that
switched this code to operate on double points instead of int points, in that it
did not also update the local temporaries used in this calculation. As a result,
this function produced inaccurate answers due to rounding when points were too
close together and downright wrong answers when points did not fit in an int
data type. Squashes 4 -Wfloat-conversion warnings.

lib/common/shapes.c

index 4cc117b77a0493f7b0c55a91174fe010eab14f40..e156945dc739de0a697175fbfda105bc0d4079a1 100644 (file)
@@ -3639,7 +3639,8 @@ static bool record_inside(inside_t * inside_context, pointf p)
 static int record_path(node_t * n, port * prt, int side, boxf rv[],
                       int *kptr)
 {
-    int i, ls, rs;
+    int i;
+    double ls, rs;
     pointf p;
     field_t *info;