From 30df041de6329716e07ac328adacd9724da5d72a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 25 Nov 2016 18:17:34 +0100 Subject: [PATCH] fix shadowed local variables --- common/gal/opengl/opengl_gal.cpp | 18 +++++++++++------- include/gal/opengl/opengl_gal.h | 2 +- pcbnew/specctra.cpp | 6 +++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index a0b3065aa8..c94bc4f94b 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -1314,7 +1314,7 @@ int OPENGL_GAL::drawBitmapChar( unsigned long aChar ) const float XOFF = glyph->minx; // adjust for height rounding - const float round_adjust = ( glyph->maxy - glyph->miny ) + const float round_adjust = ( glyph->maxy - glyph->miny ) - float( glyph->atlas_h - font_information.smooth_pixels * 2 ); const float top_adjust = font_information.max_y - glyph->maxy; const float YOFF = round_adjust + top_adjust; @@ -1383,20 +1383,24 @@ void OPENGL_GAL::drawBitmapOverbar( double aLength, double aHeight ) Restore(); } -const bitmap_glyph* OPENGL_GAL::lookupGlyph( unsigned int codepoint ) const +const bitmap_glyph* OPENGL_GAL::lookupGlyph( unsigned int aCodepoint ) const { #ifdef BITMAP_FONT_USE_SPANS auto *end = font_codepoint_spans + sizeof( font_codepoint_spans ) / sizeof( bitmap_span ); - auto ptr = std::upper_bound( font_codepoint_spans, end, codepoint, - []( unsigned int codepoint, const bitmap_span& span ) { + auto ptr = std::upper_bound( font_codepoint_spans, end, aCodepoint, + []( unsigned int codepoint, const bitmap_span& span ) + { return codepoint < span.end; } ); - if( ptr != end && ptr->start <= codepoint ) { - unsigned int index = codepoint - ptr->start + ptr->cumulative; + if( ptr != end && ptr->start <= aCodepoint ) + { + unsigned int index = aCodepoint - ptr->start + ptr->cumulative; return &font_codepoint_infos[index]; - } else { + } + else + { return nullptr; } #else diff --git a/include/gal/opengl/opengl_gal.h b/include/gal/opengl/opengl_gal.h index f9f84edef4..571f0a05e0 100644 --- a/include/gal/opengl/opengl_gal.h +++ b/include/gal/opengl/opengl_gal.h @@ -380,7 +380,7 @@ private: */ std::pair computeBitmapTextSize( const wxString& aText ) const; - const bitmap_glyph* lookupGlyph( unsigned int codepoint ) const; + const bitmap_glyph* lookupGlyph( unsigned int aCodepoint ) const; // Event handling /** diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index b9a304dcf9..e9f60e6916 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -2549,7 +2549,7 @@ void SPECCTRA_DB::doCLASS( CLASS* growth ) throw( IO_ERROR, boost::bad_pointer ) { std::string builder; int bracketNesting = 1; // we already saw the opening T_LEFT - T tok = T_NONE; + tok = T_NONE; while( bracketNesting!=0 && tok!=T_EOF ) { @@ -2563,9 +2563,9 @@ void SPECCTRA_DB::doCLASS( CLASS* growth ) throw( IO_ERROR, boost::bad_pointer ) if( bracketNesting >= 1 ) { - T prevTok = (T) PrevTok(); + T previousTok = (T) PrevTok(); - if( prevTok!=T_LEFT && prevTok!=T_circuit && tok!=T_RIGHT ) + if( previousTok!=T_LEFT && previousTok!=T_circuit && tok!=T_RIGHT ) builder += ' '; if( tok==T_STRING )