From 53b2fda184c30e24164060007ea2517fb5ab6ce6 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 17 Aug 2023 10:06:02 +0200 Subject: [PATCH] Fix some minor compil and Coverity warnings. --- 3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp | 2 +- 3d-viewer/dialogs/appearance_controls_3D.cpp | 3 ++- common/jobs/job_dispatcher.cpp | 1 + common/lib_table_base.cpp | 2 +- common/tool/tool_action.cpp | 1 + eeschema/dialogs/dialog_change_symbols.cpp | 5 +++-- eeschema/fields_data_model.h | 1 + pcbnew/plugins/eagle/eagle_plugin.h | 2 +- pcbnew/plugins/geda/gpcb_plugin.cpp | 1 - pcbnew/plugins/pcad/pcad_plugin.h | 4 ++-- 10 files changed, 13 insertions(+), 9 deletions(-) diff --git a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp index 52bffd979e..ff09ced869 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp @@ -396,7 +396,7 @@ void EDA_3D_VIEWER_FRAME::NewDisplay( bool aForceImmediateRedraw ) // After the ReloadRequest call, the refresh often takes a bit of time, // and it is made here only on request. - if( aForceImmediateRedraw ) + if( m_canvas && aForceImmediateRedraw ) m_canvas->Refresh(); } diff --git a/3d-viewer/dialogs/appearance_controls_3D.cpp b/3d-viewer/dialogs/appearance_controls_3D.cpp index 08088b4a77..0435381dc1 100644 --- a/3d-viewer/dialogs/appearance_controls_3D.cpp +++ b/3d-viewer/dialogs/appearance_controls_3D.cpp @@ -81,7 +81,8 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, wxWindow* aFocusOwner ) : APPEARANCE_CONTROLS_3D_BASE( aParent ), m_frame( aParent ), - m_focusOwner( aFocusOwner ) + m_focusOwner( aFocusOwner ), + m_lastSelectedViewport( nullptr ) { DPI_SCALING dpi( nullptr, m_frame ); diff --git a/common/jobs/job_dispatcher.cpp b/common/jobs/job_dispatcher.cpp index 6623f7945e..65b92602d8 100644 --- a/common/jobs/job_dispatcher.cpp +++ b/common/jobs/job_dispatcher.cpp @@ -27,6 +27,7 @@ JOB_DISPATCHER::JOB_DISPATCHER() { m_reporter = &NULL_REPORTER::GetInstance(); + m_progressReporter = nullptr; } diff --git a/common/lib_table_base.cpp b/common/lib_table_base.cpp index c96332d7d3..6f302c1610 100644 --- a/common/lib_table_base.cpp +++ b/common/lib_table_base.cpp @@ -344,7 +344,7 @@ bool LIB_TABLE::RemoveRow( const LIB_TABLE_ROW* aRow ) if( !found ) { // Bookkeeping got messed up... - for( size_t i = m_rows.size() - 1; i >= 0; --i ) + for( int i = (int)m_rows.size() - 1; i >= 0; --i ) { if( &m_rows[i] == aRow ) { diff --git a/common/tool/tool_action.cpp b/common/tool/tool_action.cpp index c37e2b7e9c..d3163a61d8 100644 --- a/common/tool/tool_action.cpp +++ b/common/tool/tool_action.cpp @@ -73,6 +73,7 @@ TOOL_ACTION::TOOL_ACTION( const TOOL_ACTION_ARGS& aArgs ) : m_defaultHotKey( aArgs.m_defaultHotKey.value_or( 0 ) ), m_defaultHotKeyAlt( aArgs.m_defaultHotKeyAlt.value_or( 0 ) ), m_hotKey( aArgs.m_defaultHotKey.value_or( 0 ) ), + m_hotKeyAlt( 0 ), m_legacyName( aArgs.m_legacyName.value_or( "" ) ), m_label( TowxString( aArgs.m_menuText.value_or( "" ) ) ), m_tooltip( TowxString( aArgs.m_tooltip.value_or( "" ) ) ), diff --git a/eeschema/dialogs/dialog_change_symbols.cpp b/eeschema/dialogs/dialog_change_symbols.cpp index b77ef0731f..a0910c3e60 100644 --- a/eeschema/dialogs/dialog_change_symbols.cpp +++ b/eeschema/dialogs/dialog_change_symbols.cpp @@ -370,12 +370,13 @@ void DIALOG_CHANGE_SYMBOLS::checkAll( bool aCheck ) void DIALOG_CHANGE_SYMBOLS::onOkButtonClicked( wxCommandEvent& aEvent ) { - wxBusyCursor dummy; SCH_EDIT_FRAME* parent = dynamic_cast( GetParent() ); - SCH_COMMIT commit( parent ); wxCHECK( parent, /* void */ ); + wxBusyCursor dummy; + SCH_COMMIT commit( parent ); + m_messagePanel->Clear(); m_messagePanel->Flush( false ); diff --git a/eeschema/fields_data_model.h b/eeschema/fields_data_model.h index 48101f43c7..9aed61f14d 100644 --- a/eeschema/fields_data_model.h +++ b/eeschema/fields_data_model.h @@ -28,6 +28,7 @@ struct DATA_MODEL_ROW { DATA_MODEL_ROW( const SCH_REFERENCE& aFirstReference, GROUP_TYPE aType ) { + m_ItemNumber = 0; m_Refs.push_back( aFirstReference ); m_Flag = aType; } diff --git a/pcbnew/plugins/eagle/eagle_plugin.h b/pcbnew/plugins/eagle/eagle_plugin.h index 4d3eade1c2..74489b84cd 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.h +++ b/pcbnew/plugins/eagle/eagle_plugin.h @@ -129,7 +129,7 @@ struct ERULES class EAGLE_PLUGIN : public PLUGIN, public LAYER_REMAPPABLE_PLUGIN { public: - const wxString PluginName() const { return wxT( "Eagle" ); } + const wxString PluginName() const override { return wxT( "Eagle" ); } PLUGIN_FILE_DESC GetBoardFileDesc() const override { diff --git a/pcbnew/plugins/geda/gpcb_plugin.cpp b/pcbnew/plugins/geda/gpcb_plugin.cpp index a6c3f6449b..72bd130c90 100644 --- a/pcbnew/plugins/geda/gpcb_plugin.cpp +++ b/pcbnew/plugins/geda/gpcb_plugin.cpp @@ -842,7 +842,6 @@ FOOTPRINT* GPCB_PLUGIN::ImportFootprint( const wxString& aFootprintPath, FILE_LINE_READER freader( aFootprintPath ); WHITESPACE_FILTER_READER reader( freader ); - IO_MGR::PCB_FILE_T file_type; reader.ReadLine(); char* line = reader.Line(); diff --git a/pcbnew/plugins/pcad/pcad_plugin.h b/pcbnew/plugins/pcad/pcad_plugin.h index 2e0654fd28..2427f3f9ed 100644 --- a/pcbnew/plugins/pcad/pcad_plugin.h +++ b/pcbnew/plugins/pcad/pcad_plugin.h @@ -38,9 +38,9 @@ public: PCAD_PLUGIN(); ~PCAD_PLUGIN(); - const wxString PluginName() const { return wxT( "P-Cad" ); } + const wxString PluginName() const override { return wxT( "P-Cad" ); } - PLUGIN_FILE_DESC GetBoardFileDesc() const + PLUGIN_FILE_DESC GetBoardFileDesc() const override { return PLUGIN_FILE_DESC( _HKI( "P-Cad 200x ASCII PCB files" ), { "pcb" } ); }