From 0ac33d338a81d372424ddef7c75f1786c1c3a8ae Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 7 Apr 2012 15:04:26 +0200 Subject: [PATCH] Changed: #825 Remove all warnings when compiling Ryzom --- code/nel/include/nel/misc/sstring.h | 40 +++++++++---------- code/nel/src/misc/common.cpp | 6 +-- code/nel/src/misc/sheet_id.cpp | 2 +- code/nel/src/misc/sstring.cpp | 26 ++++++------ .../tools/georges/georges2csv/georges2csv.cpp | 8 ++-- .../game_share/deployment_configuration.cpp | 6 +-- .../cpr_client_patch_repository.cpp | 2 +- .../src/patchman_service/file_manager.cpp | 12 +++--- .../src/patchman_service/file_receiver.cpp | 6 +-- .../src/patchman_service/file_repository.cpp | 2 +- .../pam_patchman_admin_module.cpp | 2 +- .../src/patchman_service/repository.cpp | 14 +++---- .../src/patchman_service/service_main.cpp | 4 +- 13 files changed, 65 insertions(+), 65 deletions(-) diff --git a/code/nel/include/nel/misc/sstring.h b/code/nel/include/nel/misc/sstring.h index 513c681c9..fc17d67f5 100644 --- a/code/nel/include/nel/misc/sstring.h +++ b/code/nel/include/nel/misc/sstring.h @@ -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= 0 && k < 3; --i, ++k ) + for (i = remaining, k = 0; i >= 0 && k < 3; --i, ++k ) { ns = s[i] + ns; // New char is added to front of ns if ( i > 0 && k == 2) ns = separator + ns; // j > 0 means still more digits diff --git a/code/nel/src/misc/sheet_id.cpp b/code/nel/src/misc/sheet_id.cpp index 0eaad3a7a..617c994b7 100644 --- a/code/nel/src/misc/sheet_id.cpp +++ b/code/nel/src/misc/sheet_id.cpp @@ -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; diff --git a/code/nel/src/misc/sstring.cpp b/code/nel/src/misc/sstring.cpp index 4c37b1f1a..ef1584361 100644 --- a/code/nel/src/misc/sstring.cpp +++ b/code/nel/src/misc/sstring.cpp @@ -37,14 +37,14 @@ namespace NLMISC return token; } - unsigned int i; + uint i; CSString result; // skip leading junk for (i=0;iDataSoFar; - 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) diff --git a/code/ryzom/server/src/patchman_service/file_repository.cpp b/code/ryzom/server/src/patchman_service/file_repository.cpp index d1d2d4b54..72881f587 100644 --- a/code/ryzom/server/src/patchman_service/file_repository.cpp +++ b/code/ryzom/server/src/patchman_service/file_repository.cpp @@ -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 { diff --git a/code/ryzom/server/src/patchman_service/pam_patchman_admin_module.cpp b/code/ryzom/server/src/patchman_service/pam_patchman_admin_module.cpp index 0eaf4f946..60efeee33 100644 --- a/code/ryzom/server/src/patchman_service/pam_patchman_admin_module.cpp +++ b/code/ryzom/server/src/patchman_service/pam_patchman_admin_module.cpp @@ -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); diff --git a/code/ryzom/server/src/patchman_service/repository.cpp b/code/ryzom/server/src/patchman_service/repository.cpp index b71c11ef2..a63a96bcd 100644 --- a/code/ryzom/server/src/patchman_service/repository.cpp +++ b/code/ryzom/server/src/patchman_service/repository.cpp @@ -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 diff --git a/code/ryzom/server/src/patchman_service/service_main.cpp b/code/ryzom/server/src/patchman_service/service_main.cpp index aa0cfbffb..7e61baba8 100644 --- a/code/ryzom/server/src/patchman_service/service_main.cpp +++ b/code/ryzom/server/src/patchman_service/service_main.cpp @@ -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];