Changed: #853 Compilation on 64-bits platforms

This commit is contained in:
kervala 2010-05-13 23:33:22 +02:00
parent 65c58b40ab
commit f79217476b
4 changed files with 21 additions and 21 deletions

View file

@ -146,9 +146,9 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bo
string getBaseName (const string &fullname) string getBaseName (const string &fullname)
{ {
string sTmp2 = ""; string sTmp2 = "";
int pos = fullname.rfind('_'); string::size_type pos = fullname.rfind('_');
for (int j = 0; j <= pos; ++j) if (pos != string::npos)
sTmp2 += fullname[j]; sTmp2 = fullname.substr(0, pos+1);
return sTmp2; return sTmp2;
} }
@ -214,7 +214,7 @@ int main(int nNbArg, char **ppArgs)
} }
string fmtName; string fmtName;
uint iNumDirs = inputDirs.size(); uint iNumDirs = (uint)inputDirs.size();
if( iNumDirs ) if( iNumDirs )
{ {
fmtName = inputDirs.front(); fmtName = inputDirs.front();

View file

@ -40,8 +40,8 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y)
std::string zoneName(name); std::string zoneName(name);
// y // y
uint ind1 = zoneName.find("_"); string::size_type ind1 = zoneName.find("_");
if(ind1>=zoneName.length()) if(ind1 == string::npos || ind1>=zoneName.length())
{ {
nlwarning("bad file name"); nlwarning("bad file name");
return false; return false;
@ -59,7 +59,7 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y)
// x // x
x = 0; x = 0;
uint ind2 = zoneName.length(); uint ind2 = (uint)zoneName.length();
if((ind2-ind1-1)!=2) if((ind2-ind1-1)!=2)
{ {
nlwarning("x code size is not a 2 characters code"); nlwarning("x code size is not a 2 characters code");

View file

@ -101,8 +101,8 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y)
std::string zoneName(name); std::string zoneName(name);
// y // y
uint ind1 = zoneName.find("_"); string::size_type ind1 = zoneName.find("_");
if(ind1>=zoneName.length()) if(ind1 == string::npos || ind1>=zoneName.length())
{ {
nlwarning("bad file name"); nlwarning("bad file name");
return false; return false;
@ -120,7 +120,7 @@ bool getZoneCoordByName(const char * name, uint16& x, uint16& y)
// x // x
x = 0; x = 0;
uint ind2 = zoneName.length(); uint ind2 = (uint)zoneName.length();
if((ind2-ind1-1)!=2) if((ind2-ind1-1)!=2)
{ {
nlwarning("x code size is not a 2 characters code"); nlwarning("x code size is not a 2 characters code");

View file

@ -70,7 +70,7 @@ inline bool isASCII (uint8 c)
bool isASCII(vector<char> &fileArray) bool isASCII(vector<char> &fileArray)
{ {
// Array size // Array size
uint size = fileArray.size(); uint size = (uint)fileArray.size();
if (size) if (size)
{ {
@ -110,7 +110,7 @@ void removeBeginEndSpaces (string &str)
str = str.substr (index, str.length ()-index); str = str.substr (index, str.length ()-index);
// Remove end space // Remove end space
index=str.length ()-1; index=(sint)str.length ()-1;
while ( (index>0) && (str[index]==' ') ) while ( (index>0) && (str[index]==' ') )
index--; index--;
str.resize (index+1); str.resize (index+1);
@ -128,17 +128,17 @@ void removeChar (string &str, char ch)
void removeDirectory (string &str) void removeDirectory (string &str)
{ {
// Remove begin space // Remove begin space
int pos = str.rfind ('\\'); string::size_type pos = str.rfind ('\\');
int pos2 = str.rfind ('/'); string::size_type pos2 = str.rfind ('/');
pos = std::max (pos, pos2); pos = std::max (pos, pos2);
if (pos>=0) if (pos != string::npos)
str = str.substr (pos+1, str.size()); str = str.substr (pos+1, str.size());
} }
bool filterExtension (const char *str, const vector<string> &extensions) bool filterExtension (const char *str, const vector<string> &extensions)
{ {
// String size // String size
uint size = strlen (str); uint size = (uint)strlen (str);
// For each filter // For each filter
for (uint i=0; i<extensions.size(); i++) for (uint i=0; i<extensions.size(); i++)
@ -164,14 +164,14 @@ const char *getExtension (const char *filename)
void removeExtension (string &filename) void removeExtension (string &filename)
{ {
int index = filename.rfind ('.'); string::size_type index = filename.rfind ('.');
filename.resize (index); filename.resize (index);
} }
void extractStringsFromBinary (const vector<char> &fileArray, set<string> &filenameStrings, const vector<string> &extensions) void extractStringsFromBinary (const vector<char> &fileArray, set<string> &filenameStrings, const vector<string> &extensions)
{ {
// Array size // Array size
uint size = fileArray.size(); uint size = (uint)fileArray.size();
// Array pointer // Array pointer
const char *arrayPointer = &fileArray[0]; const char *arrayPointer = &fileArray[0];
@ -238,7 +238,7 @@ void extractStringsFromBinary (const vector<char> &fileArray, set<string> &filen
void extractStringsFromASCII (const vector<char> &fileArray, set<string> &filenameStrings, const vector<string> &extensions) void extractStringsFromASCII (const vector<char> &fileArray, set<string> &filenameStrings, const vector<string> &extensions)
{ {
// Array size // Array size
uint size = fileArray.size(); uint size = (uint)fileArray.size();
if (size) if (size)
{ {
// Array pointer // Array pointer
@ -470,7 +470,7 @@ void progress (const char *message, float progress)
pgId= min(pgId, (uint)(BAR_LENGTH-1)); pgId= min(pgId, (uint)(BAR_LENGTH-1));
sprintf (msg, "\r%s %s", progressbar[pgId], message ); sprintf (msg, "\r%s %s", progressbar[pgId], message );
uint i; uint i;
for (i=strlen(msg); i<79; i++) for (i=(uint)strlen(msg); i<79; i++)
msg[i]=' '; msg[i]=' ';
msg[i]=0; msg[i]=0;
printf (msg); printf (msg);
@ -506,7 +506,7 @@ int main(int argc, char* argv[])
printf ("\rScaning files... \n"); printf ("\rScaning files... \n");
uint size = 0; uint size = 0;
uint maxSize = inputFiles.size(); uint maxSize = (uint)inputFiles.size();
set<string>::iterator ite = inputFiles.begin(); set<string>::iterator ite = inputFiles.begin();
while (ite != inputFiles.end()) while (ite != inputFiles.end())
{ {