Browse Source

fix a few Coverity warnings and compil minor warnings.

pull/16/head
jean-pierre charras 6 years ago
parent
commit
b1b8a32078
  1. 21
      3d-viewer/3d_viewer/tools/3d_controller.cpp
  2. 6
      common/settings/app_settings.cpp
  3. 2
      eeschema/files-io.cpp
  4. 4
      eeschema/sch_field.cpp
  5. 2
      eeschema/sch_text.cpp

21
3d-viewer/3d_viewer/tools/3d_controller.cpp

@ -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();
}
}
}

6
common/settings/app_settings.cpp

@ -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",

2
eeschema/files-io.cpp

@ -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 );
}

4
eeschema/sch_field.cpp

@ -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() ) )
{

2
eeschema/sch_text.cpp

@ -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() ) )
{

Loading…
Cancel
Save