fix a few Coverity warnings and compil minor warnings.

This commit is contained in:
jean-pierre charras 2020-04-03 09:54:47 +02:00
parent f6d7ef367d
commit b1b8a32078
5 changed files with 23 additions and 12 deletions

View File

@ -65,17 +65,22 @@ void EDA_3D_CONTROLLER::Reset( RESET_REASON aReason )
{
TOOLS_HOLDER* holder = m_toolMgr->GetToolHolder();
m_canvas = nullptr;
m_boardAdapter = nullptr;
m_camera = nullptr;
if( holder )
{
m_canvas = dynamic_cast<EDA_3D_CANVAS*>( holder->GetToolCanvas() );
m_boardAdapter = &dynamic_cast<EDA_3D_BOARD_HOLDER*>( holder )->GetAdapter();
m_camera = &dynamic_cast<EDA_3D_BOARD_HOLDER*>( holder )->GetCurrentCamera();
}
else
{
m_canvas = nullptr;
m_boardAdapter = nullptr;
m_camera = nullptr;
EDA_3D_BOARD_HOLDER* holder3d =
dynamic_cast<EDA_3D_BOARD_HOLDER*>( holder->GetToolCanvas() );
if( holder3d )
{
m_boardAdapter = &holder3d->GetAdapter();
m_camera = &holder3d->GetCurrentCamera();
}
}
}

View File

@ -35,6 +35,12 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( std::string aFilename, int aSchemaVersion
JSON_SETTINGS( std::move( aFilename ), SETTINGS_LOC::USER, appSettingsSchemaVersion ),
m_Printing(), m_System(), m_Window(), m_appSettingsSchemaVersion( aSchemaVersion )
{
// Make Coverity happy:
m_LibTree.column_width = 360;
m_Graphics.canvas_type = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
// Build parameters list:
m_params.emplace_back( new PARAM<int>( "find_replace.flags", &m_FindReplace.flags, 1 ) );
m_params.emplace_back( new PARAM<wxString>( "find_replace.find_string",

View File

@ -395,7 +395,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// Only do this if RescueNeverShow was not set.
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
if( !cfg->m_RescueNeverShow )
if( !cfg || !cfg->m_RescueNeverShow )
RescueSymbolLibTableProject( false );
}

View File

@ -93,7 +93,7 @@ wxString SCH_FIELD::GetShownText() const
}
}
for( int i = MANDATORY_FIELDS; i < fields.size(); ++i )
for( size_t i = MANDATORY_FIELDS; i < fields.size(); ++i )
{
if( token->IsSameAs( fields[i].GetName() )
|| token->IsSameAs( fields[i].GetName().Upper() ) )
@ -152,7 +152,7 @@ wxString SCH_FIELD::GetShownText() const
}
}
for( int i = SHEET_MANDATORY_FIELDS; i < fields.size(); ++i )
for( size_t i = SHEET_MANDATORY_FIELDS; i < fields.size(); ++i )
{
if( token->IsSameAs( fields[i].GetName() ) )
{

View File

@ -487,7 +487,7 @@ wxString SCH_TEXT::GetShownText() const
}
}
for( int i = SHEET_MANDATORY_FIELDS; i < fields.size(); ++i )
for( size_t i = SHEET_MANDATORY_FIELDS; i < fields.size(); ++i )
{
if( token->IsSameAs( fields[i].GetName() ) )
{