Commit f92cfcae authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

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

parent 4a9681d5
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -112,7 +112,7 @@ void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{
{
    wxString    msg;
    wxString    msg;


#if defined(DEBUG)
#if defined(__WXDEBUG__)
    BOARD_ITEM* parent = (BOARD_ITEM*) m_Parent;
    BOARD_ITEM* parent = (BOARD_ITEM*) m_Parent;
    wxASSERT( parent );
    wxASSERT( parent );


+2 −2
Original line number Original line Diff line number Diff line
@@ -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 )
    for( LAYER_NUM i=FIRST_LAYER;  i<int(layerIds.size());  ++i )
    {
    {
        if( 0 == aLayerName.compare( layerIds[i] ) )
        if( 0 == aLayerName.compare( layerIds[i] ) )
            return i;
            return i;
    }
    }
    return UNDEFINED_LAYER;
    return -1;
}
}




+7 −3
Original line number Original line Diff line number Diff line
@@ -3577,7 +3577,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER
    STRINGS         layerIds;       ///< indexed by PCB layer number
    STRINGS         layerIds;       ///< indexed by PCB layer number


    /// maps BOARD layer number to PCB layer numbers
    /// 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
    /// maps PCB layer number to BOARD layer numbers
    std::vector<LAYER_NUM> pcbLayer2kicad;
    std::vector<LAYER_NUM> pcbLayer2kicad;
@@ -3606,9 +3606,13 @@ class SPECCTRA_DB : public SPECCTRA_LEXER


    /**
    /**
     * Function findLayerName
     * 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
     * Function readCOMPnPIN
+1 −1
Original line number Original line Diff line number Diff line
@@ -783,8 +783,8 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
        }
        }
        else    // remove graphics not on EDGE_N layer
        else    // remove graphics not on EDGE_N layer
        {
        {
            ++i;
            D( items[i]->Show( 0, std::cout );)
            D( items[i]->Show( 0, std::cout );)
            ++i;
        }
        }
    }
    }


+8 −7
Original line number Original line Diff line number Diff line
@@ -319,8 +319,9 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
    }
    }
    else    // VIA_MICROVIA or VIA_BLIND_BURIED
    else    // VIA_MICROVIA or VIA_BLIND_BURIED
    {
    {
        LAYER_NUM topLayerNdx = UNDEFINED_LAYER;
        int topLayerNdx = -1;           // session layer detectors
        LAYER_NUM botLayerNdx = 7000; // Ask Dick if this number loses its magic
        int botLayerNdx = INT_MAX;

        int viaDiam = -1;
        int viaDiam = -1;


        for( int i=0; i<shapeCount;  ++i )
        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;
            CIRCLE* circle = (CIRCLE*) shape->shape;


            LAYER_NUM layerNdx = findLayerName( circle->layer_id );
            int layerNdx = findLayerName( circle->layer_id );
            if( layerNdx == UNDEFINED_LAYER )
            if( layerNdx == -1 )
            {
            {
                wxString layerName = FROM_UTF8( circle->layer_id.c_str() );
                wxString layerName = FROM_UTF8( circle->layer_id.c_str() );
                ThrowIOError( _("Session file uses invalid layer id \"%s\""),
                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 );
        via->SetWidth( viaDiam );


        topLayerNdx = pcbLayer2kicad[topLayerNdx];
        LAYER_NUM topLayer = pcbLayer2kicad[topLayerNdx];
        botLayerNdx = pcbLayer2kicad[botLayerNdx];
        LAYER_NUM botLayer = pcbLayer2kicad[botLayerNdx];


        via->SetLayerPair( topLayerNdx, botLayerNdx );
        via->SetLayerPair( topLayer, botLayer );
    }
    }


    if( via )
    if( via )