From 697b860d6e386c60358c321aefe127a95992ba06 Mon Sep 17 00:00:00 2001 From: Debian Science Maintainers Date: Fri, 6 May 2011 14:52:41 +0100 Subject: [PATCH] fix-Abs-parenthesis Replace Abs(foo < bar) by Abs(foo) < bar This is legal C++, but certainly not the expected result, (foo < bar) is a boolean which is promoted to an int, and the function Abs(int) is called. These bugs have been reported by Fotios Sioutis on the opencascade forum. Submitted upstream: http://www.opencascade.org/org/forum/thread_20187/ Gbp-Pq: Topic submitted Gbp-Pq: Name fix-Abs-parenthesis.patch --- ros/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx | 2 +- ros/src/Aspect/Aspect_RectangularGrid.cxx | 2 +- ros/src/GeomFill/GeomFill_BoundWithSurf.cxx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ros/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx b/ros/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx index 2774e0f13..9fc7ccc4f 100644 --- a/ros/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx +++ b/ros/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx @@ -133,7 +133,7 @@ static void Hunt(const TColStd_Array1OfReal& Arr, if(Abs(Coord-Arr(i))Tol)) Standard_NotImplemented::Raise("Adaptor3d_CurveOnSurface:Hunt"); + if(Abs(Coord-Arr(i))>Tol) Standard_NotImplemented::Raise("Adaptor3d_CurveOnSurface:Hunt"); } //======================================================================= diff --git a/ros/src/Aspect/Aspect_RectangularGrid.cxx b/ros/src/Aspect/Aspect_RectangularGrid.cxx index 6ee81faf9..29415b990 100644 --- a/ros/src/Aspect/Aspect_RectangularGrid.cxx +++ b/ros/src/Aspect/Aspect_RectangularGrid.cxx @@ -163,7 +163,7 @@ void Aspect_RectangularGrid::Init () { Standard_Boolean Aspect_RectangularGrid::CheckAngle(const Standard_Real alpha, const Standard_Real beta) const { - return Abs( Sin(alpha)*Cos(beta+Standard_PI/2.) - Cos(alpha)*Sin(beta+Standard_PI/2.) != 0) ; + return Abs( Sin(alpha)*Cos(beta+Standard_PI/2.) - Cos(alpha)*Sin(beta+Standard_PI/2.)) != 0 ; } diff --git a/ros/src/GeomFill/GeomFill_BoundWithSurf.cxx b/ros/src/GeomFill/GeomFill_BoundWithSurf.cxx index 0eabeee03..3f4ab464e 100644 --- a/ros/src/GeomFill/GeomFill_BoundWithSurf.cxx +++ b/ros/src/GeomFill/GeomFill_BoundWithSurf.cxx @@ -121,7 +121,7 @@ void GeomFill_BoundWithSurf::D1Norm(const Standard_Real U, Standard_Real nsuu = N.Dot(Suu), nsuv = N.Dot(Suv), nsvv = N.Dot(Svv); Standard_Real susu = Su.Dot(Su), susv = Su.Dot(Sv), svsv = Sv.Dot(Sv); Standard_Real deno = (susu*svsv) - (susv*susv); - if(Abs(deno < 1.e-16)){ + if(Abs(deno) < 1.e-16){ // on embraye sur un calcul approche, c est mieux que rien!?! gp_Vec temp = Norm(U + 1.e-12); DN = N.Multiplied(-1.); -- 2.30.2