From 4ce7b0e9ef173046b21806d9c43b0f0f83e11cf8 Mon Sep 17 00:00:00 2001 From: EinMByte Date: Thu, 16 Jul 2015 18:02:19 +0200 Subject: [PATCH] Minor changes based on cppcheck output. --- Daemon.h | 8 +++++--- I2NPProtocol.h | 1 + RouterInfo.cpp | 2 +- RouterInfo.h | 1 + TODO | 1 + util.cpp | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Daemon.h b/Daemon.h index bfbdcaa0..4d9b70fd 100644 --- a/Daemon.h +++ b/Daemon.h @@ -53,6 +53,8 @@ namespace i2p class DaemonLinux : public Daemon_Singleton { public: + DeamonLinux() = default; + static DaemonLinux& Instance() { static DaemonLinux instance; @@ -61,9 +63,9 @@ namespace i2p virtual bool start(); virtual bool stop(); - private: - std::string pidfile; - int pidFilehandle; + private: + std::string pidfile; + int pidFilehandle; }; #endif diff --git a/I2NPProtocol.h b/I2NPProtocol.h index bb4c3303..943a8d2f 100644 --- a/I2NPProtocol.h +++ b/I2NPProtocol.h @@ -160,6 +160,7 @@ namespace tunnel memcpy (buf + offset, other.buf + other.offset, other.GetLength ()); len = offset + other.GetLength (); from = other.from; + maxLen = other.maxLen; return *this; } diff --git a/RouterInfo.cpp b/RouterInfo.cpp index 403b711c..20d119d9 100644 --- a/RouterInfo.cpp +++ b/RouterInfo.cpp @@ -287,7 +287,7 @@ namespace data if (m_Caps & eReachable) caps += CAPS_FLAG_REACHABLE; // reachable if (m_Caps & eUnreachable) caps += CAPS_FLAG_UNREACHABLE; // unreachable - SetProperty ("caps", caps.c_str ()); + SetProperty ("caps", caps); } void RouterInfo::WriteToStream (std::ostream& s) diff --git a/RouterInfo.h b/RouterInfo.h index 376dfdc7..1c5af450 100644 --- a/RouterInfo.h +++ b/RouterInfo.h @@ -87,6 +87,7 @@ namespace data RouterInfo (const std::string& fullPath); RouterInfo (): m_Buffer (nullptr) { }; + RouterInfo (const RouterInfo& ) = default; RouterInfo& operator=(const RouterInfo& ) = default; RouterInfo (const uint8_t * buf, int len); diff --git a/TODO b/TODO index 0ad96b98..4ab58356 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,6 @@ Short-term refactoring: - SSUSession:637, SSUSession:635 get rid of casting to SSUHeader + - Idenity.cpp:156 check for self asignment Long-term refactoring: - Rely on a library for TLS and SSL. diff --git a/util.cpp b/util.cpp index fbaf2dbf..3215f090 100644 --- a/util.cpp +++ b/util.cpp @@ -472,7 +472,7 @@ namespace http try{ port_ = boost::lexical_cast(portstr_); } - catch (std::exception e) { + catch (const std::exception& e) { port_ = 80; } }