diff options
| author | maximius <none@none> | 2009-10-17 16:20:24 -0700 |
|---|---|---|
| committer | maximius <none@none> | 2009-10-17 16:20:24 -0700 |
| commit | 3f338cc1c328c7280957583b50598292cd8fb64b (patch) | |
| tree | ca209c2cd024e3902b7844b3224bceff7c5bb570 /src/shared | |
| parent | e585187b248f48b3c6e9247b49fa07c6565d65e5 (diff) | |
*Massive cleanup redux.
--HG--
branch : trunk
Diffstat (limited to 'src/shared')
33 files changed, 79 insertions, 123 deletions
diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index b22dbdee729..d5001cfc1bf 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -306,7 +306,7 @@ class ByteBuffer uint8 guidmark = 0; (*this) >> guidmark; - for(int i = 0; i < 8; ++i) + for (int i = 0; i < 8; ++i) { if(guidmark & (uint8(1) << i)) { @@ -391,7 +391,7 @@ class ByteBuffer size_t mask_position = wpos(); *this << uint8(0); - for(uint8 i = 0; i < 8; ++i) + for (uint8 i = 0; i < 8; ++i) { if(guid & 0xFF) { @@ -416,7 +416,7 @@ class ByteBuffer return; sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); - for(uint32 i = 0; i < size(); ++i) + for (uint32 i = 0; i < size(); ++i) sLog.outDebugInLine("%u - ", read<uint8>(i) ); sLog.outDebug(" "); } @@ -427,7 +427,7 @@ class ByteBuffer return; sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); - for(uint32 i = 0; i < size(); ++i) + for (uint32 i = 0; i < size(); ++i) sLog.outDebugInLine("%c", read<uint8>(i) ); sLog.outDebug(" "); } @@ -440,7 +440,7 @@ class ByteBuffer uint32 j = 1, k = 1; sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); - for(uint32 i = 0; i < size(); ++i) + for (uint32 i = 0; i < size(); ++i) { if ((i == (j * 8)) && ((i != (k * 16)))) { diff --git a/src/shared/Common.cpp b/src/shared/Common.cpp index 27ae9184d69..5e12f4aa52b 100644 --- a/src/shared/Common.cpp +++ b/src/shared/Common.cpp @@ -34,7 +34,7 @@ char const* localeNames[MAX_LOCALE] = { LocaleConstant GetLocaleByName(const std::string& name) { - for(uint32 i = 0; i < MAX_LOCALE; ++i) + for (uint32 i = 0; i < MAX_LOCALE; ++i) if(name==localeNames[i]) return LocaleConstant(i); diff --git a/src/shared/Common.h b/src/shared/Common.h index 8c948fb1d6d..58d9b25fd22 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -108,7 +108,6 @@ #include <ace/RW_Thread_Mutex.h> #include <ace/Thread_Mutex.h> - #if PLATFORM == PLATFORM_WINDOWS # define FD_SETSIZE 4096 # include <ace/config-all.h> diff --git a/src/shared/Config/Config.cpp b/src/shared/Config/Config.cpp index b56b804b50a..1f37bce5227 100644 --- a/src/shared/Config/Config.cpp +++ b/src/shared/Config/Config.cpp @@ -27,13 +27,11 @@ Config::Config() : mIgnoreCase(true), mConf(NULL) { } - Config::~Config() { delete mConf; } - bool Config::SetSource(const char *file, bool ignorecase) { mIgnoreCase = ignorecase; diff --git a/src/shared/Config/dotconfpp/dotconfpp.cpp b/src/shared/Config/dotconfpp/dotconfpp.cpp index e779637256e..8760b118e38 100644 --- a/src/shared/Config/dotconfpp/dotconfpp.cpp +++ b/src/shared/Config/dotconfpp/dotconfpp.cpp @@ -29,7 +29,7 @@ DOTCONFDocumentNode::~DOTCONFDocumentNode() { free(name); if(values != NULL){ - for(int i = 0 ; i < valuesCount; i++){ + for (int i = 0 ; i < valuesCount; i++){ free(values[i]); } free(values); @@ -67,13 +67,13 @@ DOTCONFDocument::DOTCONFDocument(DOTCONFDocument::CaseSensitive caseSensitivity) DOTCONFDocument::~DOTCONFDocument() { - for(std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i != nodeTree.end(); ++i){ + for (std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i != nodeTree.end(); ++i){ delete(*i); } - for(std::list<char*>::iterator i = requiredOptions.begin(); i != requiredOptions.end(); ++i){ + for (std::list<char*>::iterator i = requiredOptions.begin(); i != requiredOptions.end(); ++i){ free(*i); } - for(std::list<char*>::iterator i = processedFiles.begin(); i != processedFiles.end(); ++i){ + for (std::list<char*>::iterator i = processedFiles.begin(); i != processedFiles.end(); ++i){ free(*i); } free(fileName); @@ -189,7 +189,7 @@ int DOTCONFDocument::parseLine() DOTCONFDocumentNode * tagNode = NULL; bool newNode = false; - for(std::list<char*>::iterator i = words.begin(); i != words.end(); ++i) { + for (std::list<char*>::iterator i = words.begin(); i != words.end(); ++i) { word = *i; if(*word == '<'){ @@ -218,7 +218,7 @@ int DOTCONFDocument::parseLine() } else { nodeName+=2; std::list<DOTCONFDocumentNode*>::reverse_iterator itr=nodeTree.rbegin(); - for(; itr!=nodeTree.rend(); ++itr){ + for (; itr!=nodeTree.rend(); ++itr){ if(!cmp_func(nodeName, (*itr)->name) && !(*itr)->closed){ (*itr)->closed = true; curParent = (*itr)->parentNode; @@ -307,7 +307,7 @@ int DOTCONFDocument::checkConfig(const std::list<DOTCONFDocumentNode*>::iterator DOTCONFDocumentNode * tagNode = NULL; int vi = 0; - for(std::list<DOTCONFDocumentNode*>::iterator i = from; i != nodeTree.end(); ++i){ + for (std::list<DOTCONFDocumentNode*>::iterator i = from; i != nodeTree.end(); ++i){ tagNode = *i; if(!tagNode->closed){ error(tagNode->lineNum, tagNode->fileName, "unclosed tag %s", tagNode->name); @@ -371,7 +371,7 @@ int DOTCONFDocument::setContent(const char * _fileName) std::list<DOTCONFDocumentNode*>::iterator from; DOTCONFDocumentNode * tagNode = NULL; int vi = 0; - for(std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i!=nodeTree.end(); ++i){ + for (std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i!=nodeTree.end(); ++i){ tagNode = *i; if(!cmp_func("DOTCONFPPIncludeFile", tagNode->name)){ vi = 0; @@ -386,7 +386,7 @@ int DOTCONFDocument::setContent(const char * _fileName) } bool processed = false; - for(std::list<char*>::const_iterator itInode = processedFiles.begin(); itInode != processedFiles.end(); ++itInode){ + for (std::list<char*>::const_iterator itInode = processedFiles.begin(); itInode != processedFiles.end(); ++itInode){ if(!strcmp(*itInode, realpathBuf)){ processed = true; break; @@ -419,7 +419,6 @@ int DOTCONFDocument::setContent(const char * _fileName) } } - if(!requiredOptions.empty()) ret = checkRequiredOptions(); } @@ -429,9 +428,9 @@ int DOTCONFDocument::setContent(const char * _fileName) int DOTCONFDocument::checkRequiredOptions() { - for(std::list<char*>::const_iterator ci = requiredOptions.begin(); ci != requiredOptions.end(); ++ci){ + for (std::list<char*>::const_iterator ci = requiredOptions.begin(); ci != requiredOptions.end(); ++ci){ bool matched = false; - for(std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i!=nodeTree.end(); ++i){ + for (std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i!=nodeTree.end(); ++i){ if(!cmp_func((*i)->name, *ci)){ matched = true; break; @@ -499,7 +498,7 @@ char * DOTCONFDocument::getSubstitution(char * macro, int lineNum) } else { std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); DOTCONFDocumentNode * tagNode = NULL; - for(; i!=nodeTree.end(); i++){ + for (; i!=nodeTree.end(); i++){ tagNode = *i; if(!cmp_func(tagNode->name, variable)){ if(tagNode->valuesCount != 0){ @@ -566,7 +565,6 @@ const DOTCONFDocumentNode * DOTCONFDocument::getFirstNode() const const DOTCONFDocumentNode * DOTCONFDocument::findNode(const char * nodeName, const DOTCONFDocumentNode * parentNode, const DOTCONFDocumentNode * startNode) const { - std::list<DOTCONFDocumentNode*>::const_iterator i = nodeTree.begin(); if(startNode == NULL) @@ -579,7 +577,7 @@ const DOTCONFDocumentNode * DOTCONFDocument::findNode(const char * nodeName, con if( i != nodeTree.end() ) ++i; } - for(; i!=nodeTree.end(); ++i){ + for (; i!=nodeTree.end(); ++i){ if((*i)->parentNode != parentNode){ continue; diff --git a/src/shared/Config/dotconfpp/dotconfpp.h b/src/shared/Config/dotconfpp/dotconfpp.h index 51455854ee7..554b152f693 100644 --- a/src/shared/Config/dotconfpp/dotconfpp.h +++ b/src/shared/Config/dotconfpp/dotconfpp.h @@ -1,6 +1,5 @@ - #ifndef DOTCONFPP_H #define DOTCONFPP_H diff --git a/src/shared/Config/dotconfpp/mempool.cpp b/src/shared/Config/dotconfpp/mempool.cpp index cec8e8d119f..a23e33808bd 100644 --- a/src/shared/Config/dotconfpp/mempool.cpp +++ b/src/shared/Config/dotconfpp/mempool.cpp @@ -1,6 +1,5 @@ - #include "mempool.h" AsyncDNSMemPool::PoolChunk::PoolChunk(size_t _size): @@ -22,7 +21,7 @@ AsyncDNSMemPool::AsyncDNSMemPool(size_t _defaultSize): AsyncDNSMemPool::~AsyncDNSMemPool() { - for(size_t i = 0; i<chunksCount; ++i){ + for (size_t i = 0; i<chunksCount; ++i){ delete chunks[i]; } ::free(chunks); @@ -53,7 +52,7 @@ void AsyncDNSMemPool::addNewChunk(size_t size) void * AsyncDNSMemPool::alloc(size_t size) { PoolChunk * chunk = NULL; - for(size_t i = 0; i<chunksCount; ++i){ + for (size_t i = 0; i<chunksCount; ++i){ chunk = chunks[i]; if((chunk->size - chunk->pos) >= size){ chunk->pos += size; @@ -71,7 +70,7 @@ void AsyncDNSMemPool::free() size_t psz = 0; ++poolUsageCounter; - for(size_t i = 0; i<chunksCount; ++i){ + for (size_t i = 0; i<chunksCount; ++i){ pu += chunks[i]->pos; psz += chunks[i]->size; chunks[i]->pos = 0; diff --git a/src/shared/Config/dotconfpp/mempool.h b/src/shared/Config/dotconfpp/mempool.h index 81c01d15a58..185b50798e1 100644 --- a/src/shared/Config/dotconfpp/mempool.h +++ b/src/shared/Config/dotconfpp/mempool.h @@ -1,6 +1,5 @@ - #ifndef ASYNC_DNS_MEMPOOL_H #define ASYNC_DNS_MEMPOOL_H diff --git a/src/shared/Database/DBCFileLoader.cpp b/src/shared/Database/DBCFileLoader.cpp index e7ebeedecfb..744e4f1e01a 100644 --- a/src/shared/Database/DBCFileLoader.cpp +++ b/src/shared/Database/DBCFileLoader.cpp @@ -72,7 +72,7 @@ bool DBCFileLoader::Load(const char *filename, const char *fmt) fieldsOffset = new uint32[fieldCount]; fieldsOffset[0] = 0; - for(uint32 i = 1; i < fieldCount; i++) + for (uint32 i = 1; i < fieldCount; i++) { fieldsOffset[i] = fieldsOffset[i - 1]; if (fmt[i - 1] == 'b' || fmt[i - 1] == 'X') // byte fields @@ -109,7 +109,7 @@ uint32 DBCFileLoader::GetFormatRecordSize(const char * format,int32* index_pos) { uint32 recordsize = 0; int32 i = -1; - for(uint32 x=0; format[x];++x) + for (uint32 x=0; format[x]; ++x) switch(format[x]) { case FT_FLOAT: @@ -162,7 +162,7 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char** { uint32 maxi=0; //find max index - for(uint32 y=0;y<recordCount;y++) + for (uint32 y=0; y<recordCount; y++) { uint32 ind=getRecord(y).getUInt (i); if(ind>maxi)maxi=ind; @@ -187,7 +187,7 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char** uint32 offset=0; - for(uint32 y =0;y<recordCount;++y) + for (uint32 y =0; y<recordCount; ++y) { if(i>=0) { @@ -196,7 +196,7 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char** else indexTable[y]=&dataTable[offset]; - for(uint32 x=0;x<fieldCount;x++) + for (uint32 x=0; x<fieldCount; x++) { switch(format[x]) { @@ -235,9 +235,9 @@ char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable) uint32 offset=0; - for(uint32 y =0;y<recordCount;y++) + for (uint32 y =0; y<recordCount; y++) { - for(uint32 x=0;x<fieldCount;x++) + for (uint32 x=0; x<fieldCount; x++) switch(format[x]) { case FT_FLOAT: diff --git a/src/shared/Database/DBCStore.h b/src/shared/Database/DBCStore.h index e02265ec523..ea4ce109e27 100644 --- a/src/shared/Database/DBCStore.h +++ b/src/shared/Database/DBCStore.h @@ -34,7 +34,7 @@ struct SqlDbc { // Convert dbc file name to sql table name sqlTableName = *_filename; - for (uint32 i = 0;i< sqlTableName.size();++i) + for (uint32 i = 0; i< sqlTableName.size(); ++i) { if (isalpha(sqlTableName[i])) sqlTableName[i] = tolower(sqlTableName[i]); @@ -46,7 +46,7 @@ struct SqlDbc DBCFileLoader::GetFormatRecordSize(fmt, &indexPos); if (indexPos>=0) { - for(uint32 x=0;x < formatString->size();x++) + for (uint32 x=0; x < formatString->size(); x++) { // Count only fields present in sql if ((*formatString)[x] == FT_SQL_PRESENT) @@ -142,7 +142,7 @@ class DBCStorage uint32 columnNumber = 0; uint32 sqlColumnNumber = 0; - for(;columnNumber < sql->formatString->size();++columnNumber) + for (; columnNumber < sql->formatString->size(); ++columnNumber) { if ((*sql->formatString)[columnNumber] == FT_SQL_ABSENT) { diff --git a/src/shared/Database/Database.cpp b/src/shared/Database/Database.cpp index 572d3db6f1d..1799cf28a65 100644 --- a/src/shared/Database/Database.cpp +++ b/src/shared/Database/Database.cpp @@ -232,7 +232,7 @@ bool Database::CheckRequiredField( char const* table_name, char const* required_ { QueryFieldNames const& namesMap = result2->GetFieldNames(); std::string reqName; - for(QueryFieldNames::const_iterator itr = namesMap.begin(); itr != namesMap.end(); ++itr) + for (QueryFieldNames::const_iterator itr = namesMap.begin(); itr != namesMap.end(); ++itr) { if(itr->substr(0,9)=="required_") { diff --git a/src/shared/Database/QueryResult.h b/src/shared/Database/QueryResult.h index f9f1a009833..7f213850aa6 100644 --- a/src/shared/Database/QueryResult.h +++ b/src/shared/Database/QueryResult.h @@ -65,7 +65,7 @@ class MANGOS_DLL_SPEC QueryNamedResult uint32 GetField_idx(const std::string &name) const { - for(size_t idx = 0; idx < mFieldNames.size(); ++idx) + for (size_t idx = 0; idx < mFieldNames.size(); ++idx) { if(mFieldNames[idx] == name) return idx; diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp index 372baafe278..e6b3c7bfc5f 100644 --- a/src/shared/Database/SQLStorage.cpp +++ b/src/shared/Database/SQLStorage.cpp @@ -54,10 +54,10 @@ SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "ma void SQLStorage::Free () { uint32 offset=0; - for(uint32 x=0;x<iNumFields;x++) + for (uint32 x=0; x<iNumFields; x++) if (dst_format[x]==FT_STRING) { - for(uint32 y=0;y<MaxEntry;y++) + for (uint32 y=0; y<MaxEntry; y++) if(pIndex[y]) delete [] *(char**)((char*)(pIndex[y])+offset); diff --git a/src/shared/Database/SQLStorage.h b/src/shared/Database/SQLStorage.h index cc165af532e..cfc798a8f1b 100644 --- a/src/shared/Database/SQLStorage.h +++ b/src/shared/Database/SQLStorage.h @@ -45,7 +45,6 @@ class SQLStorage init(_entry_field, sqlname); } - ~SQLStorage() { Free(); diff --git a/src/shared/Database/SQLStorageImpl.h b/src/shared/Database/SQLStorageImpl.h index b511bdad68c..5ad8a66679a 100644 --- a/src/shared/Database/SQLStorageImpl.h +++ b/src/shared/Database/SQLStorageImpl.h @@ -166,7 +166,7 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store) uint32 sc=0; uint32 bo=0; uint32 bb=0; - for(uint32 x=0; x< store.iNumFields; x++) + for (uint32 x=0; x< store.iNumFields; x++) if(store.dst_format[x]==FT_STRING) ++sc; else if (store.dst_format[x]==FT_LOGIC) @@ -189,7 +189,7 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store) newIndex[fields[0].GetUInt32()]=p; offset=0; - for(uint32 x = 0; x < store.iNumFields; x++) + for (uint32 x = 0; x < store.iNumFields; x++) switch(store.src_format[x]) { case FT_LOGIC: diff --git a/src/shared/Database/SqlDelayThread.h b/src/shared/Database/SqlDelayThread.h index 3c24d3525b7..c2b826044c8 100644 --- a/src/shared/Database/SqlDelayThread.h +++ b/src/shared/Database/SqlDelayThread.h @@ -25,7 +25,6 @@ #include "LockedQueue.h" #include "Threading.h" - class Database; class SqlOperation; diff --git a/src/shared/Database/SqlOperations.cpp b/src/shared/Database/SqlOperations.cpp index 396f2e36bc2..89cebff6870 100644 --- a/src/shared/Database/SqlOperations.cpp +++ b/src/shared/Database/SqlOperations.cpp @@ -162,7 +162,7 @@ void SqlQueryHolder::SetResult(size_t index, QueryResult *result) SqlQueryHolder::~SqlQueryHolder() { - for(size_t i = 0; i < m_queries.size(); i++) + for (size_t i = 0; i < m_queries.size(); i++) { /// if the result was never used, free the resources /// results used already (getresult called) are expected to be deleted @@ -189,7 +189,7 @@ void SqlQueryHolderEx::Execute(Database *db) /// we can do this, we are friends std::vector<SqlQueryHolder::SqlResultPair> &queries = m_holder->m_queries; - for(size_t i = 0; i < queries.size(); i++) + for (size_t i = 0; i < queries.size(); i++) { /// execute all queries in the holder and pass the results char const *sql = queries[i].first; diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 89544a82426..df3a19dfe55 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -235,7 +235,7 @@ void Log::InitColors(const std::string& str) std::istringstream ss(str); - for(uint8 i = 0; i < LogLevels; ++i) + for (uint8 i = 0; i < LogLevels; ++i) { ss >> color[i]; @@ -246,7 +246,7 @@ void Log::InitColors(const std::string& str) return; } - for(uint8 i = 0; i < LogLevels; ++i) + for (uint8 i = 0; i < LogLevels; ++i) m_colors[i] = ColorTypes(color[i]); m_colored = true; diff --git a/src/shared/Log.h b/src/shared/Log.h index 283b8819a10..173e3abdc1d 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -110,7 +110,7 @@ class Log : public Trinity::Singleton<Log, Trinity::ClassLevelLockable<Log, ACE_ void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3,4); void outRemote( const char * str, ... ) ATTR_PRINTF(2,3); void outChat( const char * str, ... ) ATTR_PRINTF(2,3); - void outArena( const char * str, ... ) ATTR_PRINTF(2,3); + void outArena( const char * str, ... ) ATTR_PRINTF(2,3); void outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name ); static void outTimestamp(FILE* file); diff --git a/src/shared/ProgressBar.cpp b/src/shared/ProgressBar.cpp index 2eba31c2c40..61d037bb42e 100644 --- a/src/shared/ProgressBar.cpp +++ b/src/shared/ProgressBar.cpp @@ -46,7 +46,7 @@ barGoLink::barGoLink( int row_count ) #else printf( "[" ); #endif - for ( int i = 0; i < indic_len; i++ ) printf( empty ); + for (int i = 0; i < indic_len; i++ ) printf( empty ); #ifdef _WIN32 printf( "\x3D 0%%\r\x3D" ); #else @@ -69,8 +69,8 @@ void barGoLink::step( void ) #else printf( "\r[" ); #endif - for ( i = 0; i < n; i++ ) printf( full ); - for ( ; i < indic_len; i++ ) printf( empty ); + for (i = 0; i < n; i++ ) printf( full ); + for (; i < indic_len; i++ ) printf( empty ); float percent = (((float)n/(float)indic_len)*100); #ifdef _WIN32 printf( "\x3D %i%% \r\x3D", (int)percent); diff --git a/src/shared/SystemConfig.h b/src/shared/SystemConfig.h index 9d154b863d0..b19ed77e559 100644 --- a/src/shared/SystemConfig.h +++ b/src/shared/SystemConfig.h @@ -27,7 +27,6 @@ #include "Platform/Define.h" #include "revision.h" - #define _PACKAGENAME "TrinityCore2 " #define _CODENAME "YUME" diff --git a/src/shared/Threading.cpp b/src/shared/Threading.cpp index 90861b8f425..3938286dbdb 100644 --- a/src/shared/Threading.cpp +++ b/src/shared/Threading.cpp @@ -182,7 +182,7 @@ ACE_THR_FUNC_RETURN Thread::ThreadTask(void * param) Runnable * _task = (Runnable*)param; _task->run(); - // task execution complete, free referecne added at + // task execution complete, free referecne added at _task->decReference(); return (ACE_THR_FUNC_RETURN)0; diff --git a/src/shared/Util.cpp b/src/shared/Util.cpp index ede7a27ea7b..9846b48286c 100644 --- a/src/shared/Util.cpp +++ b/src/shared/Util.cpp @@ -136,7 +136,7 @@ void stripLineInvisibleChars(std::string &str) size_t wpos = 0; bool space = false; - for(size_t pos = 0; pos < str.size(); ++pos) + for (size_t pos = 0; pos < str.size(); ++pos) { if(invChars.find(str[pos])!=std::string::npos) { @@ -192,7 +192,7 @@ uint32 TimeStringToSecs(const std::string& timestring) uint32 buffer = 0; uint32 multiplier = 0; - for(std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); itr++ ) + for (std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); itr++ ) { if(isdigit(*itr)) { @@ -418,7 +418,7 @@ std::wstring GetMainPartOfName(std::wstring wname, uint32 declension) { &ie_End[1], &i_End[1], NULL, NULL, NULL, NULL, NULL, NULL } }; - for(wchar_t const * const* itr = &dropEnds[declension][0]; *itr; ++itr) + for (wchar_t const * const* itr = &dropEnds[declension][0]; *itr; ++itr) { size_t len = size_t((*itr)[-1]); // get length from string size field @@ -506,9 +506,9 @@ void vutf8printf(FILE *out, const char *str, va_list* ap) void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result) { std::ostringstream ss; - for(uint32 i=0; i<arrayLen; ++i) + for (uint32 i=0; i<arrayLen; ++i) { - for(uint8 j=0; j<2; ++j) + for (uint8 j=0; j<2; ++j) { unsigned char nibble = 0x0F & (bytes[i]>>((1-j)*4)); char encodedNibble; diff --git a/src/shared/Util.h b/src/shared/Util.h index 04be6e93bed..a8b9df8f29a 100644 --- a/src/shared/Util.h +++ b/src/shared/Util.h @@ -189,7 +189,7 @@ inline bool isNumericOrSpace(wchar_t wchar) inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace) { - for(size_t i = 0; i < wstr.size(); ++i) + for (size_t i = 0; i < wstr.size(); ++i) if(!isBasicLatinCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) return false; return true; @@ -197,7 +197,7 @@ inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace) inline bool isExtendedLatinString(std::wstring wstr, bool numericOrSpace) { - for(size_t i = 0; i < wstr.size(); ++i) + for (size_t i = 0; i < wstr.size(); ++i) if(!isExtendedLatinCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) return false; return true; @@ -205,7 +205,7 @@ inline bool isExtendedLatinString(std::wstring wstr, bool numericOrSpace) inline bool isCyrillicString(std::wstring wstr, bool numericOrSpace) { - for(size_t i = 0; i < wstr.size(); ++i) + for (size_t i = 0; i < wstr.size(); ++i) if(!isCyrillicCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) return false; return true; @@ -213,7 +213,7 @@ inline bool isCyrillicString(std::wstring wstr, bool numericOrSpace) inline bool isEastAsianString(std::wstring wstr, bool numericOrSpace) { - for(size_t i = 0; i < wstr.size(); ++i) + for (size_t i = 0; i < wstr.size(); ++i) if(!isEastAsianCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) return false; return true; @@ -348,7 +348,7 @@ public: template<class type> inline bool operator < (type & right) { - for (uint8 i=3;i>0;i--) + for (uint8 i=3; i>0; i--) { if (part[i-1]<right.part[i-1]) return 1; @@ -361,7 +361,7 @@ public: template<class type> inline bool operator < (type & right) const { - for (uint8 i=3;i>0;i--) + for (uint8 i=3; i>0; i--) { if (part[i-1]<right.part[i-1]) return 1; diff --git a/src/shared/WheatyExceptionReport.cpp b/src/shared/WheatyExceptionReport.cpp index f2fd9b0f2e7..8fb5d5e2d2a 100644 --- a/src/shared/WheatyExceptionReport.cpp +++ b/src/shared/WheatyExceptionReport.cpp @@ -374,7 +374,6 @@ void WheatyExceptionReport::printTracesForAllThreads() CloseHandle(hThreadSnap); } - //=========================================================================== // Open the report file, and write the desired information to it. Called by // WheatyUnhandledExceptionFilter diff --git a/src/shared/vmap/AABSPTree.h b/src/shared/vmap/AABSPTree.h index ff4335b6774..1a7b17cdaa2 100644 --- a/src/shared/vmap/AABSPTree.h +++ b/src/shared/vmap/AABSPTree.h @@ -42,7 +42,6 @@ inline void getBounds(const G3D::Vector3& v, G3D::AABox& out) { out = G3D::AABox(v); } - inline void getBounds(const G3D::AABox& a, G3D::AABox& out) { out = a; } @@ -51,23 +50,18 @@ inline void getBounds(const G3D::Sphere& s, G3D::AABox& out) { s.getBounds(out); } - inline void getBounds(const G3D::Box& b, G3D::AABox& out) { b.getBounds(out); } - inline void getBounds(const G3D::Triangle& t, G3D::AABox& out) { t.getBounds(out); } - - inline void getBounds(const G3D::Vector3* v, G3D::AABox& out) { out = G3D::AABox(*v); } - inline void getBounds(const G3D::AABox* a, G3D::AABox& out) { getBounds(*a, out); } @@ -76,7 +70,6 @@ inline void getBounds(const G3D::Sphere* s, G3D::AABox& out) { s->getBounds(out); } - inline void getBounds(const G3D::Box* b, G3D::AABox& out) { b->getBounds(out); } @@ -165,7 +158,6 @@ namespace G3D { you can use the AABSPTree::update method as a shortcut to insert/remove an object in one step after it has moved. - Note: Do not mutate any value once it has been inserted into AABSPTree. Values are copied interally. All AABSPTree iterators convert to pointers to constant values to reinforce this. @@ -258,7 +250,6 @@ template<class T> class AABSPTree { protected: public: - /** Returns the bounds of the sub array. Used by makeNode. */ static AABox computeBounds( const Array<_AABSPTree::Handle<T>*>& point, @@ -297,7 +288,6 @@ public: } }; - /** Compares bounds for strict >, <, or overlap*/ class BoundsComparator { public: @@ -319,7 +309,6 @@ public: } }; - /** Compares bounds to the sort location */ class Comparator { public: @@ -436,7 +425,6 @@ public: return (child[0] == NULL) && (child[1] == NULL); } - /** Recursively appends all handles and children's handles to the array. @@ -461,7 +449,7 @@ public: const AABox& b = valueArray[i]->bounds; debugAssert(b == boundsArray[i]); - for(int axis = 0; axis < 3; ++axis) { + for (int axis = 0; axis < 3; ++axis) { debugAssert(b.low()[axis] <= b.high()[axis]); debugAssert(b.low()[axis] >= lo[axis]); debugAssert(b.high()[axis] <= hi[axis]); @@ -545,7 +533,6 @@ public: return this; } - /** Appends all members that intersect the box. If useSphere is true, members that pass the box test face a second test against the sphere. */ @@ -721,7 +708,6 @@ public: } }; - /** Recursively subdivides the subarray. @@ -813,7 +799,6 @@ public: // The Comparator ensures that elements are strictly on the correct side of the split } - # if defined(G3D_DEBUG) && defined(VERIFY_TREE) debugAssert(lt.size() + node->valueArray.size() + gt.size() == source.size()); // Verify that all objects ended up on the correct side of the split. @@ -904,12 +889,10 @@ public: AABSPTree::balance(). */ AABSPTree() : root(NULL) {} - AABSPTree(const AABSPTree& src) : root(NULL) { *this = src; } - AABSPTree& operator=(const AABSPTree& src) { delete root; // Clone tree takes care of filling out the memberTable. @@ -917,7 +900,6 @@ public: return *this; } - ~AABSPTree() { clear(); } @@ -1007,7 +989,6 @@ public: } } - /** Returns true if this object is in the set, otherwise returns false. O(1) time. @@ -1018,7 +999,6 @@ public: return memberTable.containsKey(Member(&h)); } - /** Removes an object from the set in O(1) time. It is an error to remove members that are not already @@ -1066,7 +1046,6 @@ public: ptr = NULL; } - /** If the element is in the set, it is removed. The element is then inserted. @@ -1085,7 +1064,6 @@ public: insert(value); } - /** Rebalances the tree (slow). Call when objects have moved substantially from their original positions @@ -1402,7 +1380,6 @@ public: } }; - /** Iterates through the members that intersect the box */ @@ -1426,7 +1403,6 @@ public: root->getIntersectingMembers(box, Sphere(Vector3::zero(), 0), members, false); } - /** Invoke a callback for every member along a ray until the closest intersection is found. @@ -1473,7 +1449,6 @@ public: scene.intersectRay(camera.worldRay(x, y), intersection, distance); </pre> - @param distance When the method is invoked, this is the maximum distance that the tree should search for an intersection. On return, this is set to the distance to the first intersection encountered. @@ -1492,7 +1467,6 @@ public: } - /** @param members The results are appended to this array. */ @@ -1533,7 +1507,6 @@ public: } } - /** C++ STL style iterator variable. See begin(). Overloads the -> (dereference) operator, so this acts like a pointer @@ -1591,7 +1564,6 @@ public: } }; - /** C++ STL style iterator method. Returns the first member. Use preincrement (++entry) to get to the next element (iteration @@ -1602,7 +1574,6 @@ public: return Iterator(memberTable.begin()); } - /** C++ STL style iterator method. Returns one after the last iterator element. @@ -1617,5 +1588,3 @@ public: #endif - - diff --git a/src/shared/vmap/BaseModel.cpp b/src/shared/vmap/BaseModel.cpp index 2ffd5672218..94389f683cf 100644 --- a/src/shared/vmap/BaseModel.cpp +++ b/src/shared/vmap/BaseModel.cpp @@ -29,7 +29,7 @@ namespace VMAP void BaseModel::getMember(Array<TriangleBox>& pMembers) { - for(unsigned int i=0; i<iNTriangles; i++) + for (unsigned int i=0; i<iNTriangles; i++) { pMembers.append(iTriangles[i]); } diff --git a/src/shared/vmap/DebugCmdLogger.cpp b/src/shared/vmap/DebugCmdLogger.cpp index c899606045b..461df62843e 100644 --- a/src/shared/vmap/DebugCmdLogger.cpp +++ b/src/shared/vmap/DebugCmdLogger.cpp @@ -78,7 +78,7 @@ namespace VMAP if(f) { result = true; - for(int i=0; i<pCmdArray.size(); ++i) + for (int i=0; i<pCmdArray.size(); ++i) { if(fwrite(&pCmdArray[i], sizeof(Command), 1, f) != 1) { result = false; break; } } diff --git a/src/shared/vmap/ModelContainer.cpp b/src/shared/vmap/ModelContainer.cpp index 4a722d2585b..d00464880f3 100644 --- a/src/shared/vmap/ModelContainer.cpp +++ b/src/shared/vmap/ModelContainer.cpp @@ -66,7 +66,7 @@ namespace VMAP ++nNodes; nSubModels += pNode.valueArray.size(); - for(int i=0;i<pNode.valueArray.size(); i++) + for (int i=0; i<pNode.valueArray.size(); i++) { G3D::_AABSPTree::Handle<SubModel*>* h= pNode.valueArray[i]; SubModel *m = h->value; @@ -97,7 +97,7 @@ namespace VMAP Vector3 lo = Vector3(inf(),inf(),inf()); Vector3 hi = Vector3(-inf(),-inf(),-inf()); - for(int i=0;i<pNode.valueArray.size(); i++) + for (int i=0; i<pNode.valueArray.size(); i++) { G3D::_AABSPTree::Handle<SubModel*>* h= pNode.valueArray[i]; SubModel *m = h->value; @@ -303,7 +303,7 @@ namespace VMAP if(result) { - for(unsigned int i=0;i<iNSubModel && result; ++i) + for (unsigned int i=0; i<iNSubModel && result; ++i) { unsigned char readBuffer[52]; // this is the size of SubModel on 32 bit systems if(fread(readBuffer,sizeof(readBuffer),1,rf) != 1) result = false; diff --git a/src/shared/vmap/SubModel.cpp b/src/shared/vmap/SubModel.cpp index 370c80062d6..72dbed2a5a1 100644 --- a/src/shared/vmap/SubModel.cpp +++ b/src/shared/vmap/SubModel.cpp @@ -148,7 +148,7 @@ namespace VMAP Vector3 lo = Vector3(inf(),inf(),inf()); Vector3 hi = Vector3(-inf(),-inf(),-inf()); - for(int i=0;i<pNode.valueArray.size(); i++) + for (int i=0; i<pNode.valueArray.size(); i++) { G3D::_AABSPTree::Handle<Triangle>* h= pNode.valueArray[i]; Triangle t = h->value; diff --git a/src/shared/vmap/TileAssembler.cpp b/src/shared/vmap/TileAssembler.cpp index 75997a847a2..5a9b35bb3a1 100644 --- a/src/shared/vmap/TileAssembler.cpp +++ b/src/shared/vmap/TileAssembler.cpp @@ -166,25 +166,25 @@ namespace VMAP return false; } - for(int i=0; i<mapIds.size(); ++i) + for (int i=0; i<mapIds.size(); ++i) { unsigned int mapId = mapIds[i]; #ifdef _ASSEMBLER_DEBUG if(mapId == 0) // "Azeroth" just for debug { - for(int x=28; x<29; ++x) //debug + for (int x=28; x<29; ++x) //debug { - for(int y=28; y<29; ++y) + for (int y=28; y<29; ++y) { #else // ignore DeeprunTram (369) it is too large for short vector and not important // ignore test (13), Test (29) , development (451) if(mapId != 369 && mapId != 13 && mapId != 29 && mapId != 451) { - for(int x=0; x<66; ++x) + for (int x=0; x<66; ++x) { - for(int y=0; y<66; ++y) + for (int y=0; y<66; ++y) { #endif Array<ModelContainer*> mc; @@ -423,7 +423,7 @@ namespace VMAP READ_OR_RETURN(&groups, sizeof(G3D::uint32)); - for(int g=0;g<(int)groups;g++) + for (int g=0; g<(int)groups; g++) { // group MUST NOT have more then 65536 indexes !! Array will have a problem with that !! (strange ...) Array<int> tempIndexArray; @@ -447,7 +447,7 @@ namespace VMAP CMP_OR_RETURN(blockId, "GRP "); READ_OR_RETURN(&blocksize, sizeof(int)); READ_OR_RETURN(&branches, sizeof(G3D::uint32)); - for(int b=0;b<(int)branches; b++) + for (int b=0; b<(int)branches; b++) { G3D::uint32 indexes; // indexes for each branch (not used jet) @@ -464,7 +464,7 @@ namespace VMAP { unsigned short *indexarray = new unsigned short[nindexes*sizeof(unsigned short)]; READ_OR_RETURN(indexarray, nindexes*sizeof(unsigned short)); - for(int i=0;i<(int)nindexes; i++) + for (int i=0; i<(int)nindexes; i++) { unsigned short val = indexarray[i]; tempIndexArray.append(val); @@ -504,8 +504,7 @@ namespace VMAP fseek(rf, blocksize, SEEK_CUR); } - - for(unsigned int i=0, indexNo=0; indexNo<nvectors; indexNo++) + for (unsigned int i=0, indexNo=0; indexNo<nvectors; indexNo++) { Vector3 v = Vector3(vectorarray[i+2], vectorarray[i+1], vectorarray[i+0]); i+=3; @@ -525,7 +524,7 @@ namespace VMAP nindexes -= rest; } - for(unsigned int i=0;i<(nindexes);) + for (unsigned int i=0; i<(nindexes); ) { Triangle t = Triangle(tempVertexArray[tempIndexArray[i+2]], tempVertexArray[tempIndexArray[i+1]], tempVertexArray[tempIndexArray[i+0]] ); i+=3; diff --git a/src/shared/vmap/VMapFactory.cpp b/src/shared/vmap/VMapFactory.cpp index 5189f79daba..a92e4a1afac 100644 --- a/src/shared/vmap/VMapFactory.cpp +++ b/src/shared/vmap/VMapFactory.cpp @@ -38,7 +38,7 @@ namespace VMAP { bool result = false; unsigned int i; - for(i=pStartPos;i<pString.size(); ++i) + for (i=pStartPos; i<pString.size(); ++i) { if(pString[i] == ',') { diff --git a/src/shared/vmap/VMapManager.cpp b/src/shared/vmap/VMapManager.cpp index 342da0eb9e2..a059f267f2e 100644 --- a/src/shared/vmap/VMapManager.cpp +++ b/src/shared/vmap/VMapManager.cpp @@ -41,7 +41,7 @@ namespace VMAP VMapManager::~VMapManager(void) { Array<unsigned int > keyArray = iInstanceMapTrees.getKeys(); - for(int i=0;i<keyArray.size(); ++i) + for (int i=0; i<keyArray.size(); ++i) { delete iInstanceMapTrees.get(keyArray[i]); iInstanceMapTrees.remove(keyArray[i]); @@ -151,7 +151,7 @@ namespace VMAP { bool result = false; unsigned int i; - for(i=pStartPos;i<pString.size(); ++i) + for (i=pStartPos; i<pString.size(); ++i) { if(pString[i] == ',') { @@ -740,7 +740,7 @@ namespace VMAP { Array<std::string> fileNames = filesInDir.getFiles(); bool treeChanged = false; - for(int i=0; i<fileNames.size(); ++i) + for (int i=0; i<fileNames.size(); ++i) { std::string name = fileNames[i]; ManagedModelContainer* mc = getModelContainer(name); |
