1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0026377: Passing Handle objects as arguments to functions as non-const reference to base type is dangerous

Operator of cast to non-const reference is declared deprecated to produce compiler warning if used (usually implicitly).

OCCT code is updated to avoid that cast, occurring when function accepting non-const reference to handle is called with handle to derived type.
For that, local variable of argument type is passed instead, and down-cast is used to get it to desired type after the call.
A few occurrences of use of uninitialized variable are corrected.
This commit is contained in:
abv
2016-02-17 17:33:18 +03:00
parent fe9b8ff2f2
commit aa00364da7
59 changed files with 395 additions and 211 deletions

View File

@@ -1762,7 +1762,9 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
Standard_Boolean is_planar (aConst->IsPlanar());
Handle(Geom_Plane) aplane;
if (is_planar) {
GetGeom (aConst,aplane);
Handle(Geom_Geometry) ageom;
GetGeom (aConst,ageom);
aplane = Handle(Geom_Plane)::DownCast (ageom);
if (aplane.IsNull()) {
#ifdef OCCT_DEBUG
cout << "TPrsStd_ConstraintTools::ComputeOffset: null plane" << endl;
@@ -2090,8 +2092,9 @@ void TPrsStd_ConstraintTools::ComputeCoincident(const Handle(TDataXtd_Constraint
}
TopoDS_Shape shape1,shape2 ;
Handle(Geom_Plane) aplane;
GetShapesAndGeom(aConst,shape1,shape2,aplane);
Handle(Geom_Geometry) ageom;
GetShapesAndGeom(aConst,shape1,shape2,ageom);
Handle(Geom_Plane) aplane = Handle(Geom_Plane)::DownCast (ageom);
if (shape1.IsNull() || shape2.IsNull()) {
#ifdef OCCT_DEBUG
cout << "TPrsStd_ConstraintTools::ComputeCoincident: nul shape" << endl;