From 1ae9175671a5f386e09e3fac13099cf5af2ffe05 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 29 May 2016 17:02:34 +0200 Subject: [PATCH] A few minor fixes for compil warnings (shadowed variables and deprecated auto_ptr) --- common/gal/opengl/opengl_gal.cpp | 6 +++--- .../fp_conflict_assignment_selector.cpp | 2 +- .../board_items_to_polygon_shape_transform.cpp | 14 +++++++------- pcbnew/dialogs/wizard_add_fplib.cpp | 4 ++-- pcbnew/eagle_plugin.cpp | 18 +++++++++--------- pcbnew/gpcb_plugin.cpp | 4 ++-- pcbnew/loadcmp.cpp | 6 ++---- pcbnew/netlist.cpp | 2 +- pcbnew/netlist_reader.cpp | 4 ++-- 9 files changed, 29 insertions(+), 31 deletions(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 73b1b4f805..f8e0ec6e32 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -767,9 +767,9 @@ void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition, * v2 v3 */ - for( unsigned int i = 0; i < aText.length(); ++i ) + for( unsigned int ii = 0; ii < aText.length(); ++ii ) { - const unsigned int c = aText[i]; + const unsigned int c = aText[ii]; wxASSERT_MSG( c < bitmap_chars_count, wxT( "Missing character in bitmap font atlas." ) ); @@ -798,7 +798,7 @@ void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition, } // Draw tilda characters if there are any remaining - for( int i = 0; i < tildas / 2; ++i ) + for( int jj = 0; jj < tildas / 2; ++jj ) overbarLength += drawBitmapChar( '~' ); tildas = 0; diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector.cpp b/cvpcb/dialogs/fp_conflict_assignment_selector.cpp index 35dcd8f5a5..ef2f180023 100644 --- a/cvpcb/dialogs/fp_conflict_assignment_selector.cpp +++ b/cvpcb/dialogs/fp_conflict_assignment_selector.cpp @@ -127,7 +127,7 @@ void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnItemClicked( wxMouseEvent& event else { minpx = maxpx; - int maxpx = minpx + m_listFp->GetColumnWidth( 3 ); + maxpx = minpx + m_listFp->GetColumnWidth( 3 ); if( pos.x > minpx && pos.x < maxpx ) { diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index ff72aac71d..ebe5c0d5c0 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -758,9 +758,6 @@ void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer, // the pad position is NOT the shape position wxSize copper_thickness; - int dx = aPad.GetSize().x / 2; - int dy = aPad.GetSize().y / 2; - double delta = 3600.0 / aCircleToSegmentsCount; // rot angle in 0.1 degree /* Keep in account the polygon outline thickness @@ -778,6 +775,9 @@ void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer, if( aCopperThickness < 0 ) aCopperThickness = 0; + int dx = aPad.GetSize().x / 2; + int dy = aPad.GetSize().y / 2; + copper_thickness.x = std::min( dx, aCopperThickness ); copper_thickness.y = std::min( dy, aCopperThickness ); @@ -870,8 +870,8 @@ void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer, // Oval pad support along the lines of round and rectangular pads std::vector corners_buffer; // Polygon buffer as vector - int dx = (aPad.GetSize().x / 2) + aThermalGap; // Cutout radius x - int dy = (aPad.GetSize().y / 2) + aThermalGap; // Cutout radius y + dx = (aPad.GetSize().x / 2) + aThermalGap; // Cutout radius x + dy = (aPad.GetSize().y / 2) + aThermalGap; // Cutout radius y wxPoint shape_offset; @@ -1023,8 +1023,8 @@ void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer, std::vector corners_buffer; // Polygon buffer as vector - int dx = (aPad.GetSize().x / 2) + aThermalGap; // Cutout radius x - int dy = (aPad.GetSize().y / 2) + aThermalGap; // Cutout radius y + dx = (aPad.GetSize().x / 2) + aThermalGap; // Cutout radius x + dy = (aPad.GetSize().y / 2) + aThermalGap; // Cutout radius y // The first point of polygon buffer is left lower corner, second the crosspoint of // thermal spoke sides, the third is upper right corner and the rest are rounding diff --git a/pcbnew/dialogs/wizard_add_fplib.cpp b/pcbnew/dialogs/wizard_add_fplib.cpp index 254cec3531..17fdb9b919 100644 --- a/pcbnew/dialogs/wizard_add_fplib.cpp +++ b/pcbnew/dialogs/wizard_add_fplib.cpp @@ -658,9 +658,9 @@ bool WIZARD_FPLIB_TABLE::downloadGithubLibsFromList( wxArrayString& aUrlList, for( unsigned i = 0; i < footprints.size(); ++i ) { - std::auto_ptr m( src->FootprintLoad( libsrc_name, footprints[i] ) ); + std::unique_ptr m( src->FootprintLoad( libsrc_name, footprints[i] ) ); dst->FootprintSave( libdst_name, m.get() ); - // m is deleted here by auto_ptr. + // m is deleted here by unique_ptr. } } catch( const IO_ERROR& ioe ) diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 4040161283..ec7182a405 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -149,11 +149,11 @@ public: /// return the contents of the XPATH as a single string string Contents() { - typedef std::vector::const_iterator CITER; + typedef std::vector::const_iterator CITER_TRIPLET; string ret; - for( CITER it = p.begin(); it != p.end(); ++it ) + for( CITER_TRIPLET it = p.begin(); it != p.end(); ++it ) { if( it != p.begin() ) ret += '.'; @@ -1191,8 +1191,8 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, const if( !aAppendToMe ) m_board->SetFileName( aFileName ); - // delete on exception, iff I own m_board, according to aAppendToMe - auto_ptr deleter( aAppendToMe ? NULL : m_board ); + // delete on exception, if I own m_board, according to aAppendToMe + unique_ptr deleter( aAppendToMe ? NULL : m_board ); try { @@ -1806,9 +1806,9 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements ) m_xpath->Value( e.name.c_str() ); - string key = makeKey( e.library, e.package ); + string pkg_key = makeKey( e.library, e.package ); - MODULE_CITER mi = m_templates.find( key ); + MODULE_CITER mi = m_templates.find( pkg_key ); if( mi == m_templates.end() ) { @@ -1832,9 +1832,9 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements ) // update the nets within the pads of the clone for( D_PAD* pad = m->Pads(); pad; pad = pad->Next() ) { - string key = makeKey( e.name, TO_UTF8( pad->GetPadName() ) ); + string pn_key = makeKey( e.name, TO_UTF8( pad->GetPadName() ) ); - NET_MAP_CITER ni = m_pads_to_nets.find( key ); + NET_MAP_CITER ni = m_pads_to_nets.find( pn_key ); if( ni != m_pads_to_nets.end() ) { const ENET* enet = &ni->second; @@ -2124,7 +2124,7 @@ void EAGLE_PLUGIN::orientModuleText( MODULE* m, const EELEMENT& e, MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const string& aPkgName ) const { - std::auto_ptr m( new MODULE( m_board ) ); + std::unique_ptr m( new MODULE( m_board ) ); m->SetFPID( FPID( aPkgName ) ); diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index 94815f0430..a41d026582 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -140,7 +140,7 @@ class GPCB_FPL_CACHE_ITEM wxFileName m_file_name; ///< The the full file name and path of the footprint to cache. bool m_writable; ///< Writability status of the footprint file. wxDateTime m_mod_time; ///< The last file modified time stamp. - std::auto_ptr m_module; + std::unique_ptr m_module; public: GPCB_FPL_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName ); @@ -412,7 +412,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR, wxPoint textPos; wxString msg; wxArrayString parameters; - std::auto_ptr module( new MODULE( NULL ) ); + std::unique_ptr module( new MODULE( NULL ) ); if( aLineReader->ReadLine() == NULL ) diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 7527b0c684..c49d105adf 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -252,8 +252,6 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, } else { - FPID fpid; - wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL, wxString::Format( wxT( "Could not parse FPID string '%s'." ), GetChars( moduleName ) ) ); @@ -553,14 +551,14 @@ void FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs( wxCommandEvent& aEvent ) for( unsigned i = 0; i < mods.size(); ++i ) { - std::auto_ptr m( cur->FootprintLoad( curLibPath, mods[i] ) ); + std::unique_ptr m( cur->FootprintLoad( curLibPath, mods[i] ) ); dst->FootprintSave( dstLibPath, m.get() ); msg = wxString::Format( _( "Footprint '%s' saved" ), GetChars( mods[i] ) ); SetStatusText( msg ); - // m is deleted here by auto_ptr. + // m is deleted here by unique_ptr. } } catch( const IO_ERROR& ioe ) diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index dab6f701b5..96b4e8b88e 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -75,7 +75,7 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName, try { - std::auto_ptr netlistReader( NETLIST_READER::GetNetlistReader( + std::unique_ptr netlistReader( NETLIST_READER::GetNetlistReader( &netlist, aNetlistFileName, aCmpFileName ) ); if( !netlistReader.get() ) diff --git a/pcbnew/netlist_reader.cpp b/pcbnew/netlist_reader.cpp index 5e67c94fa5..3aab71fb6b 100644 --- a/pcbnew/netlist_reader.cpp +++ b/pcbnew/netlist_reader.cpp @@ -83,13 +83,13 @@ NETLIST_READER* NETLIST_READER::GetNetlistReader( NETLIST* aNetlist, { wxASSERT( aNetlist != NULL ); - std::auto_ptr< FILE_LINE_READER > file_rdr(new FILE_LINE_READER( aNetlistFileName ) ); + std::unique_ptr< FILE_LINE_READER > file_rdr(new FILE_LINE_READER( aNetlistFileName ) ); NETLIST_FILE_T type = GuessNetlistFileType( file_rdr.get() ); file_rdr->Rewind(); // The component footprint link reader is NULL if no file name was specified. - std::auto_ptr cmp_rdr( aCompFootprintFileName.IsEmpty() ? + std::unique_ptr cmp_rdr( aCompFootprintFileName.IsEmpty() ? NULL : new CMP_READER( new FILE_LINE_READER( aCompFootprintFileName ) ) );