From 8f7a050a9e2b49bd91dd011d65589188cdf508fb Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 2 Aug 2014 10:57:31 +0200 Subject: [PATCH] Fixed: VC++ 2010 compiler bug in for loop variables reuse --- code/nel/tools/3d/build_interface/main.cpp | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/code/nel/tools/3d/build_interface/main.cpp b/code/nel/tools/3d/build_interface/main.cpp index be39b7d17..da652b0cc 100644 --- a/code/nel/tools/3d/build_interface/main.cpp +++ b/code/nel/tools/3d/build_interface/main.cpp @@ -113,18 +113,17 @@ void putPixel(uint8 *dst, uint8 *src, bool alphaTransfert) // *************************************************************************** bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bool alphaTransfert=true) { - uint32 a, b; - uint8 *rSrcPix = &pSrc->getPixels()[0]; uint8 *rDstPix = &pDst->getPixels()[0]; uint wSrc= pSrc->getWidth(); uint hSrc= pSrc->getHeight(); - for (b = 0; b < hSrc; ++b) - for (a = 0; a < wSrc; ++a) + for (uint b = 0; b < hSrc; ++b) + for (uint a = 0; a < wSrc; ++a) { if (rDstPix[4*((x+a)+(y+b)*pDst->getWidth())+3] != 0) return false; + // write putPixel(rDstPix + 4*((x+a)+(y+b)*pDst->getWidth()), rSrcPix+ 4*(a+b*pSrc->getWidth()), alphaTransfert); } @@ -135,9 +134,9 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bo // expand on W if(wSrcgetWidth()), rDstPix + 4*((x+wSrc-1)+(y+b)*pDst->getWidth()), alphaTransfert); } @@ -146,9 +145,9 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bo // expand on H if(hSrcgetWidth()), rDstPix + 4*((x+a)+(y+hSrc-1)*pDst->getWidth()), alphaTransfert); } @@ -252,12 +251,12 @@ int main(int nNbArg, char **ppArgs) } vector AllMaps; - sint32 i, j; + sint32 j; // Load all maps sint32 mapSize = (sint32)AllMapNames.size(); AllMaps.resize( mapSize ); - for( i = 0; i < mapSize; ++i ) + for(sint i = 0; i < mapSize; ++i ) { try { @@ -275,7 +274,7 @@ int main(int nNbArg, char **ppArgs) } // Sort all maps by decreasing size - for (i = 0; i < mapSize-1; ++i) + for (sint i = 0; i < mapSize-1; ++i) for (j = i+1; j < mapSize; ++j) { NLMISC::CBitmap *pBI = AllMaps[i]; @@ -303,7 +302,7 @@ int main(int nNbArg, char **ppArgs) vector UVMin, UVMax; UVMin.resize (mapSize, NLMISC::CUV(0.0f, 0.0f)); UVMax.resize (mapSize, NLMISC::CUV(0.0f, 0.0f)); - for (i = 0; i < mapSize; ++i) + for (sint i = 0; i < mapSize; ++i) { sint32 x, y; while (!tryAllPos(AllMaps[i], &GlobalMask, x, y)) @@ -349,7 +348,7 @@ int main(int nNbArg, char **ppArgs) } // Convert UV from pixel to ratio - for (i = 0; i < mapSize; ++i) + for (sint i = 0; i < mapSize; ++i) { UVMin[i].U = UVMin[i].U / (float)GlobalTexture.getWidth(); UVMin[i].V = UVMin[i].V / (float)GlobalTexture.getHeight(); @@ -394,7 +393,7 @@ int main(int nNbArg, char **ppArgs) FILE *f = fopen (fmtName.c_str(), "wt"); if (f != NULL) { - for (i = 0; i < mapSize; ++i) + for (sint i = 0; i < mapSize; ++i) { // get the string whitout path string fileName= CFile::getFilename(AllMapNames[i]); @@ -442,6 +441,8 @@ int main(int nNbArg, char **ppArgs) nlwarning("Can't parse %s", bufTmp); continue; } + + sint i; sTGAname = toLower(string(tgaName)); string findTGAName;