Lars Clausen wrote:
> That was a division-by-zero error in point_normalize().  I've added checks
> around the uses in lib/*.c (rather than have point_normalize() check it,
> because point_normalize doesn't know enough context).  There are calls in
> ./objects/FS/flow-poly.c
> ./objects/FS/flow.c
> ./objects/UML/implements.c
> ./objects/network/bus.c
> that may need to be checked, too, but I'll leave that to those who know
> those areas.
Here's a patch to perform the checks in the FS directory (diffs are
relative to objects/FS dir). Also, were there problems with the other FS patch 
I sent a couple weeks ago?

                David

diff -r -u flow-poly.c flow-poly.c.new
--- flow-poly.c Thu Apr 27 18:12:20 2000
+++ flow-poly.c.new     Thu Apr 27 18:00:41 2000
@@ -340,3 +340,8 @@ flow_create(Point *startpoint,
   n.y = -p.x ;
-  point_normalize( &n ) ;
+  if ( fabs(n.x) < 1.e-5 && fabs(n.y) < 1.e-5 ) {
+    n.x = 0. ;
+    n.y = -1. ;
+  } else {
+    point_normalize( &n ) ;
+  }
   point_scale( &n, 0.5*FLOW_FONTHEIGHT ) ;
diff -r -u flow.c flow.c.new
--- flow.c      Thu Apr 27 18:12:14 2000
+++ flow.c.new  Thu Apr 27 18:00:47 2000
@@ -339,3 +339,8 @@ flow_create(Point *startpoint,
   n.y = -p.x ;
-  point_normalize( &n ) ;
+  if ( fabs(n.x) < 1.e-5 && fabs(n.y) < 1.e-5 ) {
+    n.x = 0. ;
+    n.y = -1. ;
+  } else {
+    point_normalize( &n ) ;
+  }
   point_scale( &n, 0.5*FLOW_FONTHEIGHT ) ;

Reply via email to