diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-04 16:19:54 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-04 16:19:54 +0100 |
commit | ad148587dcf5244c2d2011dba339786c765c54c4 (patch) | |
tree | bdd914121cd326da2ed26679838878e3edffc841 /src/ban.cpp | |
parent | 1145b05ea0bda87dc0827821385810eced08f774 (diff) | |
download | dragonfireclient-ad148587dcf5244c2d2011dba339786c765c54c4.tar.xz |
Make Lint Happy
Diffstat (limited to 'src/ban.cpp')
-rw-r--r-- | src/ban.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/ban.cpp b/src/ban.cpp index 3decc9666..a6623574f 100644 --- a/src/ban.cpp +++ b/src/ban.cpp @@ -28,14 +28,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "log.h" #include "filesys.h" -BanManager::BanManager(const std::string &banfilepath): - m_banfilepath(banfilepath) +BanManager::BanManager(const std::string &banfilepath) : m_banfilepath(banfilepath) { try { load(); - } catch(SerializationError &e) { - infostream << "BanManager: creating " - << m_banfilepath << std::endl; + } catch (SerializationError &e) { + infostream << "BanManager: creating " << m_banfilepath << std::endl; } } @@ -47,10 +45,11 @@ BanManager::~BanManager() void BanManager::load() { MutexAutoLock lock(m_mutex); - infostream<<"BanManager: loading from "<<m_banfilepath<<std::endl; + infostream << "BanManager: loading from " << m_banfilepath << std::endl; std::ifstream is(m_banfilepath.c_str(), std::ios::binary); if (!is.good()) { - infostream<<"BanManager: failed loading from "<<m_banfilepath<<std::endl; + infostream << "BanManager: failed loading from " << m_banfilepath + << std::endl; throw SerializationError("BanManager::load(): Couldn't open file"); } @@ -60,7 +59,7 @@ void BanManager::load() Strfnd f(line); std::string ip = trim(f.next("|")); std::string name = trim(f.next("|")); - if(!ip.empty()) { + if (!ip.empty()) { m_ips[ip] = name; } } @@ -77,7 +76,8 @@ void BanManager::save() ss << ip.first << "|" << ip.second << "\n"; if (!fs::safeWriteToFile(m_banfilepath, ss.str())) { - infostream << "BanManager: failed saving to " << m_banfilepath << std::endl; + infostream << "BanManager: failed saving to " << m_banfilepath + << std::endl; throw SerializationError("BanManager::save(): Couldn't write file"); } @@ -95,8 +95,8 @@ std::string BanManager::getBanDescription(const std::string &ip_or_name) MutexAutoLock lock(m_mutex); std::string s; for (const auto &ip : m_ips) { - if (ip.first == ip_or_name || ip.second == ip_or_name - || ip_or_name.empty()) { + if (ip.first == ip_or_name || ip.second == ip_or_name || + ip_or_name.empty()) { s += ip.first + "|" + ip.second + ", "; } } @@ -133,10 +133,8 @@ void BanManager::remove(const std::string &ip_or_name) } } - bool BanManager::isModified() { MutexAutoLock lock(m_mutex); return m_modified; } - |