From abfcac367a26ed0aed05c0cee9f08de6a6574922 Mon Sep 17 00:00:00 2001 From: erg Date: Mon, 30 Nov 2009 19:21:23 +0000 Subject: [PATCH] Fix obscure bug where ratio=compress but size is very large. 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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/dotgen/position.c b/lib/dotgen/position.c index 7b1272b27..518416acc 100644 --- a/lib/dotgen/position.c +++ b/lib/dotgen/position.c @@ -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) -- 2.40.0