diff --git a/modules/autovoice.cpp b/modules/autovoice.cpp index 5f360683..fa7b3f32 100644 --- a/modules/autovoice.cpp +++ b/modules/autovoice.cpp @@ -123,7 +123,7 @@ public: } // Load the saved users - for (MCString::iterator it = BeginNV(); it != EndNV(); it++) { + for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) { const CString& sLine = it->second; CAutoVoiceUser* pUser = new CAutoVoiceUser; diff --git a/modules/certauth.cpp b/modules/certauth.cpp index bec6050e..e893349c 100644 --- a/modules/certauth.cpp +++ b/modules/certauth.cpp @@ -39,11 +39,11 @@ public: // We need the SSL_VERIFY_PEER flag on all listeners, or else // the client doesn't send a ssl cert - for (it = vListeners.begin(); it != vListeners.end(); it++) + for (it = vListeners.begin(); it != vListeners.end(); ++it) (*it)->GetRealListener()->SetRequireClientCertFlags(SSL_VERIFY_PEER); MCString::iterator it1; - for (it1 = BeginNV(); it1 != EndNV(); it1++) { + for (it1 = BeginNV(); it1 != EndNV(); ++it1) { VCString vsKeys; VCString::iterator it2; @@ -53,7 +53,7 @@ public: } it1->second.Split(" ", vsKeys, false); - for (it2 = vsKeys.begin(); it2 != vsKeys.end(); it2++) { + for (it2 = vsKeys.begin(); it2 != vsKeys.end(); ++it2) { m_PubKeys[it1->first].insert(*it2); } } @@ -75,10 +75,10 @@ public: MSCString::iterator it; ClearNV(false); - for (it = m_PubKeys.begin(); it != m_PubKeys.end(); it++) { + for (it = m_PubKeys.begin(); it != m_PubKeys.end(); ++it) { CString sVal; SCString::iterator it2; - for (it2 = it->second.begin(); it2 != it->second.end(); it2++) { + for (it2 = it->second.begin(); it2 != it->second.end(); ++it2) { sVal += *it2 + " "; } @@ -176,7 +176,7 @@ public: SCString::iterator it2; unsigned int id = 1; - for (it2 = it->second.begin(); it2 != it->second.end(); it2++) { + for (it2 = it->second.begin(); it2 != it->second.end(); ++it2) { Table.AddRow(); Table.SetCell("Id", CString(id++)); Table.SetCell("Key", *it2); @@ -205,7 +205,7 @@ public: SCString::iterator it2 = it->second.begin(); while (id > 1) { - it2++; + ++it2; id--; } @@ -245,7 +245,7 @@ public: if (it != m_PubKeys.end()) { SCString::iterator it2; - for (it2 = it->second.begin(); it2 != it->second.end(); it2++) { + for (it2 = it->second.begin(); it2 != it->second.end(); ++it2) { CTemplate& row = Tmpl.AddRow("KeyLoop"); row["Key"] = *it2; } diff --git a/modules/charset.cpp b/modules/charset.cpp index 3d735def..8255bacc 100644 --- a/modules/charset.cpp +++ b/modules/charset.cpp @@ -151,7 +151,7 @@ private: bool bConverted = false; // try all possible source charsets: - for(VCString::const_iterator itf = vsFrom.begin(); itf != vsFrom.end(); itf++) + for(VCString::const_iterator itf = vsFrom.begin(); itf != vsFrom.end(); ++itf) { if(ConvertCharset(*itf, sTo, sDataCopy)) { @@ -201,9 +201,9 @@ public: sArgs.Token(uIndex + 1).Split(",", vsTo); // probe conversions: - for(VCString::const_iterator itf = vsFrom.begin(); itf != vsFrom.end(); itf++) + for(VCString::const_iterator itf = vsFrom.begin(); itf != vsFrom.end(); ++itf) { - for(VCString::const_iterator itt = vsTo.begin(); itt != vsTo.end(); itt++) + for(VCString::const_iterator itt = vsTo.begin(); itt != vsTo.end(); ++itt) { iconv_t icTest = iconv_open(itt->c_str(), itf->c_str()); if(icTest == (iconv_t)-1) diff --git a/modules/controlpanel.cpp b/modules/controlpanel.cpp index ba7078c4..90e29b1c 100644 --- a/modules/controlpanel.cpp +++ b/modules/controlpanel.cpp @@ -913,7 +913,7 @@ class CAdminMod : public CModule { CTable Table; Table.AddColumn("Request"); Table.AddColumn("Reply"); - for (MCString::const_iterator it = msCTCPReplies.begin(); it != msCTCPReplies.end(); it++) { + for (MCString::const_iterator it = msCTCPReplies.begin(); it != msCTCPReplies.end(); ++it) { Table.AddRow(); Table.SetCell("Request", it->first); Table.SetCell("Reply", it->second); diff --git a/modules/modtcl.cpp b/modules/modtcl.cpp index 35516f4d..983a86f1 100644 --- a/modules/modtcl.cpp +++ b/modules/modtcl.cpp @@ -34,7 +34,7 @@ class CModTcl; class CModTclTimer : public CTimer { public: - CModTclTimer(CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription) : CTimer(pModule, uInterval, uCycles, sLabel, sDescription) {} + CModTclTimer(CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription) : CTimer(pModule, uInterval, uCycles, sLabel, sDescription), mpParent(NULL) {} virtual ~CModTclTimer() {} protected: virtual void RunJob(); @@ -44,7 +44,7 @@ protected: class CModTclStartTimer : public CTimer { public: - CModTclStartTimer(CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription) : CTimer(pModule, uInterval, uCycles, sLabel, sDescription) {} + CModTclStartTimer(CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription) : CTimer(pModule, uInterval, uCycles, sLabel, sDescription), m_pParent(NULL) {} virtual ~CModTclStartTimer() {} protected: virtual void RunJob(); diff --git a/modules/partyline.cpp b/modules/partyline.cpp index 7960c5aa..cd9c6889 100644 --- a/modules/partyline.cpp +++ b/modules/partyline.cpp @@ -47,7 +47,7 @@ protected: class CPartylineMod : public CModule { public: void ListChannelsCommand(const CString& sLine) { - if (!m_ssChannels.size()) { + if (m_ssChannels.empty()) { PutModule("There are no open channels."); return; } @@ -89,7 +89,7 @@ public: } } - while (m_ssChannels.size()) { + while (!m_ssChannels.empty()) { delete *m_ssChannels.begin(); m_ssChannels.erase(m_ssChannels.begin()); } @@ -174,7 +174,7 @@ public: CPartylineChannel *pChan = *it; // RemoveUser() might delete channels, so make sure our // iterator doesn't break. - it++; + ++it; RemoveUser(&User, pChan, "KICK", "User deleted", true); } diff --git a/modules/perform.cpp b/modules/perform.cpp index 7821d68f..1f443426 100644 --- a/modules/perform.cpp +++ b/modules/perform.cpp @@ -45,7 +45,7 @@ class CPerform : public CModule { Table.AddColumn("Perform"); Table.AddColumn("Expanded"); - for (VCString::const_iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++, index++) { + for (VCString::const_iterator it = m_vPerform.begin(); it != m_vPerform.end(); ++it, index++) { Table.AddRow(); Table.SetCell("Id", CString(index)); Table.SetCell("Perform", *it); diff --git a/modules/schat.cpp b/modules/schat.cpp index 8a030078..f7cc72ae 100644 --- a/modules/schat.cpp +++ b/modules/schat.cpp @@ -89,7 +89,7 @@ public: } else { // Buffer playback vector::reverse_iterator it = m_vBuffer.rbegin(); - for (; it != m_vBuffer.rend(); it++) + for (; it != m_vBuffer.rend(); ++it) ReadLine(*it); m_vBuffer.clear(); diff --git a/modules/watch.cpp b/modules/watch.cpp index 4b07ec0a..2f8d9f02 100644 --- a/modules/watch.cpp +++ b/modules/watch.cpp @@ -68,7 +68,7 @@ public: bool bGoodSource = true; - if (sSource.size() && m_vsSources.size()) { + if (!sSource.empty() && !m_vsSources.empty()) { bGoodSource = false; for (unsigned int a = 0; a < m_vsSources.size(); a++) { @@ -325,7 +325,7 @@ private: list::iterator it = m_lsWatchers.begin(); for (unsigned int a = 0; a < uIdx; a++) - it++; + ++it; (*it).SetDisabled(bDisabled); PutModule("Id " + CString(uIdx +1) + ((bDisabled) ? " Disabled" : " Enabled")); @@ -343,7 +343,7 @@ private: unsigned int uIdx = 1; - for (list::iterator it = m_lsWatchers.begin(); it != m_lsWatchers.end(); it++, uIdx++) { + for (list::iterator it = m_lsWatchers.begin(); it != m_lsWatchers.end(); ++it, uIdx++) { CWatchEntry& WatchEntry = *it; Table.AddRow(); @@ -373,7 +373,7 @@ private: unsigned int uIdx = 1; - for (list::iterator it = m_lsWatchers.begin(); it != m_lsWatchers.end(); it++, uIdx++) { + for (list::iterator it = m_lsWatchers.begin(); it != m_lsWatchers.end(); ++it, uIdx++) { CWatchEntry& WatchEntry = *it; PutModule("/msg " + GetModNick() + " ADD " + WatchEntry.GetHostMask() + " " + @@ -401,7 +401,7 @@ private: list::iterator it = m_lsWatchers.begin(); for (unsigned int a = 0; a < uIdx; a++) - it++; + ++it; (*it).SetSources(sSources); PutModule("Sources set for Id " + CString(uIdx +1) + "."); @@ -417,7 +417,7 @@ private: list::iterator it = m_lsWatchers.begin(); for (unsigned int a = 0; a < uIdx; a++) - it++; + ++it; m_lsWatchers.erase(it); PutModule("Id " + CString(uIdx +1) + " Removed."); diff --git a/modules/webadmin.cpp b/modules/webadmin.cpp index b793c021..fad9d793 100644 --- a/modules/webadmin.cpp +++ b/modules/webadmin.cpp @@ -941,7 +941,7 @@ public: } } - for (set::iterator it2 = ssUnloadMods.begin(); it2 != ssUnloadMods.end(); it2++) { + for (set::iterator it2 = ssUnloadMods.begin(); it2 != ssUnloadMods.end(); ++it2) { pNetwork->GetModules().UnloadModule(*it2); } @@ -1069,7 +1069,7 @@ public: } const MCString& msCTCPReplies = pUser->GetCTCPReplies(); - for (MCString::const_iterator it2 = msCTCPReplies.begin(); it2 != msCTCPReplies.end(); it2++) { + for (MCString::const_iterator it2 = msCTCPReplies.begin(); it2 != msCTCPReplies.end(); ++it2) { CTemplate& l = Tmpl.AddRow("CTCPLoop"); l["CTCP"] = it2->first + " " + it2->second; } @@ -1645,7 +1645,7 @@ public: } } - for (set::iterator it2 = ssUnloadMods.begin(); it2 != ssUnloadMods.end(); it2++) { + for (set::iterator it2 = ssUnloadMods.begin(); it2 != ssUnloadMods.end(); ++it2) { CZNC::Get().GetModules().UnloadModule(*it2); } diff --git a/src/ClientCommand.cpp b/src/ClientCommand.cpp index 01c99c90..417bde35 100644 --- a/src/ClientCommand.cpp +++ b/src/ClientCommand.cpp @@ -66,7 +66,7 @@ void CClient::UserCommand(CString& sLine) { CIRCSock* pIRCSock = m_pNetwork->GetIRCSock(); const CString& sPerms = (pIRCSock) ? pIRCSock->GetPerms() : ""; - if (!msNicks.size()) { + if (msNicks.empty()) { PutStatus("No nicks on [" + sChan + "]"); return; } @@ -414,7 +414,7 @@ void CClient::UserCommand(CString& sLine) { CIRCSock* pIRCSock = pNetwork->GetIRCSock(); const CString& sPerms = (pIRCSock) ? pIRCSock->GetPerms() : ""; - if (!vChans.size()) { + if (vChans.empty()) { PutStatus("There are no channels defined."); return; } @@ -831,7 +831,7 @@ void CClient::UserCommand(CString& sLine) { set ssUserMods; CZNC::Get().GetModules().GetAvailableMods(ssUserMods); - if (!ssUserMods.size()) { + if (ssUserMods.empty()) { PutStatus("No user modules available."); } else { PutStatus("User modules:"); @@ -853,7 +853,7 @@ void CClient::UserCommand(CString& sLine) { set ssNetworkMods; CZNC::Get().GetModules().GetAvailableMods(ssNetworkMods, CModInfo::NetworkModule); - if (!ssNetworkMods.size()) { + if (ssNetworkMods.empty()) { PutStatus("No network modules available."); } else { PutStatus("Network modules:"); diff --git a/src/Csocket.cpp b/src/Csocket.cpp index 4e5b71aa..81c1d9b2 100644 --- a/src/Csocket.cpp +++ b/src/Csocket.cpp @@ -757,7 +757,7 @@ bool CSMonitorFD::CheckFDs( const std::map< int, short > & miiReadyFds ) if( itFD != miiReadyFds.end() ) miiTriggerdFds[itFD->first] = itFD->second; } - if( miiTriggerdFds.size() ) + if( !miiTriggerdFds.empty() ) return( FDsThatTriggered( miiTriggerdFds ) ); return( m_bEnabled ); } @@ -1269,10 +1269,9 @@ bool Csock::Listen( uint16_t iPort, int iMaxConns, const CS_STRING & sBindHost, cs_sock_t Csock::Accept( CS_STRING & sHost, uint16_t & iRPort ) { - cs_sock_t iSock = CS_INVALID_SOCK; struct sockaddr_storage cAddr; socklen_t iAddrLen = sizeof( cAddr ); - iSock = accept( m_iReadSock, ( struct sockaddr * )&cAddr, &iAddrLen ); + cs_sock_t iSock = accept( m_iReadSock, ( struct sockaddr * )&cAddr, &iAddrLen ); if( iSock != CS_INVALID_SOCK && getpeername( iSock, ( struct sockaddr * )&cAddr, &iAddrLen ) == 0 ) { ConvertAddress( &cAddr, iAddrLen, sHost, &iRPort ); @@ -2816,7 +2815,7 @@ void CSocketManager::Loop() { case SUCCESS: { - for( std::map::iterator itSock = mpeSocks.begin(); itSock != mpeSocks.end(); itSock++ ) + for( std::map::iterator itSock = mpeSocks.begin(); itSock != mpeSocks.end(); ++itSock ) { Csock * pcSock = itSock->first; EMessages iErrno = itSock->second; @@ -2968,7 +2967,7 @@ Csock * CSocketManager::FindSockByName( const CS_STRING & sName ) { std::vector::iterator it; std::vector::iterator it_end = this->end(); - for( it = this->begin(); it != it_end; it++ ) + for( it = this->begin(); it != it_end; ++it ) { if( (*it)->GetSockName() == sName ) return( *it ); diff --git a/test/ConfigTest.cpp b/test/ConfigTest.cpp index e693e2c2..38f240ea 100644 --- a/test/ConfigTest.cpp +++ b/test/ConfigTest.cpp @@ -106,7 +106,7 @@ public: else while (i != vsEntries.end()) { sRes += sKey + "=" + *i + "\n"; - i++; + ++i; } ++it; }