mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-26 10:16:18 +08: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:
@@ -211,9 +211,14 @@ Standard_Boolean StepData_StepReaderTool::AnalyseRecord
|
||||
Handle(Interface_Check)& acheck)
|
||||
{
|
||||
DeclareAndCast(StepData_StepReaderData,stepdat,Data());
|
||||
Handle(StepData_ReadWriteModule) module; Standard_Integer CN;
|
||||
if (therlib.Select(anent,module,CN))
|
||||
Handle(Interface_ReaderModule) imodule;
|
||||
Standard_Integer CN;
|
||||
if (therlib.Select(anent,imodule,CN))
|
||||
{
|
||||
Handle(StepData_ReadWriteModule) module =
|
||||
Handle(StepData_ReadWriteModule)::DownCast (imodule);
|
||||
module->ReadStep(CN,stepdat,num,acheck,anent);
|
||||
}
|
||||
else {
|
||||
// Pas trouve : tenter UndefinedEntity de StepData
|
||||
DeclareAndCast(StepData_UndefinedEntity,und,anent);
|
||||
|
||||
Reference in New Issue
Block a user