From 3c6c83bf03e9a8a25893d98ce7a6988597e6eaf6 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 13 May 2010 23:37:09 +0200 Subject: [PATCH] Changed: #853 Compilation on 64-bits platforms --- code/nel/tools/3d/lightmap_optimizer/main.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/code/nel/tools/3d/lightmap_optimizer/main.cpp b/code/nel/tools/3d/lightmap_optimizer/main.cpp index 80b10668d..6bda04b78 100644 --- a/code/nel/tools/3d/lightmap_optimizer/main.cpp +++ b/code/nel/tools/3d/lightmap_optimizer/main.cpp @@ -155,23 +155,24 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y) string getBaseName (const string &fullname) { string sTmp2 = ""; - int pos = fullname.rfind('_'); - for (int j = 0; j <= pos; ++j) - sTmp2 += fullname[j]; + string::size_type pos = fullname.rfind('_'); + if (pos != string::npos) + sTmp2 = fullname.substr(0, pos+1); return sTmp2; } // --------------------------------------------------------------------------- uint8 getLayerNb (const string &fullname) { - string sTmp2; uint8 nRet = 0; - int beg = fullname.rfind('_'); - int end = fullname.rfind('.'); - for (int j = beg+1; j < end; ++j) - sTmp2 += fullname[j]; + string::size_type beg = fullname.rfind('_'); + string::size_type end = fullname.rfind('.'); + if (beg != string::npos) + { + string sTmp2 = fullname.substr(beg+1, end-beg-1); + NLMISC::fromString(sTmp2, nRet); + } - NLMISC::fromString(sTmp2, nRet); return nRet; } @@ -478,7 +479,7 @@ int main(int nNbArg, char **ppArgs) std::string start = AllLightmapNames[k].substr(0, tags[l].size()); if (NLMISC::nlstricmp(start, tags[l]) == 0) { - bestLength = tags[l].size(); + bestLength = (uint)tags[l].size(); // the tag matchs AllLightmapTags[k] = l; }