bugfix #1325743: cvpcb crashes when opening any netlist.
This commit is contained in:
parent
563502b8fa
commit
2af3e5f6e9
|
@ -1305,13 +1305,13 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
|
||||||
int netcode = intParse( line + SZ( "Ne" ), &data );
|
int netcode = intParse( line + SZ( "Ne" ), &data );
|
||||||
|
|
||||||
// Store the new code mapping
|
// Store the new code mapping
|
||||||
pad->SetNetCode( m_netCodes[netcode] );
|
pad->SetNetCode( getNetCode( netcode ) );
|
||||||
|
|
||||||
// read Netname
|
// read Netname
|
||||||
ReadDelimitedText( buf, data, sizeof(buf) );
|
ReadDelimitedText( buf, data, sizeof(buf) );
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if( m_board )
|
if( m_board )
|
||||||
assert( m_board->FindNet( m_netCodes[netcode] )->GetNetname() ==
|
assert( m_board->FindNet( getNetCode( netcode ) )->GetNetname() ==
|
||||||
FROM_UTF8( StrPurge( buf ) ) );
|
FROM_UTF8( StrPurge( buf ) ) );
|
||||||
#endif /* NDEBUG */
|
#endif /* NDEBUG */
|
||||||
}
|
}
|
||||||
|
@ -2102,7 +2102,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
|
||||||
via->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK );
|
via->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK );
|
||||||
}
|
}
|
||||||
|
|
||||||
newTrack->SetNetCode( m_netCodes[net_code] );
|
newTrack->SetNetCode( getNetCode( net_code ) );
|
||||||
newTrack->SetState( flags, true );
|
newTrack->SetState( flags, true );
|
||||||
|
|
||||||
m_board->Add( newTrack );
|
m_board->Add( newTrack );
|
||||||
|
@ -2250,7 +2250,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
|
||||||
// Init the net code only, not the netname, to be sure
|
// Init the net code only, not the netname, to be sure
|
||||||
// the zone net name is the name read in file.
|
// the zone net name is the name read in file.
|
||||||
// (When mismatch, the user will be prompted in DRC, to fix the actual name)
|
// (When mismatch, the user will be prompted in DRC, to fix the actual name)
|
||||||
zc->BOARD_CONNECTED_ITEM::SetNetCode( m_netCodes[netcode] );
|
zc->BOARD_CONNECTED_ITEM::SetNetCode( getNetCode( netcode ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( TESTLINE( "ZLayer" ) ) // layer found
|
else if( TESTLINE( "ZLayer" ) ) // layer found
|
||||||
|
|
|
@ -139,6 +139,16 @@ protected:
|
||||||
double diskToBiu; ///< convert from disk engineering units to BIUs
|
double diskToBiu; ///< convert from disk engineering units to BIUs
|
||||||
///< with this scale factor
|
///< with this scale factor
|
||||||
|
|
||||||
|
///> Converts net code using the mapping table if available,
|
||||||
|
///> otherwise returns unchanged net code
|
||||||
|
inline int getNetCode( int aNetCode )
|
||||||
|
{
|
||||||
|
if( aNetCode < (int) m_netCodes.size() )
|
||||||
|
return m_netCodes[aNetCode];
|
||||||
|
|
||||||
|
return aNetCode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function biuParse
|
* Function biuParse
|
||||||
* parses an ASCII decimal floating point value and scales it into a BIU
|
* parses an ASCII decimal floating point value and scales it into a BIU
|
||||||
|
|
|
@ -2201,7 +2201,7 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent ) throw( IO_ERROR, PARSE_ERROR )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_net:
|
case T_net:
|
||||||
pad->SetNetCode( m_netCodes[parseInt( "net number" )] );
|
pad->SetNetCode( getNetCode( parseInt( "net number" ) ) );
|
||||||
NeedSYMBOLorNUMBER();
|
NeedSYMBOLorNUMBER();
|
||||||
assert( FromUTF8() == m_board->FindNet( pad->GetNetCode() )->GetNetname() );
|
assert( FromUTF8() == m_board->FindNet( pad->GetNetCode() )->GetNetname() );
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
|
@ -2299,7 +2299,7 @@ TRACK* PCB_PARSER::parseTRACK() throw( IO_ERROR, PARSE_ERROR )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_net:
|
case T_net:
|
||||||
track->SetNetCode( m_netCodes[parseInt( "net number" )] );
|
track->SetNetCode( getNetCode( parseInt( "net number" ) ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_tstamp:
|
case T_tstamp:
|
||||||
|
@ -2377,7 +2377,7 @@ VIA* PCB_PARSER::parseVIA() throw( IO_ERROR, PARSE_ERROR )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_net:
|
case T_net:
|
||||||
via->SetNetCode( m_netCodes[parseInt( "net number" )] );
|
via->SetNetCode( getNetCode( parseInt( "net number" ) ) );
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2429,7 +2429,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
|
||||||
// Init the net code only, not the netname, to be sure
|
// Init the net code only, not the netname, to be sure
|
||||||
// the zone net name is the name read in file.
|
// the zone net name is the name read in file.
|
||||||
// (When mismatch, the user will be prompted in DRC, to fix the actual name)
|
// (When mismatch, the user will be prompted in DRC, to fix the actual name)
|
||||||
zone->SetNetCode( m_netCodes[parseInt( "net number" )] );
|
zone->SetNetCode( getNetCode( parseInt( "net number" ) ) );
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,16 @@ class PCB_PARSER : public PCB_LEXER
|
||||||
LAYER_MSK_MAP m_layerMasks; ///< map layer names to their masks
|
LAYER_MSK_MAP m_layerMasks; ///< map layer names to their masks
|
||||||
std::vector<int> m_netCodes; ///< net codes mapping for boards being loaded
|
std::vector<int> m_netCodes; ///< net codes mapping for boards being loaded
|
||||||
|
|
||||||
|
///> Converts net code using the mapping table if available,
|
||||||
|
///> otherwise returns unchanged net code
|
||||||
|
inline int getNetCode( int aNetCode )
|
||||||
|
{
|
||||||
|
if( aNetCode < (int) m_netCodes.size() )
|
||||||
|
return m_netCodes[aNetCode];
|
||||||
|
|
||||||
|
return aNetCode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function init
|
* Function init
|
||||||
* clears and re-establishes m_layerMap with the default layer names.
|
* clears and re-establishes m_layerMap with the default layer names.
|
||||||
|
|
Loading…
Reference in New Issue