From 335f5a57e58eb9bb418cf18fade6e22fbada17b5 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 6 Jun 2014 12:30:07 +0200 Subject: [PATCH] Pcbnew: fix an issue with very old .brd files. --- pcbnew/dialogs/dialog_drc.h | 2 -- pcbnew/dialogs/dialog_footprint_wizard_list.h | 1 - pcbnew/legacy_plugin.cpp | 15 +++++++++++++-- pcbnew/sel_layer.cpp | 1 - 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pcbnew/dialogs/dialog_drc.h b/pcbnew/dialogs/dialog_drc.h index 6f299429e1..68ed43c712 100644 --- a/pcbnew/dialogs/dialog_drc.h +++ b/pcbnew/dialogs/dialog_drc.h @@ -118,10 +118,8 @@ private: void OnPopupMenu( wxCommandEvent& event ); - DRC* m_tester; PCB_EDIT_FRAME* m_Parent; - int m_UnconnectedCount; }; #endif // _DIALOG_DRC_H_ diff --git a/pcbnew/dialogs/dialog_footprint_wizard_list.h b/pcbnew/dialogs/dialog_footprint_wizard_list.h index 181bafd819..11e81d3dee 100644 --- a/pcbnew/dialogs/dialog_footprint_wizard_list.h +++ b/pcbnew/dialogs/dialog_footprint_wizard_list.h @@ -11,7 +11,6 @@ class DIALOG_FOOTPRINT_WIZARD_LIST: public DIALOG_FOOTPRINT_WIZARD_LIST_BASE { private: - wxDialog * m_Parent; FOOTPRINT_WIZARD *m_FootprintWizard; public: diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 42ef2aa80b..64e57d8b17 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -483,7 +483,8 @@ void LEGACY_PLUGIN::loadGENERAL() m_board->SetBoundingBox( bbbox ); } - /* Read the number of segments of type DRAW, TRACK, ZONE + /* This is no more usefull, so this info is no more parsed + // Read the number of segments of type DRAW, TRACK, ZONE else if( TESTLINE( "Ndraw" ) ) { NbDraw = intParse( line + SZ( "Ndraw" ) ); @@ -509,6 +510,11 @@ void LEGACY_PLUGIN::loadGENERAL() m_netCodes.resize( intParse( line + SZ( "Nnets" ) ) ); } + else if( TESTLINE( "Nn" ) ) // id "Nnets" for old .brd files + { + m_netCodes.resize( intParse( line + SZ( "Nn" ) ) ); + } + else if( TESTLINE( "$EndGENERAL" ) ) return; // preferred exit } @@ -1823,7 +1829,7 @@ void LEGACY_PLUGIN::loadNETINFO_ITEM() NETINFO_ITEM* net = NULL; char* line; - int netCode; + int netCode = 0; while( ( line = READLINE( m_reader ) ) != NULL ) { @@ -1846,6 +1852,11 @@ void LEGACY_PLUGIN::loadNETINFO_ITEM() if( net != NULL && ( net->GetNet() > 0 || m_board->FindNet( 0 ) == NULL ) ) { m_board->AppendNet( net ); + + // Be sure we have room to store the net in m_netCodes + if( (int)m_netCodes.size() <= netCode ) + m_netCodes.resize( netCode+1 ); + m_netCodes[netCode] = net->GetNet(); } else diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 09e954dd7b..4c22c927fa 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -252,7 +252,6 @@ class SELECT_COPPER_LAYERS_PAIR_DIALOG: public PCB_LAYER_SELECTOR, public DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE { private: - BOARD* m_brd; LAYER_NUM m_frontLayer; LAYER_NUM m_backLayer; int m_leftRowSelected;