]> OCCT Git - occt.git/commitdiff
0029927: Coding Rules - eliminate GCC compiler warnings -Wmaybe-uninitialized in...
authorkgv <kgv@opencascade.com>
Wed, 4 Jul 2018 07:49:44 +0000 (10:49 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 6 Jul 2018 12:54:34 +0000 (15:54 +0300)
The code has been fixed to avoid taking a reference from a field of a temporary variable
(BRepApprox_ApproxLine::Point() returns non-reference structure).

src/ApproxInt/ApproxInt_Approx.gxx
src/ApproxInt/ApproxInt_MultiLine.gxx

index 24440e3b221e1e366d4d05d608b9b6a1f776b769..63cec229868a1fa593bea36041a76651d4cbb8bf 100644 (file)
@@ -42,8 +42,8 @@ static void ComputeTrsf3d(const Handle(TheWLine)& theline,
   const Standard_Integer aNbPnts = theline->NbPnts();
   Standard_Real aXmin = RealLast(), aYmin = RealLast(), aZmin = RealLast();
   for(Standard_Integer i=1;i<=aNbPnts;i++)
-  { 
-    const gp_Pnt& P = theline->Point(i).Value();
+  {
+    const gp_Pnt P = theline->Point(i).Value();
     aXmin = Min(P.X(), aXmin);
     aYmin = Min(P.Y(), aYmin);
     aZmin = Min(P.Z(), aZmin);
@@ -75,8 +75,8 @@ static void ComputeTrsf2d(const Handle(TheWLine)& theline,
     pfunc = &IntSurf_PntOn2S::ParametersOnS2;
   
   for(Standard_Integer i=1; i<=aNbPnts; i++)
-  { 
-    const IntSurf_PntOn2S POn2S = theline->Point(i);
+  {
+    const IntSurf_PntOn2S POn2S = theline->Point(i);
     Standard_Real  U,V;
     (POn2S.*pfunc)(U,V);
     aUmin = Min(U, aUmin);
index d19952fb98a18841a5eb28f7f14e16c1acd5b6d0..ad8472b2213ce4bb619ec4c5aecb5bc3d7f9b762 100644 (file)
@@ -156,9 +156,9 @@ Standard_Integer ApproxInt_MultiLine::NbP2d() const {
 }
 //================================================================================
 void ApproxInt_MultiLine::Value(const Standard_Integer  Index,
-                                TColgp_Array1OfPnt&     TabPnt)  const 
-{ 
-  const gp_Pnt& aP = myLine->Point(Index).Value();
+                                TColgp_Array1OfPnt&     TabPnt)  const
+{
+  const gp_Pnt aP = myLine->Point(Index).Value();
   TabPnt(1).SetCoord(aP.X()+Xo, aP.Y()+Yo, aP.Z()+Zo);
 }