From aa4c270d73eeed3e4508fea926f4858648ee8426 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 22 Oct 2017 16:43:17 +0200 Subject: [PATCH] Fix warning about local variable shadowing in clipping unit test Use "col" for the "wxColour" variable to avoid clash with "c" one used for the corner index. Also just construct the colour directly from the RGB values instead of default-initializing it and then using Set(), which also allows to make it "const". --- tests/graphics/clippingbox.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/graphics/clippingbox.cpp b/tests/graphics/clippingbox.cpp index 9cf1071cca..832105609b 100644 --- a/tests/graphics/clippingbox.cpp +++ b/tests/graphics/clippingbox.cpp @@ -646,33 +646,32 @@ void ClippingBoxTestCaseBase::CheckClipRect(int x, int y, int width, int height) for( int py = ymin; py <= ymax; py++ ) for( int px = xmin; px <= xmax; px++ ) { - wxColour c; unsigned char r = img.GetRed(px, py); unsigned char g = img.GetGreen(px, py); unsigned char b = img.GetBlue(px, py); - c.Set(r, g, b); + const wxColour col(r, g, b); wxString msgColour; if ( px >= x && px <= x + (width-1) && py >= y && py <= y + (height-1) ) { // Pixel inside the box. - if ( c != s_fgColour ) + if ( col != s_fgColour ) { msgColour = wxString::Format(wxS("Invalid colour drawn at (%i, %i): Actual: %s Expected: %s"), - px, py, c.GetAsString().mbc_str(), s_fgColour.GetAsString().mbc_str()); + px, py, col.GetAsString().mbc_str(), s_fgColour.GetAsString().mbc_str()); } } else { // Pixel outside the box. - if ( c != s_bgColour ) + if ( col != s_bgColour ) { msgColour = wxString::Format(wxS("Invalid colour drawn at (%i, %i): Actual: %s Expected: %s"), - px, py, c.GetAsString().mbc_str(), s_bgColour.GetAsString().mbc_str()); + px, py, col.GetAsString().mbc_str(), s_bgColour.GetAsString().mbc_str()); } }