Commit feb14fa3 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

pcbnew, place file: Fix a minor bug in side identification: a comment in file...

pcbnew, place file: Fix a minor bug in side identification: a comment in file header was generated with always "top side" id even when the bottom side file was created. Fix also a minor coverity warning (no bug)
parent 3c427645
Loading
Loading
Loading
Loading
+19 −17
Original line number Original line Diff line number Diff line
@@ -373,7 +373,7 @@ void PCB_EDIT_FRAME::GenFootprintsPositionFile( wxCommandEvent& event )
 * aSide = 0 -> Back (bottom) side)
 * aSide = 0 -> Back (bottom) side)
 * aSide = 1 -> Front (top) side)
 * aSide = 1 -> Front (top) side)
 * aSide = 2 -> both sides
 * aSide = 2 -> both sides
 * if aFullFileName is empty, the file is not crated, only the
 * if aFullFileName is empty, the file is not created, only the
 * count of footprints to place is returned
 * count of footprints to place is returned
 */
 */
int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
@@ -483,13 +483,19 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,


    fputs( unit_text, file );
    fputs( unit_text, file );


    sprintf( line, "## Side : %s\n",
    fputs( "## Side : ", file );
             ( aSide < 2 ) ? TO_UTF8( frontSideName ) : "All" );
    fputs( line, file );


    sprintf( line,
    if( aSide == 0 )
             "# Ref    Val                  Package         PosX       PosY        Rot     Side\n" );
        fputs( TO_UTF8( backSideName ), file );
    fputs( line, file );
    else if( aSide == 1 )
        fputs( TO_UTF8( frontSideName ), file );
    else
        fputs( "All", file );

    fputs( "\n", file );

    fputs( "# Ref    Val                  Package         PosX       PosY        Rot     Side\n",
           file );


    for( int ii = 0; ii < moduleCount; ii++ )
    for( int ii = 0; ii < moduleCount; ii++ )
    {
    {
@@ -515,20 +521,16 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,


        LAYER_NUM layer = list[ii].m_Module->GetLayer();
        LAYER_NUM layer = list[ii].m_Module->GetLayer();


        fputs( line, file );

        wxASSERT( layer==F_Cu || layer==B_Cu );
        wxASSERT( layer==F_Cu || layer==B_Cu );


        if( layer == F_Cu )
        if( layer == F_Cu )
        {
            fputs( TO_UTF8( frontSideName ), file );
            strcat( line, TO_UTF8( frontSideName ) );
            strcat( line, "\n" );
            fputs( line, file );
        }
        else if( layer == B_Cu )
        else if( layer == B_Cu )
        {
            fputs( TO_UTF8( backSideName ), file );
            strcat( line, TO_UTF8( backSideName ) );

            strcat( line, "\n" );
        fputs( "\n", file );
            fputs( line, file );
        }
    }
    }


    // Write EOF
    // Write EOF