mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +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:
@@ -56,7 +56,7 @@ void IGESSolid_ToolManifoldSolid::ReadOwnParams
|
||||
Standard_Boolean abool, shellFlag; //szv#4:S4163:12Mar99 `st` moved down
|
||||
Standard_Integer nbshells, i;
|
||||
Handle(TColStd_HArray1OfInteger) voidShellFlags;
|
||||
Handle(IGESSolid_Shell) shell;
|
||||
Handle(IGESData_IGESEntity) shell;
|
||||
Handle(IGESSolid_Shell) ashell;
|
||||
Handle(IGESSolid_HArray1OfShell) voidShells;
|
||||
IGESData_Status aStatus;
|
||||
@@ -132,7 +132,7 @@ void IGESSolid_ToolManifoldSolid::ReadOwnParams
|
||||
}
|
||||
}
|
||||
DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
|
||||
ent->Init (shell, shellFlag, voidShells, voidShellFlags);
|
||||
ent->Init (Handle(IGESSolid_Shell)::DownCast (shell), shellFlag, voidShells, voidShellFlags);
|
||||
}
|
||||
|
||||
void IGESSolid_ToolManifoldSolid::WriteOwnParams
|
||||
|
@@ -44,7 +44,7 @@ void IGESSolid_ToolToroidalSurface::ReadOwnParams
|
||||
Handle(IGESGeom_Point) tempCenter;
|
||||
Standard_Real majRad, minRad;
|
||||
Handle(IGESGeom_Direction) tempAxis; // default Unparametrised
|
||||
Handle(IGESGeom_Direction) tempRefdir; // default Unparametrised
|
||||
Handle(IGESData_IGESEntity) tempRefdir; // default Unparametrised
|
||||
//Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
|
||||
|
||||
PR.ReadEntity(IR, PR.Current(), "Center point",
|
||||
@@ -61,7 +61,7 @@ void IGESSolid_ToolToroidalSurface::ReadOwnParams
|
||||
PR.ReadEntity(IR, PR.Current(), "Reference direction", tempRefdir); //szv#4:S4163:12Mar99 `st=` not needed
|
||||
|
||||
DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
|
||||
ent->Init (tempCenter, tempAxis, majRad, minRad, tempRefdir);
|
||||
ent->Init (tempCenter, tempAxis, majRad, minRad, Handle(IGESGeom_Direction)::DownCast (tempRefdir));
|
||||
}
|
||||
|
||||
void IGESSolid_ToolToroidalSurface::WriteOwnParams
|
||||
|
Reference in New Issue
Block a user