1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0027104: DownCast() cannot return null for mismatched handle

Method DownCast() is made template, to be available only when argument is actually a pointer or handle to a base class.

For compatibility with existing code, method DownCast() that can be used for the same type, derived, or unrelated class (i.e. where there is no actual down casting) is still available, its use shall cause "deprecated" compiler warning.

OCCT code is updated to remove meaningless DownCast()s; a few places where DownCast() was used with argument of unrelated type are corrected.

DRAW command QAHandleCast is removed (it was useful only during redesign of handles).
This commit is contained in:
abv
2016-01-25 10:14:20 +03:00
parent 5d351a0822
commit a9dde4a31b
65 changed files with 190 additions and 380 deletions

View File

@@ -689,9 +689,7 @@ Handle(Geom_BSplineSurface) StepToGeom::MakeBSplineSurface (const Handle(StepGeo
BSR =
Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)
::DownCast(SS);
BS =
Handle(StepGeom_BSplineSurfaceWithKnots)
::DownCast(BSR->BSplineSurfaceWithKnots());
BS = BSR->BSplineSurfaceWithKnots();
}
else
BS = Handle(StepGeom_BSplineSurfaceWithKnots)::DownCast(SS);
@@ -1526,8 +1524,7 @@ Handle(Geom_Surface) StepToGeom::MakeSurface (const Handle(StepGeom_Surface)& SS
else if (SS->IsKind(STANDARD_TYPE(StepGeom_SurfaceReplica))) { //:n7 abv 16 Feb 99
const Handle(StepGeom_SurfaceReplica) SR = Handle(StepGeom_SurfaceReplica)::DownCast(SS);
const Handle(StepGeom_Surface) PS = SR->ParentSurface();
const Handle(StepGeom_CartesianTransformationOperator3d) T =
Handle(StepGeom_CartesianTransformationOperator3d)::DownCast(SR->Transformation());
const Handle(StepGeom_CartesianTransformationOperator3d) T = SR->Transformation();
// protect against cyclic references and wrong type of cartop
if ( !T.IsNull() && PS != SS ) {
Handle(Geom_Surface) S1 = MakeSurface (PS);

View File

@@ -19,7 +19,7 @@
if (SC->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve))) {
BSCWR = Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)::DownCast(SC);
BSCW = Handle(StepGeom_BSplineCurveWithKnots)::DownCast(BSCWR->BSplineCurveWithKnots());
BSCW = BSCWR->BSplineCurveWithKnots();
}
else
BSCW = Handle(StepGeom_BSplineCurveWithKnots)::DownCast(SC);