Coverity cleanup and remove unused variables
This commit is contained in:
parent
65bd1ee9a4
commit
89dcc46898
|
@ -264,20 +264,18 @@ int COMMON_TOOLS::doZoomFit( ZOOM_FIT_TYPE_T aFitType )
|
|||
{
|
||||
KIGFX::VIEW* view = getView();
|
||||
EDA_DRAW_PANEL_GAL* canvas = m_frame->GetCanvas();
|
||||
EDA_DRAW_FRAME* frame = getEditFrame<EDA_DRAW_FRAME>();
|
||||
EDA_DRAW_FRAME* frame = getEditFrame<EDA_DRAW_FRAME>();
|
||||
|
||||
BOX2I bBox = frame->GetDocumentExtents();
|
||||
BOX2I defaultBox = canvas->GetDefaultViewBBox();
|
||||
VECTOR2D scrollbarSize = VECTOR2D( canvas->GetSize() - canvas->GetClientSize() );
|
||||
|
||||
view->SetScale( 1.0 ); // The best scale will be determined later, but this initial
|
||||
// value ensures all view parameters are up to date (especially
|
||||
// at init time)
|
||||
VECTOR2D screenSize = view->ToWorld( canvas->GetClientSize(), false );
|
||||
|
||||
// Currently "Zoom to Objects" is only supported on Eeschema. Support for other
|
||||
// Currently "Zoom to Objects" is only supported on Eeschema. Support for other
|
||||
// programs in the suite can be added as needed.
|
||||
|
||||
if( aFitType == ZOOM_FIT_OBJECTS )
|
||||
{
|
||||
if( frame->IsType( FRAME_SCH ) )
|
||||
|
@ -287,7 +285,6 @@ int COMMON_TOOLS::doZoomFit( ZOOM_FIT_TYPE_T aFitType )
|
|||
}
|
||||
|
||||
// If the screen is empty then use the default view bbox
|
||||
|
||||
if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
|
||||
bBox = defaultBox;
|
||||
|
||||
|
@ -302,7 +299,6 @@ int COMMON_TOOLS::doZoomFit( ZOOM_FIT_TYPE_T aFitType )
|
|||
{
|
||||
case ZOOM_FIT_ALL:
|
||||
// Leave a bigger margin for library editors & viewers
|
||||
|
||||
if( frame->IsType( FRAME_FOOTPRINT_VIEWER ) || frame->IsType( FRAME_FOOTPRINT_VIEWER_MODAL )
|
||||
|| frame->IsType( FRAME_SCH_VIEWER ) || frame->IsType( FRAME_SCH_VIEWER_MODAL ) )
|
||||
{
|
||||
|
|
|
@ -343,7 +343,7 @@ int ERC_TESTER::TestMultiunitFootprints()
|
|||
const wxString secondFp = secondRef.GetFootprint();
|
||||
wxString msg;
|
||||
|
||||
if( !secondFp.IsEmpty() && unitFP != secondFp )
|
||||
if( unit && !secondFp.IsEmpty() && unitFP != secondFp )
|
||||
{
|
||||
msg.Printf( _( "Different footprints assigned to %s and %s" ),
|
||||
unitName, secondName );
|
||||
|
|
|
@ -2117,7 +2117,7 @@ wxString BOARD::GroupsSanityCheckInternal( bool repair )
|
|||
// This check of childIdx should never fail, because if a group
|
||||
// is not found in the groups list, then the board.GetItem()
|
||||
// check above should have failed.
|
||||
wxCHECK( childIdx >= 0 && childIdx < groups.size(),
|
||||
wxCHECK( childIdx < groups.size(),
|
||||
wxString::Format( "Group %s not found in groups list",
|
||||
item->m_Uuid.AsString() ) );
|
||||
wxCHECK( parentGroupIdx[childIdx] == -1,
|
||||
|
|
|
@ -671,7 +671,6 @@ void VIA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
|
|||
wxString msg;
|
||||
wxString msg2;
|
||||
wxString source;
|
||||
BOARD* board = GetBoard();
|
||||
|
||||
// Display basic infos
|
||||
switch( GetViaType() )
|
||||
|
|
|
@ -402,12 +402,15 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
|||
{
|
||||
MARKER_PCB* marker = dynamic_cast<MARKER_PCB*>( node->m_RcItem->GetParent() );
|
||||
|
||||
marker->SetExcluded( false );
|
||||
m_brdEditor->GetCanvas()->GetView()->Update( marker );
|
||||
if( marker )
|
||||
{
|
||||
marker->SetExcluded( false );
|
||||
m_brdEditor->GetCanvas()->GetView()->Update( marker );
|
||||
|
||||
// Update view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
||||
modified = true;
|
||||
// Update view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -415,16 +418,19 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
|||
{
|
||||
MARKER_PCB* marker = dynamic_cast<MARKER_PCB*>( node->m_RcItem->GetParent() );
|
||||
|
||||
marker->SetExcluded( true );
|
||||
m_brdEditor->GetCanvas()->GetView()->Update( marker );
|
||||
if( marker )
|
||||
{
|
||||
marker->SetExcluded( true );
|
||||
m_brdEditor->GetCanvas()->GetView()->Update( marker );
|
||||
|
||||
// Update view
|
||||
if( m_severities & RPT_SEVERITY_EXCLUSION )
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
||||
else
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false );
|
||||
// Update view
|
||||
if( m_severities & RPT_SEVERITY_EXCLUSION )
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
||||
else
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false );
|
||||
|
||||
modified = true;
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -554,7 +554,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRulesForItems( DRC_CONSTRAINT_TYPE_T aConstraintI
|
|||
// Unfortunately implicit rules don't work for local clearances (such as zones) because
|
||||
// they have to be max'ed with netclass values (which are already implicit rules), and our
|
||||
// rule selection paradigm is "winner takes all".
|
||||
if( aConstraintId == DRC_CONSTRAINT_TYPE_CLEARANCE && implicit )
|
||||
if( constraintRef && aConstraintId == DRC_CONSTRAINT_TYPE_CLEARANCE && implicit )
|
||||
{
|
||||
int global = constraintRef->m_Value.Min();
|
||||
int localA = connectedA ? connectedA->GetLocalClearance( nullptr ) : 0;
|
||||
|
|
|
@ -532,7 +532,10 @@ int CONVERT_TOOL::SegmentToArc( const TOOL_EVENT& aEvent )
|
|||
BOARD_ITEM_CONTAINER* parent = frame->GetModel();
|
||||
|
||||
BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( source );
|
||||
wxASSERT( boardItem );
|
||||
|
||||
// Don't continue processing if we don't actually have a board item
|
||||
if( !boardItem )
|
||||
return 0;
|
||||
|
||||
PCB_LAYER_ID layer = boardItem->GetLayer();
|
||||
|
||||
|
|
|
@ -208,7 +208,8 @@ void DRC_TOOL::RunTests( PROGRESS_REPORTER* aProgressReporter, bool aTestTracksA
|
|||
m_drcEngine->SetProgressReporter( nullptr );
|
||||
m_drcEngine->ClearViolationHandler();
|
||||
|
||||
m_drcDialog->SetDrcRun();
|
||||
if( m_drcDialog )
|
||||
m_drcDialog->SetDrcRun();
|
||||
|
||||
if( !netlist.IsEmpty() )
|
||||
m_drcDialog->SetFootprintTestsRun();
|
||||
|
|
|
@ -294,10 +294,9 @@ int PCB_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent )
|
|||
r->Report( _( "Items belong to the same net. Clearance is 0." ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
else if( ac )
|
||||
{
|
||||
// Different nets (or second unconnected)....
|
||||
|
||||
reportCopperClearance( layer, ac, b, r );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2173,7 +2173,7 @@ void APPEARANCE_CONTROLS::onLayerPresetChanged( wxCommandEvent& aEvent )
|
|||
|
||||
m_lastSelectedUserPreset = ( !preset || preset->readOnly ) ? nullptr : preset;
|
||||
|
||||
if( !preset )
|
||||
if( preset )
|
||||
doApplyLayerPreset( *preset );
|
||||
|
||||
if( !m_currentPreset->name.IsEmpty() )
|
||||
|
|
|
@ -161,27 +161,35 @@ public:
|
|||
|
||||
APPEARANCE_SETTING( const wxString& aLabel, int aId,
|
||||
const wxString& aTooltip = wxEmptyString,
|
||||
bool aCanControlOpacity = false )
|
||||
bool aCanControlOpacity = false ) :
|
||||
id( aId ),
|
||||
label( aLabel ),
|
||||
tooltip( aTooltip ),
|
||||
visible( true ),
|
||||
can_control_opacity( aCanControlOpacity ),
|
||||
spacer( false ),
|
||||
ctl_panel( nullptr ),
|
||||
ctl_indicator( nullptr ),
|
||||
ctl_visibility( nullptr ),
|
||||
ctl_color( nullptr ),
|
||||
ctl_text( nullptr ),
|
||||
ctl_opacity( nullptr )
|
||||
{
|
||||
label = aLabel;
|
||||
id = aId;
|
||||
tooltip = aTooltip;
|
||||
spacer = false;
|
||||
visible = true;
|
||||
|
||||
can_control_opacity = aCanControlOpacity;
|
||||
|
||||
ctl_panel = nullptr;
|
||||
ctl_indicator = nullptr;
|
||||
ctl_visibility = nullptr;
|
||||
ctl_color = nullptr;
|
||||
ctl_text = nullptr;
|
||||
ctl_opacity = nullptr;
|
||||
}
|
||||
|
||||
APPEARANCE_SETTING() :
|
||||
id( -1 ), label( "" ), tooltip( "" ), visible( false ),
|
||||
can_control_opacity( false ), spacer( true )
|
||||
id( -1 ),
|
||||
label( "" ),
|
||||
tooltip( "" ),
|
||||
visible( false ),
|
||||
can_control_opacity( false ),
|
||||
spacer( true ),
|
||||
ctl_panel( nullptr ),
|
||||
ctl_indicator( nullptr ),
|
||||
ctl_visibility( nullptr ),
|
||||
ctl_color( nullptr ),
|
||||
ctl_text( nullptr ),
|
||||
ctl_opacity( nullptr )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue