A few minor fixes for compil warnings (shadowed local variables and deprecated auto_ptr)

This commit is contained in:
jean-pierre charras 2016-05-29 17:03:58 +02:00
commit 7872f1ec15
9 changed files with 29 additions and 31 deletions

View File

@ -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;

View File

@ -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 )
{

View File

@ -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 <wxPoint> 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 <wxPoint> 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

View File

@ -658,9 +658,9 @@ bool WIZARD_FPLIB_TABLE::downloadGithubLibsFromList( wxArrayString& aUrlList,
for( unsigned i = 0; i < footprints.size(); ++i )
{
std::auto_ptr<MODULE> m( src->FootprintLoad( libsrc_name, footprints[i] ) );
std::unique_ptr<MODULE> 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 )

View File

@ -149,11 +149,11 @@ public:
/// return the contents of the XPATH as a single string
string Contents()
{
typedef std::vector<TRIPLET>::const_iterator CITER;
typedef std::vector<TRIPLET>::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<BOARD> deleter( aAppendToMe ? NULL : m_board );
// delete on exception, if I own m_board, according to aAppendToMe
unique_ptr<BOARD> 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<MODULE> m( new MODULE( m_board ) );
std::unique_ptr<MODULE> m( new MODULE( m_board ) );
m->SetFPID( FPID( aPkgName ) );

View File

@ -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<MODULE> m_module;
std::unique_ptr<MODULE> 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> module( new MODULE( NULL ) );
std::unique_ptr<MODULE> module( new MODULE( NULL ) );
if( aLineReader->ReadLine() == NULL )

View File

@ -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<MODULE> m( cur->FootprintLoad( curLibPath, mods[i] ) );
std::unique_ptr<MODULE> 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 )

View File

@ -75,7 +75,7 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
try
{
std::auto_ptr<NETLIST_READER> netlistReader( NETLIST_READER::GetNetlistReader(
std::unique_ptr<NETLIST_READER> netlistReader( NETLIST_READER::GetNetlistReader(
&netlist, aNetlistFileName, aCmpFileName ) );
if( !netlistReader.get() )

View File

@ -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_READER> cmp_rdr( aCompFootprintFileName.IsEmpty() ?
std::unique_ptr<CMP_READER> cmp_rdr( aCompFootprintFileName.IsEmpty() ?
NULL :
new CMP_READER( new FILE_LINE_READER( aCompFootprintFileName ) ) );