From f79217476bf1523b755b02ebbba9340e13a1c656 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 13 May 2010 23:33:22 +0200 Subject: [PATCH] Changed: #853 Compilation on 64-bits platforms --- code/nel/tools/3d/build_interface/main.cpp | 8 +++---- .../tools/3d/zone_check_bind/zone_utility.cpp | 6 ++--- code/nel/tools/3d/zone_lib/zone_utility.cpp | 6 ++--- .../extract_filename/extract_filename.cpp | 22 +++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/code/nel/tools/3d/build_interface/main.cpp b/code/nel/tools/3d/build_interface/main.cpp index c332f0063..09c327db6 100644 --- a/code/nel/tools/3d/build_interface/main.cpp +++ b/code/nel/tools/3d/build_interface/main.cpp @@ -146,9 +146,9 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bo 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; } @@ -214,7 +214,7 @@ int main(int nNbArg, char **ppArgs) } string fmtName; - uint iNumDirs = inputDirs.size(); + uint iNumDirs = (uint)inputDirs.size(); if( iNumDirs ) { fmtName = inputDirs.front(); diff --git a/code/nel/tools/3d/zone_check_bind/zone_utility.cpp b/code/nel/tools/3d/zone_check_bind/zone_utility.cpp index 0d349dfc8..106427d53 100644 --- a/code/nel/tools/3d/zone_check_bind/zone_utility.cpp +++ b/code/nel/tools/3d/zone_check_bind/zone_utility.cpp @@ -40,8 +40,8 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y) std::string zoneName(name); // y - uint ind1 = zoneName.find("_"); - if(ind1>=zoneName.length()) + string::size_type ind1 = zoneName.find("_"); + if(ind1 == string::npos || ind1>=zoneName.length()) { nlwarning("bad file name"); return false; @@ -59,7 +59,7 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y) // x x = 0; - uint ind2 = zoneName.length(); + uint ind2 = (uint)zoneName.length(); if((ind2-ind1-1)!=2) { nlwarning("x code size is not a 2 characters code"); diff --git a/code/nel/tools/3d/zone_lib/zone_utility.cpp b/code/nel/tools/3d/zone_lib/zone_utility.cpp index 5d104e856..63570aa39 100644 --- a/code/nel/tools/3d/zone_lib/zone_utility.cpp +++ b/code/nel/tools/3d/zone_lib/zone_utility.cpp @@ -101,8 +101,8 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y) std::string zoneName(name); // y - uint ind1 = zoneName.find("_"); - if(ind1>=zoneName.length()) + string::size_type ind1 = zoneName.find("_"); + if(ind1 == string::npos || ind1>=zoneName.length()) { nlwarning("bad file name"); return false; @@ -120,7 +120,7 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y) // x x = 0; - uint ind2 = zoneName.length(); + uint ind2 = (uint)zoneName.length(); if((ind2-ind1-1)!=2) { nlwarning("x code size is not a 2 characters code"); diff --git a/code/nel/tools/misc/extract_filename/extract_filename.cpp b/code/nel/tools/misc/extract_filename/extract_filename.cpp index 310e91bd2..926ac359c 100644 --- a/code/nel/tools/misc/extract_filename/extract_filename.cpp +++ b/code/nel/tools/misc/extract_filename/extract_filename.cpp @@ -70,7 +70,7 @@ inline bool isASCII (uint8 c) bool isASCII(vector &fileArray) { // Array size - uint size = fileArray.size(); + uint size = (uint)fileArray.size(); if (size) { @@ -110,7 +110,7 @@ void removeBeginEndSpaces (string &str) str = str.substr (index, str.length ()-index); // Remove end space - index=str.length ()-1; + index=(sint)str.length ()-1; while ( (index>0) && (str[index]==' ') ) index--; str.resize (index+1); @@ -128,17 +128,17 @@ void removeChar (string &str, char ch) void removeDirectory (string &str) { // Remove begin space - int pos = str.rfind ('\\'); - int pos2 = str.rfind ('/'); + string::size_type pos = str.rfind ('\\'); + string::size_type pos2 = str.rfind ('/'); pos = std::max (pos, pos2); - if (pos>=0) + if (pos != string::npos) str = str.substr (pos+1, str.size()); } bool filterExtension (const char *str, const vector &extensions) { // String size - uint size = strlen (str); + uint size = (uint)strlen (str); // For each filter for (uint i=0; i &fileArray, set &filenameStrings, const vector &extensions) { // Array size - uint size = fileArray.size(); + uint size = (uint)fileArray.size(); // Array pointer const char *arrayPointer = &fileArray[0]; @@ -238,7 +238,7 @@ void extractStringsFromBinary (const vector &fileArray, set &filen void extractStringsFromASCII (const vector &fileArray, set &filenameStrings, const vector &extensions) { // Array size - uint size = fileArray.size(); + uint size = (uint)fileArray.size(); if (size) { // Array pointer @@ -470,7 +470,7 @@ void progress (const char *message, float progress) pgId= min(pgId, (uint)(BAR_LENGTH-1)); sprintf (msg, "\r%s %s", progressbar[pgId], message ); uint i; - for (i=strlen(msg); i<79; i++) + for (i=(uint)strlen(msg); i<79; i++) msg[i]=' '; msg[i]=0; printf (msg); @@ -506,7 +506,7 @@ int main(int argc, char* argv[]) printf ("\rScaning files... \n"); uint size = 0; - uint maxSize = inputFiles.size(); + uint maxSize = (uint)inputFiles.size(); set::iterator ite = inputFiles.begin(); while (ite != inputFiles.end()) {