Coverity fixes
CIDs: - 153097 - 157120 - 157119 - 155148 - 155146 - 153103 - 153099 - 153095 - 153087 - 153086
This commit is contained in:
parent
082b8dd2a9
commit
fe4f02f5b9
|
@ -87,9 +87,9 @@ COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, COLOR4D aColor, int aID,
|
|||
SetSizer( sizer );
|
||||
|
||||
auto swatch = makeColorSwatch( this, m_color, aID );
|
||||
m_swatch = swatch.get(); // hold a handle
|
||||
m_swatch = swatch.release(); // hold a handle
|
||||
|
||||
sizer->Add( swatch.release(), 0, 0 );
|
||||
sizer->Add( m_swatch, 0, 0 );
|
||||
|
||||
// forward click to any other listeners, since we don't want them
|
||||
m_swatch->Bind( wxEVT_LEFT_DOWN, &COLOR_SWATCH::rePostEvent, this );
|
||||
|
|
|
@ -44,11 +44,12 @@ public:
|
|||
|
||||
virtual const BOX2I ViewBBox() const override
|
||||
{
|
||||
BOX2I bb; bb.SetMaximum();
|
||||
return bb;
|
||||
|
||||
if( !m_item )
|
||||
return BOX2I();
|
||||
{
|
||||
BOX2I bb;
|
||||
bb.SetMaximum();
|
||||
return bb;
|
||||
}
|
||||
|
||||
return m_item->ViewBBox();
|
||||
}
|
||||
|
|
|
@ -957,12 +957,6 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
commit.Modify( m_currentPad );
|
||||
|
||||
wxSize size;
|
||||
MODULE* footprint = m_currentPad->GetParent();
|
||||
|
||||
if( footprint )
|
||||
footprint->SetLastEditTime();
|
||||
|
||||
// redraw the area where the pad was, without pad (delete pad on screen)
|
||||
m_currentPad->SetFlags( DO_NOT_DRAW );
|
||||
m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() );
|
||||
|
@ -978,16 +972,21 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
|
|||
rastnestIsChanged = true;
|
||||
}
|
||||
|
||||
// compute the pos 0 value, i.e. pad position for footprint with orientation = 0
|
||||
// i.e. relative to footprint origin (footprint position)
|
||||
wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
|
||||
wxSize size;
|
||||
MODULE* footprint = m_currentPad->GetParent();
|
||||
|
||||
RotatePoint( &pt, -footprint->GetOrientation() );
|
||||
if( footprint )
|
||||
{
|
||||
footprint->SetLastEditTime();
|
||||
|
||||
m_currentPad->SetPos0( pt );
|
||||
|
||||
m_currentPad->SetOrientation( m_padMaster->GetOrientation() * isign
|
||||
+ footprint->GetOrientation() );
|
||||
// compute the pos 0 value, i.e. pad position for footprint with orientation = 0
|
||||
// i.e. relative to footprint origin (footprint position)
|
||||
wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
|
||||
RotatePoint( &pt, -footprint->GetOrientation() );
|
||||
m_currentPad->SetPos0( pt );
|
||||
m_currentPad->SetOrientation( m_padMaster->GetOrientation() * isign
|
||||
+ footprint->GetOrientation() );
|
||||
}
|
||||
|
||||
m_currentPad->SetSize( m_padMaster->GetSize() );
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ XNODE* PCB_MODULE::FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGra
|
|||
|
||||
if( FindNode( aNode, wxT( "patternGraphicsDef" ) ) )
|
||||
lNode = FindNode( aNode, wxT( "patternGraphicsDef" ) );
|
||||
else
|
||||
else if( pNode )
|
||||
lNode = FindNode( pNode, wxT( "patternGraphicsDef" ) );
|
||||
|
||||
if( *aPatGraphRefName == wxEmptyString ) // no patern delection, the first is actual...
|
||||
|
|
|
@ -40,7 +40,7 @@ class ALGO_BASE
|
|||
{
|
||||
public:
|
||||
ALGO_BASE( ROUTER* aRouter ) :
|
||||
m_router( aRouter )
|
||||
m_debugDecorator( nullptr ), m_router( aRouter )
|
||||
{}
|
||||
|
||||
virtual ~ALGO_BASE() {}
|
||||
|
|
|
@ -195,7 +195,11 @@ INDEX::ITEM_SHAPE_INDEX* INDEX::getSubindex( const ITEM* aItem )
|
|||
break;
|
||||
}
|
||||
|
||||
assert( idx_n >= 0 && idx_n < MaxSubIndices );
|
||||
if( idx_n < 0 || idx_n >= MaxSubIndices )
|
||||
{
|
||||
assert( false );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( !m_subIndices[idx_n] )
|
||||
m_subIndices[idx_n] = new ITEM_SHAPE_INDEX;
|
||||
|
@ -207,6 +211,9 @@ void INDEX::Add( ITEM* aItem )
|
|||
{
|
||||
ITEM_SHAPE_INDEX* idx = getSubindex( aItem );
|
||||
|
||||
if( !idx )
|
||||
return;
|
||||
|
||||
idx->Add( aItem );
|
||||
m_allItems.insert( aItem );
|
||||
int net = aItem->Net();
|
||||
|
@ -221,9 +228,11 @@ void INDEX::Remove( ITEM* aItem )
|
|||
{
|
||||
ITEM_SHAPE_INDEX* idx = getSubindex( aItem );
|
||||
|
||||
if( !idx )
|
||||
return;
|
||||
|
||||
idx->Remove( aItem );
|
||||
m_allItems.erase( aItem );
|
||||
|
||||
int net = aItem->Net();
|
||||
|
||||
if( net >= 0 && m_netMap.find( net ) != m_netMap.end() )
|
||||
|
|
|
@ -153,6 +153,7 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS::ROUTER*
|
|||
m_overrideNetA = 0;
|
||||
m_overrideNetB = 0;
|
||||
m_overrideClearance = 0;
|
||||
m_useDpGap = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -812,29 +812,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 );
|
||||
|
|
|
@ -785,12 +785,13 @@ int PCBNEW_CONTROL::AppendBoard( const TOOL_EVENT& aEvent )
|
|||
wxString fileName;
|
||||
|
||||
PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
|
||||
BOARD* board = getModel<BOARD>();
|
||||
BOARD_COMMIT commit( editFrame );
|
||||
|
||||
if( !editFrame )
|
||||
return 0;
|
||||
|
||||
BOARD* board = getModel<BOARD>();
|
||||
BOARD_COMMIT commit( editFrame );
|
||||
|
||||
// Pick a file to append
|
||||
if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
|
||||
return 0;
|
||||
|
|
|
@ -908,10 +908,10 @@ int SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
|
|||
// on one sheet.
|
||||
auto item = m_selection.Front();
|
||||
|
||||
if( item->Type() != PCB_MODULE_T )
|
||||
if( !item )
|
||||
return 0;
|
||||
|
||||
if( !item )
|
||||
if( item->Type() != PCB_MODULE_T )
|
||||
return 0;
|
||||
|
||||
auto mod = dynamic_cast<MODULE*>( item );
|
||||
|
@ -1509,6 +1509,9 @@ static double calcMaxArea( GENERAL_COLLECTOR& aCollector, KICAD_T aType )
|
|||
|
||||
static inline double calcCommonArea( const BOARD_ITEM* aItem, const BOARD_ITEM* aOther )
|
||||
{
|
||||
if( !aItem || !aOther )
|
||||
return 0;
|
||||
|
||||
return getRect( aItem ).Common( getRect( aOther ) ).GetArea();
|
||||
}
|
||||
|
||||
|
@ -1697,7 +1700,7 @@ void SELECTION_TOOL::guessSelectionCandidates( GENERAL_COLLECTOR& aCollector ) c
|
|||
|
||||
for( int i = 0; i < aCollector.GetCount(); ++i )
|
||||
{
|
||||
if( TRACK* track = dyn_cast<TRACK*> ( aCollector[i] ) )
|
||||
if( TRACK* track = dyn_cast<TRACK*>( aCollector[i] ) )
|
||||
{
|
||||
maxLength = std::max( track->GetLength(), maxLength );
|
||||
maxLength = std::max( (double) track->GetWidth(), maxLength );
|
||||
|
|
Loading…
Reference in New Issue