Make sure fixes to netlist stuff are done on both sides.

This fixes the CmpNoCase() == 0 bug on one side, and the
footprint == null bug on the other side; both of which were
previously fixed on only one side.

Fixes: lp:1795561
* https://bugs.launchpad.net/kicad/+bug/1795561
This commit is contained in:
Jeff Young 2018-10-02 18:17:16 +01:00
parent afd518d1e8
commit 536451138d
2 changed files with 14 additions and 19 deletions

View File

@ -632,6 +632,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
{
COMPONENT* component = aNetlist.GetComponent( i );
int matchCount = 0;
MODULE* tmp;
msg.Printf( _( "Processing component \"%s:%s:%s\"." ),
component->GetReference(),
@ -639,12 +640,9 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
component->GetFPID().Format().wx_str() );
m_reporter->Report( msg, REPORTER::RPT_INFO );
// This loop must be executed at least once to add new footprints even
// if the board has no existing footprints:
for( MODULE* footprint = m_board->m_Modules; ; footprint = footprint->Next() )
for( MODULE* footprint = m_board->m_Modules; footprint; footprint = footprint->Next() )
{
bool match = false;
MODULE* tmp;
if( footprint )
{
@ -672,6 +670,11 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
if( footprint == lastPreexistingFootprint )
{
// No sense going through the newly-created footprints: end of loop
break;
}
}
if( matchCount == 0 )
{
tmp = addNewComponent( component );
@ -681,16 +684,8 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
updateComponentParameters( tmp, component );
updateComponentPadConnections( tmp, component );
}
matchCount++;
}
// No sense going through the newly-created footprints: end of loop
break;
}
}
if( matchCount > 1 )
else if( matchCount > 1 )
{
msg.Printf( _( "Multiple footprints found for \"%s\"." ),
component->GetReference() );

View File

@ -2575,7 +2575,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
if( aNetlist.IsFindByTimeStamp() )
match = footprint->GetPath() == component->GetTimeStamp();
else
match = footprint->GetReference().CmpNoCase( component->GetReference() );
match = footprint->GetReference().CmpNoCase( component->GetReference() ) == 0;
if( match )
{