1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0029164: GCC 7.1 compiler warnings -Wmaybe-uninitialized in gp_XYZ and siblings

Code is corrected to avoid local variables of reference type pointing to fields of temporary objects.
This commit is contained in:
abv 2017-09-29 18:35:03 +03:00 committed by bugmaster
parent b1811c1d2b
commit 9b372aa8ba
5 changed files with 19 additions and 16 deletions

View 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);

View 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
}
}

View 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

View 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();

View 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();