]> OCCT Git - occt-copy.git/commitdiff
0023132: Suspicious code snippets
authoromy <omy@opencascade.com>
Fri, 16 Nov 2012 09:30:31 +0000 (13:30 +0400)
committeromy <omy@opencascade.com>
Fri, 23 Nov 2012 11:41:20 +0000 (15:41 +0400)
1) Warning in Aspect.cxx couldn't be reproduced
2) Description of changes: added 'return' statements into ReadStep(...) functions of RWStepBasic_* classes.
3) BRepFill_OffsetWire.cxx - removed dead code;
4) IFSelect_WorkSession.cxx - swapped arguments;
5) TopOpeBRep_ShapeIntersector2d.cxx - removed 'brake' statement and changed loop to if-statement because of
     void TopOpeBRep_ShapeIntersector2d::FindFFIntersection() function's call features.
6) V2d_RectangularGraphicGrid.cxx - left constants instead of functions beacuse of faster perfomance.
7) Commented unreachable code in files GeomFill_LocationGuide.cxx and TopOpeBRepTool_mkTondgE.cxx

15 files changed:
src/BRepFill/BRepFill_OffsetWire.cxx
src/GeomFill/GeomFill_LocationGuide.cxx
src/IFSelect/IFSelect_WorkSession.cxx
src/IntTools/IntTools_EdgeFace.cxx
src/RWStepBasic/RWStepBasic_RWSiUnitAndAreaUnit.cxx
src/RWStepBasic/RWStepBasic_RWSiUnitAndLengthUnit.cxx
src/RWStepBasic/RWStepBasic_RWSiUnitAndMassUnit.cxx
src/RWStepBasic/RWStepBasic_RWSiUnitAndPlaneAngleUnit.cxx
src/RWStepBasic/RWStepBasic_RWSiUnitAndRatioUnit.cxx
src/RWStepBasic/RWStepBasic_RWSiUnitAndSolidAngleUnit.cxx
src/RWStepBasic/RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit.cxx
src/RWStepBasic/RWStepBasic_RWSiUnitAndTimeUnit.cxx
src/RWStepBasic/RWStepBasic_RWSiUnitAndVolumeUnit.cxx
src/TopOpeBRep/TopOpeBRep_ShapeIntersector2d.cxx
src/TopOpeBRepTool/TopOpeBRepTool_mkTondgE.cxx

