From 83cb9c0d1496fd4ebc5062b1d54a6fbbd80a07a1 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 21 Apr 2020 12:47:48 +0200 Subject: [PATCH] Fix a few Coverity and compil minor warnings. Remove dead code --- eeschema/sim/sim_plot_frame.cpp | 3 +++ pcbnew/class_track.cpp | 26 ++------------------------ pcbnew/router/pns_shove.h | 7 +++++++ 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index b8b4a1e8d0..46ef02b5b5 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -1451,6 +1451,7 @@ void SIM_PLOT_FRAME::onCursorUpdate( wxCommandEvent& event ) // Update cursor values int itemidx = 0; + for( const auto& trace : plotPanel->GetTraces() ) { if( CURSOR* cursor = trace.second->GetCursor() ) @@ -1499,6 +1500,8 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent ) TRACE_MAP& traceMap = m_plots[plotPanelWindow].m_traces; SIM_PLOT_PANEL* plotPanel = dynamic_cast( plotPanelWindow ); + wxCHECK_RET( plotPanel, "not a SIM_PLOT_PANEL" ); + for( auto it = traceMap.begin(); it != traceMap.end(); /* iteration occurs in the loop */) { if( !updatePlot( it->second, plotPanel ) ) diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 110b528a80..93a11b597c 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -25,12 +25,8 @@ */ #include -#include -#include -#include -#include +//#include #include -#include #include #include #include @@ -44,29 +40,11 @@ #include #include -/** - * Function ShowClearance - * tests to see if the clearance border is drawn on the given track. - * @return bool - true if should draw clearance, else false. - */ -static bool ShowClearance( const PCB_DISPLAY_OPTIONS& aDisplOpts, const TRACK* aTrack ) -{ - // maybe return true for tracks and vias, not for zone segments - return IsCopperLayer( aTrack->GetLayer() ) - && ( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_VIA_T - || aTrack->Type() == PCB_ARC_T ) - && ( ( aDisplOpts.m_ShowTrackClearanceMode == PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS - && ( aTrack->IsDragging() || aTrack->IsMoving() || aTrack->IsNew() ) ) - || ( aDisplOpts.m_ShowTrackClearanceMode == PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS ) - ); - -} - TRACK::TRACK( BOARD_ITEM* aParent, KICAD_T idtype ) : BOARD_CONNECTED_ITEM( aParent, idtype ) { - m_Width = Millimeter2iu( 0.2 ); + m_Width = Millimeter2iu( 0.2 ); // Gives a reasonable default width } diff --git a/pcbnew/router/pns_shove.h b/pcbnew/router/pns_shove.h index 8e034fcaa9..5ffe7fed55 100644 --- a/pcbnew/router/pns_shove.h +++ b/pcbnew/router/pns_shove.h @@ -98,6 +98,13 @@ private: struct SPRINGBACK_TAG { + SPRINGBACK_TAG() : + m_length( 0 ), + m_node( nullptr ), + m_seq( 0 ), + m_locked( false ) + {} + int64_t m_length; VIA_HANDLE m_draggedVia; VECTOR2I m_p;