]> granicus.if.org Git - graphviz/commitdiff
Fix obscure bug where ratio=compress but size is very large.
authorerg <devnull@localhost>
Mon, 30 Nov 2009 19:21:23 +0000 (19:21 +0000)
committererg <devnull@localhost>
Mon, 30 Nov 2009 19:21:23 +0000 (19:21 +0000)
Also report l as a double in largeMinlen, not an int.
Otherwise, the error report gives
  Edge length 0 larger than maximum 1090603160 allowed.
which is weird.

lib/dotgen/position.c

index 7b1272b271308953cabf52cc45f2341fc0e21983..518416acc1e423b5ef6224964b1f2f2263269b79 100644 (file)
@@ -61,7 +61,7 @@ dumpNS (graph_t * g)
 static void
 largeMinlen (double l)
 {
-    agerr (AGERR, "Edge length %d larger than maximum %u allowed.\nCheck for overwide node(s).\n", l, USHRT_MAX); 
+    agerr (AGERR, "Edge length %f larger than maximum %u allowed.\nCheck for overwide node(s).\n", l, USHRT_MAX); 
     exit (1);
 }
 
@@ -521,7 +521,13 @@ static void compress_graph(graph_t * g)
        x = p.x;
     else
        x = p.y;
-    make_aux_edge(GD_ln(g), GD_rn(g), (int) x, 1000);
+
+    /* Guard against huge size attribute since max. edge length is USHRT_MAX
+     * A warning might be called for. Also, one could check that the graph
+     * already fits GD_drawing(g)->size and return immediately.
+     */
+    x = MIN(x,USHRT_MAX); 
+    make_aux_edge(GD_ln(g), GD_rn(g), x, 1000);
 }
 
 static void create_aux_edges(graph_t * g)