Cleanup some dynamic casts

From Coverity scan
This commit is contained in:
Ian McInerney 2020-04-04 12:41:45 +01:00
parent 306ebb0e89
commit 0dac0c9a47
3 changed files with 17 additions and 7 deletions

View File

@ -395,6 +395,8 @@ void SCH_EDIT_FRAME::AddFormattingParameters( std::vector<PARAM_CFG*>& params )
{
EESCHEMA_SETTINGS* appSettings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxCHECK( appSettings, /*void*/ );
params.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ),
LIB_PART::SubpartIdSeparatorPtr(), 0, 0, 126 ) );
params.push_back( new PARAM_CFG_INT( wxT( "SubpartFirstId" ),

View File

@ -1405,7 +1405,10 @@ void ALTIUM_PCB::ParseArcs6Data(
if( elem.component != ALTIUM_COMPONENT_NONE )
{
dynamic_cast<EDGE_MODULE*>( ds )->SetLocalCoord();
auto em = dynamic_cast<EDGE_MODULE*>( ds );
if( em )
em->SetLocalCoord();
}
}
}
@ -1842,16 +1845,21 @@ void ALTIUM_PCB::ParseTexts6Data(
itm->SetPosition( elem.position );
tx->SetTextAngle( elem.rotation * 10. );
if( elem.component != ALTIUM_COMPONENT_NONE )
{
TEXTE_MODULE* txm = dynamic_cast<TEXTE_MODULE*>( tx );
if( elem.isDesignator || elem.isComment )
if( txm )
{
double orientation =
static_cast<const MODULE*>( txm->GetParent() )->GetOrientation();
txm->SetTextAngle( orientation + txm->GetTextAngle() );
if( elem.isDesignator || elem.isComment )
{
double orientation =
static_cast<const MODULE*>( txm->GetParent() )->GetOrientation();
txm->SetTextAngle( orientation + txm->GetTextAngle() );
}
txm->SetLocalCoord();
}
txm->SetLocalCoord();
}
PCB_LAYER_ID klayer = GetKicadLayer( elem.layer );

View File

@ -695,7 +695,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
void FOOTPRINT_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
wxASSERT( cfg );
wxCHECK( cfg, /*void*/ );
PCB_BASE_FRAME::LoadSettings( aCfg );