Commit f92cfcae authored by Dick Hollenbeck's avatar Dick Hollenbeck

fix compiler warnings, comments, debug crash, and conceptual issues in specctra

parent 4a9681d5
......@@ -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 );
......
......@@ -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<int(layerIds.size()); ++i )
{
if( 0 == aLayerName.compare( layerIds[i] ) )
return i;
}
return UNDEFINED_LAYER;
return -1;
}
......
......@@ -3577,7 +3577,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER
STRINGS layerIds; ///< indexed by PCB layer number
/// maps BOARD layer number to PCB layer numbers
std::vector<LAYER_NUM> kicadLayer2pcb;
std::vector<int> kicadLayer2pcb;
/// maps PCB layer number to BOARD layer numbers
std::vector<LAYER_NUM> 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
......
......@@ -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;
}
}
......
......@@ -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; i<shapeCount; ++i )
......@@ -333,8 +334,8 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
CIRCLE* circle = (CIRCLE*) shape->shape;
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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment