From f92cfcaee66e1b15cb35e3f72ee97cdcad0c964a Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Mon, 29 Apr 2013 11:35:07 -0500 Subject: [PATCH] fix compiler warnings, comments, debug crash, and conceptual issues in specctra --- pcbnew/class_pcb_text.cpp | 2 +- pcbnew/specctra.cpp | 4 ++-- pcbnew/specctra.h | 10 +++++++--- pcbnew/specctra_export.cpp | 2 +- pcbnew/specctra_import.cpp | 15 ++++++++------- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 89cbfed473..5233807eca 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -112,7 +112,7 @@ void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; -#if defined(DEBUG) +#if defined(__WXDEBUG__) BOARD_ITEM* parent = (BOARD_ITEM*) m_Parent; wxASSERT( parent ); diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index cc2c8cfc1d..2c1f2d96d2 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -96,14 +96,14 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard ) } -LAYER_NUM SPECCTRA_DB::findLayerName( const std::string& aLayerName ) const +int SPECCTRA_DB::findLayerName( const std::string& aLayerName ) const { for( LAYER_NUM i=FIRST_LAYER; i kicadLayer2pcb; + std::vector kicadLayer2pcb; /// maps PCB layer number to BOARD layer numbers std::vector pcbLayer2kicad; @@ -3606,9 +3606,13 @@ class SPECCTRA_DB : public SPECCTRA_LEXER /** * Function findLayerName - * returns the PCB layer index for a given layer name + * returns the PCB layer index for a given layer name, within the specctra session + * file. + * + * @return int - the layer index within the specctra session file, or -1 if + * aLayerName is not found. */ - LAYER_NUM findLayerName( const std::string& aLayerName ) const; + int findLayerName( const std::string& aLayerName ) const; /** * Function readCOMPnPIN diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index 7acb5cbe74..30fa3491ec 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -783,8 +783,8 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER } else // remove graphics not on EDGE_N layer { - ++i; D( items[i]->Show( 0, std::cout );) + ++i; } } diff --git a/pcbnew/specctra_import.cpp b/pcbnew/specctra_import.cpp index 988c08def3..d05834c91e 100644 --- a/pcbnew/specctra_import.cpp +++ b/pcbnew/specctra_import.cpp @@ -319,8 +319,9 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet } else // VIA_MICROVIA or VIA_BLIND_BURIED { - LAYER_NUM topLayerNdx = UNDEFINED_LAYER; - LAYER_NUM botLayerNdx = 7000; // Ask Dick if this number loses its magic + int topLayerNdx = -1; // session layer detectors + int botLayerNdx = INT_MAX; + int viaDiam = -1; for( int i=0; ishape; - LAYER_NUM layerNdx = findLayerName( circle->layer_id ); - if( layerNdx == UNDEFINED_LAYER ) + int layerNdx = findLayerName( circle->layer_id ); + if( layerNdx == -1 ) { wxString layerName = FROM_UTF8( circle->layer_id.c_str() ); ThrowIOError( _("Session file uses invalid layer id \"%s\""), @@ -363,10 +364,10 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet via->SetWidth( viaDiam ); - topLayerNdx = pcbLayer2kicad[topLayerNdx]; - botLayerNdx = pcbLayer2kicad[botLayerNdx]; + LAYER_NUM topLayer = pcbLayer2kicad[topLayerNdx]; + LAYER_NUM botLayer = pcbLayer2kicad[botLayerNdx]; - via->SetLayerPair( topLayerNdx, botLayerNdx ); + via->SetLayerPair( topLayer, botLayer ); } if( via )