Changed: #853 Compilation on 64-bits platforms

This commit is contained in:
kervala 2010-05-17 14:30:28 +02:00
parent a0c4d7d72f
commit 17262473c0
12 changed files with 44 additions and 43 deletions

View file

@ -11,8 +11,8 @@ using namespace NLMISC;
void explodeSubStrings(const std::string &str, vector<std::string> &strings, sint32 parenthesis=0) void explodeSubStrings(const std::string &str, vector<std::string> &strings, sint32 parenthesis=0)
{ {
const std::string separators("(),"); const std::string separators("(),");
uint32 current=0; string::size_type current=0;
uint32 nextCurrent=current; string::size_type nextCurrent=current;
strings.clear(); strings.clear();
nextCurrent=str.find_first_of(separators.c_str(), current); nextCurrent=str.find_first_of(separators.c_str(), current);
@ -1060,7 +1060,7 @@ CFightScriptComp *CFightScriptCompReader::createScriptComp (const string &str) t
{ {
string scriptCompName; string scriptCompName;
{ {
const uint32 index=str.find_first_of("()", 0); const string::size_type index=str.find_first_of("()", 0);
if (index==string::npos) if (index==string::npos)
throw ReadFightActionException("ScriptComp Creation of :"+str+" Failed because of bad Syntax"); throw ReadFightActionException("ScriptComp Creation of :"+str+" Failed because of bad Syntax");
scriptCompName=str.substr(0,index); scriptCompName=str.substr(0,index);

View file

@ -35,8 +35,8 @@ void stripWhitespaces(std::string& str)
{ {
if(str.empty()) return; if(str.empty()) return;
int startIndex = str.find_first_not_of(" "); string::size_type startIndex = str.find_first_not_of(" ");
int endIndex = str.find_last_not_of(" "); string::size_type endIndex = str.find_last_not_of(" ");
std::string tmp = str; std::string tmp = str;
str.erase(); str.erase();
@ -46,7 +46,7 @@ void stripWhitespaces(std::string& str)
std::string removeComment(const std::string &str) std::string removeComment(const std::string &str)
{ {
uint newPos= str.find("//",0); string::size_type newPos= str.find("//",0);
if (newPos != string::npos) if (newPos != string::npos)
{ {

View file

@ -1117,7 +1117,7 @@ void CCompiler::dumpByteCode (const string &sourceCode, const string &fullName,
{ {
// Build a valid filename // Build a valid filename
string tmp = fullName; string tmp = fullName;
int pos; string::size_type pos;
while ((pos=tmp.find (':')) != string::npos) while ((pos=tmp.find (':')) != string::npos)
tmp[pos] = '-'; tmp[pos] = '-';

View file

@ -1245,17 +1245,17 @@ NLMISC_COMMAND (createItemInBag, "Create an item and put it in the player bag",
} }
// banners are the only items in game which use privilege // banners are the only items in game which use privilege
if( sheetName.find("banner") != -1 ) if( sheetName.find("banner") != string::npos )
{ {
CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) ); CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) );
// if (player != NULL && !player->havePriv(":DEV:") ) // if (player != NULL && !player->havePriv(":DEV:") )
if (player != NULL && player->havePriv(BannerPriv) ) if (player != NULL && player->havePriv(BannerPriv) )
{ {
if( sheetName.find("_gu") != -1 && !player->havePriv(":G:") ) return false; if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false;
if( sheetName.find("_sgu") != -1 && !player->havePriv(":SG:") ) return false; if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false;
if( sheetName.find("_vgu") != -1 && !player->havePriv(":VG:") ) return false; if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false;
if( sheetName.find("_gm") != -1 && !player->havePriv(":GM:") ) return false; if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false;
if( sheetName.find("_sgm") != -1 && !player->havePriv(":SGM:") ) return false; if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false;
} }
} }
@ -1333,16 +1333,16 @@ NLMISC_COMMAND (createItemInTmpInv, "Create an item and put it in the player tem
} }
// banners are the only items in game which use privilege // banners are the only items in game which use privilege
if( sheetName.find("banner") != -1 ) if( sheetName.find("banner") != string::npos )
{ {
CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) ); CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) );
if (player != NULL && player->havePriv(BannerPriv) ) if (player != NULL && player->havePriv(BannerPriv) )
{ {
if( sheetName.find("_gu") != -1 && !player->havePriv(":G:") ) return false; if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false;
if( sheetName.find("_sgu") != -1 && !player->havePriv(":SG:") ) return false; if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false;
if( sheetName.find("_vgu") != -1 && !player->havePriv(":VG:") ) return false; if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false;
if( sheetName.find("_gm") != -1 && !player->havePriv(":GM:") ) return false; if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false;
if( sheetName.find("_sgm") != -1 && !player->havePriv(":SGM:") ) return false; if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false;
} }
} }
@ -1403,16 +1403,16 @@ NLMISC_COMMAND (createItemInInv, "Create items and put them in the given invento
} }
// banners are the only items in game which use privilege // banners are the only items in game which use privilege
if( sheetName.find("banner") != -1 ) if( sheetName.find("banner") != string::npos )
{ {
CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) ); CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) );
if (player != NULL && player->havePriv(BannerPriv) ) if (player != NULL && player->havePriv(BannerPriv) )
{ {
if( sheetName.find("_gu") != -1 && !player->havePriv(":G:") ) return false; if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false;
if( sheetName.find("_sgu") != -1 && !player->havePriv(":SG:") ) return false; if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false;
if( sheetName.find("_vgu") != -1 && !player->havePriv(":VG:") ) return false; if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false;
if( sheetName.find("_gm") != -1 && !player->havePriv(":GM:") ) return false; if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false;
if( sheetName.find("_sgm") != -1 && !player->havePriv(":SGM:") ) return false; if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false;
} }
} }
@ -4039,12 +4039,12 @@ NLMISC_COMMAND(broadcast,"[repeat=<num repeat> or during=<time in seconds>] [eve
uint32 during = 0; uint32 during = 0;
uint32 every = 0; uint32 every = 0;
sint32 posMessage = 0; string::size_type posMessage = 0;
sint32 pos = message.find("repeat"); string::size_type pos = message.find("repeat");
if( pos != string::npos ) if( pos != string::npos )
{ {
sint32 posEgale = message.find("=", pos); string::size_type posEgale = message.find("=", pos);
if( posEgale != string::npos ) if( posEgale != string::npos )
{ {
repeat = atoi( message.substr( posEgale+1 ).c_str() ); repeat = atoi( message.substr( posEgale+1 ).c_str() );
@ -4056,7 +4056,7 @@ NLMISC_COMMAND(broadcast,"[repeat=<num repeat> or during=<time in seconds>] [eve
pos = message.find("during"); pos = message.find("during");
if( pos != string::npos ) if( pos != string::npos )
{ {
sint32 posEgale = message.find("=", pos); string::size_type posEgale = message.find("=", pos);
if( posEgale != string::npos ) if( posEgale != string::npos )
{ {
during = atoi( message.substr( posEgale+1 ).c_str() ); during = atoi( message.substr( posEgale+1 ).c_str() );
@ -4068,7 +4068,7 @@ NLMISC_COMMAND(broadcast,"[repeat=<num repeat> or during=<time in seconds>] [eve
pos = message.find("every"); pos = message.find("every");
if( pos != string::npos ) if( pos != string::npos )
{ {
sint32 posEgale = message.find("=", pos); string::size_type posEgale = message.find("=", pos);
if( posEgale != string::npos ) if( posEgale != string::npos )
{ {
every = atoi( message.substr( posEgale+1 ).c_str() ); every = atoi( message.substr( posEgale+1 ).c_str() );

View file

@ -335,7 +335,7 @@ void CStaticBrick::readStaticBrick( const NLGEORGES::UFormElm &root, const NLMIS
if(Family==BRICK_FAMILIES::Unknown) if(Family==BRICK_FAMILIES::Unknown)
{ {
string sheetName= sheetId.toString(); string sheetName= sheetId.toString();
sint end= sheetName.find(".sbrick")-NB_LETTERS_AFTER_FAMILY; string::size_type end= sheetName.find(".sbrick")-NB_LETTERS_AFTER_FAMILY;
string sub = sheetName.substr(0,end); string sub = sheetName.substr(0,end);
sub = strupr(sub); sub = strupr(sub);
Family = BRICK_FAMILIES::toSBrickFamily ( sub ); Family = BRICK_FAMILIES::toSBrickFamily ( sub );

View file

@ -976,8 +976,8 @@ void loadCosmetics( NLGEORGES::UFormElm &root, CStaticItem *item, const NLMISC:
std::string name = sheetId.toString(); std::string name = sheetId.toString();
sint pos = (sint)name.find('.',0); string::size_type pos = name.find('.',0);
if ( pos == (sint) string::npos) if ( pos == string::npos)
nlwarning("<loadCosmetics> Can't load the VPValue from sheet name in sheet %s", sheetId.toString().c_str() ); nlwarning("<loadCosmetics> Can't load the VPValue from sheet name in sheet %s", sheetId.toString().c_str() );
else else
{ {

View file

@ -119,7 +119,7 @@ void CAIAliasTranslator::buildBotTree(const NLLIGO::IPrimitive* prim)
NLMISC::strlwr(name); NLMISC::strlwr(name);
//remove AI name parameters //remove AI name parameters
uint trash = name.find('$'); string::size_type trash = name.find('$');
if ( trash != string::npos ) if ( trash != string::npos )
{ {
name.resize(trash); name.resize(trash);
@ -157,7 +157,7 @@ void CAIAliasTranslator::buildBotTree(const NLLIGO::IPrimitive* prim)
// NLMISC::strlwr(name); // NLMISC::strlwr(name);
//remove AI name parameters //remove AI name parameters
// uint trash = name.find('$'); // string::size_type trash = name.find('$');
// if ( trash != string::npos ) // if ( trash != string::npos )
// { // {
// name.resize(trash); // name.resize(trash);

View file

@ -60,7 +60,7 @@ bool CMissionStepQueueStart::buildStep( uint32 line, const vector< string > & sc
QueueName = missionData.Name + "_" + script[1]; QueueName = missionData.Name + "_" + script[1];
// remove all blanks in name // remove all blanks in name
uint pos = QueueName.find_first_of(" "); string::size_type pos = QueueName.find_first_of(" ");
while ( pos != string::npos ) while ( pos != string::npos )
{ {
QueueName.erase(pos,1); QueueName.erase(pos,1);
@ -203,7 +203,7 @@ bool CMissionStepQueueEnd::buildStep( uint32 line, const vector< string > & scri
QueueName = missionData.Name + "_" + script[1]; QueueName = missionData.Name + "_" + script[1];
// remove all blanks in name // remove all blanks in name
uint pos = QueueName.find_first_of(" "); string::size_type pos = QueueName.find_first_of(" ");
while ( pos != string::npos ) while ( pos != string::npos )
{ {
QueueName.erase(pos,1); QueueName.erase(pos,1);

View file

@ -674,7 +674,7 @@ bool CMissionStepDynChat::buildStep( uint32 line, const std::vector< std::string
for (uint i = 3; i < script.size(); i++ ) for (uint i = 3; i < script.size(); i++ )
{ {
string answerStr = CMissionParser::getNoBlankString( script[i] ); string answerStr = CMissionParser::getNoBlankString( script[i] );
uint pos = answerStr.find( ' ' ); string::size_type pos = answerStr.find( ' ' );
if( pos == string::npos || answerStr.empty() ) if( pos == string::npos || answerStr.empty() )
{ {
MISLOGERROR1("invalid answer '%s'", answerStr.c_str()); MISLOGERROR1("invalid answer '%s'", answerStr.c_str());

View file

@ -598,7 +598,7 @@ void CPDSLib::update()
// setup update logs with full timestamp // setup update logs with full timestamp
if (!_DbMessageQueue.empty()) if (!_DbMessageQueue.empty())
{ {
i = _UpdateLogs.size(); i = (uint)_UpdateLogs.size();
_UpdateLogs.resize(_DbMessageQueue.size()); _UpdateLogs.resize(_DbMessageQueue.size());
for (; i<_UpdateLogs.size(); ++i) for (; i<_UpdateLogs.size(); ++i)
@ -1025,7 +1025,7 @@ std::string CPDSLib::getPDSRootDirectory(const std::string& shard, bool wantRemo
} }
std::string findstr("$shard"); std::string findstr("$shard");
uint p = dir.find(findstr); std::string::size_type p = dir.find(findstr);
if (p != std::string::npos) if (p != std::string::npos)
dir.replace(p, findstr.size(), shard); dir.replace(p, findstr.size(), shard);

View file

@ -605,7 +605,7 @@ bool CUpdateLog::selectMessages(const CDBDescriptionParser& description, const N
{ {
bool selected = false; bool selected = false;
uint pos = valuePath.find('.'); std::string::size_type pos = valuePath.find('.');
if (pos == std::string::npos) if (pos == std::string::npos)
return false; return false;

View file

@ -571,7 +571,8 @@ bool CDbManager::parsePath(const string &strPath, CLocatePath &lpath)
anode.Set = false; anode.Set = false;
anode.Array = false; anode.Array = false;
uint pos = node.find_first_of("[<"); string::size_type pos = node.find_first_of("[<");
if (pos != string::npos) if (pos != string::npos)
{ {
if (node[pos] == '[') if (node[pos] == '[')
@ -581,7 +582,7 @@ bool CDbManager::parsePath(const string &strPath, CLocatePath &lpath)
anode.Name = node.substr(0, pos); anode.Name = node.substr(0, pos);
uint end = node.find((anode.Array ? ']' : '>'), pos); string::size_type end = node.find((anode.Array ? ']' : '>'), pos);
if (end == string::npos) if (end == string::npos)
return false; return false;