From 9c38b49839790dce7068e451d35d8d5f85866ab2 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Thu, 23 Mar 2017 19:30:52 -0700 Subject: [PATCH] Prefer prefix ++/-- operators where possible, for performance reasons (per CppCheck) --- src/db/blockfile.cpp | 10 +++++----- src/db/blockrecordfile.cpp | 6 +++--- src/db/hierdatabase.cpp | 10 +++++----- src/fco/fcodatasourceiterimpl.cpp | 10 +++++----- src/fco/fconame.cpp | 10 +++++----- src/fco/fcosetimpl.cpp | 4 ++-- src/fco/fcospecattr.h | 2 +- src/fco/fcospechelper.cpp | 4 ++-- src/fco/fcospechelper.h | 2 +- src/fco/fcospeclist.cpp | 4 ++-- src/fco/genreswitcher.cpp | 4 ++-- src/fs/fsparserutil.cpp | 2 +- src/fs/fspropdisplayer.cpp | 8 ++++---- src/tripwire/generatedb_t.cpp | 2 +- src/tripwire/integritycheck.cpp | 2 +- src/tripwire/integritycheck_t.cpp | 2 +- src/tripwire/mailmessage.cpp | 6 +++--- src/tripwire/twcmdline.cpp | 4 ++-- src/tw/dbexplore.cpp | 4 ++-- src/tw/fcodatabasefile.cpp | 8 ++++---- src/tw/fcoreport.cpp | 8 ++++---- src/tw/textreportviewer.cpp | 10 +++++----- src/tw/twutil.cpp | 6 +++--- src/twparser/genreparseinfo.cpp | 4 ++-- src/twparser/parserhelper.cpp | 14 +++++++------- src/twparser/parserobjects.cpp | 12 ++++++------ src/twparser/parserobjects.h | 2 +- src/twprint/twprintcmdline.cpp | 4 ++-- src/twtest/displayencoder_t.cpp | 2 +- src/twtest/textreportviewer_t.cpp | 2 +- src/twtest/unixfsservices_t.cpp | 2 +- src/util/stringencoder.cpp | 4 ++-- 32 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/db/blockfile.cpp b/src/db/blockfile.cpp index b936bb4..d87f3d4 100644 --- a/src/db/blockfile.cpp +++ b/src/db/blockfile.cpp @@ -140,7 +140,7 @@ void cBlockFile::Close() void cBlockFile::Flush() { ASSERT( mpArchive ); - for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); i++ ) + for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); ++i ) { FlushBlock( &(*i) ); } @@ -171,7 +171,7 @@ cBlockFile::Block* cBlockFile::GetBlock( int blockNum ) //throw (eArchive) mTimer++; if( mTimer == 0 ) { - for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); i++ ) + for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); ++i ) { i->SetTimestamp( 0 ); } @@ -179,7 +179,7 @@ cBlockFile::Block* cBlockFile::GetBlock( int blockNum ) //throw (eArchive) // // now, see if the desired block is in memory... // - for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); i++ ) + for( BlockVector::iterator i = mvPagedBlocks.begin(); i != mvPagedBlocks.end(); ++i ) { if( i->GetBlockNum() == blockNum ) { @@ -201,9 +201,9 @@ cBlockFile::Block* cBlockFile::GetBlock( int blockNum ) //throw (eArchive) uint32 earliestTime = mvPagedBlocks[0].GetTimestamp(); BlockVector::iterator it = mvPagedBlocks.begin(); BlockVector::iterator earliestIter = it; - it++; // since we don't want to check the first one + ++it; // since we don't want to check the first one ASSERT(it != mvPagedBlocks.end()); - for( ; it != mvPagedBlocks.end(); it++ ) + for( ; it != mvPagedBlocks.end(); ++it ) { if( it->GetTimestamp() < earliestTime ) { diff --git a/src/db/blockrecordfile.cpp b/src/db/blockrecordfile.cpp index e049181..194a5db 100644 --- a/src/db/blockrecordfile.cpp +++ b/src/db/blockrecordfile.cpp @@ -277,7 +277,7 @@ int cBlockRecordFile::FindRoomForData( int32 dataSize ) //throw (eArchive) // BlockArray::iterator it; int cnt = 0; - for( it = mvBlocks.begin(); it != mvBlocks.end(); it++, cnt++ ) + for( it = mvBlocks.begin(); it != mvBlocks.end(); ++it, ++cnt ) { util_InitBlockArray( *it ); if( it->GetAvailableSpace() >= dataSize ) @@ -310,7 +310,7 @@ void cBlockRecordFile::TraceContents(int dl) const { // TODO -- this is probably not what I want to do, but it helps me right now... // - for( BlockArray::const_iterator i = mvBlocks.begin(); i != mvBlocks.end(); i++ ) + for( BlockArray::const_iterator i = mvBlocks.begin(); i != mvBlocks.end(); ++i ) { i->TraceContents( dl ); } @@ -330,7 +330,7 @@ void cBlockRecordFile::AssertValid() const /////////////////////////////////////////////////////////////////////////////// void cBlockRecordFile::AssertAllBlocksValid() { - for( BlockArray::iterator i = mvBlocks.begin(); i != mvBlocks.end(); i++ ) + for( BlockArray::iterator i = mvBlocks.begin(); i != mvBlocks.end(); ++i ) { i->AssertValid(); } diff --git a/src/db/hierdatabase.cpp b/src/db/hierdatabase.cpp index b4fd831..e90e28a 100644 --- a/src/db/hierdatabase.cpp +++ b/src/db/hierdatabase.cpp @@ -405,7 +405,7 @@ bool cHierDatabaseIter::Done() const /////////////////////////////////////////////////////////////////////////////// void cHierDatabaseIter::Next() { - mIter++; + ++mIter; } /////////////////////////////////////////////////////////////////////////////// @@ -552,10 +552,10 @@ void cHierDatabaseIter::CreateEntry( const TSTRING& name ) //throw (eArchive, eH { // altering the previous node... // - mIter--; + --mIter; mIter->mNext = newAddr; util_RewriteObject( mpDb, &(*mIter), GetCurrentAddr() ); - mIter++; + ++mIter; } } @@ -672,10 +672,10 @@ void cHierDatabaseIter::DeleteEntry() //throw (eArchive, eHierDatabase) { // altering the previous node... // - mIter--; + --mIter; mIter->mNext = (mIter+1)->mNext; util_RewriteObject( mpDb, &(*mIter), GetCurrentAddr() ); - mIter++; + ++mIter; } // // now, delete the node from the file and from our array... diff --git a/src/fco/fcodatasourceiterimpl.cpp b/src/fco/fcodatasourceiterimpl.cpp index c906188..b0cb892 100644 --- a/src/fco/fcodatasourceiterimpl.cpp +++ b/src/fco/fcodatasourceiterimpl.cpp @@ -75,7 +75,7 @@ cFCODataSourceIterImpl& cFCODataSourceIterImpl::operator=( const cFCODataSourceI // // we need to addref all of the fcos we just got... // - for( FCOList::const_iterator i = mPeers.begin(); i != mPeers.end(); i++ ) + for( FCOList::const_iterator i = mPeers.begin(); i != mPeers.end(); ++i ) { (*i)->AddRef(); } @@ -191,7 +191,7 @@ bool cFCODataSourceIterImpl::Done() const /////////////////////////////////////////////////////////////////////////////// void cFCODataSourceIterImpl::Next() { - mCurPos++; + ++mCurPos; } /////////////////////////////////////////////////////////////////////////////// @@ -282,7 +282,7 @@ bool cFCODataSourceIterImpl::IsCaseSensitive() const /////////////////////////////////////////////////////////////////////////////// void cFCODataSourceIterImpl::ClearList() { - for( mCurPos = mPeers.begin(); mCurPos != mPeers.end(); mCurPos++ ) + for( mCurPos = mPeers.begin(); mCurPos != mPeers.end(); ++mCurPos ) { (*mCurPos)->Release(); } @@ -316,7 +316,7 @@ void cFCODataSourceIterImpl::GeneratePeers() // std::vector::iterator i; cFCOName curName = mParentName; - for( i = vChildrenNames.begin(); i != vChildrenNames.end(); i++) + for( i = vChildrenNames.begin(); i != vChildrenNames.end(); ++i) { curName.Push( *i ); @@ -369,7 +369,7 @@ void cFCODataSourceIterImpl::TraceContents(int dl) const d.Trace( dl, "FCO Iterator; parent = %s\n", mParentName.AsString().c_str() ); d.Trace( dl, "---- Peers ---- (current has a * by it)\n" ); int cnt = 0; - for( FCOList::const_iterator iter = mPeers.begin(); iter != mPeers.end(); iter++, cnt++ ) + for( FCOList::const_iterator iter = mPeers.begin(); iter != mPeers.end(); ++iter, ++cnt ) { d.Trace( dl, "[%d]%c\t:%s\n", cnt, iter == mCurPos ? _T('*') : _T(' '), (*iter)->GetName().AsString().c_str() ); } diff --git a/src/fco/fconame.cpp b/src/fco/fconame.cpp index b3428d5..e73e8ac 100644 --- a/src/fco/fconame.cpp +++ b/src/fco/fconame.cpp @@ -288,7 +288,7 @@ TSTRING cFCOName::AsString() const TSTRING current = (*i)->GetString(); // the loop is constructed in this odd fashion because I don't want a trailing mDelimiter str += current; - i++; + ++i; if(i != mpPathName->mNames.end() && current != "/") str += mDelimiter; @@ -343,7 +343,7 @@ cFCOName::Relationship cFCOName::GetRelationship(const cFCOName& rhs) const for(myIter = mpPathName->mNames.begin(), rhsIter = rhs.mpPathName->mNames.begin(); (myIter != mpPathName->mNames.end() && rhsIter != rhs.mpPathName->mNames.end()); - myIter++, rhsIter++) + ++myIter, ++rhsIter) { if(bCaseSensitive) bEqual = (*myIter == *rhsIter); @@ -522,7 +522,7 @@ bool cFCOName::operator<(const cFCOName& rhs) const for(myIter = mpPathName->mNames.begin(), rhsIter = rhs.mpPathName->mNames.begin(); (myIter != mpPathName->mNames.end() && rhsIter != rhs.mpPathName->mNames.end()); - myIter++, rhsIter++) + ++myIter, ++rhsIter) { if(bCaseSensitive) { @@ -593,7 +593,7 @@ void cFCONameIter::SeekBegin() /////////////////////////////////////////////////////////////////////////////// void cFCONameIter::Next() { - mIter++; + ++mIter; } /////////////////////////////////////////////////////////////////////////////// @@ -619,7 +619,7 @@ const TCHAR* cFCONameIter::GetName() const /////////////////////////////////////////////////////////////////////////////// void cFCONameIter::Prev() { - mIter--; + --mIter; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/fco/fcosetimpl.cpp b/src/fco/fcosetimpl.cpp index a8f27d4..2f271e4 100644 --- a/src/fco/fcosetimpl.cpp +++ b/src/fco/fcosetimpl.cpp @@ -204,7 +204,7 @@ void cFCOSetImpl::Write(iSerializer* pSerializer) const pSerializer->WriteInt32(mFCOSet.size()); std::set::const_iterator itr; - for( itr = mFCOSet.begin(); itr != mFCOSet.end(); itr++) + for( itr = mFCOSet.begin(); itr != mFCOSet.end(); ++itr) { pSerializer->WriteObjectDynCreate(itr->mpFCO); } @@ -286,7 +286,7 @@ bool cFCOIterImpl::IsEmpty() const void cFCOIterImpl::Next() const { ASSERT(mpSet != 0); - mIter++; + ++mIter; } diff --git a/src/fco/fcospecattr.h b/src/fco/fcospecattr.h index b369758..c212673 100644 --- a/src/fco/fcospecattr.h +++ b/src/fco/fcospecattr.h @@ -171,7 +171,7 @@ inline bool cFCOSpecAttrEmailIter::IsEmpty() const } inline void cFCOSpecAttrEmailIter::Next() const { - mIter++; + ++mIter; } inline const TSTRING& cFCOSpecAttrEmailIter::EmailAddress() const { diff --git a/src/fco/fcospechelper.cpp b/src/fco/fcospechelper.cpp index d701b70..24909ee 100644 --- a/src/fco/fcospechelper.cpp +++ b/src/fco/fcospechelper.cpp @@ -221,7 +221,7 @@ void cFCOSpecStopPointSet::Add(const cFCOName& name) break; default: - i++; + ++i; } } @@ -306,7 +306,7 @@ iFCOSpecHelper::CompareResult cFCOSpecStopPointSet::Compare(const iFCOSpecHelper std::set::const_iterator myIter = mStopPoints.begin(), rhsIter = pStopPtSet->mStopPoints.begin(); - for(; myIter != mStopPoints.end(); myIter++, rhsIter++) + for(; myIter != mStopPoints.end(); ++myIter, ++rhsIter) { if(*myIter != *rhsIter) return ((*myIter < *rhsIter) ? CMP_LT : CMP_GT); diff --git a/src/fco/fcospechelper.h b/src/fco/fcospechelper.h index af4ef29..f0ae60f 100644 --- a/src/fco/fcospechelper.h +++ b/src/fco/fcospechelper.h @@ -257,7 +257,7 @@ inline bool cFCOSpecStopPointIter::IsEmpty() const inline void cFCOSpecStopPointIter::Next() const { - mIter++; + ++mIter; } inline void cFCOSpecStopPointIter::Remove() diff --git a/src/fco/fcospeclist.cpp b/src/fco/fcospeclist.cpp index 1c1d971..735d73b 100644 --- a/src/fco/fcospeclist.cpp +++ b/src/fco/fcospeclist.cpp @@ -61,7 +61,7 @@ void cFCOSpecList::Clear() { std::list::iterator itr; - for (itr = mAddedList.begin(); itr != mAddedList.end(); itr++) + for (itr = mAddedList.begin(); itr != mAddedList.end(); ++itr) { itr->first->Release(); itr->second->Release(); @@ -227,7 +227,7 @@ void cFCOSpecListAddedIter::Remove() // the tricky part is finding the spec in the other list... std::list::iterator i; - for(i = mpSpecList->mCanonicalList.begin(); i != mpSpecList->mCanonicalList.end(); i++) + for(i = mpSpecList->mCanonicalList.begin(); i != mpSpecList->mCanonicalList.end(); ++i) { if(i->first == mIter->first) break; diff --git a/src/fco/genreswitcher.cpp b/src/fco/genreswitcher.cpp index 1702f98..98f04a5 100644 --- a/src/fco/genreswitcher.cpp +++ b/src/fco/genreswitcher.cpp @@ -223,7 +223,7 @@ cGenre::Genre cGenreSwitcher::StringToGenre( const wchar_t* wsz ) cGenreInfoVec::const_iterator cGenreInfoVec::find( cGenre::Genre g ) const { const_iterator i; - for( i = begin(); i != end(); i++ ) + for( i = begin(); i != end(); ++i ) { ASSERT( (*i)->m_ID != cGenre::GENRE_INVALID ); @@ -244,7 +244,7 @@ cGenreInfoVec::const_iterator cGenreInfoVec::find( const cGenreInfo* pGI ) const cGenreInfoVec::const_iterator cGenreInfoVec::find( const TSTRING& sGenre ) const { const_iterator i; - for( i = begin(); i != end(); i++ ) + for( i = begin(); i != end(); ++i ) { ASSERT( (*i)->m_ID != cGenre::GENRE_INVALID ); diff --git a/src/fs/fsparserutil.cpp b/src/fs/fsparserutil.cpp index c711234..7de1b0a 100644 --- a/src/fs/fsparserutil.cpp +++ b/src/fs/fsparserutil.cpp @@ -139,7 +139,7 @@ static inline void trim_leading_whitespace(std::string &str) void cFSParserUtil::InterpretFCOName( const std::list& l, cFCOName& nameOut ) const { TSTRING strT; - for( std::list::const_iterator i = l.begin(); i != l.end(); i++ ) + for( std::list::const_iterator i = l.begin(); i != l.end(); ++i ) strT += *i; #if USES_DEVICE_PATH diff --git a/src/fs/fspropdisplayer.cpp b/src/fs/fspropdisplayer.cpp index 312f403..6e465f3 100644 --- a/src/fs/fspropdisplayer.cpp +++ b/src/fs/fspropdisplayer.cpp @@ -151,7 +151,7 @@ void cFSPropDisplayer::Merge( const iFCOPropDisplayer* const ppd ) // merge mapping info for( INT64_TO_STRING_MAP::const_iterator iterUID = pfspd->uidToUsername.begin(); iterUID != pfspd->uidToUsername.end(); - iterUID++ + ++iterUID ) { AddUsernameMapping( iterUID->first, iterUID->second ); @@ -159,7 +159,7 @@ void cFSPropDisplayer::Merge( const iFCOPropDisplayer* const ppd ) for( INT64_TO_STRING_MAP::const_iterator iterGID = pfspd->gidToGroupname.begin(); iterGID != pfspd->gidToGroupname.end(); - iterGID++ + ++iterGID ) { AddGroupnameMapping( iterGID->first, iterGID->second ); @@ -401,7 +401,7 @@ void cFSPropDisplayer::Write( iSerializer* pSerializer ) const { // write UID mapping pSerializer->WriteInt32( uidToUsername.size() ); - for( INT64_TO_STRING_MAP::const_iterator iterUid = uidToUsername.begin(); iterUid != uidToUsername.end(); iterUid++ ) + for( INT64_TO_STRING_MAP::const_iterator iterUid = uidToUsername.begin(); iterUid != uidToUsername.end(); ++iterUid ) { pSerializer->WriteInt64( iterUid->first ); pSerializer->WriteString( iterUid->second ); @@ -409,7 +409,7 @@ void cFSPropDisplayer::Write( iSerializer* pSerializer ) const // write GID mapping pSerializer->WriteInt32( gidToGroupname.size() ); - for( INT64_TO_STRING_MAP::const_iterator iterGid = gidToGroupname.begin(); iterGid != gidToGroupname.end(); iterGid++ ) + for( INT64_TO_STRING_MAP::const_iterator iterGid = gidToGroupname.begin(); iterGid != gidToGroupname.end(); ++iterGid ) { pSerializer->WriteInt64( iterGid->first ); pSerializer->WriteString( iterGid->second ); diff --git a/src/tripwire/generatedb_t.cpp b/src/tripwire/generatedb_t.cpp index bfc31c4..7de5c82 100644 --- a/src/tripwire/generatedb_t.cpp +++ b/src/tripwire/generatedb_t.cpp @@ -78,7 +78,7 @@ void TestGenerateDb() // ok, time to integrity check! // cGenreSpecListVector::iterator at; - for( at = slv.begin(); at != slv.end(); at++ ) + for( at = slv.begin(); at != slv.end(); ++at ) { cGenerateDb::Execute( at->GetSpecList(), diff --git a/src/tripwire/integritycheck.cpp b/src/tripwire/integritycheck.cpp index ef599d6..224c14c 100644 --- a/src/tripwire/integritycheck.cpp +++ b/src/tripwire/integritycheck.cpp @@ -593,7 +593,7 @@ void cIntegrityCheck::ExecuteOnObjectList( const std::list& fcoNames, // iterate over all the objects to integrity check.. // std::list::const_iterator it; - for( it = fcoNames.begin(); it != fcoNames.end(); it++ ) + for( it = fcoNames.begin(); it != fcoNames.end(); ++it ) { TW_NOTIFY_VERBOSE( _T("%s%s\n"), TSS_GetString( cTripwire, tripwire::STR_NOTIFY_CHECKING ).c_str(), diff --git a/src/tripwire/integritycheck_t.cpp b/src/tripwire/integritycheck_t.cpp index a28f519..ed133b4 100644 --- a/src/tripwire/integritycheck_t.cpp +++ b/src/tripwire/integritycheck_t.cpp @@ -80,7 +80,7 @@ void TestIntegrityCheck() // ok, time to integrity check! // cGenreSpecListVector::iterator at; - for( at = slv.begin(); at != slv.end(); at++ ) + for( at = slv.begin(); at != slv.end(); ++at ) { cIntegrityCheck ic( at->GetGenre(), at->GetSpecList(), db, report, &et ); ic.Execute(); diff --git a/src/tripwire/mailmessage.cpp b/src/tripwire/mailmessage.cpp index 94b59f6..2830c4e 100644 --- a/src/tripwire/mailmessage.cpp +++ b/src/tripwire/mailmessage.cpp @@ -130,7 +130,7 @@ bool cMailMessage::GetAttachmentsAsString( std::string& s ) bool allOK = true; for( std::vector::const_iterator at = mvstrAttachments.begin(); at != mvstrAttachments.end(); - at++ ) + ++at ) { s += "\r\n"; @@ -349,7 +349,7 @@ cQuotedPrintableEncoding::Encode( const std::string& sIn, std::string::size_type lineLen = 0; for( at = sIn.begin(); at != sIn.end(); - at++, lineLen += _ENCODED_CHAR_LEN ) + ++at, lineLen += _ENCODED_CHAR_LEN ) { if( NeedsEncoding( *at ) ) { @@ -481,7 +481,7 @@ cMailMessageUtil::HasNonAsciiChars( const std::string& s ) { for( std::string::const_iterator at = s.begin(); at != s.end(); - at ++ ) + ++at ) { if( (unsigned char)*at > (unsigned char)0x7F ) return true; diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index 6c51144..5666533 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -1123,7 +1123,7 @@ int cTWModeIC::Execute(cErrorQueue* pQueue) // // now, we will iterate over the list, performing an integrity check for each genre // - for( cTWUtil::GenreObjList::iterator genreIter = listOut.begin(); genreIter != listOut.end(); genreIter++ ) + for( cTWUtil::GenreObjList::iterator genreIter = listOut.begin(); genreIter != listOut.end(); ++genreIter ) { dbIter.SeekToGenre( genreIter->first ); if( ! dbIter.Done() ) @@ -1134,7 +1134,7 @@ int cTWModeIC::Execute(cErrorQueue* pQueue) // I have to turn this into a list of cFCONames // std::list fcoNames; - for(cTWUtil::ObjList::iterator it = genreIter->second.begin(); it != genreIter->second.end(); it++) + for(cTWUtil::ObjList::iterator it = genreIter->second.begin(); it != genreIter->second.end(); ++it) { // if this is not an absolute path, warn and continue... // diff --git a/src/tw/dbexplore.cpp b/src/tw/dbexplore.cpp index 8897708..4d4692f 100644 --- a/src/tw/dbexplore.cpp +++ b/src/tw/dbexplore.cpp @@ -179,7 +179,7 @@ static void SplitString( const TSTRING& str, TCHAR c, std::vector& vStr vStrings.clear(); TSTRING::const_iterator i, prev; - for( prev = i = str.begin(); i != str.end(); i++ ) + for( prev = i = str.begin(); i != str.end(); ++i ) { if( *i == c ) { @@ -284,7 +284,7 @@ void cDbExplore::Execute( cFCODatabaseFileIter& dbIter ) GetNoun(noun); std::vector vDirs; SplitString( noun, pIter->GetParentName().GetDelimiter(), vDirs ); - for( std::vector::iterator i = vDirs.begin(); i != vDirs.end(); i++ ) + for( std::vector::iterator i = vDirs.begin(); i != vDirs.end(); ++i ) { if( i->compare( _T("..") ) == 0 ) diff --git a/src/tw/fcodatabasefile.cpp b/src/tw/fcodatabasefile.cpp index 1332f5c..d36a5c2 100644 --- a/src/tw/fcodatabasefile.cpp +++ b/src/tw/fcodatabasefile.cpp @@ -72,7 +72,7 @@ cFCODatabaseFile::cFCODatabaseFile() cFCODatabaseFile::~cFCODatabaseFile() { - for( DbList::iterator i = mDbList.begin(); i != mDbList.end(); i++ ) + for( DbList::iterator i = mDbList.begin(); i != mDbList.end(); ++i ) { delete *i; } @@ -152,7 +152,7 @@ void cFCODatabaseFile::Write(iSerializer* pSerializer) const //throw( eFCODbFile // // TODO -- the database is not really const-correct; therefore I have the sick casts below... // - for( DbList::iterator i = const_cast(&mDbList)->begin(); i != const_cast(&mDbList)->end(); i++ ) + for( DbList::iterator i = const_cast(&mDbList)->begin(); i != const_cast(&mDbList)->end(); ++i ) { pSerializer->WriteInt32 ( (*i)->mGenre ); pSerializer->WriteObject ( &(*i)->mGenreHeader ); @@ -193,7 +193,7 @@ void cFCODatabaseFile::AddGenre( cGenre::Genre genreId, cFCODatabaseFileIter* pI // // first, lets make sure this genre doesn't exist... // - for( DbList::iterator i = mDbList.begin(); i != mDbList.end(); i++ ) + for( DbList::iterator i = mDbList.begin(); i != mDbList.end(); ++i ) { if( (*i)->mGenre == genreId ) { @@ -254,7 +254,7 @@ void cFCODatabaseFileIter::SeekBegin() void cFCODatabaseFileIter::Next() { - mIter++; + ++mIter; } bool cFCODatabaseFileIter::Done() const diff --git a/src/tw/fcoreport.cpp b/src/tw/fcoreport.cpp index 4bc800d..b66c231 100644 --- a/src/tw/fcoreport.cpp +++ b/src/tw/fcoreport.cpp @@ -433,7 +433,7 @@ void cFCOReportSpecIter::SeekBegin() const void cFCOReportSpecIter::Next() const { ASSERT(mpData != 0); - mpData->mIter++; + ++(mpData->mIter); } bool cFCOReportSpecIter::Done() const @@ -450,7 +450,7 @@ const iFCOSpec* cFCOReportSpecIter::GetSpec() const bool cFCOReportSpecIter::SeekToSpec(const iFCOSpec* pSpec) { if (mpData) - for(mpData->mIter = mpData->mpList->begin(); mpData->mIter != mpData->mpList->end(); mpData->mIter++) + for(mpData->mIter = mpData->mpList->begin(); mpData->mIter != mpData->mpList->end(); ++(mpData->mIter)) { if(iFCOSpecUtil::FCOSpecEqual(*mpData->mIter->mpSpec, *pSpec)) return true; @@ -563,7 +563,7 @@ void cFCOReportChangeIter::SeekBegin() const void cFCOReportChangeIter::Next() const { ASSERT(mpData->mpList != 0); - mpData->mIter++; + ++(mpData->mIter); } bool cFCOReportChangeIter::Done() const @@ -707,7 +707,7 @@ void cFCOReport::AddSpec(cGenre::Genre genre, const iFCOSpec* pSpec, const cFCOS if (pIter && pIter->mpData && pIter->mpData->mpList == &genreIter->mSpecList) { pIter->mpData->mIter = genreIter->mSpecList.end(); - pIter->mpData->mIter--; + --(pIter->mpData->mIter); ASSERT(pIter->GetSpec() == node.mpSpec); } } diff --git a/src/tw/textreportviewer.cpp b/src/tw/textreportviewer.cpp index 2824536..d1e8b61 100644 --- a/src/tw/textreportviewer.cpp +++ b/src/tw/textreportviewer.cpp @@ -162,7 +162,7 @@ cTextReportViewer::~cTextReportViewer() { if( mfUpdate ) { - for( GenreList::iterator i = mFCOsRemoveFromReport.begin(); i != mFCOsRemoveFromReport.end(); i++ ) + for( GenreList::iterator i = mFCOsRemoveFromReport.begin(); i != mFCOsRemoveFromReport.end(); ++i ) { ASSERT( i->second != 0 ); i->second->clear(); @@ -1051,7 +1051,7 @@ void cTextReportViewer::RemoveFCOsFromReport() //throw (eTextReportViewer) // // see if any FCOs to remove are in this set // - for( iter = pFCOList->begin(); iter != pFCOList->end(); iter++ ) + for( iter = pFCOList->begin(); iter != pFCOList->end(); ++iter ) { fcoIter = pAddedSet->Lookup( *iter ); if( fcoIter ) @@ -1071,7 +1071,7 @@ void cTextReportViewer::RemoveFCOsFromReport() //throw (eTextReportViewer) // // see if any FCOs to remove are in this set // - for( iter = pFCOList->begin(); iter != pFCOList->end(); iter++ ) + for( iter = pFCOList->begin(); iter != pFCOList->end(); ++iter ) { fcoIter = pRemovedSet->Lookup( *iter ); if( fcoIter ) @@ -1084,7 +1084,7 @@ void cTextReportViewer::RemoveFCOsFromReport() //throw (eTextReportViewer) } - for( iter = pFCOList->begin(); iter != pFCOList->end(); iter++ ) + for( iter = pFCOList->begin(); iter != pFCOList->end(); ++iter ) { // search changed // get changed set iterator @@ -1110,7 +1110,7 @@ void cTextReportViewer::RemoveFCOsFromReport() //throw (eTextReportViewer) // int nFCOsToRemove = 0; cTextReportViewer::GenreList::const_iterator iter = mFCOsRemoveFromReport.begin(); - for( ; iter != mFCOsRemoveFromReport.end(); iter++ ) + for( ; iter != mFCOsRemoveFromReport.end(); ++iter ) nFCOsToRemove += iter->second->size(); if( nFCOsToRemove != nFCOsRemoved ) diff --git a/src/tw/twutil.cpp b/src/tw/twutil.cpp index 38656e8..62a25f3 100644 --- a/src/tw/twutil.cpp +++ b/src/tw/twutil.cpp @@ -1228,7 +1228,7 @@ void cTWUtil::ParseObjectList( cTWUtil::GenreObjList& listOut, const cTWUtil::Ob // iterate over all of the input... // - for( ObjList::const_iterator i = listIn.begin(); i != listIn.end(); i++ ) + for( ObjList::const_iterator i = listIn.begin(); i != listIn.end(); ++i ) { // first, try to interperate the current string as a genre name... // 17 Mar 99 mdb -- we now only do this if the string ends in a ':' @@ -1261,7 +1261,7 @@ void cTWUtil::ParseObjectList( cTWUtil::GenreObjList& listOut, const cTWUtil::Ob { // seek to right list; create it if it is not there... // - for( curIter = listOut.begin(); curIter != listOut.end(); curIter++ ) + for( curIter = listOut.begin(); curIter != listOut.end(); ++curIter ) { if( curIter->first == curGenre ) break; @@ -1282,7 +1282,7 @@ void cTWUtil::ParseObjectList( cTWUtil::GenreObjList& listOut, const cTWUtil::Ob // add this to the list; assert that it has not been added yet. // ObjList::iterator oi; - for( oi = curIter->second.begin(); oi != curIter->second.end(); oi++ ) + for( oi = curIter->second.begin(); oi != curIter->second.end(); ++oi ) { if( *oi == *i ) { diff --git a/src/twparser/genreparseinfo.cpp b/src/twparser/genreparseinfo.cpp index fa1fa51..ad64f43 100644 --- a/src/twparser/genreparseinfo.cpp +++ b/src/twparser/genreparseinfo.cpp @@ -108,7 +108,7 @@ bool cGenreParseInfo::RulePointAlreadyDefined( const cFCOName& fcoName ) bool fFound = false; // check start points - for( RuleListType::iterator i = mRuleList.begin(); i != mRuleList.end(); i++ ) + for( RuleListType::iterator i = mRuleList.begin(); i != mRuleList.end(); ++i ) { if( (*i)->GetName() == fcoName ) fFound = true; @@ -117,7 +117,7 @@ bool cGenreParseInfo::RulePointAlreadyDefined( const cFCOName& fcoName ) // check stop points if( ! fFound ) { - for( StopListType::iterator j = mStopList.begin(); j != mStopList.end(); j++ ) + for( StopListType::iterator j = mStopList.begin(); j != mStopList.end(); ++j ) { if( *j == fcoName ) fFound = true; diff --git a/src/twparser/parserhelper.cpp b/src/twparser/parserhelper.cpp index 62a600b..3415907 100644 --- a/src/twparser/parserhelper.cpp +++ b/src/twparser/parserhelper.cpp @@ -144,7 +144,7 @@ void cParserHelper::Finit( cGenreSpecListVector* pPolicy ) int nRulesInPolicy = 0; GenreContainer::iterator i; - for( i = mAph.begin(); i != mAph.end(); i++ ) + for( i = mAph.begin(); i != mAph.end(); ++i ) { cGenreSpecListPair slp; cGenre::Genre g = i->first; @@ -193,7 +193,7 @@ void cParserHelper::Finit( cGenreSpecListVector* pPolicy ) void cParserHelper::CleanUp() { GenreContainer::iterator i; - for( i = mAph.begin(); i != mAph.end(); i++ ) + for( i = mAph.begin(); i != mAph.end(); ++i ) delete i->second; while( ! cPreprocessor::Empty() ) cPreprocessor::PopState(); @@ -390,7 +390,7 @@ bool cParserUtil::AnyOfTheseHostsExists( cParseStringList* pList ) std::transform( strHostName.begin(), strHostName.end(), strHostName.begin(), _totlower ); // if the host name matches any in the list, return true - for( std::list::iterator iter = pList->begin(); iter != pList->end(); iter++ ) + for( std::list::iterator iter = pList->begin(); iter != pList->end(); ++iter ) { // want to do case-insensitive compare std::transform( (*iter).begin(), (*iter).end(), (*iter).begin(), _totlower ); @@ -531,7 +531,7 @@ void cParserUtil::CreateFCOSpecs( cGenre::Genre g, cGenreParseInfo* pgpi, cFCOSp // foreach rule std::list::iterator rule; - for (rule = pgpi->GetRules()->begin(); rule != pgpi->GetRules()->end(); rule++) + for (rule = pgpi->GetRules()->begin(); rule != pgpi->GetRules()->end(); ++rule) { // // create the spec with its the last element of its start point as its name. @@ -557,7 +557,7 @@ void cParserUtil::CreateFCOSpecs( cGenre::Genre g, cGenreParseInfo* pgpi, cFCOSp // set stop points cGenreParseInfo::StopListType::iterator stop; - for (stop = pgpi->GetStopList()->begin(); stop != pgpi->GetStopList()->end(); stop++) + for (stop = pgpi->GetStopList()->begin(); stop != pgpi->GetStopList()->end(); ++stop) { // add stop point if below start point cFCOName::Relationship relate = startpoint.GetRelationship(*stop); @@ -677,7 +677,7 @@ void cParserUtil::CreatePropVector( const TSTRING& strPropListC, class cFCOPropV TSTRING::const_iterator iter; TSTRING::size_type i; // index into string - for ( iter = strPropList.begin(), i = 0; iter != strPropList.end(); iter++, i++ ) + for ( iter = strPropList.begin(), i = 0; iter != strPropList.end(); ++iter, ++i ) { int propIndex = -1; // index into propvector @@ -825,7 +825,7 @@ cParseNamedAttrList* cParserHelper::GetGlobalAttrList() void cParserHelper::IncrementScopeStatementCount() { // must add count to ALL previous scopes. - for( ScopedAttrContainer::iterator i = mScopedAttrs.begin(); i != mScopedAttrs.end(); i++ ) + for( ScopedAttrContainer::iterator i = mScopedAttrs.begin(); i != mScopedAttrs.end(); ++i ) (*i)->IncrementStatementCount(); } diff --git a/src/twparser/parserobjects.cpp b/src/twparser/parserobjects.cpp index 909c56b..e29b086 100644 --- a/src/twparser/parserobjects.cpp +++ b/src/twparser/parserobjects.cpp @@ -211,7 +211,7 @@ void cParseSpecMaskList::Dump(cDebug &d) const { std::list::const_iterator ispec; - for (ispec = mList.begin(); ispec != mList.end(); ispec++) { + for (ispec = mList.begin(); ispec != mList.end(); ++ispec) { (*ispec)->Dump(d); } } @@ -295,7 +295,7 @@ cParseNamedAttrList::~cParseNamedAttrList() void cParseNamedAttrList::Clear() { - for( std::list::iterator iter = mList.begin(); iter != mList.end(); iter++ ) + for( std::list::iterator iter = mList.begin(); iter != mList.end(); ++iter ) { delete *iter; } @@ -307,7 +307,7 @@ cParseNamedAttrList::Dump(cDebug &d) const { // dump out each named attribute std::list::const_iterator iattr; - for (iattr = mList.begin(); iattr != mList.end(); iattr++) { + for (iattr = mList.begin(); iattr != mList.end(); ++iattr) { (*iattr)->Dump(d); } } @@ -339,7 +339,7 @@ cParseNamedAttrList::constListIter cParseNamedAttrList::Find( const cParseNamedA for( std::list< cParseNamedAttr * >::const_iterator iter = mList.begin(); iter != mList.end(); - iter++ + ++iter ) { if( (*iter)->GetName() == pa->GetName() ) @@ -356,7 +356,7 @@ void cParseNamedAttrList::MergeNoOverwrite( const cParseNamedAttrList* const pal if( pal ) { // foreach attribute in pal - for( constListIter newIter = pal->mList.begin(); newIter != pal->mList.end(); newIter++ ) + for( constListIter newIter = pal->mList.begin(); newIter != pal->mList.end(); ++newIter ) { // look for this attribute in this list constListIter thisIter = Find( *newIter ); @@ -384,7 +384,7 @@ const cParseNamedAttr* cParseNamedAttrList::Lookup( const TSTRING& tstrAttrName { constListIter i; - for( i = mList.begin(); i != mList.end(); i++) + for( i = mList.begin(); i != mList.end(); ++i) { if( 0 == tstrAttrName.compare( (*i)->GetName() ) ) { diff --git a/src/twparser/parserobjects.h b/src/twparser/parserobjects.h index 3100be9..4b52409 100644 --- a/src/twparser/parserobjects.h +++ b/src/twparser/parserobjects.h @@ -64,7 +64,7 @@ class iParserGenreUtil; // INLINE FUNCTIONS //========================================================================= -#define KILL_LIST(type, name) do { for( std::list::iterator iter = mList.begin(); iter != mList.end(); iter++ ) { delete *iter; } } while(0) +#define KILL_LIST(type, name) do { for( std::list::iterator iter = mList.begin(); iter != mList.end(); ++iter ) { delete *iter; } } while(0) /////////////////////////////////////////////////////////////////////////////// diff --git a/src/twprint/twprintcmdline.cpp b/src/twprint/twprintcmdline.cpp index 9e3fe8e..f3a435e 100644 --- a/src/twprint/twprintcmdline.cpp +++ b/src/twprint/twprintcmdline.cpp @@ -719,7 +719,7 @@ int cTWPrintDBMode::Execute(cErrorQueue* pQueue) // now, iterate through the list of objects... // cFCODatabaseFile::iterator dbIter( db ); - for( cTWUtil::GenreObjList::iterator genreIter = listOut.begin(); genreIter != listOut.end(); genreIter++ ) + for( cTWUtil::GenreObjList::iterator genreIter = listOut.begin(); genreIter != listOut.end(); ++genreIter ) { dbIter.SeekToGenre( genreIter->first ); if( ! dbIter.Done() ) @@ -731,7 +731,7 @@ int cTWPrintDBMode::Execute(cErrorQueue* pQueue) // // iterate over all the objects in this genre.... // - for(cTWUtil::ObjList::iterator it = genreIter->second.begin(); it != genreIter->second.end(); it++) + for(cTWUtil::ObjList::iterator it = genreIter->second.begin(); it != genreIter->second.end(); ++it) { try { diff --git a/src/twtest/displayencoder_t.cpp b/src/twtest/displayencoder_t.cpp index 39935d2..b2595d4 100644 --- a/src/twtest/displayencoder_t.cpp +++ b/src/twtest/displayencoder_t.cpp @@ -57,7 +57,7 @@ template< class CharT > bool IsPrintable( const std::basic_string< CharT >& str ) { const std::ctype< CharT > *pct = 0, &ct = tss::GetFacet( std::locale(), pct ); - for( std::basic_string< CharT >::const_iterator at = str.begin(); at != str.end(); at++ ) + for( std::basic_string< CharT >::const_iterator at = str.begin(); at != str.end(); ++at ) { if( ! ct.is( std::ctype_base::print, *at ) ) // if not printable return false; diff --git a/src/twtest/textreportviewer_t.cpp b/src/twtest/textreportviewer_t.cpp index c6287e0..1d970d1 100644 --- a/src/twtest/textreportviewer_t.cpp +++ b/src/twtest/textreportviewer_t.cpp @@ -416,7 +416,7 @@ void MakeFile( TSTRING& strNameMakeMe ) pFSServices->MakeTempFilename( strNameMakeMe ); std::string strA; - for( TSTRING::iterator i = strNameMakeMe.begin(); i != strNameMakeMe.end(); i++ ) + for( TSTRING::iterator i = strNameMakeMe.begin(); i != strNameMakeMe.end(); ++i ) { char ach[6]; ASSERT( MB_CUR_MAX <= 6 ); diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index c7e852c..1a9280c 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -69,7 +69,7 @@ void TestUnixFSServices() std::vector ::iterator p; size_t n = 0; - for (p = v.begin(); p != v.end(); p++) { + for (p = v.begin(); p != v.end(); ++p) { d.TraceDetail(" %s\n", p->c_str()); n++; } diff --git a/src/util/stringencoder.cpp b/src/util/stringencoder.cpp index 22d72a2..d2bcf4f 100644 --- a/src/util/stringencoder.cpp +++ b/src/util/stringencoder.cpp @@ -120,7 +120,7 @@ TSTRING& cStringEncoder::Encode( const TSTRING& in, TSTRING& out ) // out.reserve( in.length() ); - for( TSTRING::const_iterator i = in.begin(); i != in.end(); i++ ) + for( TSTRING::const_iterator i = in.begin(); i != in.end(); ++i ) ce.EncodeChar( i, out ); return out; @@ -143,7 +143,7 @@ TSTRING& cStringEncoder::Unencode( const TSTRING& in, TSTRING& out ) out.reserve( in.length() ); TSTRING::const_iterator end = in.end(); - for( TSTRING::const_iterator i = in.begin(); i != end; i++ ) + for( TSTRING::const_iterator i = in.begin(); i != end; ++i ) out += ce.DecodeChar( i, end ); return out;