diff options
author | Loïc Blot <loic.blot@unix-experience.fr> | 2019-02-15 12:27:29 +0100 |
---|---|---|
committer | Loïc Blot <loic.blot@unix-experience.fr> | 2019-02-15 12:27:29 +0100 |
commit | 3dafc007a95ae89904e0e92dc86ed27205de05c5 (patch) | |
tree | b018acb3673c14ace33b55198ca41b29c1d3c930 | |
parent | 88c68ce8ec79bd5ce60d11fb4a09df1adc720d2f (diff) | |
download | minetest-3dafc007a95ae89904e0e92dc86ed27205de05c5.tar.gz minetest-3dafc007a95ae89904e0e92dc86ed27205de05c5.tar.bz2 minetest-3dafc007a95ae89904e0e92dc86ed27205de05c5.zip |
LINT fix
-rw-r--r-- | src/network/address.cpp | 5 | ||||
-rw-r--r-- | src/unittest/test_address.cpp | 8 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/network/address.cpp b/src/network/address.cpp index fce3b48f0..896b24317 100644 --- a/src/network/address.cpp +++ b/src/network/address.cpp @@ -272,7 +272,8 @@ void Address::print(std::ostream *s) const *s << serializeString() << ":" << m_port; } -bool Address::isLocalhost() const { +bool Address::isLocalhost() const +{ if (isIPv6()) { static const unsigned char localhost_bytes[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; @@ -281,8 +282,10 @@ bool Address::isLocalhost() const { auto addr = m_address.ipv6.sin6_addr.s6_addr; +// clang-format off return memcmp(addr, localhost_bytes, 16) == 0 || memcmp(addr, mapped_ipv4_localhost, 13) == 0; +// clang-format on } return (m_address.ipv4.sin_addr.s_addr & 0xFF) == 0x7f; diff --git a/src/unittest/test_address.cpp b/src/unittest/test_address.cpp index 000a648f1..35d4effb6 100644 --- a/src/unittest/test_address.cpp +++ b/src/unittest/test_address.cpp @@ -23,12 +23,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" #include "network/socket.h" -class TestAddress : public TestBase { +class TestAddress : public TestBase +{ public: - TestAddress() - { - TestManager::registerTestModule(this); - } + TestAddress() { TestManager::registerTestModule(this); } const char *getName() { return "TestAddress"; } |