From 44d9ae897cb19f5b1420b656d3b0b7bb0c52b21c Mon Sep 17 00:00:00 2001 From: AMA <> Date: Fri, 17 Feb 2012 11:18:31 +0000 Subject: [PATCH] 0022885: Bugfix: else clause applies to the wrong if statement because of missing braces --- src/AIS/AIS_InteractiveContext.cxx | 11 ++--- src/AIS2D/AIS2D_InteractiveContext.cdl | 10 +---- src/AIS2D/AIS2D_InteractiveContext.cxx | 17 ------- src/Bnd/Bnd_Box.cxx | 27 ++++++----- src/Bnd/Bnd_Box2d.cxx | 18 ++++---- src/IGESData/IGESData_GlobalSection.cxx | 45 ++++++++++--------- .../ShapeAnalysis_CheckSmallFace.cxx | 6 ++- src/TPrsStd/TPrsStd_AISPresentation.cxx | 4 +- 8 files changed, 59 insertions(+), 79 deletions(-) diff --git a/src/AIS/AIS_InteractiveContext.cxx b/src/AIS/AIS_InteractiveContext.cxx index c20a674a05..58515a6725 100755 --- a/src/AIS/AIS_InteractiveContext.cxx +++ b/src/AIS/AIS_InteractiveContext.cxx @@ -2763,13 +2763,10 @@ void AIS_InteractiveContext::ClearGlobal(const Handle(AIS_InteractiveObject)& an myAISDetectedSeq.Remove( i ); } - if(myWasLastMain && !myLastinMain.IsNull()) - if(myLastinMain == anIObj) - myLastinMain.Nullify(); - else - if(!myWasLastMain && !myLastinColl.IsNull()) - if(myLastinColl == anIObj) - myLastinColl.Nullify(); + if(myLastinMain == anIObj) + myLastinMain.Nullify(); + if(myLastinColl == anIObj) + myLastinColl.Nullify(); if(myLastPicked == anIObj) myLastPicked.Nullify(); diff --git a/src/AIS2D/AIS2D_InteractiveContext.cdl b/src/AIS2D/AIS2D_InteractiveContext.cdl index a59bb559ce..247209647b 100755 --- a/src/AIS2D/AIS2D_InteractiveContext.cdl +++ b/src/AIS2D/AIS2D_InteractiveContext.cdl @@ -108,7 +108,7 @@ is -- will be hilighted when detected by the selector. -- ex : be able to select center of a line without -- displaying all centers before selection process - + Erase( me : mutable; anIObj : InteractiveObject from AIS2D; UpdateVwr : Boolean from Standard = Standard_True; @@ -118,14 +118,6 @@ is -- or failing that, in other local contexts which allow erasing. -- If is false, the object is erased but -- not put in the Collector. - - EraseMode( me : mutable; - anIObj : InteractiveObject from AIS2D; - aMode : Integer from Standard; - UpdateVwr : Boolean from Standard = Standard_True); - ---Purpose: Selects an erase mode. Used only if more than one - -- mode is displayed in the main viewer. If aMode is - -- the Prs used by default, no erase mode is selected. EraseAll( me : mutable; PutInCollector : Boolean from Standard = Standard_True; diff --git a/src/AIS2D/AIS2D_InteractiveContext.cxx b/src/AIS2D/AIS2D_InteractiveContext.cxx index 3a24b7289a..be28903320 100755 --- a/src/AIS2D/AIS2D_InteractiveContext.cxx +++ b/src/AIS2D/AIS2D_InteractiveContext.cxx @@ -341,23 +341,6 @@ void AIS2D_InteractiveContext::Erase( } -void AIS2D_InteractiveContext::EraseMode( - const Handle(AIS2D_InteractiveObject)& anIObj, - const Standard_Integer aMode, - const Standard_Boolean /*UpdateVwr*/ ) { - - if ( anIObj.IsNull() ) return; - - if ( !myObjects.IsBound( anIObj ) ) return; - - if ( anIObj->HasDisplayMode() ) - if ( anIObj->DisplayMode() == aMode ) return; - else if ( myDisplayMode == aMode) return; - Handle(AIS2D_GlobalStatus) GStatus = myObjects( anIObj ); - if ( GStatus->GraphicStatus() != AIS2D_DS_Displayed ) return; - if ( GStatus->IsDModeIn( aMode ) ) {} -} - void AIS2D_InteractiveContext::EraseAll (const Standard_Boolean /*PutInCollector*/, const Standard_Boolean UpdateVwr) { diff --git a/src/Bnd/Bnd_Box.cxx b/src/Bnd/Bnd_Box.cxx index ea39cec9be..1f4971bc24 100755 --- a/src/Bnd/Bnd_Box.cxx +++ b/src/Bnd/Bnd_Box.cxx @@ -577,18 +577,21 @@ void Bnd_Box::Add (const gp_Dir& D) { Standard_Real DX,DY,DZ; D.Coord(DX,DY,DZ); - if (Abs(DX) > gp::Resolution()) { - if (DX > 0) OpenXmax(); - else OpenXmin(); - } - if (Abs(DY) > gp::Resolution()) { - if (DY > 0) OpenYmax(); - else OpenYmin(); - } - if (Abs(DZ) > gp::Resolution()) { - if (DZ > 0) OpenZmax(); - else OpenZmin(); - } + + if (DX < -RealEpsilon()) + OpenXmin(); + else if (DX > RealEpsilon()) + OpenXmax(); + + if (DY < -RealEpsilon()) + OpenYmin(); + else if (DY > RealEpsilon()) + OpenYmax(); + + if (DZ < -RealEpsilon()) + OpenZmin(); + else if (DZ > RealEpsilon()) + OpenZmax(); } //======================================================================= diff --git a/src/Bnd/Bnd_Box2d.cxx b/src/Bnd/Bnd_Box2d.cxx index fd33203d22..694703d9c6 100755 --- a/src/Bnd/Bnd_Box2d.cxx +++ b/src/Bnd/Bnd_Box2d.cxx @@ -204,14 +204,16 @@ void Bnd_Box2d::Add (const gp_Dir2d& D) { Standard_Real DX = D.X(); Standard_Real DY = D.Y(); - if (DX < 0) - if (DX < - gp::Resolution()) OpenXmin(); - else - if (DX > gp::Resolution()) OpenXmax(); - if (DY < 0) - if (DY < - gp::Resolution()) OpenYmin(); - else - if (DY > gp::Resolution()) OpenYmax(); + + if (DX < -RealEpsilon()) + OpenXmin(); + else if (DX > RealEpsilon()) + OpenXmax(); + + if (DY < -RealEpsilon()) + OpenYmin(); + else if (DY > RealEpsilon()) + OpenYmax(); } //======================================================================= diff --git a/src/IGESData/IGESData_GlobalSection.cxx b/src/IGESData/IGESData_GlobalSection.cxx index b602480793..f1337c6cbc 100755 --- a/src/IGESData/IGESData_GlobalSection.cxx +++ b/src/IGESData/IGESData_GlobalSection.cxx @@ -124,28 +124,6 @@ void IGESData_GlobalSection::Init(const Handle(Interface_ParamSet)& params, Standard_Integer nbp = params->NbParams(); - // Sending of message : Incorrect number of parameters (following the IGES version) - // Version less than 5.3 - if (theIGESVersion < 11) - if ((nbp < 24) || (nbp > 25)) { - // 24 or 25 parameters are expected (parameter 25 is not required) - Message_Msg Msg39 ("XSTEP_39"); - Msg39.Arg(24); - Msg39.Arg(25); - if (nbp < 24) ach->SendFail(Msg39); - else ach->SendWarning(Msg39); - } - - // Version 5.3 - else if ((nbp < 25) || (nbp > 26)) { - // 25 or 26 parameters are expected (parameter 25 is not required) - Message_Msg Msg39 ("XSTEP_39"); - Msg39.Arg(25); - Msg39.Arg(26); - if (nbp < 25) ach->SendFail(Msg39); - else ach->SendWarning(Msg39); - } - for (Standard_Integer i = 1; i <= nbp; i ++) { Standard_Integer intval = 0; Standard_Real realval = 0.0; Handle(TCollection_HAsciiString) strval; // doit repartir a null @@ -227,6 +205,29 @@ void IGESData_GlobalSection::Init(const Handle(Interface_ParamSet)& params, default : break; } } + + // Sending of message : Incorrect number of parameters (following the IGES version) + // Version less than 5.3 + if (theIGESVersion < 11) + { + if ((nbp < 24) || (nbp > 25)) { + // 24 or 25 parameters are expected (parameter 25 is not required) + Message_Msg Msg39 ("XSTEP_39"); + Msg39.Arg(24); + Msg39.Arg(25); + if (nbp < 24) ach->SendFail(Msg39); + else ach->SendWarning(Msg39); + } + } + // Version 5.3 + else if ((nbp < 25) || (nbp > 26)) { + // 25 or 26 parameters are expected (parameter 25 is not required) + Message_Msg Msg39 ("XSTEP_39"); + Msg39.Arg(25); + Msg39.Arg(26); + if (nbp < 25) ach->SendFail(Msg39); + else ach->SendWarning(Msg39); + } //:45 by abv 11.12.97: if UnitFlag is not defined in the file, // restore it from UnitName. Repris par CKY 13-FEV-1998 diff --git a/src/ShapeAnalysis/ShapeAnalysis_CheckSmallFace.cxx b/src/ShapeAnalysis/ShapeAnalysis_CheckSmallFace.cxx index 80b1ccc066..17f9dd69f5 100755 --- a/src/ShapeAnalysis/ShapeAnalysis_CheckSmallFace.cxx +++ b/src/ShapeAnalysis/ShapeAnalysis_CheckSmallFace.cxx @@ -582,8 +582,10 @@ static Standard_Boolean CheckPoles(const TColgp_Array2OfPnt& poles, Standard_Int Standard_Integer i0 = (uorv == 1 ? poles.LowerCol() : poles.LowerRow()); Standard_Integer i1 = (uorv == 1 ? poles.UpperCol() : poles.UpperRow()); for (Standard_Integer i = i0; i <= i1-1; i ++) { - if (uorv == 1) if(poles(rank,i).IsEqual(poles(rank, i+1), 1e-15)) return Standard_True; - else if(poles(i,rank).IsEqual(poles(i+1,rank), 1e-15)) return Standard_True; + if (uorv == 1) { + if(poles(rank,i).IsEqual(poles(rank, i+1), 1e-15)) return Standard_True; + } else + if(poles(i,rank).IsEqual(poles(i+1,rank), 1e-15)) return Standard_True; } return Standard_False; } diff --git a/src/TPrsStd/TPrsStd_AISPresentation.cxx b/src/TPrsStd/TPrsStd_AISPresentation.cxx index e449b1244c..0fc7ff9b24 100755 --- a/src/TPrsStd/TPrsStd_AISPresentation.cxx +++ b/src/TPrsStd/TPrsStd_AISPresentation.cxx @@ -1031,12 +1031,12 @@ void TPrsStd_AISPresentation::AISErase (const Standard_Boolean remove) } } else { - if( remove ) + if( remove ) { if( !ownctx.IsNull() ) { ownctx->Remove (myAIS,Standard_False); myAIS->SetToUpdate(); } - else + } else if( !ownctx.IsNull() ) ownctx->Erase (myAIS,Standard_False); } }