From: kgv Date: Wed, 4 Jul 2018 07:49:44 +0000 (+0300) Subject: 0029927: Coding Rules - eliminate GCC compiler warnings -Wmaybe-uninitialized in... X-Git-Tag: OCCT_VC2017_73~83 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=b053e5d673bb1ce74a5b7984c79a07e17dd9b35c;p=occt.git 0029927: Coding Rules - eliminate GCC compiler warnings -Wmaybe-uninitialized in BRepApprox The code has been fixed to avoid taking a reference from a field of a temporary variable (BRepApprox_ApproxLine::Point() returns non-reference structure). --- diff --git a/src/ApproxInt/ApproxInt_Approx.gxx b/src/ApproxInt/ApproxInt_Approx.gxx index 24440e3b22..63cec22986 100644 --- a/src/ApproxInt/ApproxInt_Approx.gxx +++ b/src/ApproxInt/ApproxInt_Approx.gxx @@ -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); diff --git a/src/ApproxInt/ApproxInt_MultiLine.gxx b/src/ApproxInt/ApproxInt_MultiLine.gxx index d19952fb98..ad8472b221 100644 --- a/src/ApproxInt/ApproxInt_MultiLine.gxx +++ b/src/ApproxInt/ApproxInt_MultiLine.gxx @@ -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); }