From 28222961ddeb827197747fe6bd7917fe7e637532 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 24 Oct 2012 13:42:39 -0500 Subject: [PATCH] fix ownership issue in wxFFile vs. FILE_LINE_READER --- .../dialogs/dialog_select_one_pcb_layer.cpp | 60 +++++++++---------- pcbnew/kicad_plugin.cpp | 16 ++--- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp index 14afd18e1a..caf596d05f 100644 --- a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp +++ b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp @@ -188,36 +188,36 @@ const wxString GetPCBDefaultLayerName( int aLayerNumber ) // Use a switch to explicitly show the mapping more clearly switch( aLayerNumber ) { - case LAYER_N_FRONT: txt = _( "Front" ); break; - case LAYER_N_2: txt = _( "Inner1" ); break; - case LAYER_N_3: txt = _( "Inner2" ); break; - case LAYER_N_4: txt = _( "Inner3" ); break; - case LAYER_N_5: txt = _( "Inner4" ); break; - case LAYER_N_6: txt = _( "Inner5" ); break; - case LAYER_N_7: txt = _( "Inner6" ); break; - case LAYER_N_8: txt = _( "Inner7" ); break; - case LAYER_N_9: txt = _( "Inner8" ); break; - case LAYER_N_10: txt = _( "Inner9" ); break; - case LAYER_N_11: txt = _( "Inner10" ); break; - case LAYER_N_12: txt = _( "Inner11" ); break; - case LAYER_N_13: txt = _( "Inner12" ); break; - case LAYER_N_14: txt = _( "Inner13" ); break; - case LAYER_N_15: txt = _( "Inner14" ); break; - case LAYER_N_BACK: txt = _( "Back" ); break; - case ADHESIVE_N_BACK: txt = _( "Adhes_Back" ); break; - case ADHESIVE_N_FRONT: txt = _( "Adhes_Front" ); break; - case SOLDERPASTE_N_BACK: txt = _( "SoldP_Back" ); break; - case SOLDERPASTE_N_FRONT: txt = _( "SoldP_Front" ); break; - case SILKSCREEN_N_BACK: txt = _( "SilkS_Back" ); break; - case SILKSCREEN_N_FRONT: txt = _( "SilkS_Front" ); break; - case SOLDERMASK_N_BACK: txt = _( "Mask_Back" ); break; - case SOLDERMASK_N_FRONT: txt = _( "Mask_Front" ); break; - case DRAW_N: txt = _( "Drawings" ); break; - case COMMENT_N: txt = _( "Comments" ); break; - case ECO1_N: txt = _( "Eco1" ); break; - case ECO2_N: txt = _( "Eco2" ); break; - case EDGE_N: txt = _( "PCB_Edges" ); break; - default: txt = wxT( "BAD INDEX" ); break; + case LAYER_N_FRONT: txt = _( "Front" ); break; + case LAYER_N_2: txt = _( "Inner1" ); break; + case LAYER_N_3: txt = _( "Inner2" ); break; + case LAYER_N_4: txt = _( "Inner3" ); break; + case LAYER_N_5: txt = _( "Inner4" ); break; + case LAYER_N_6: txt = _( "Inner5" ); break; + case LAYER_N_7: txt = _( "Inner6" ); break; + case LAYER_N_8: txt = _( "Inner7" ); break; + case LAYER_N_9: txt = _( "Inner8" ); break; + case LAYER_N_10: txt = _( "Inner9" ); break; + case LAYER_N_11: txt = _( "Inner10" ); break; + case LAYER_N_12: txt = _( "Inner11" ); break; + case LAYER_N_13: txt = _( "Inner12" ); break; + case LAYER_N_14: txt = _( "Inner13" ); break; + case LAYER_N_15: txt = _( "Inner14" ); break; + case LAYER_N_BACK: txt = _( "Back" ); break; + case ADHESIVE_N_BACK: txt = _( "Adhes_Back" ); break; + case ADHESIVE_N_FRONT: txt = _( "Adhes_Front" ); break; + case SOLDERPASTE_N_BACK: txt = _( "SoldP_Back" ); break; + case SOLDERPASTE_N_FRONT: txt = _( "SoldP_Front" ); break; + case SILKSCREEN_N_BACK: txt = _( "SilkS_Back" ); break; + case SILKSCREEN_N_FRONT: txt = _( "SilkS_Front" ); break; + case SOLDERMASK_N_BACK: txt = _( "Mask_Back" ); break; + case SOLDERMASK_N_FRONT: txt = _( "Mask_Front" ); break; + case DRAW_N: txt = _( "Drawings" ); break; + case COMMENT_N: txt = _( "Comments" ); break; + case ECO1_N: txt = _( "Eco1" ); break; + case ECO2_N: txt = _( "Eco2" ); break; + case EDGE_N: txt = _( "PCB_Edges" ); break; + default: txt = wxT( "BAD INDEX" ); break; } return wxString( txt ); diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 1eecdb10b5..2a7ada1e6c 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -983,20 +983,20 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const throw( IO_ERROR ) { - std::string shape; + const char* shape; switch( aPad->GetShape() ) { - case PAD_CIRCLE: shape = "circle"; break; - case PAD_RECT: shape = "rect"; break; - case PAD_OVAL: shape = "oval"; break; - case PAD_TRAPEZOID: shape = "trapezoid"; break; + case PAD_CIRCLE: shape = "circle"; break; + case PAD_RECT: shape = "rect"; break; + case PAD_OVAL: shape = "oval"; break; + case PAD_TRAPEZOID: shape = "trapezoid"; break; default: THROW_IO_ERROR( wxString::Format( _( "unknown pad type: %d"), aPad->GetShape() ) ); } - std::string type; + const char* type; switch( aPad->GetAttribute() ) { @@ -1012,7 +1012,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const m_out->Print( aNestLevel, "(pad %s %s %s", m_out->Quotew( aPad->GetPadName() ).c_str(), - type.c_str(), shape.c_str() ); + type, shape ); m_out->Print( 0, " (at %s", FMT_IU( aPad->GetPos0() ).c_str() ); if( aPad->GetOrientation() != 0.0 ) @@ -1502,7 +1502,7 @@ BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* THROW_IO_ERROR( msg ); } - FILE_LINE_READER reader( file.fp(), aFileName ); + FILE_LINE_READER reader( file.fp(), aFileName, false /* wxFFile owns fp */ ); m_parser->SetLineReader( &reader ); m_parser->SetBoard( aAppendToMe );