Changed: #825 Remove all warnings when compiling Ryzom

This commit is contained in:
kervala 2012-04-07 15:04:26 +02:00
parent 3fa0aa2216
commit 85c70f27b4
13 changed files with 65 additions and 65 deletions

View file

@ -55,7 +55,7 @@ public:
/// ctor
CSString(int i,const char *fmt="%d");
/// ctor
CSString(unsigned u,const char *fmt="%u");
CSString(uint32 u,const char *fmt="%u");
/// ctor
CSString(double d,const char *fmt="%f");
/// ctor
@ -76,14 +76,14 @@ public:
char back() const;
/// Return the n left hand most characters of a string
CSString left(unsigned count) const;
CSString left(uint32 count) const;
/// Return the n right hand most characters of a string
CSString right(unsigned count) const;
CSString right(uint32 count) const;
/// Return the string minus the n left hand most characters of a string
CSString leftCrop(unsigned count) const;
CSString leftCrop(uint32 count) const;
/// Return the string minus the n right hand most characters of a string
CSString rightCrop(unsigned count) const;
CSString rightCrop(uint32 count) const;
/// Return sub string up to but not including first instance of given character, starting at 'iterator'
/// on exit 'iterator' indexes first character after extracted string segment
@ -116,9 +116,9 @@ public:
/// Return sub string remaining after the first word
CSString tailFromFirstWord() const;
/// Count the number of words in a string
unsigned countWords() const;
uint32 countWords() const;
/// Extract the given word
CSString word(unsigned idx) const;
CSString word(uint32 idx) const;
/// Return first word or quote-encompassed sub-string - can remove extracted sub-string from source string
CSString firstWordOrWords(bool truncateThis=false,bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true);
@ -127,9 +127,9 @@ public:
/// Return sub string following first word (or quote-encompassed sub-string)
CSString tailFromFirstWordOrWords(bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true) const;
/// Count the number of words (or quote delimited sub-strings) in a string
unsigned countWordOrWords(bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true) const;
uint32 countWordOrWords(bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true) const;
/// Extract the given words (or quote delimited sub-strings)
CSString wordOrWords(unsigned idx,bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true) const;
CSString wordOrWords(uint32 idx,bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true) const;
/// Return first line - can remove extracted line from source string
CSString firstLine(bool truncateThis=false);
@ -138,9 +138,9 @@ public:
/// Return sub string remaining after the first line
CSString tailFromFirstLine() const;
/// Count the number of lines in a string
unsigned countLines() const;
uint32 countLines() const;
/// Extract the given line
CSString line(unsigned idx) const;
CSString line(uint32 idx) const;
/// A handy utility routine for knowing if a character is a white space character or not (' ','\t','\n','\r',26)
static bool isWhiteSpace(char c);
@ -377,7 +377,7 @@ public:
/// assignment operator
CSString& operator=(int i);
/// assignment operator
CSString& operator=(unsigned u);
CSString& operator=(uint32 u);
/// assignment operator
CSString& operator=(double d);
@ -561,7 +561,7 @@ inline CSString::CSString(int i,const char *fmt)
*this=buf;
}
inline CSString::CSString(unsigned u,const char *fmt)
inline CSString::CSString(uint32 u,const char *fmt)
{
char buf[1024];
sprintf(buf,fmt,u);
@ -611,26 +611,26 @@ inline char CSString::back() const
return (*this)[size()-1];
}
inline CSString CSString::right(unsigned count) const
inline CSString CSString::right(uint32 count) const
{
if (count>=size())
return *this;
return substr(size()-count);
}
inline CSString CSString::rightCrop(unsigned count) const
inline CSString CSString::rightCrop(uint32 count) const
{
if (count>=size())
return CSString();
return substr(0,size()-count);
}
inline CSString CSString::left(unsigned count) const
inline CSString CSString::left(uint32 count) const
{
return substr(0,count);
}
inline CSString CSString::leftCrop(unsigned count) const
inline CSString CSString::leftCrop(uint32 count) const
{
if (count>=size())
return CSString();
@ -639,7 +639,7 @@ inline CSString CSString::leftCrop(unsigned count) const
inline CSString CSString::splitToWithIterator(char c,uint32& iterator) const
{
unsigned i;
uint32 i;
CSString result;
for (i=iterator;i<size() && (*this)[i]!=c;++i)
result+=(*this)[i];
@ -713,7 +713,7 @@ inline bool CSString::isPrintable(char c)
if (c==',') return true;
if (c==';') return true;
if (c=='$') return true;
if ((unsigned char)c==156) return true; // Sterling Pound char causing error in gcc 4.1.2
if ((uint8)c==156) return true; // Sterling Pound char causing error in gcc 4.1.2
if (c=='^') return true;
if (c=='~') return true;
if (c=='\'') return true;
@ -784,7 +784,7 @@ inline CSString& CSString::operator=(int i)
return *this;
}
inline CSString& CSString::operator=(unsigned u)
inline CSString& CSString::operator=(uint32 u)
{
CSString other(u);
*this = other;

View file

@ -529,8 +529,8 @@ void toUpper(char *str)
std::string formatThousands(const std::string& s)
{
int i, k;
int remaining = s.length() - 1;
sint i, k;
sint remaining = (sint)s.length() - 1;
static std::string separator = NLMISC::CI18N::get("uiThousandsSeparator").toUtf8();
// Don't add separator if the number is < 10k

View file

@ -592,7 +592,7 @@ uint32 CSheetId::typeFromFileExtension(const std::string &fileExtension)
{
if (!_Initialised) init(false);
unsigned i;
uint i;
for (i=0;i<_FileExtensions.size();i++)
if (toLower(fileExtension)==_FileExtensions[i])
return i;

View file

@ -37,14 +37,14 @@ namespace NLMISC
return token;
}
unsigned int i;
uint i;
CSString result;
// skip leading junk
for (i=0;i<size();++i)
{
// look for the next character in the 'separator' character list supplied
unsigned j;
uint j;
for (j=0;separators[j] && (*this)[i]!=separators[j];++j)
{}
// if not found then we're at end of leading junk
@ -56,7 +56,7 @@ namespace NLMISC
for (;i<size();++i)
{
// look for the next character in the 'separator' character list supplied
unsigned j;
uint j;
for (j=0;separators[j] && (*this)[i]!=separators[j];++j)
{}
// if not found then we're at end of text chunk
@ -69,7 +69,7 @@ namespace NLMISC
for (;i<size();++i)
{
// look for the next character in the 'separator' character list supplied
unsigned j;
uint j;
for (j=0;separators[j] && (*this)[i]!=separators[j];++j)
{}
// if not found then we're at end of leading junk
@ -684,7 +684,7 @@ namespace NLMISC
CSString CSString::splitTo(char c) const
{
unsigned i;
uint i;
CSString result;
for (i=0;i<size() && (*this)[i]!=c;++i)
result+=(*this)[i];
@ -693,7 +693,7 @@ namespace NLMISC
CSString CSString::splitTo(char c,bool truncateThis,bool absorbSeparator)
{
unsigned i;
uint i;
CSString result;
for (i=0;i<size() && (*this)[i]!=c;++i)
result+=(*this)[i];
@ -714,7 +714,7 @@ namespace NLMISC
CSString CSString::splitTo(const char *s,bool truncateThis)
{
unsigned i;
uint i;
CSString result;
for (i=0;i<size();++i)
{
@ -762,12 +762,12 @@ namespace NLMISC
CSString CSString::splitFrom(const char *s) const
{
unsigned int i;
uint i;
CSString result;
for (i=0;i<size();++i)
{
// perform a quick string compare
unsigned int j;
uint j;
for (j=0;i+j<size() && s[j]!=0 && s[j]==(*this)[i+j];++j)
{
}
@ -789,7 +789,7 @@ namespace NLMISC
return CSString();
CSString result;
unsigned i=0;
uint i=0;
// skip white space
for (i=0;i<size() && isWhiteSpace((*this)[i]);++i)
{}
@ -847,7 +847,7 @@ namespace NLMISC
return count;
}
CSString CSString::word(unsigned idx) const
CSString CSString::word(uint32 idx) const
{
CSString hold=strip();
@ -901,7 +901,7 @@ namespace NLMISC
return count;
}
CSString CSString::wordOrWords(unsigned idx,bool useSlashStringEscape,bool useRepeatQuoteStringEscape) const
CSString CSString::wordOrWords(uint32 idx,bool useSlashStringEscape,bool useRepeatQuoteStringEscape) const
{
CSString hold=strip();
@ -941,7 +941,7 @@ namespace NLMISC
return count;
}
CSString CSString::line(unsigned idx) const
CSString CSString::line(uint32 idx) const
{
CSString hold=strip();

View file

@ -289,7 +289,7 @@ void addQuotesRoundString (std::string &valueString)
std::string hold=valueString;
valueString.erase();
valueString='\"';
for (unsigned i=0;i<hold.size();i++)
for (uint i=0;i<hold.size();i++)
{
if (hold[i]=='\"')
valueString+="\"\"";
@ -337,7 +337,7 @@ void scanFiles(const CSString &filespec)
// display the table header line
fprintf(Outf,"FILE");
for (unsigned i=0;i<fields.size();i++)
for (uint i=0;i<fields.size();i++)
fprintf(Outf,"%s%s",SEPARATOR, fields[i]._name.c_str());
fprintf(Outf,"\n");
@ -379,7 +379,7 @@ void scanFiles(const CSString &filespec)
// the form was found so read the true values from George
// std::string s;
fprintf(Outf,"%s",CFile::getFilenameWithoutExtension(filenames[j]).c_str());
for (unsigned i=0;i<fields.size();i++)
for (uint i=0;i<fields.size();i++)
{
UFormElm::TWhereIsValue where;
UFormElm *fieldForm=NULL;
@ -452,7 +452,7 @@ void scanFiles(const CSString &filespec)
// std::string hold=s;
// s.erase();
// s='\"';
// for (unsigned i=0;i<hold.size();i++)
// for (uint i=0;i<hold.size();i++)
// {
// if (hold[i]=='\"')
// s+="\"\"";

View file

@ -795,7 +795,7 @@ namespace DEPCFG
else
{
// put the number of info blocks to the stream
uint32 count= _InfoBlocks.size();
uint32 count= (uint32)_InfoBlocks.size();
stream.serial(count);
// put the info blocks to the stream one by one
for (TInfoBlocks::iterator it= _InfoBlocks.begin(); it!=_InfoBlocks.end(); ++it)
@ -1203,7 +1203,7 @@ namespace DEPCFG
DROP_IF(exeRecord.CfgEntries.empty(), "No 'cfg' entriesfound in: "+exeRecord.FullName, ++errors );
// add a refference from the domains' shard map to the exe...
_DomainExes[exeRecord.DomainName][exeRecord.ShardName].push_back(_ExeRecords.size());
_DomainExes[exeRecord.DomainName][exeRecord.ShardName].push_back((uint32)_ExeRecords.size());
// we may have hit errors but we go ahead anyway as in the case of errors the whole thing will be cleared out anyway
_ExeRecords.push_back(exeRecord);
@ -1508,7 +1508,7 @@ NLMISC_CATEGORISED_COMMAND(depcfg,dumpDepCfgShards,"dump the shard set for the d
DEPCFG::SAppDescription app;
DEPCFG::CDeploymentConfiguration::getInstance().getApp(*dit,*ait,app);
uint32 cfgFileLines=app.CfgFile.countLines();
uint32 numDataPacks= app.DataPacks.size();
uint32 numDataPacks= (uint32)app.DataPacks.size();
log.displayNL(" -- App: %-20s: %s (cfg file length: %d lines, data packs used: %d)",app.AppName.c_str(),app.CmdLine.c_str(),cfgFileLines,numDataPacks);
}
}

View file

@ -97,7 +97,7 @@ protected:
static uint32 getFileVersion(const NLMISC::CSString& fileName)
{
// start at the back of the file name and scan forwards until we find a '/' or '\\' or ':' or a digit
uint32 i= fileName.size();
uint32 i= (uint32)fileName.size();
while (i--)
{
char c= fileName[i];

View file

@ -459,9 +459,9 @@ namespace PATCHMAN
NLMISC::CPath::getPathContent(_Root+directoryName,false,true,false,pathContents);
// run through the directories we found...
for (uint32 i=pathContents.size();i--;)
for (uint32 i=(uint32)pathContents.size();i--;)
{
NLMISC::CSString childDirectoryName= NLMISC::CSString(pathContents[i]).leftCrop(_Root.size());
NLMISC::CSString childDirectoryName= NLMISC::CSString(pathContents[i]).leftCrop((uint32)_Root.size());
// make sure they exist in the '_DirectoryTree' map
_DirectoryTree[childDirectoryName];
@ -484,14 +484,14 @@ namespace PATCHMAN
NLMISC::CPath::getPathContent(_Root+directoryName,false,false,true,pathContents);
// run through the files adding them to ourself
for (uint32 i=pathContents.size();i--;)
for (uint32 i=(uint32)pathContents.size();i--;)
{
// if the file is system file then skip it
if (pathContents[i].find("/.")!=std::string::npos)
continue;
// construct the file name
NLMISC::CSString fileName= NLMISC::CSString(pathContents[i]).leftCrop(_Root.size());
NLMISC::CSString fileName= NLMISC::CSString(pathContents[i]).leftCrop((uint32)_Root.size());
// get hold of the directory entry for this file (or create a new one if not exist) and update it
_IndexFileIsUpToDate&= _DirectoryTree[directoryName][fileName].updateFileInfo(fileName,pathContents[i],SFileInfo::RECALCULATE_IF_CHANGED,updateListener);
}
@ -601,7 +601,7 @@ namespace PATCHMAN
// read in the file
FILE* inf= fopen(fileName.c_str(),"rb");
BOMB_IF(inf==NULL,"Failed to open input file for reading: "+fileName,return false);
uint32 bytesRead=fread(&_CacheBuffer[newFileEntry.StartOffset],1,fileSize,inf);
uint32 bytesRead=(uint32)fread(&_CacheBuffer[newFileEntry.StartOffset],1,fileSize,inf);
fclose(inf);
BOMB_IF(bytesRead!=fileSize,"Failed to read data from input file: "+fileName,return false);
@ -732,7 +732,7 @@ NLMISC_CATEGORISED_COMMAND(patchman,fileManagerSave,"Save a file via the file ma
CSString fileName= args[0];
CMemStream data;
data.serialBuffer((uint8*)(&args[1][0]),args[1].size());
data.serialBuffer((uint8*)(&args[1][0]),(uint32)args[1].size());
CFileManager::getInstance().save(fileName,data);
return true;

View file

@ -347,7 +347,7 @@ namespace PATCHMAN
// add the data to the file
CSString& theBuffer= theRequest->DataSoFar;
uint32 oldSize= theBuffer.size();
uint32 oldSize= (uint32)theBuffer.size();
theBuffer.resize(oldSize+data.getBufferSize());
memcpy(&(theBuffer[oldSize]), data.getBuffer(), data.getBufferSize());
@ -355,7 +355,7 @@ namespace PATCHMAN
if (theRequest->DataSoFar.size()>=theRequest->ExpectedFileSize)
{
// we've reached the end of file
_dealWithReceivedFile(sender,theRequest,NLNET::TBinBuffer((const uint8 *)&theRequest->DataSoFar[0],theRequest->DataSoFar.size()));
_dealWithReceivedFile(sender,theRequest,NLNET::TBinBuffer((const uint8 *)&theRequest->DataSoFar[0],(uint32)theRequest->DataSoFar.size()));
return;
}
@ -374,7 +374,7 @@ namespace PATCHMAN
}
// log our progress
_downloadLog(fileName,theRequest->DataSoFar.size(),theRequest->ExpectedFileSize);
_downloadLog(fileName,(uint32)theRequest->DataSoFar.size(),theRequest->ExpectedFileSize);
}
void CFileReceiver::cbFileDataFailure(NLNET::IModuleProxy *sender, const std::string &fileName)

View file

@ -332,7 +332,7 @@ namespace PATCHMAN
CFileReceiverProxy rr(sender);
if (ok && !result.empty())
{
rr.cbFileData(_Parent,fileName,startOffset,NLNET::TBinBuffer((const uint8 *)&result[0],result.size()));
rr.cbFileData(_Parent,fileName,startOffset,NLNET::TBinBuffer((const uint8 *)&result[0],(uint32)result.size()));
}
else
{

View file

@ -436,7 +436,7 @@ NLMISC_CLASS_COMMAND_IMPL(CPatchmanAdminModule, download)
}
// iterate over matching files, adding them to the download list
for (uint32 i=fileInfo.size();i--;)
for (uint i=(uint)fileInfo.size();i--;)
{
_DownloadRequests[fileInfo[i].FileName]= NLMISC::CPath::standardizePath(destination);
requestFile(fileInfo[i].FileName);

View file

@ -52,7 +52,7 @@ NLMISC::CSString getRepositoryIndexFileName(const NLMISC::CSString& repositoryNa
uint32 getFileVersion(const NLMISC::CSString& fileName)
{
// start at the back of the file name and scan forwards until we find a '/' or '\\' or ':' or a digit
uint32 i= fileName.size();
uint32 i= (uint32)fileName.size();
while (i--)
{
char c= fileName[i];
@ -184,9 +184,9 @@ void CRepository::updateFile(NLMISC::CSString fileName)
nldebug(("GUSREP_Updating repository entry for file: '"+fileName+"'").c_str());
// if the name of the file that has changed contains the target directory name then crop it
if (fileName.left(_TargetDirectory.size())==_TargetDirectory)
if (fileName.left((uint32)_TargetDirectory.size())==_TargetDirectory)
{
fileName=fileName.leftCrop(_TargetDirectory.size());
fileName=fileName.leftCrop((uint32)_TargetDirectory.size());
}
// lookup the file in the map
@ -219,9 +219,9 @@ void CRepository::addFileStub(NLMISC::CSString fileName)
nldebug(("GUSREP_Adding repository stub for file: '"+fileName+"'").c_str());
// if the name of the file that has changed contains the target directory name then crop it
if (fileName.left(_TargetDirectory.size())==_TargetDirectory)
if (fileName.left((uint32)_TargetDirectory.size())==_TargetDirectory)
{
fileName=fileName.leftCrop(_TargetDirectory.size());
fileName=fileName.leftCrop((uint32)_TargetDirectory.size());
}
// make sure the file didn't already exist in the map
@ -258,7 +258,7 @@ uint32 CRepository::update()
// get hold of the file name for the next file
// CSString fileName= NLMISC::CFile::getFilename(theFile.FileName);
CSString fileName= theFile.FileName.leftCrop(_TargetDirectory.size());
CSString fileName= theFile.FileName.leftCrop((uint32)_TargetDirectory.size());
// extract the version number from the file name and skip the file if it's too recent or the version number was invalid
uint32 fileVersion= getFileVersion(fileName);
@ -345,7 +345,7 @@ void CRepository::setVersion(uint32 version)
uint32 CRepository::size() const
{
return _Files.size();
return (uint32)_Files.size();
}
const CRepository::CFilesMapEntry& CRepository::operator[](const NLMISC::CSString& key) const

View file

@ -115,12 +115,12 @@ void CTaskScheduler::update()
// check to see if we've broken our max sheduled tasks record...
if (_MaxTasks < _Tasks.size())
{
_MaxTasks = _Tasks.size();
_MaxTasks = (uint32)_Tasks.size();
nldebug("New scheduled task record: %u",_MaxTasks);
}
// iterate over all scheduled tasks (we go backwards to simplify deletion of executed tasks as we go)
for (uint32 i=_Tasks.size();i--;)
for (uint32 i=(uint32)_Tasks.size();i--;)
{
// get a refference to the next task
STask& theTask= _Tasks[i];