From c9801cebad467121a0f46619e22188c97ec63b69 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 15 Jan 2016 23:11:19 -0600 Subject: [PATCH] more partial reverts of inadvisable changes from i++ to ++i, per pvs-studio...i'll ignore that type of advice from now on as i wasn't considering the consequences --- .../src/shared/ai/AiMovementPathFollow.cpp | 8 +++--- .../src/shared/ServerPathBuildManager.cpp | 2 +- .../sharedUtility/src/shared/RotaryCache.cpp | 2 +- .../VChatAPI/utils2.0/utils/Base/log.cpp | 6 ++--- .../VChatAPI/utils2.0/utils/Base/profile.cpp | 14 +++++------ .../utils/Base/serializeStringVector.h | 25 +++++++++++-------- 6 files changed, 30 insertions(+), 27 deletions(-) mode change 100755 => 100644 engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp mode change 100755 => 100644 engine/server/library/serverPathfinding/src/shared/ServerPathBuildManager.cpp mode change 100755 => 100644 engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp mode change 100755 => 100644 external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp mode change 100755 => 100644 external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/profile.cpp mode change 100755 => 100644 external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeStringVector.h diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp old mode 100755 new mode 100644 index 7a6ad28d..2105c898 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp @@ -258,7 +258,7 @@ void AiMovementPathFollow::popNodeBack ( void ) AiPath::iterator it = m_path->end(); - --it; + it--; m_path->erase(it); } @@ -293,7 +293,7 @@ void AiMovementPathFollow::swapPath ( AiPath * newPath ) AiPath::iterator it; #ifdef _DEBUG - for(it = m_path->begin(); it != m_path->end(); ++it) + for(it = m_path->begin(); it != m_path->end(); it++) { sendEraseWaypoint(*it); } @@ -303,7 +303,7 @@ void AiMovementPathFollow::swapPath ( AiPath * newPath ) m_path->swap(*newPath); - for(it = m_path->begin(); it != m_path->end(); ++it) + for(it = m_path->begin(); it != m_path->end(); it++) { (*it).detach(); @@ -323,7 +323,7 @@ void AiMovementPathFollow::clearPath ( void ) { AiPath::iterator it; - for(it = m_path->begin(); it != m_path->end(); ++it) + for(it = m_path->begin(); it != m_path->end(); it++) { sendEraseWaypoint(*it); } diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathBuildManager.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathBuildManager.cpp old mode 100755 new mode 100644 index 236a14a5..617cabae --- a/engine/server/library/serverPathfinding/src/shared/ServerPathBuildManager.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathBuildManager.cpp @@ -45,7 +45,7 @@ void updateQueue ( BuildQueue * queue, PerformanceTimer const & timer, float tim currentBuilder->update(); BuildQueue::iterator old = it; - ++it; + it++; if(currentBuilder->buildDone()) { diff --git a/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp b/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp old mode 100755 new mode 100644 index 3a9769d4..b406fe08 --- a/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp +++ b/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp @@ -138,7 +138,7 @@ RotaryCache::getNext() { void* retVal = (*mIterList).value; - ++mIterList; + mIterList++; return retVal; } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp old mode 100755 new mode 100644 index 1644955e..e14aee9a --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp @@ -171,7 +171,7 @@ void Logger::LoggerInit(const char *programName) Logger::~Logger() { map::iterator iter; - for(iter = m_logTable.begin(); iter != m_logTable.end(); ++iter) + for(iter = m_logTable.begin(); iter != m_logTable.end(); iter++) { logWithSys((*iter).first, LOG_INFO, LOG_FILEONLY, "---=== Log Stopped ===---"); fflush((*iter).second->file); @@ -215,7 +215,7 @@ void Logger::flushAll() { map::iterator iter; - for(iter = m_logTable.begin(); iter != m_logTable.end(); ++iter) + for(iter = m_logTable.begin(); iter != m_logTable.end(); iter++) { LogInfo *info = (*iter).second; fflush(info->file); @@ -660,7 +660,7 @@ void Logger::rollDate(time_t t) m_logPrefix = buf; map::iterator iter; - for(iter = m_logTable.begin(); iter != m_logTable.end(); ++iter) + for(iter = m_logTable.begin(); iter != m_logTable.end(); iter++) { (*iter).second->filename = m_logPrefix + file_sep + (*iter).second->name.c_str() + ".log"; fflush((*iter).second->file); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/profile.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/profile.cpp old mode 100755 new mode 100644 index e53a185c..8b3917cb --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/profile.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/profile.cpp @@ -57,7 +57,7 @@ void Profiler::AddNode(Node & lhs, const Node & rhs) lhs.mData.mMinLatency = rhs.mData.mMinLatency; NodeMap_t::const_iterator iter; - for (iter = rhs.mNodeMap.begin(); iter != rhs.mNodeMap.end(); ++iter) + for (iter = rhs.mNodeMap.begin(); iter != rhs.mNodeMap.end(); iter++) { Node & node = lhs.mNodeMap[iter->first]; AddNode(node, iter->second); @@ -69,7 +69,7 @@ void Profiler::AddData(const Profiler & rhs, bool hierarchy) if (hierarchy) { NodeMap_t::const_iterator nodeIter; - for (nodeIter = rhs.mNodeMap.begin(); nodeIter != rhs.mNodeMap.end(); ++nodeIter) + for (nodeIter = rhs.mNodeMap.begin(); nodeIter != rhs.mNodeMap.end(); nodeIter++) { Node & node = mNodeMap[nodeIter->first]; AddNode(node, nodeIter->second); @@ -77,7 +77,7 @@ void Profiler::AddData(const Profiler & rhs, bool hierarchy) } DataMap_t::const_iterator iter; - for (iter = rhs.mDataMap.begin(); iter != rhs.mDataMap.end(); ++iter) + for (iter = rhs.mDataMap.begin(); iter != rhs.mDataMap.end(); iter++) { NodeData & lhs = mDataMap[iter->first]; const NodeData & rhs = iter->second; @@ -195,7 +195,7 @@ void Profiler::GetOutput(std::string & output, bool hierarchy) // print data map (linear call profile) DataMap_t::const_iterator iter; - for (iter = mDataMap.begin(); iter != mDataMap.end(); ++iter) + for (iter = mDataMap.begin(); iter != mDataMap.end(); iter++) { const NodeData & data = iter->second; double trueLatency = data.mTotalLatency-data.mTotalChildLatency; @@ -254,7 +254,7 @@ void Profiler::GetXmlOutput(std::string & output, bool hierarchy) // print data map (linear call profile) int i = 1; DataMap_t::const_iterator iter; - for (iter = mDataMap.begin(); iter != mDataMap.end(); ++iter) + for (iter = mDataMap.begin(); iter != mDataMap.end(); iter++) { const NodeData & data = iter->second; double trueLatency = data.mTotalLatency-data.mTotalChildLatency; @@ -332,7 +332,7 @@ void Profiler::GetNodeOutput(std::string & output, const NodeMap_t & nodeMap, do // recursively print node map NodeMap_t::const_iterator iter; - for (iter = nodeMap.begin(); iter != nodeMap.end(); ++iter) + for (iter = nodeMap.begin(); iter != nodeMap.end(); iter++) { // output node description const Node & node = iter->second; @@ -361,7 +361,7 @@ void Profiler::GetXmlNodeOutput(std::string & output, const NodeMap_t & nodeMap, // recursively print node map int i = 1; NodeMap_t::const_iterator iter; - for (iter = nodeMap.begin(); iter != nodeMap.end(); ++iter) + for (iter = nodeMap.begin(); iter != nodeMap.end(); iter++) { snprintf(buffer, sizeof(buffer), "", i); output += buffer; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeStringVector.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeStringVector.h old mode 100755 new mode 100644 index 19c42fad..52422e3b --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeStringVector.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeStringVector.h @@ -22,7 +22,7 @@ namespace soe // // This class is designed to handle the serialization of a vector of strings. This was necessary // because the default serialization routines did not handle the length of the string properly, and - // there was more risk involved in modifying all the serialization routines to handle the + // there was more risk involved in modifying all the serialization routines to handle the // extra length property for the string as well as the vector. // // this is intenede to be used with the serialization macros @@ -50,17 +50,17 @@ namespace soe : mMaxStringLength(maxStringLength), mMaxListLength(maxListLength) { } - SerializeStringList(stringList_t vStrings) + SerializeStringList::SerializeStringList(stringList_t vStrings) : mMaxStringLength(DEFAULT_MAX_LENGTH_STRING), mMaxListLength(DEFAULT_MAX_NUMBER_ELEMENTS) { - for(stringList_t::iterator i = vStrings.begin(); i != vStrings.end(); ++i) + for(stringList_t::iterator i = vStrings.begin(); i != vStrings.end(); i++) { push_back(*i); } } /////////////////////////////////////////////////////////////////////////////////////////// - unsigned Read(const unsigned char * stream, unsigned size) + unsigned SerializeStringList::Read(const unsigned char * stream, unsigned size) { // fix this: std::string element; @@ -91,7 +91,7 @@ namespace soe } /////////////////////////////////////////////////////////////////////////////////////////// - unsigned Write(unsigned char * stream, unsigned size) const + unsigned SerializeStringList::Write(unsigned char * stream, unsigned size) const { unsigned index = 0; unsigned bytes = 0; @@ -103,7 +103,7 @@ namespace soe #endif return 0; } - for (stringList_t::const_iterator iter = begin(); iter != end(); ++iter, ++index) + for (stringList_t::const_iterator iter = begin(); iter != end(); iter++, index++) { elementBytes = soe::Write(stream+bytes, size-bytes, *iter); if (!elementBytes) { @@ -153,17 +153,17 @@ namespace soe : mMaxStringLength(maxStringLength), mMaxVectorLength(maxVectorLength) { } - SerializeStringVector(stringVector_t vStrings) + SerializeStringVector::SerializeStringVector(stringVector_t vStrings) : mMaxStringLength(DEFAULT_MAX_LENGTH_STRING), mMaxVectorLength(DEFAULT_MAX_NUMBER_ELEMENTS) { - for(stringVector_t::iterator i = vStrings.begin(); i != vStrings.end(); ++i) + for(stringVector_t::iterator i = vStrings.begin(); i != vStrings.end(); i++) { push_back(*i); } } /////////////////////////////////////////////////////////////////////////////////////////// - unsigned Read(const unsigned char * stream, unsigned size) + unsigned SerializeStringVector::Read(const unsigned char * stream, unsigned size) { // fix this: std::string element; @@ -194,7 +194,7 @@ namespace soe } /////////////////////////////////////////////////////////////////////////////////////////// - unsigned Write(unsigned char * stream, unsigned size) const + unsigned SerializeStringVector::Write(unsigned char * stream, unsigned size) const { unsigned index = 0; unsigned bytes = 0; @@ -206,7 +206,7 @@ namespace soe #endif return 0; } - for (stringVector_t::const_iterator iter = begin(); iter != end(); ++iter, ++index) + for (stringVector_t::const_iterator iter = begin(); iter != end(); iter++, index++) { elementBytes = soe::Write(stream+bytes, size-bytes, *iter); if (!elementBytes) { @@ -221,6 +221,9 @@ namespace soe return bytes; } + operator stringVector_t () { return *this; } + + //unsigned Read(const unsigned char * stream, unsigned size); //DECLARE_SCRIBE_MEMBERS };