From 07f79208b902314df948ef063e7868f1a2bbaef4 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 18 Feb 2023 13:04:30 +0100 Subject: [PATCH] Minor fixes: Coverity and compil minor warnings. --- eeschema/dialogs/dialog_export_netlist.cpp | 1 + eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp | 4 ++-- eeschema/sim/sim_plot_frame.cpp | 4 +++- eeschema/sim/toolbars_sim_plot_frame.cpp | 12 ++++++++---- .../fliege_filter/fliege_filter.kicad_sch-bak | 5 ----- qa/unittests/eeschema/test_netlist_exporter_spice.h | 4 +++- 6 files changed, 17 insertions(+), 13 deletions(-) delete mode 100644 qa/data/eeschema/spice_netlists/fliege_filter/fliege_filter.kicad_sch-bak diff --git a/eeschema/dialogs/dialog_export_netlist.cpp b/eeschema/dialogs/dialog_export_netlist.cpp index d087db822a..7b967262f5 100644 --- a/eeschema/dialogs/dialog_export_netlist.cpp +++ b/eeschema/dialogs/dialog_export_netlist.cpp @@ -213,6 +213,7 @@ EXPORT_NETLIST_PAGE::EXPORT_NETLIST_PAGE( wxNotebook* aParent, const wxString& a m_SaveAllVoltages = nullptr; m_SaveAllCurrents = nullptr; m_SaveAllDissipations = nullptr; + m_RunExternalSpiceCommand = nullptr; m_custom = aCustom; aParent->AddPage( this, aTitle, false ); diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index 1847d2b0f0..770bd989d9 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -926,8 +926,8 @@ void SCH_SEXPR_PLUGIN::saveBitmap( SCH_BITMAP* aBitmap, int aNestLevel ) // Let's keep compatibility by changing image scale. if( SEXPR_SCHEMATIC_FILE_VERSION <= 20230121 ) { - BITMAP_BASE* image = aBitmap->GetImage(); - scale = scale * 300.0 / image->GetPPI(); + BITMAP_BASE* bm_image = aBitmap->GetImage(); + scale = scale * 300.0 / bm_image->GetPPI(); } if( scale != 1.0 ) diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 69708a0560..1bd8c744c4 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -219,7 +219,9 @@ class CURSORS_GRID_TRICKS : public GRID_TRICKS public: CURSORS_GRID_TRICKS( SIM_PLOT_FRAME* aParent, WX_GRID* aGrid ) : GRID_TRICKS( aGrid ), - m_parent( aParent ) + m_parent( aParent ), + m_menuRow( 0 ), + m_menuCol( 0 ) {} protected: diff --git a/eeschema/sim/toolbars_sim_plot_frame.cpp b/eeschema/sim/toolbars_sim_plot_frame.cpp index 2fbfee334e..51258733c2 100644 --- a/eeschema/sim/toolbars_sim_plot_frame.cpp +++ b/eeschema/sim/toolbars_sim_plot_frame.cpp @@ -74,12 +74,16 @@ void SIM_PLOT_FRAME::ReCreateHToolbar() void SIM_PLOT_FRAME::doReCreateMenuBar() { COMMON_CONTROL* tool = m_toolManager->GetTool(); + EDA_BASE_FRAME* base_frame = dynamic_cast( this ); + + // base_frame == nullptr should not happen, but it makes Coverity happy + wxCHECK( base_frame, /* void */ ); + // wxWidgets handles the OSX Application menu behind the scenes, but that means // we always have to start from scratch with a new wxMenuBar. - wxMenuBar* oldMenuBar = dynamic_cast( this )->GetMenuBar(); + wxMenuBar* oldMenuBar = base_frame->GetMenuBar(); WX_MENUBAR* menuBar = new WX_MENUBAR(); - //-- File menu ----------------------------------------------------------- // ACTION_MENU* fileMenu = new ACTION_MENU( false, tool ); @@ -153,8 +157,8 @@ void SIM_PLOT_FRAME::doReCreateMenuBar() menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( simulationMenu, _( "&Simulation" ) ); menuBar->Append( prefsMenu, _( "&Preferences" ) ); - dynamic_cast( this )->AddStandardHelpMenu( menuBar ); + base_frame->AddStandardHelpMenu( menuBar ); - dynamic_cast( this )->SetMenuBar( menuBar ); + base_frame->SetMenuBar( menuBar ); delete oldMenuBar; } diff --git a/qa/data/eeschema/spice_netlists/fliege_filter/fliege_filter.kicad_sch-bak b/qa/data/eeschema/spice_netlists/fliege_filter/fliege_filter.kicad_sch-bak deleted file mode 100644 index 915a260cf3..0000000000 --- a/qa/data/eeschema/spice_netlists/fliege_filter/fliege_filter.kicad_sch-bak +++ /dev/null @@ -1,5 +0,0 @@ -(kicad_sch (version 20220820) (generator eeschema) - (paper "A4") - (lib_symbols) - (symbol_instances) -) diff --git a/qa/unittests/eeschema/test_netlist_exporter_spice.h b/qa/unittests/eeschema/test_netlist_exporter_spice.h index dcf4bbf8e1..96718b11ae 100644 --- a/qa/unittests/eeschema/test_netlist_exporter_spice.h +++ b/qa/unittests/eeschema/test_netlist_exporter_spice.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2022 KiCad Developers, see AUTHORS.TXT for contributors. + * Copyright (C) 2023 KiCad Developers, see AUTHORS.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -157,11 +157,13 @@ public: // Debug info. // Display all vectors. + *m_log << "\n"; ngspice->Command( "echo Available Vectors" ); ngspice->Command( "echo -----------------" ); ngspice->Command( "display" ); // Display the original netlist. + *m_log << "\n"; *m_log << "Original Netlist\n"; *m_log << "----------------\n"; *m_log << netlist << "\n";