From c256116d8131dd3fd4a4014444bde3125d16bbc2 Mon Sep 17 00:00:00 2001 From: baines Date: Tue, 26 Feb 2013 22:03:15 -0500 Subject: [PATCH] Catch as references --- src/Client.cpp | 6 +++--- src/IRCNetwork.cpp | 2 +- src/Modules.cpp | 12 ++++++------ src/User.cpp | 2 +- src/main.cpp | 2 +- src/znc.cpp | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Client.cpp b/src/Client.cpp index 0ad7a974..fb8ce34e 100644 --- a/src/Client.cpp +++ b/src/Client.cpp @@ -24,7 +24,7 @@ using std::vector; pModule->SetClient(CLIENT); \ pModule->FUNC; \ pModule->SetClient(NULL); \ - } catch (CModule::EModException e) { \ + } catch (const CModule::EModException& e) { \ if (e == CModule::UNLOAD) { \ (NETWORK)->GetModules().UnloadModule(MOD); \ } \ @@ -36,7 +36,7 @@ using std::vector; pModule->FUNC; \ pModule->SetClient(NULL); \ pModule->SetNetwork(NULL); \ - } catch (CModule::EModException e) { \ + } catch (const CModule::EModException& e) { \ if (e == CModule::UNLOAD) { \ (USER)->GetModules().UnloadModule(MOD); \ } \ @@ -50,7 +50,7 @@ using std::vector; pModule->SetClient(NULL); \ pModule->SetNetwork(NULL); \ pModule->SetUser(NULL); \ - } catch (CModule::EModException e) { \ + } catch (const CModule::EModException& e) { \ if (e == CModule::UNLOAD) { \ CZNC::Get().GetModules().UnloadModule(MOD); \ } \ diff --git a/src/IRCNetwork.cpp b/src/IRCNetwork.cpp index 4ca5035a..7257ed68 100644 --- a/src/IRCNetwork.cpp +++ b/src/IRCNetwork.cpp @@ -760,7 +760,7 @@ bool CIRCNetwork::DelServer(const CString& sName, unsigned short uPort, const CS bool bSawCurrentServer = false; CServer* pCurServer = GetCurrentServer(); - for (vector::iterator it = m_vServers.begin(); it != m_vServers.end(); it++, a++) { + for (vector::iterator it = m_vServers.begin(); it != m_vServers.end(); ++it, a++) { CServer* pServer = *it; if (pServer == pCurServer) diff --git a/src/Modules.cpp b/src/Modules.cpp index 68a7e1d3..3c721163 100644 --- a/src/Modules.cpp +++ b/src/Modules.cpp @@ -48,7 +48,7 @@ bool ZNC_NO_NEED_TO_DO_ANYTHING_ON_MODULE_CALL_EXITER; if (m_pNetwork) \ pMod->SetNetwork(pNetwork); \ pMod->SetClient(pOldClient); \ - } catch (CModule::EModException e) { \ + } catch (const CModule::EModException& e) { \ if (e == CModule::UNLOAD) { \ UnloadModule((*this)[a]->GetModName()); \ } \ @@ -88,7 +88,7 @@ bool ZNC_NO_NEED_TO_DO_ANYTHING_ON_MODULE_CALL_EXITER; bHaltCore = true; \ break; \ } \ - } catch (CModule::EModException e) { \ + } catch (const CModule::EModException& e) { \ if (e == CModule::UNLOAD) { \ UnloadModule((*this)[a]->GetModName()); \ } \ @@ -689,7 +689,7 @@ bool CModules::OnBoot() { if (!(*this)[a]->OnBoot()) { return true; } - } catch (CModule::EModException e) { + } catch (const CModule::EModException& e) { if (e == CModule::UNLOAD) { UnloadModule((*this)[a]->GetModName()); } @@ -773,7 +773,7 @@ bool CModules::OnServerCapAvailable(const CString& sCap) { bResult |= pMod->OnServerCapAvailable(sCap); } pMod->SetClient(pOldClient); - } catch (CModule::EModException e) { + } catch (const CModule::EModException& e) { if (CModule::UNLOAD == e) { UnloadModule((*this)[a]->GetModName()); } @@ -836,7 +836,7 @@ bool CModules::IsClientCapSupported(CClient* pClient, const CString& sCap, bool bResult |= pMod->IsClientCapSupported(pClient, sCap, bState); } pMod->SetClient(pOldClient); - } catch (CModule::EModException e) { + } catch (const CModule::EModException& e) { if (CModule::UNLOAD == e) { UnloadModule((*this)[a]->GetModName()); } @@ -942,7 +942,7 @@ bool CModules::LoadModule(const CString& sModule, const CString& sArgs, CModInfo bool bLoaded; try { bLoaded = pModule->OnLoad(sArgs, sRetMsg); - } catch (CModule::EModException) { + } catch (const CModule::EModException&) { bLoaded = false; sRetMsg = "Caught an exception"; } diff --git a/src/User.cpp b/src/User.cpp index 81455490..9da76a00 100644 --- a/src/User.cpp +++ b/src/User.cpp @@ -327,7 +327,7 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) { CZNC::DumpConfig(pSubConf); return false; } - subIt++; + ++subIt; } if (subIt != subConf.end()) { sError = "Password defined more than once"; diff --git a/src/main.cpp b/src/main.cpp index beb2bf59..3f3913f4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -344,7 +344,7 @@ int main(int argc, char** argv) { try { pZNC->Loop(); - } catch (CException e) { + } catch (const CException& e) { switch (e.GetType()) { case CException::EX_Shutdown: iRet = 0; diff --git a/src/znc.cpp b/src/znc.cpp index 8c2e5818..e0258913 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -711,7 +711,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { GetModules().GetAvailableMods(ssUserMods); size_t uNrOtherUserMods = FilterUncommonModules(ssUserMods); - if (ssUserMods.size()) { + if (!ssUserMods.empty()) { vsLines.push_back(""); CUtils::PrintMessage(""); CUtils::PrintMessage("-- User Modules --"); @@ -770,7 +770,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) { GetModules().GetAvailableMods(ssNetworkMods, CModInfo::NetworkModule); size_t uNrOtherNetworkMods = FilterUncommonModules(ssNetworkMods); - if (ssNetworkMods.size()) { + if (!ssNetworkMods.empty()) { CUtils::PrintMessage(""); CUtils::PrintMessage("-- Network Modules --"); CUtils::PrintMessage(""); @@ -964,7 +964,7 @@ size_t CZNC::FilterUncommonModules(set& ssModules) { size_t uNrRemoved = 0; for(set::iterator it = ssModules.begin(); it != ssModules.end(); ) { if(ssNames.count(it->GetName()) > 0) { - it++; + ++it; } else { set::iterator it2 = it++; ssModules.erase(it2);