Skip to content

Commit

Permalink
LINT fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzhul committed Feb 15, 2019
1 parent 88c68ce commit 3dafc00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/network/address.cpp
Expand Up @@ -272,7 +272,8 @@ void Address::print(std::ostream *s) const
*s << serializeString() << ":" << m_port; *s << serializeString() << ":" << m_port;
} }


bool Address::isLocalhost() const { bool Address::isLocalhost() const
{
if (isIPv6()) { if (isIPv6()) {
static const unsigned char localhost_bytes[] = { static const unsigned char localhost_bytes[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
Expand All @@ -281,8 +282,10 @@ bool Address::isLocalhost() const {


auto addr = m_address.ipv6.sin6_addr.s6_addr; auto addr = m_address.ipv6.sin6_addr.s6_addr;


// clang-format off
return memcmp(addr, localhost_bytes, 16) == 0 || return memcmp(addr, localhost_bytes, 16) == 0 ||
memcmp(addr, mapped_ipv4_localhost, 13) == 0; memcmp(addr, mapped_ipv4_localhost, 13) == 0;
// clang-format on
} }


return (m_address.ipv4.sin_addr.s_addr & 0xFF) == 0x7f; return (m_address.ipv4.sin_addr.s_addr & 0xFF) == 0x7f;
Expand Down
8 changes: 3 additions & 5 deletions src/unittest/test_address.cpp
Expand Up @@ -23,12 +23,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "settings.h" #include "settings.h"
#include "network/socket.h" #include "network/socket.h"


class TestAddress : public TestBase { class TestAddress : public TestBase
{
public: public:
TestAddress() TestAddress() { TestManager::registerTestModule(this); }
{
TestManager::registerTestModule(this);
}


const char *getName() { return "TestAddress"; } const char *getName() { return "TestAddress"; }


Expand Down

0 comments on commit 3dafc00

Please sign in to comment.