Coverity fixes

CIDs:
dereference before null check:
175439 @ drc.cpp

uninitalized field:
175435 @ point_editor.cpp
174162 @ zone_filler.cpp
163188 @ footprint_info_impl.cpp

logically dead code:
155146 @ pcb_editor_control.cpp
This commit is contained in:
Maciej Suminski 2018-05-04 14:01:26 +02:00
parent 1ac905d3ee
commit 684f085ac5
5 changed files with 23 additions and 23 deletions

View File

@ -409,12 +409,16 @@ void DRC::RunTests( wxTextCtrl* aMessages )
if( m_refillZones )
{
aMessages->AppendText( _( "Refilling all zones...\n" ) );
if( aMessages )
aMessages->AppendText( _( "Refilling all zones...\n" ) );
m_pcbEditorFrame->Fill_All_Zones( caller );
}
else
{
aMessages->AppendText( _( "Checking zone fills...\n" ) );
if( aMessages )
aMessages->AppendText( _( "Checking zone fills...\n" ) );
m_pcbEditorFrame->Check_All_Zones( caller );
}

View File

@ -295,7 +295,7 @@ bool FOOTPRINT_LIST_IMPL::JoinWorkers()
if( m_cancelled )
m_list_timestamp = 0; // God knows what we got before we were cancelled
else
m_list_timestamp = m_lib_table->GenerateTimestamp( m_library );;
m_list_timestamp = m_lib_table->GenerateTimestamp( m_library );
return m_errors.empty();
}
@ -303,6 +303,7 @@ bool FOOTPRINT_LIST_IMPL::JoinWorkers()
FOOTPRINT_LIST_IMPL::FOOTPRINT_LIST_IMPL() :
m_loader( nullptr ),
m_library( nullptr ),
m_count_finished( 0 ),
m_list_timestamp( 0 ),
m_progress_reporter( nullptr ),

View File

@ -700,6 +700,7 @@ static bool mergeZones( BOARD_COMMIT& aCommit, std::vector<ZONE_CONTAINER *>& aO
return true;
}
int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
@ -726,29 +727,22 @@ int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
netcode = curr_area->GetNetCode();
if( firstZone )
{
if( firstZone->GetNetCode() != netcode )
continue;
if( firstZone->GetNetCode() != netcode )
continue;
if( curr_area->GetPriority() != firstZone->GetPriority() )
continue;
if( curr_area->GetPriority() != firstZone->GetPriority() )
continue;
if( curr_area->GetIsKeepout() != firstZone->GetIsKeepout() )
continue;
if( curr_area->GetIsKeepout() != firstZone->GetIsKeepout() )
continue;
if( curr_area->GetLayer() != firstZone->GetLayer() )
continue;
if( curr_area->GetLayer() != firstZone->GetLayer() )
continue;
if( !board->TestAreaIntersection( curr_area, firstZone ) )
continue;
if( !board->TestAreaIntersection( curr_area, firstZone ) )
continue;
toMerge.push_back( curr_area );
}
else
{
toMerge.push_back( curr_area );
}
toMerge.push_back( curr_area );
}
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );

View File

@ -219,7 +219,7 @@ private:
POINT_EDITOR::POINT_EDITOR() :
PCB_TOOL( "pcbnew.PointEditor" ), m_selectionTool( NULL ), m_editedPoint( NULL ),
m_original( VECTOR2I( 0, 0 ) ), m_altConstrainer( VECTOR2I( 0, 0 ) )
m_original( VECTOR2I( 0, 0 ) ), m_altConstrainer( VECTOR2I( 0, 0 ) ), m_refill( false )
{
}

View File

@ -66,7 +66,8 @@ static double s_thermalRot = 450; // angle of stubs in thermal reliefs for ro
static const bool s_DumpZonesWhenFilling = false;
ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) :
m_board( aBoard ), m_commit( aCommit ), m_progressReporter( nullptr ), m_count_done( 0 )
m_board( aBoard ), m_commit( aCommit ), m_progressReporter( nullptr ),
m_next( 0 ), m_count_done( 0 )
{
}