index 75673c6673892d155ef19fb6c688b23cbd7e11b7..d83fbae172660a10c4ffc214ae0b8cfcd6ae6713 100755 (executable)
@@ -1619,35 +1619,6 @@ Standard_Integer CutEdge (const TopoDS_Edge& E,
   if (CT2d->BasisCurve()->IsKind(STANDARD_TYPE(Geom2d_Circle)) &&
       ( Abs(f-l) >= M_PI) ) {
     return 0;
-    //---------------------------
-    // Cut closed circle.
-    //---------------------------
-    Standard_Real m = (f + l)*0.5;
-//  Modified by Sergey KHROMOV - Wed Mar  6 17:37:28 2002 Begin
-    gp_Pnt        P = aC->Value(m);
-
-    VL = BRepLib_MakeVertex(P);
-    B.UpdateVertex(VL, aTol);
-//  Modified by Sergey KHROMOV - Wed Mar  6 17:37:30 2002 End
-    TopoDS_Shape aLocalShape = E.EmptyCopied();
-    TopoDS_Edge FE = TopoDS::Edge(aLocalShape);  
-    TopoDS_Edge LE = TopoDS::Edge(aLocalShape);  
-//    TopoDS_Edge FE = TopoDS::Edge(E.EmptyCopied());    
-//    TopoDS_Edge LE = TopoDS::Edge(E.EmptyCopied());
-    FE.Orientation(TopAbs_FORWARD);
-    LE.Orientation(TopAbs_FORWARD);
-    B.Add  (FE,V1);
-    B.Add  (FE,VL.Oriented(TopAbs_REVERSED));
-    B.Range(FE, f, m);    
-    B.Add  (LE,V2);
-    B.Add  (LE,VL.Oriented(TopAbs_FORWARD));
-    B.Range(LE, m, l);
-    Cuts.Append(FE.Oriented(E.Orientation()));
-    Cuts.Append(LE.Oriented(E.Orientation()));
-    //--------
-    // Return.
-    //--------
-    return 2;
   }
 
   //-------------------------
index 50fa4a5010105c2212cfcad255b91af05ea0b57d..2a548c6806d9a6e5fdb06d0d65738d919c1c35dd 100755 (executable)
@@ -743,7 +743,7 @@ static void InGoodPeriod(const Standard_Real Prec,
 
   if (rotation) {  
     return Standard_False;
-    
+ /*   
 #ifdef DEB
     Standard_Real U = myFirstS + ratio*(Param-myCurve->FirstParameter());
 #else
@@ -862,7 +862,7 @@ static void InGoodPeriod(const Standard_Real Prec,
        myStatus = GeomFill_ImpossibleContact;
        return Standard_False;
       }
-
+*/
     }//if_rotation
   
 
index a413f11e1936b070818f29082e1f37631afef49d..537368a17399357b1f3bbad5df810630f18addfb 100755 (executable)
@@ -2822,7 +2822,7 @@ void IFSelect_WorkSession::QueryCheckList (const Interface_CheckIterator& chl)
 {
   if (!IsLoaded()) return;
   Standard_Integer i,nb = themodel->NbEntities();
-  thecheckana = TCollection_AsciiString (' ',nb+1);
+  thecheckana = TCollection_AsciiString (nb+1,' ');
   for (chl.Start(); chl.More(); chl.Next()) {
     Standard_Integer num = chl.Number();
     const Handle(Interface_Check) ach = chl.Value();
index 7952ffe24c1a9cbcc651d3a08fc49dbe995478bf..b0a4912cb04c86e2552be9466f68e58549e897f9 100755 (executable)
@@ -898,10 +898,10 @@ void IntTools_EdgeFace::CheckData()
       aCommonPrt.SetVertexParameter1(tm);
       aCommonPrt.SetRange1 (af1, al1);
     }
-    return 0;
+        return 0;
   }
-
   //
+  /*
   dt=al1-af1;
   if (dt<1.e-5) {
     gp_Pnt aPF, aPL;
@@ -940,6 +940,7 @@ void IntTools_EdgeFace::CheckData()
       aCommonPrt.SetType(TopAbs_EDGE);
     }
   }
+  */
   return 0;
 }
 
index 60d95d2f823b5a2c8f696ce4db513ef394a0ebd4..76c61b5b375442bfaee0ced20965b75c8f7b21e2 100755 (executable)
@@ -54,19 +54,29 @@ void RWStepBasic_RWSiUnitAndAreaUnit::ReadStep(const Handle(StepData_StepReaderD
     if (data->ParamType(num,1) == Interface_ParamEnum) {
       Standard_CString text = data->ParamCValue(num,1);
       hasAprefix = reader.DecodePrefix(aPrefix,text);
-      if(!hasAprefix)
-       ach->AddFail("Enumeration si_prefix has not an allowed value");
+      if(!hasAprefix){
+             ach->AddFail("Enumeration si_prefix has not an allowed value");
+        return;
+      }
+    }
+    else{
+      ach->AddFail("Parameter #2 (prefix) is not an enumeration");
+      return;
     }
-    else ach->AddFail("Parameter #2 (prefix) is not an enumeration");
   }
      
   StepBasic_SiUnitName aName;
   if (data->ParamType(num,2) == Interface_ParamEnum) {
     Standard_CString text = data->ParamCValue(num,2);
-    if(!reader.DecodeName(aName,text))
+    if(!reader.DecodeName(aName,text)){
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
+      return;
+    }
+  }
+  else{
+    ach->AddFail("Parameter #3 (name) is not an enumeration");
+    return;
   }
-  else ach->AddFail("Parameter #3 (name) is not an enumeration");
   
   ent->Init(hasAprefix,aPrefix,aName);
   ent->SetDimensions(aDimensions);
index 4217aa541ec5e9cc0770b0a0d2cae6824df3065f..e7361482628dbbaee12a22440462ae00b558d773 100755 (executable)
@@ -66,20 +66,30 @@ void RWStepBasic_RWSiUnitAndLengthUnit::ReadStep(const Handle(StepData_StepReade
     if (data->ParamType(num,1) == Interface_ParamEnum) {
       Standard_CString text = data->ParamCValue(num,1);
       hasAprefix = reader.DecodePrefix(aPrefix,text);
-      if(!hasAprefix)
-       ach->AddFail("Enumeration si_prefix has not an allowed value");
+      if(!hasAprefix){
+             ach->AddFail("Enumeration si_prefix has not an allowed value");
+        return;
+      }
+    }
+    else{
+      ach->AddFail("Parameter #2 (prefix) is not an enumeration");
+      return;
     }
-    else ach->AddFail("Parameter #2 (prefix) is not an enumeration");
   } 
   
   // --- field : name ---
   StepBasic_SiUnitName aName;
   if (data->ParamType(num,2) == Interface_ParamEnum) {
     Standard_CString text = data->ParamCValue(num,2);
-    if(!reader.DecodeName(aName,text))
+    if(!reader.DecodeName(aName,text)){
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
+      return;
+    }
+  }
+  else{
+    ach->AddFail("Parameter #2 (name) is not an enumeration");
+    return;
   }
-  else ach->AddFail("Parameter #2 (name) is not an enumeration");
 
   //--- Initialisation of the red entity ---
   ent->Init(hasAprefix,aPrefix,aName);
index 599531fa9fdfe0fbc99aa6fa7d2af6541dd613c3..fa997df5b37421acbb78a8d7f1dd269b3c09807a 100755 (executable)
@@ -75,20 +75,30 @@ void RWStepBasic_RWSiUnitAndMassUnit::ReadStep(const Handle(StepData_StepReaderD
     if (data->ParamType(num,1) == Interface_ParamEnum) {
       Standard_CString text = data->ParamCValue(num,1);
       hasAprefix = reader.DecodePrefix(aPrefix,text);
-      if(!hasAprefix)
-       ach->AddFail("Enumeration si_prefix has not an allowed value");
+      if(!hasAprefix){
+             ach->AddFail("Enumeration si_prefix has not an allowed value");
+        return;
+      }
+    }
+    else{
+      ach->AddFail("Parameter #2 (prefix) is not an enumeration");
+      return;
     }
-    else ach->AddFail("Parameter #2 (prefix) is not an enumeration");
   } 
   
   // --- field : name ---
   StepBasic_SiUnitName aName;
   if (data->ParamType(num,2) == Interface_ParamEnum) {
     Standard_CString text = data->ParamCValue(num,2);
-    if(!reader.DecodeName(aName,text))
+    if(!reader.DecodeName(aName,text)){
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
+      return;
+    }
+  }
+  else{
+    ach->AddFail("Parameter #2 (name) is not an enumeration");
+    return;
   }
-  else ach->AddFail("Parameter #2 (name) is not an enumeration");
 
   //--- Initialisation of the red entity ---
   ent->Init(hasAprefix,aPrefix,aName);
index e0da75f87788194db20fc9ec7827091a8bd59466..0e7d46f1d16c785578676b5235190fb07ffd7a0a 100755 (executable)
@@ -59,20 +59,30 @@ void RWStepBasic_RWSiUnitAndPlaneAngleUnit::ReadStep(const Handle(StepData_StepR
     if (data->ParamType(num,1) == Interface_ParamEnum) {
       Standard_CString text = data->ParamCValue(num,1);
       hasAprefix = reader.DecodePrefix(aPrefix,text);
-      if(!hasAprefix)
-       ach->AddFail("Enumeration si_prefix has not an allowed value");
+      if(!hasAprefix){
+             ach->AddFail("Enumeration si_prefix has not an allowed value");
+        return;
+      }
+    }
+    else{
+      ach->AddFail("Parameter #2 (prefix) is not an enumeration");
+      return;
     }
-    else ach->AddFail("Parameter #2 (prefix) is not an enumeration");
   }
        
   // --- field : name ---
   StepBasic_SiUnitName aName;
   if (data->ParamType(num,2) == Interface_ParamEnum) {
     Standard_CString text = data->ParamCValue(num,2);
-    if(!reader.DecodeName(aName,text))
+    if(!reader.DecodeName(aName,text)){
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
+      return;
+    }
+  }
+  else{
+    ach->AddFail("Parameter #2 (name) is not an enumeration");
+    return;
   }
-  else ach->AddFail("Parameter #2 (name) is not an enumeration");
   
   //--- Initialisation of the red entity ---
   ent->Init(hasAprefix,aPrefix,aName);
index 7e995e908eb8097eca8eb4c0952afc83ff56c75f..6c359aec1388a8adc7e7b64415a2869976ce378a 100755 (executable)
@@ -58,20 +58,30 @@ void RWStepBasic_RWSiUnitAndRatioUnit::ReadStep     (const Handle(StepData_StepReade
     if (data->ParamType(num,1) == Interface_ParamEnum) {
       Standard_CString text = data->ParamCValue(num,1);
       hasAprefix = reader.DecodePrefix(aPrefix,text);
-      if(!hasAprefix)
-       ach->AddFail("Enumeration si_prefix has not an allowed value");
+      if(!hasAprefix){
+             ach->AddFail("Enumeration si_prefix has not an allowed value");
+        return;
+      }
+    }
+    else{
+      ach->AddFail("Parameter #1 (prefix) is not an enumeration");
+      return;
     }
-    else ach->AddFail("Parameter #1 (prefix) is not an enumeration");
   }
 
   // --- field : name ---
   StepBasic_SiUnitName aName;
   if (data->ParamType(num,2) == Interface_ParamEnum) {
     Standard_CString text = data->ParamCValue(num,2);
-    if(!reader.DecodeName(aName,text))
+    if(!reader.DecodeName(aName,text)){
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
+      return;
+    }
+  }
+  else{
+    ach->AddFail("Parameter #2 (name) is not an enumeration");
+    return;
   }
-  else ach->AddFail("Parameter #2 (name) is not an enumeration");
   
   //--- Initialisation of the red entity ---
   ent->Init(hasAprefix,aPrefix,aName);
index 9b4aae2ec0b236c707f2e672972292409d97ed3a..ee36aaa30977cc4bc96309a0ef23df658e64fbb3 100755 (executable)
@@ -55,20 +55,30 @@ void RWStepBasic_RWSiUnitAndSolidAngleUnit::ReadStep (const Handle(StepData_Step
     if (data->ParamType(num,1) == Interface_ParamEnum) {
       Standard_CString text = data->ParamCValue(num,1);
       hasAprefix = reader.DecodePrefix(aPrefix,text);
-      if(!hasAprefix)
-       ach->AddFail("Enumeration si_prefix has not an allowed value");
+      if(!hasAprefix){
+             ach->AddFail("Enumeration si_prefix has not an allowed value");
+        return;
+      }
+    }
+    else{
+      ach->AddFail("Parameter #1 (prefix) is not an enumeration");
+      return;
     }
-    else ach->AddFail("Parameter #1 (prefix) is not an enumeration");
   }
   
   // --- field : name ---
   StepBasic_SiUnitName aName;
   if (data->ParamType(num,2) == Interface_ParamEnum) {
     Standard_CString text = data->ParamCValue(num,2);
-    if(!reader.DecodeName(aName,text))
+    if(!reader.DecodeName(aName,text)){
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
+      return;
+    }
+  }
+  else{
+    ach->AddFail("Parameter #2 (name) is not an enumeration");
+    return;
   }
-  else ach->AddFail("Parameter #2 (name) is not an enumeration");
 
   // --- Instance of plex componant SolidAngleUnit ---
   num = data->NextForComplex(num);
index f10029a516a3668b2f1cc8ef55060e8515072107..656af63e02fafc919f8231341d2380dbcb040bb2 100755 (executable)
@@ -67,20 +67,30 @@ void RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit::ReadStep
     if (data->ParamType(num,1) == Interface_ParamEnum) {
       Standard_CString text = data->ParamCValue(num,1);
       hasAprefix = reader.DecodePrefix(aPrefix,text);
-      if(!hasAprefix)
-       ach->AddFail("Enumeration si_prefix has not an allowed value");
+      if(!hasAprefix){
+             ach->AddFail("Enumeration si_prefix has not an allowed value");
+        return;
+      }
+    }
+    else{
+      ach->AddFail("Parameter #1 (prefix) is not an enumeration");
+      return;
     }
-    else ach->AddFail("Parameter #1 (prefix) is not an enumeration");
   }
   
   // --- field : name ---
   StepBasic_SiUnitName aName;
   if (data->ParamType(num,2) == Interface_ParamEnum) {
     Standard_CString text = data->ParamCValue(num,2);
-    if(!reader.DecodeName(aName,text))
+    if(!reader.DecodeName(aName,text)){
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
+      return;
+    }
+  }
+  else{
+    ach->AddFail("Parameter #2 (name) is not an enumeration");
+    return;
   }
-  else ach->AddFail("Parameter #2 (name) is not an enumeration");
 
   // --- Instance of plex componant SolidAngleUnit ---
   num = data->NextForComplex(num);
index 4177eb19bb7d8a76de131d5324a1e2b0508d91e0..1a9db85bb822d3f0f96ac5099530415dc2746f0f 100755 (executable)
@@ -66,20 +66,30 @@ void RWStepBasic_RWSiUnitAndTimeUnit::ReadStep (const Handle(StepData_StepReader
     if (data->ParamType(num,1) == Interface_ParamEnum) {
       Standard_CString text = data->ParamCValue(num,1);
       hasAprefix = reader.DecodePrefix(aPrefix,text);
-      if(!hasAprefix)
-       ach->AddFail("Enumeration si_prefix has not an allowed value");
+      if(!hasAprefix){
+             ach->AddFail("Enumeration si_prefix has not an allowed value");
+        return;
+      }
+    }
+    else{
+      ach->AddFail("Parameter #1 (prefix) is not an enumeration");
+      return;
     }
-    else ach->AddFail("Parameter #1 (prefix) is not an enumeration");
   }
   
   // --- field : name ---
   StepBasic_SiUnitName aName;
   if (data->ParamType(num,2) == Interface_ParamEnum) {
     Standard_CString text = data->ParamCValue(num,2);
-    if(!reader.DecodeName(aName,text))
+    if(!reader.DecodeName(aName,text)){
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
+      return;
+    }
+  }
+  else{
+    ach->AddFail("Parameter #2 (name) is not an enumeration");
+    return;
   }
-  else ach->AddFail("Parameter #2 (name) is not an enumeration");
   
   // --- Instance of plex componant TimeUnit ---
   num = data->NextForComplex(num);
index 67a39b25a520da89fe24f0b0ec927a083f088b4f..4c00ee099d82cbc10fc6fba09cc93a3651c98b68 100755 (executable)
@@ -49,19 +49,29 @@ void RWStepBasic_RWSiUnitAndVolumeUnit::ReadStep(const Handle(StepData_StepReade
     if (data->ParamType(num,1) == Interface_ParamEnum) {
       Standard_CString text = data->ParamCValue(num,1);
       hasAprefix = reader.DecodePrefix(aPrefix,text);
-      if(!hasAprefix)
-       ach->AddFail("Enumeration si_prefix has not an allowed value");
+      if(!hasAprefix){
+             ach->AddFail("Enumeration si_prefix has not an allowed value");
+        return;
+      }
+    }
+    else{
+      ach->AddFail("Parameter #2 (prefix) is not an enumeration");
+      return;
     }
-    else ach->AddFail("Parameter #2 (prefix) is not an enumeration");
   }
      
   StepBasic_SiUnitName aName;
   if (data->ParamType(num,2) == Interface_ParamEnum) {
     Standard_CString text = data->ParamCValue(num,2);
-    if(!reader.DecodeName(aName,text))
+    if(!reader.DecodeName(aName,text)){
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
+      return;
+    }
+  }
+  else{
+    ach->AddFail("Parameter #3 (name) is not an enumeration");
+    return;
   }
-  else ach->AddFail("Parameter #3 (name) is not an enumeration");
   
   data->NamedForComplex("VOLUME_UNIT",num0,num,ach);
   if (!data->CheckNbParams(num,0,ach,"volume_unit")) return;
index e11f2196c8cd32569e51169fb0656168cde17894..b33881a465debfb6c680cadf65a285b7bccffeee 100755 (executable)
@@ -258,7 +258,7 @@ void TopOpeBRep_ShapeIntersector2d::FindFFIntersection()
   myFFDone = Standard_False;
 //  myFFSameDomain = Standard_False;
   
-  while ( MoreFFCouple() ) {
+  if ( MoreFFCouple() ) {
     
     // The two candidate intersecting GeomShapes GS1,GS2 and their types t1,t2
     const TopoDS_Shape& GS1 = myFaceScanner.Current();
@@ -277,8 +277,6 @@ void TopOpeBRep_ShapeIntersector2d::FindFFIntersection()
     BS.Box(GS1);
     BS.Box(GS2);
     myFFDone = Standard_True;
-    break;
-    NextFFCouple();
   }
   
   SetIntersectionDone();
index 7490a65d805367059e4029815bbfda1e6dbd4af0..e72db5fc6eabb2d3f58faa470e509007da2786e2 100755 (executable)
@@ -366,7 +366,7 @@ Standard_Boolean TopOpeBRepTool_mkTondgE::MkTonE(const TopoDS_Edge& ei, Standard
     else         mkT = outin ? MKI2 : MKI1;
     return Standard_True;
     ////////////////////////////////////////////////
-
+/*
     // xxri : 
     Standard_Real ddot = tgin1di.Dot(faxis);
     Standard_Boolean tgaxis = Abs(1-(Abs(ddot))) < FUN_tola(); //=true : edge is tangent to sphere's axis
@@ -378,7 +378,7 @@ Standard_Boolean TopOpeBRepTool_mkTondgE::MkTonE(const TopoDS_Edge& ei, Standard
       if ((!onfi) && (!onli)) {mkT = MKI12; return Standard_True;} // @190499
       if (closedi)            {mkT = MKI12; return Standard_True;}// onfi || onli @190499
       xxri = tgin1di;
-    }
+    }*/
   }//!isT2d
 
   mkT = MKI12;  // without restrictions.
@@ -387,5 +387,7 @@ Standard_Boolean TopOpeBRepTool_mkTondgE::MkTonE(const TopoDS_Edge& ei, Standard
   Standard_Boolean keepang = (dot > 0);  
   if (keepang) mkT = outin ? MKI1 : MKI2;
   else         mkT = outin ? MKI2 : MKI1;
+
   return Standard_True;
+
 }