0029157: Modeling - suspicious pass-through of case labels in switch statements
authormsv <msv@opencascade.com>
Wed, 18 Oct 2017 16:20:30 +0000 (19:20 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 19 Oct 2017 09:26:50 +0000 (12:26 +0300)
Suspicious passes through case labels have been resolved either by using Standard_FALLTHROUGH macro or by redesigning the code.

src/GeomFill/GeomFill_Frenet.cxx
src/IntCurveSurface/IntCurveSurface_Inter.gxx
src/IntWalk/IntWalk_PWalking.cxx

index d1858ef..fbf64ac 100644 (file)
@@ -129,13 +129,14 @@ Handle(GeomFill_TrihedronLaw) GeomFill_Frenet::Copy() const
     case GeomAbs_Parabola:
     case GeomAbs_Line:
       {
-       // No probleme
-       isSngl = Standard_False;
+        // No probleme
+        isSngl = Standard_False;
+        break;
       }
      default :
        { 
-        // We have to search singulaties
-        Init(); 
+         // We have to search singulaties
+         Init();
        }
     }
   }
index e0bad06..7864735 100644 (file)
@@ -916,6 +916,7 @@ void IntCurveSurface_Inter::PerformConicSurf(const gp_Lin&   Line,
   
 
   GeomAbs_SurfaceType SurfaceType = TheSurfaceTool::GetType(surface);
+  Standard_Boolean isAnaProcessed = Standard_True;
   switch(SurfaceType) { 
   case GeomAbs_Plane: 
     {
@@ -937,94 +938,99 @@ void IntCurveSurface_Inter::PerformConicSurf(const gp_Lin&   Line,
     }
   case GeomAbs_Torus: 
     {
-      IntAna_IntLinTorus intlintorus(Line,TheSurfaceTool::Torus(surface));
-      if(intlintorus.IsDone()) { 
-       Standard_Integer nbp = intlintorus.NbPoints();
-       Standard_Real fi,theta,w;
-       for(Standard_Integer i = 1; i<= nbp; i++) { 
-         const gp_Pnt aDebPnt(intlintorus.Value(i));
-         (void )aDebPnt;
-         w = intlintorus.ParamOnLine(i);
-         intlintorus.ParamOnTorus(i,fi,theta);
-         AppendPoint(curve,w,surface,fi,theta);
-       }
-       break;
+      IntAna_IntLinTorus intlintorus(Line, TheSurfaceTool::Torus(surface));
+      if (intlintorus.IsDone()) {
+        Standard_Integer nbp = intlintorus.NbPoints();
+        Standard_Real fi, theta, w;
+        for (Standard_Integer i = 1; i <= nbp; i++) {
+          const gp_Pnt aDebPnt(intlintorus.Value(i));
+          (void)aDebPnt;
+          w = intlintorus.ParamOnLine(i);
+          intlintorus.ParamOnTorus(i, fi, theta);
+          AppendPoint(curve, w, surface, fi, theta);
+        }
       }
-    }  //-- Si Done retourne False, On passe dans Default !! 
+      else
+        isAnaProcessed = Standard_False;
+      break;
+    }
   case GeomAbs_Cone:
     {
-      //OCC516(apo)->
       const Standard_Real correction = 1.E+5*Precision::Angular();
       gp_Cone cn = TheSurfaceTool::Cone(surface);
-      if(Abs(cn.SemiAngle()) < M_PI/2.0 - correction){
-       IntAna_IntConicQuad LinCone(Line,cn);
-       AppendIntAna(curve,surface,LinCone);
-       break;
-      }//<-OCC516(apo)
-    }   
-  default: 
-    {
-      Standard_Integer nbsu,nbsv;
-      nbsu = TheSurfaceTool::NbSamplesU(surface,U1,U2);
-      nbsv = TheSurfaceTool::NbSamplesV(surface,V1,V2);
+      if(Abs(cn.SemiAngle()) < M_PI/2.0 - correction) {
+        IntAna_IntConicQuad LinCone(Line, cn);
+        AppendIntAna(curve, surface, LinCone);
+      }
+      else
+        isAnaProcessed = Standard_False;
+      break;
+    }
+  default:
+    isAnaProcessed = Standard_False;
+  }
+  if (!isAnaProcessed)
+  {
+    Standard_Integer nbsu,nbsv;
+    nbsu = TheSurfaceTool::NbSamplesU(surface,U1,U2);
+    nbsv = TheSurfaceTool::NbSamplesV(surface,V1,V2);
 
-      Standard_Boolean U1inf = Precision::IsInfinite(U1);
-      Standard_Boolean U2inf = Precision::IsInfinite(U2);
-      Standard_Boolean V1inf = Precision::IsInfinite(V1);
-      Standard_Boolean V2inf = Precision::IsInfinite(V2);
+    Standard_Boolean U1inf = Precision::IsInfinite(U1);
+    Standard_Boolean U2inf = Precision::IsInfinite(U2);
+    Standard_Boolean V1inf = Precision::IsInfinite(V1);
+    Standard_Boolean V2inf = Precision::IsInfinite(V2);
 
-      Standard_Real U1new=U1, U2new=U2, V1new=V1, V2new=V2;
+    Standard_Real U1new=U1, U2new=U2, V1new=V1, V2new=V2;
 
-      Standard_Boolean NoIntersection = Standard_False;
+    Standard_Boolean NoIntersection = Standard_False;
 
-      if(U1inf || U2inf || V1inf || V2inf ) {
+    if(U1inf || U2inf || V1inf || V2inf ) {
 
-       if(SurfaceType == GeomAbs_SurfaceOfExtrusion) {
+      if(SurfaceType == GeomAbs_SurfaceOfExtrusion) {
 
-         EstLimForInfExtr(Line, surface, Standard_False, nbsu, 
-                          U1inf, U2inf, V1inf, V2inf, 
-                          U1new, U2new, V1new, V2new, NoIntersection);
+        EstLimForInfExtr(Line, surface, Standard_False, nbsu,
+                         U1inf, U2inf, V1inf, V2inf,
+                         U1new, U2new, V1new, V2new, NoIntersection);
 
-       } 
-       else if(SurfaceType == GeomAbs_SurfaceOfRevolution) {
+      }
+      else if (SurfaceType == GeomAbs_SurfaceOfRevolution) {
 
-         EstLimForInfRevl(Line, surface,  
-                          U1inf, U2inf, V1inf, V2inf, 
-                          U1new, U2new, V1new, V2new, NoIntersection);
+        EstLimForInfRevl(Line, surface,
+                         U1inf, U2inf, V1inf, V2inf,
+                         U1new, U2new, V1new, V2new, NoIntersection);
 
-       } 
-       else if(SurfaceType == GeomAbs_OffsetSurface) {
+      }
+      else if (SurfaceType == GeomAbs_OffsetSurface) {
 
-         EstLimForInfOffs(Line, surface, nbsu,  
-                          U1inf, U2inf, V1inf, V2inf, 
-                          U1new, U2new, V1new, V2new, NoIntersection);
-       }
-       else {
-           
-         EstLimForInfSurf(U1new, U2new, V1new, V2new);
-       }
+        EstLimForInfOffs(Line, surface, nbsu,
+                         U1inf, U2inf, V1inf, V2inf,
+                         U1new, U2new, V1new, V2new, NoIntersection);
+      }
+      else {
 
+        EstLimForInfSurf(U1new, U2new, V1new, V2new);
       }
 
+    }
+
 
-      if(NoIntersection) return;
+    if(NoIntersection) return;
 
 
-      // modified by NIZHNY-OFV  Mon Aug 20 14:56:47 2001 (60963 begin)
-      if(nbsu<20) nbsu=20;
-      if(nbsv<20) nbsv=20;
-      // modified by NIZHNY-OFV  Mon Aug 20 14:57:06 2001 (60963 end)
-      IntCurveSurface_ThePolyhedron polyhedron(surface,nbsu,nbsv,U1new,V1new,U2new,V2new);
-      Intf_Tool                         bndTool;
-      Bnd_Box                          boxLine;
-      bndTool.LinBox(Line,polyhedron.Bounding(),boxLine);
-      for(Standard_Integer nbseg=1; nbseg<= bndTool.NbSegments(); nbseg++) { 
-       Standard_Real pinf = bndTool.BeginParam(nbseg);
-       Standard_Real psup = bndTool.EndParam(nbseg);
-       if((psup - pinf)<1e-10) { pinf-=1e-10; psup+=1e-10; } 
-       IntCurveSurface_ThePolygon polygon(curve, pinf,psup,2);
-       InternalPerform(curve,polygon,surface,polyhedron,U1new,V1new,U2new,V2new);
-      }
+    // modified by NIZHNY-OFV  Mon Aug 20 14:56:47 2001 (60963 begin)
+    if(nbsu<20) nbsu=20;
+    if(nbsv<20) nbsv=20;
+    // modified by NIZHNY-OFV  Mon Aug 20 14:57:06 2001 (60963 end)
+    IntCurveSurface_ThePolyhedron polyhedron(surface,nbsu,nbsv,U1new,V1new,U2new,V2new);
+    Intf_Tool                     bndTool;
+    Bnd_Box                       boxLine;
+    bndTool.LinBox(Line,polyhedron.Bounding(),boxLine);
+    for(Standard_Integer nbseg=1; nbseg<= bndTool.NbSegments(); nbseg++) { 
+      Standard_Real pinf = bndTool.BeginParam(nbseg);
+      Standard_Real psup = bndTool.EndParam(nbseg);
+      if((psup - pinf)<1e-10) { pinf-=1e-10; psup+=1e-10; } 
+      IntCurveSurface_ThePolygon polygon(curve, pinf,psup,2);
+      InternalPerform(curve,polygon,surface,polyhedron,U1new,V1new,U2new,V2new);
     }
   }
 }
index 92298b0..141e905 100644 (file)
@@ -1168,6 +1168,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
               break;
             }
           }
+          Standard_FALLTHROUGH
         case IntWalk_OK:
         case IntWalk_ArretSurPoint://006
           {