Fix a few Coverity and compil minor warnings. Remove dead code

This commit is contained in:
jean-pierre charras 2020-04-21 12:47:48 +02:00
parent 6d16762df9
commit 83cb9c0d14
3 changed files with 12 additions and 24 deletions

View File

@ -1451,6 +1451,7 @@ void SIM_PLOT_FRAME::onCursorUpdate( wxCommandEvent& event )
// Update cursor values // Update cursor values
int itemidx = 0; int itemidx = 0;
for( const auto& trace : plotPanel->GetTraces() ) for( const auto& trace : plotPanel->GetTraces() )
{ {
if( CURSOR* cursor = trace.second->GetCursor() ) 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; TRACE_MAP& traceMap = m_plots[plotPanelWindow].m_traces;
SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( plotPanelWindow ); SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( plotPanelWindow );
wxCHECK_RET( plotPanel, "not a SIM_PLOT_PANEL" );
for( auto it = traceMap.begin(); it != traceMap.end(); /* iteration occurs in the loop */) for( auto it = traceMap.begin(); it != traceMap.end(); /* iteration occurs in the loop */)
{ {
if( !updatePlot( it->second, plotPanel ) ) if( !updatePlot( it->second, plotPanel ) )

View File

@ -25,12 +25,8 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <gr_basic.h> //#include <common.h>
#include <common.h>
#include <trigo.h>
#include <macros.h>
#include <pcb_screen.h> #include <pcb_screen.h>
#include <gr_text.h>
#include <pcb_base_frame.h> #include <pcb_base_frame.h>
#include <class_board.h> #include <class_board.h>
#include <class_track.h> #include <class_track.h>
@ -44,29 +40,11 @@
#include <settings/color_settings.h> #include <settings/color_settings.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
/**
* 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 ) : TRACK::TRACK( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_CONNECTED_ITEM( aParent, idtype ) BOARD_CONNECTED_ITEM( aParent, idtype )
{ {
m_Width = Millimeter2iu( 0.2 ); m_Width = Millimeter2iu( 0.2 ); // Gives a reasonable default width
} }

View File

@ -98,6 +98,13 @@ private:
struct SPRINGBACK_TAG struct SPRINGBACK_TAG
{ {
SPRINGBACK_TAG() :
m_length( 0 ),
m_node( nullptr ),
m_seq( 0 ),
m_locked( false )
{}
int64_t m_length; int64_t m_length;
VIA_HANDLE m_draggedVia; VIA_HANDLE m_draggedVia;
VECTOR2I m_p; VECTOR2I m_p;