]> OCCT Git - occt.git/commitdiff
0029164: GCC 7.1 compiler warnings -Wmaybe-uninitialized in gp_XYZ and siblings
authorabv <abv@opencascade.com>
Fri, 29 Sep 2017 15:35:03 +0000 (18:35 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 5 Oct 2017 10:18:14 +0000 (13:18 +0300)
Code is corrected to avoid local variables of reference type pointing to fields of temporary objects.

src/AIS/AIS_EqualDistanceRelation.cxx
src/BRepClass3d/BRepClass3d_SClassifier.cxx
src/DrawDim/DrawDim_Distance.cxx
src/TopOpeBRepTool/TopOpeBRepTool_GEOMETRY.cxx
src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx

index f4d36283844f49010e9dfd8d7449c4ad2273d19f..96f21f646d9a34ee637c436713be6212218550c1 100644 (file)
@@ -639,8 +639,8 @@ void AIS_EqualDistanceRelation::ComputeTwoVerticesLength( const Handle( Prs3d_Pr
      curpos.Translate(offset);
      Position = curpos;
    }
-   else {  
-     const gp_Dir& aDir = Plane->Pln().Axis().Direction();
+   else {
+     gp_Dir aDir = Plane->Pln().Axis().Direction();
      gp_Vec aVec (aDir.XYZ()*10*ArrowSize);
      //Position = gp_Pnt(FirstAttach.XYZ()+gp_XYZ(1.,1.,1.)); // not correct
      Position = FirstAttach.Translated(aVec);
index edc87e24d4691b513ad93b4b0f16718561e99daa..451336da096a87822101d94869ad4fc7d827f51f 100644 (file)
@@ -47,9 +47,9 @@ static
   Standard_Real GetAddToParam(const gp_Lin& L,const Standard_Real P,const Bnd_Box& B);
 
 //gets transition of line <L> passing through/near the edge <e> of faces <f1>, <f2>. <param> is
-// a parameter on the edge where the minimum distance between <l> and <e> was found 
-static Standard_Integer GetTransi(const TopoDS_Face& f1, const TopoDS_Face& f2, const TopoDS_Edge e, 
-                     Standard_Real param, const Geom_Line& L, IntCurveSurface_TransitionOnCurve& trans);
+// a parameter on the edge where the minimum distance between <l> and <e> was found
+static Standard_Integer GetTransi(const TopoDS_Face& f1, const TopoDS_Face& f2, const TopoDS_Edge e,
+                     Standard_Real param, const gp_Lin& L, IntCurveSurface_TransitionOnCurve& trans);
 
 static Standard_Boolean GetNormalOnFaceBound(const TopoDS_Edge& E, const TopoDS_Face& F, Standard_Real param, gp_Dir& OutDir);
 
@@ -560,7 +560,7 @@ static Standard_Integer GetTransi(const TopoDS_Face& f1,
                                   const TopoDS_Face& f2,
                                   const TopoDS_Edge e,
                                   const Standard_Real param,
-                                  const Geom_Line& L,
+                                  const gp_Lin& L,
                                   IntCurveSurface_TransitionOnCurve& trans)
 {
   //return statuses:
@@ -573,7 +573,7 @@ static Standard_Integer GetTransi(const TopoDS_Face& f1,
   if (!GetNormalOnFaceBound(e, f2, param, nf2))
     return -1;
 
-  const gp_Dir& LDir = L.Lin().Direction();
+  const gp_Dir& LDir = L.Direction();
 
   if(Abs(LDir.Dot(nf1)) < Precision::Angular() || Abs(LDir.Dot(nf2)) < Precision::Angular())
   {
@@ -627,4 +627,4 @@ static void Trans(const Standard_Real parmin,
     state = 3; // IN
   else
     state = 4; // OUT
-}
\ No newline at end of file
+}
index 6f2ca45fbd706944f1b1439eb037ec46e8a20019..fa459d35ae4e659eea4a0c0b4000e30756bfe98f 100644 (file)
@@ -114,8 +114,8 @@ void DrawDim_Distance::DrawOn(Draw_Display& dis) const
   // today we process only planar faces
   if (surf1.GetType() != GeomAbs_Plane)
     return;
-  
-  const gp_Ax1& anAx1 = surf1.Plane().Axis();
+
+  gp_Ax1 anAx1 = surf1.Plane().Axis();
   gp_Vec V = anAx1.Direction();
 
   // output
index 45953e8b1e654854cc049efabf15e8116035c90f..ef4d4ee57f71c71b3027f393b255cdf63d7d7000 100644 (file)
@@ -119,9 +119,10 @@ Standard_EXPORT gp_Dir FUN_tool_ngS(const gp_Pnt2d& p2d,const Handle(Geom_Surfac
       Standard_Boolean nullx = (Abs(p2d.X()) < toluv);
       Standard_Boolean apex = nullx && (Abs(p2d.Y()) < toluv);
       if (apex) {
-       const gp_Dir& axis = GS.Cone().Axis().Direction();
-       gp_Vec ng(axis); ng.Reverse();
-       return ng;
+        gp_Dir axis = GS.Cone().Axis().Direction();
+        gp_Vec ng(axis);
+        ng.Reverse();
+        return ng;
       }
       else if (du < tol) {
        Standard_Real vf = GS.FirstVParameter();
index e3064263a3819fdd5f2f0fbfe2b2ff663501d676..90add9ca4d40e9b6cd6760fb7444fb24e471df5d 100644 (file)
@@ -1245,9 +1245,11 @@ static Standard_Boolean FUN_ngF(const gp_Pnt2d& uv, const TopoDS_Face& F, gp_Vec
       Standard_Boolean nullx = (Abs(uv.X()) < tolu);
       Standard_Boolean apex = nullx && (Abs(uv.Y()) < tolv);
       if (apex) {
-       const gp_Dir& axis = bs.Cone().Axis().Direction();
-       gp_Vec ng(axis); ng.Reverse();
-       ngF = ng; return Standard_True;
+        const gp_Dir axis = bs.Cone().Axis().Direction();
+        gp_Vec ng(axis);
+        ng.Reverse();
+        ngF = ng;
+        return Standard_True;
       }
       else if (du < tolu) {            
        Standard_Real x = uv.X();