X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Falert.cpp;h=ea2bc570495073155f5adfc0cba93c570b581603;hb=HEAD;hp=65927ed74bd028ac0296242dfd7576fe518d3aee;hpb=9e58e0a8ca28b15a4bfa677f5b23891972db40fd;p=novacoin.git diff --git a/src/alert.cpp b/src/alert.cpp index 65927ed..ef2ee46 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -2,14 +2,11 @@ // Alert system // -#include -#include - #include "alert.h" #include "key.h" #include "net.h" #include "sync.h" -#include "ui_interface.h" +#include "interface.h" using namespace std; @@ -45,10 +42,10 @@ void CUnsignedAlert::SetNull() std::string CUnsignedAlert::ToString() const { std::string strSetCancel; - BOOST_FOREACH(int n, setCancel) + for (int n : setCancel) strSetCancel += strprintf("%d ", n); std::string strSetSubVer; - BOOST_FOREACH(std::string str, setSubVer) + for (const std::string& str : setSubVer) strSetSubVer += "\"" + str + "\" "; return strprintf( "CAlert(\n" @@ -79,11 +76,6 @@ std::string CUnsignedAlert::ToString() const strStatusBar.c_str()); } -void CUnsignedAlert::print() const -{ - printf("%s", ToString().c_str()); -} - void CAlert::SetNull() { CUnsignedAlert::SetNull(); @@ -113,7 +105,7 @@ bool CAlert::Cancels(const CAlert& alert) const return (alert.nID <= nCancel || setCancel.count(alert.nID)); } -bool CAlert::AppliesTo(int nVersion, std::string strSubVerIn) const +bool CAlert::AppliesTo(int nVersion, const std::string& strSubVerIn) const { // TODO: rework for client-version-embedded-in-strSubVer ? return (IsInEffect() && @@ -165,7 +157,7 @@ CAlert CAlert::getAlertByHash(const uint256 &hash) CAlert retval; { LOCK(cs_mapAlerts); - map::iterator mi = mapAlerts.find(hash); + auto mi = mapAlerts.find(hash); if(mi != mapAlerts.end()) retval = mi->second; } @@ -204,7 +196,7 @@ bool CAlert::ProcessAlert() { LOCK(cs_mapAlerts); // Cancel previous alerts - for (map::iterator mi = mapAlerts.begin(); mi != mapAlerts.end();) + for (auto mi = mapAlerts.begin(); mi != mapAlerts.end();) { const CAlert& alert = (*mi).second; if (Cancels(alert)) @@ -224,7 +216,7 @@ bool CAlert::ProcessAlert() } // Check if this alert has been cancelled - BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts) + for (auto& item : mapAlerts) { const CAlert& alert = item.second; if (alert.Cancels(*this))