From: Vadim Zeitlin Date: Tue, 4 Jan 2011 23:48:09 +0000 (+0000) Subject: Fix wxImage test compilation for MSVC6. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2960bae821456e2adae52936839898e0715b0889 Fix wxImage test compilation for MSVC6. Don't reuse variables declared inside for loops as VC6 doesn't implement proper scoping for them. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66583 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/tests/image/image.cpp b/tests/image/image.cpp index cff0630650..7cadc7fb32 100644 --- a/tests/image/image.cpp +++ b/tests/image/image.cpp @@ -967,6 +967,11 @@ void CompareImage(const wxImageHandler& handler, const wxImage& image, void ImageTestCase::CompareSavedImage() { + // FIXME-VC6: Pre-declare the loop variables for compatibility with + // pre-standard compilers such as MSVC6 that don't implement proper scope + // for the variables declared in the for loops. + int i, x, y; + wxImage expected24("horse.png"); CPPUNIT_ASSERT( expected24.IsOk() ); CPPUNIT_ASSERT( !expected24.HasAlpha() ); @@ -976,7 +981,7 @@ void ImageTestCase::CompareSavedImage() numColours = expected8.CountColours(); unsigned char greys[256]; - for (size_t i = 0; i < 256; ++i) + for (i = 0; i < 256; ++i) { greys[i] = i; } @@ -990,9 +995,9 @@ void ImageTestCase::CompareSavedImage() int width = expected32.GetWidth(); int height = expected32.GetHeight(); - for (int y = 0; y < height; ++y) + for (y = 0; y < height; ++y) { - for (int x = 0; x < width; ++x) + for (x = 0; x < width; ++x) { expected32.SetAlpha(x, y, (x*y) & wxIMAGE_ALPHA_OPAQUE); } @@ -1020,9 +1025,9 @@ void ImageTestCase::CompareSavedImage() width = expected8.GetWidth(); height = expected8.GetHeight(); - for (int y = 0; y < height; ++y) + for (y = 0; y < height; ++y) { - for (int x = 0; x < width; ++x) + for (x = 0; x < width; ++x) { expected8.SetAlpha(x, y, (x*y) & wxIMAGE_ALPHA_OPAQUE); } @@ -1046,7 +1051,7 @@ void ImageTestCase::CompareSavedImage() unsigned char red[256], green[256], blue[256]; const wxPalette& pal = expected8.GetPalette(); const int paletteCount = pal.GetColoursCount(); - for (int i = 0; i < paletteCount; ++i) + for (i = 0; i < paletteCount; ++i) { expected8.GetPalette().GetRGB(i, &red[i], &green[i], &blue[i]); }