From a4658ab6bea27d4d8cbb0bb1a831ed121f7f7584 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 1 Jun 2016 14:22:05 +0200 Subject: [PATCH] Fix a few compil warnings (not used vars, shadowed local vars) --- 3d-viewer/3d_cache/sg/sg_faceset.cpp | 4 ++-- 3d-viewer/3d_cache/sg/sg_shape.cpp | 4 ++-- .../c3d_render_createscene_ogl_legacy.cpp | 15 ++++++--------- .../3d_render_ogl_legacy/ogl_legacy_utils.cpp | 1 - pcbnew/autorouter/auto_place_footprints.cpp | 4 ++-- pcbnew/specctra.cpp | 8 ++++---- pcbnew/tools/drawing_tool.cpp | 7 +++---- 7 files changed, 19 insertions(+), 24 deletions(-) diff --git a/3d-viewer/3d_cache/sg/sg_faceset.cpp b/3d-viewer/3d_cache/sg/sg_faceset.cpp index 16cd9c7023..e505591d58 100644 --- a/3d-viewer/3d_cache/sg/sg_faceset.cpp +++ b/3d-viewer/3d_cache/sg/sg_faceset.cpp @@ -638,8 +638,8 @@ bool SGFACESET::WriteCache( std::ofstream& aFile, SGNODE* parentNode ) if( NULL != m_RColors ) items[i] = true; - for( int i = 0; i < NITEMS; ++i ) - aFile.write( (char*)&items[i], sizeof(bool) ); + for( int jj = 0; jj < NITEMS; ++jj ) + aFile.write( (char*)&items[jj], sizeof(bool) ); if( items[0] ) m_Coords->WriteCache( aFile, this ); diff --git a/3d-viewer/3d_cache/sg/sg_shape.cpp b/3d-viewer/3d_cache/sg/sg_shape.cpp index adbf804d1b..aa4272afc9 100644 --- a/3d-viewer/3d_cache/sg/sg_shape.cpp +++ b/3d-viewer/3d_cache/sg/sg_shape.cpp @@ -486,8 +486,8 @@ bool SGSHAPE::WriteCache( std::ofstream& aFile, SGNODE* parentNode ) if( NULL != m_RFaceSet ) items[i] = true; - for( int i = 0; i < NITEMS; ++i ) - aFile.write( (char*)&items[i], sizeof(bool) ); + for( int jj = 0; jj < NITEMS; ++jj ) + aFile.write( (char*)&items[jj], sizeof(bool) ); if( items[0] ) m_Appearance->WriteCache( aFile, this ); diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp index ce6ab8719b..e9523441d9 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp @@ -185,16 +185,15 @@ void C3D_RENDER_OGL_LEGACY::reload() // Add layers maps (except B_Mask and F_Mask) // ///////////////////////////////////////////////////////////////////////// printf("Add layers maps...\n"); - for( MAP_CONTAINER_2D::const_iterator ii = m_settings.GetMapLayers().begin(); - ii != m_settings.GetMapLayers().end(); - ii++ ) + for( MAP_CONTAINER_2D::const_iterator it = m_settings.GetMapLayers().begin(); + it != m_settings.GetMapLayers().end(); it++ ) { - LAYER_ID layer_id = static_cast(ii->first); + LAYER_ID layer_id = static_cast(it->first); if( !m_settings.Is3DLayerEnabled( layer_id ) ) continue; - const CBVHCONTAINER2D *container2d = static_cast(ii->second); + const CBVHCONTAINER2D *container2d = static_cast(it->second); const LIST_OBJECT2D listObject2d = container2d->GetList(); if( listObject2d.size() == 0 ) @@ -277,8 +276,7 @@ void C3D_RENDER_OGL_LEGACY::reload() m_triangles[layer_id] = layerTriangles; for( LIST_OBJECT2D::const_iterator itemOnLayer = listObject2d.begin(); - itemOnLayer != listObject2d.end(); - itemOnLayer++ ) + itemOnLayer != listObject2d.end(); itemOnLayer++ ) { const COBJECT2D *object2d_A = static_cast(*itemOnLayer); @@ -328,8 +326,7 @@ void C3D_RENDER_OGL_LEGACY::reload() contournPoints.clear(); contournPoints.reserve( nr_sides_per_circle + 2 ); int delta = 3600 / nr_sides_per_circle; - int ii; - for( ii = 0; ii < 3600; ii += delta ) + for( int ii = 0; ii < 3600; ii += delta ) { const SFVEC2F rotatedDir = glm::rotate( SFVEC2F( 0.0f, 1.0f ), (float)ii * 2.0f * 3.14f / 3600.0f ); contournPoints.push_back( SFVEC2F( center.x - rotatedDir.y * radius, center.y + rotatedDir.x * radius ) ); diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/ogl_legacy_utils.cpp b/3d-viewer/3d_rendering/3d_render_ogl_legacy/ogl_legacy_utils.cpp index e256e3e388..db748bc2a1 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/ogl_legacy_utils.cpp +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/ogl_legacy_utils.cpp @@ -206,7 +206,6 @@ void OGL_Draw_segment( const CROUNDSEGMENT2D &aSegment, unsigned int aNrSidesPer glPushMatrix(); const SFVEC2F start = aSegment.GetStart(); - const SFVEC2F end = aSegment.GetEnd(); const SFVEC2F end_minus_start = aSegment.GetEnd_minus_Start(); const float radius = aSegment.GetRadius(); const float width = aSegment.GetWidth(); diff --git a/pcbnew/autorouter/auto_place_footprints.cpp b/pcbnew/autorouter/auto_place_footprints.cpp index d6d25a13da..0a3626d890 100644 --- a/pcbnew/autorouter/auto_place_footprints.cpp +++ b/pcbnew/autorouter/auto_place_footprints.cpp @@ -1109,9 +1109,9 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC ) sort( moduleList.begin(), moduleList.end(), Tri_PlaceModules ); - for( unsigned ii = 0; ii < moduleList.size(); ii++ ) + for( unsigned kk = 0; kk < moduleList.size(); kk++ ) { - Module = moduleList[ii]; + Module = moduleList[kk]; Module->SetFlag( 0 ); if( !Module->NeedsPlaced() ) diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index a62925993c..ef14eee471 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -242,9 +242,9 @@ void SPECCTRA_DB::readTIME( time_t* time_stamp ) throw( IO_ERROR ) void SPECCTRA_DB::LoadPCB( const wxString& aFilename ) throw( IO_ERROR, boost::bad_pointer ) { - FILE_LINE_READER reader( aFilename ); + FILE_LINE_READER curr_reader( aFilename ); - PushReader( &reader ); + PushReader( &curr_reader ); if( NextTok() != T_LEFT ) Expecting( T_LEFT ); @@ -261,9 +261,9 @@ void SPECCTRA_DB::LoadPCB( const wxString& aFilename ) throw( IO_ERROR, boost::b void SPECCTRA_DB::LoadSESSION( const wxString& aFilename ) throw( IO_ERROR, boost::bad_pointer ) { - FILE_LINE_READER reader( aFilename ); + FILE_LINE_READER curr_reader( aFilename ); - PushReader( &reader ); + PushReader( &curr_reader ); if( NextTok() != T_LEFT ) Expecting( T_LEFT ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index eb73489c57..c4ecdc9b0d 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -235,7 +235,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent ) int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) { DIMENSION* dimension = NULL; - int width, maxThickness; + int maxThickness; // if one day it is possible to draw dimensions in the footprint editor, // then hereby I'm letting you know that this tool does not handle UR_MODEDIT undo yet @@ -322,7 +322,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) dimension->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) ); dimension->Text().SetSize( m_board->GetDesignSettings().m_PcbTextSize ); - width = m_board->GetDesignSettings().m_PcbTextWidth; + int width = m_board->GetDesignSettings().m_PcbTextWidth; maxThickness = Clamp_Text_PenSize( width, dimension->Text().GetSize() ); if( width > maxThickness ) @@ -453,8 +453,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent ) KIGFX::VIEW_GROUP preview( m_view ); // Build the undo list & add items to the current view - std::list::const_iterator it, itEnd; - for( it = list.begin(), itEnd = list.end(); it != itEnd; ++it ) + for( auto it = list.begin(), itEnd = list.end(); it != itEnd; ++it ) { KICAD_T type = (*it)->Type(); assert( type == PCB_LINE_T || type == PCB_TEXT_T );