diff options
author | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
commit | cfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch) | |
tree | 18d94153a302445196fc0c18586abf44a1ce4a38 /Swiften/Network/HostAddress.cpp | |
parent | 1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff) | |
download | swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2 |
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines
in the process.
Changed CheckTabs.py tool to disallow hard tabs in source
files.
Test-Information:
Manually checked 30 random files that the conversion worked
as expected.
Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swiften/Network/HostAddress.cpp')
-rw-r--r-- | Swiften/Network/HostAddress.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/Swiften/Network/HostAddress.cpp b/Swiften/Network/HostAddress.cpp index ae1a008..64a4ff6 100644 --- a/Swiften/Network/HostAddress.cpp +++ b/Swiften/Network/HostAddress.cpp @@ -25,48 +25,48 @@ HostAddress::HostAddress() { } HostAddress::HostAddress(const std::string& address) { - try { - address_ = boost::asio::ip::address::from_string(address); - } - catch (const std::exception&) { - } + try { + address_ = boost::asio::ip::address::from_string(address); + } + catch (const std::exception&) { + } } HostAddress::HostAddress(const unsigned char* address, size_t length) { - assert(length == 4 || length == 16); - if (length == 4) { - boost::asio::ip::address_v4::bytes_type data; - for (size_t i = 0; i < length; ++i) { - data[i] = address[i]; - } - address_ = boost::asio::ip::address(boost::asio::ip::address_v4(data)); - } - else { - boost::asio::ip::address_v6::bytes_type data; - for (size_t i = 0; i < length; ++i) { - data[i] = address[i]; - } - address_ = boost::asio::ip::address(boost::asio::ip::address_v6(data)); - } + assert(length == 4 || length == 16); + if (length == 4) { + boost::asio::ip::address_v4::bytes_type data; + for (size_t i = 0; i < length; ++i) { + data[i] = address[i]; + } + address_ = boost::asio::ip::address(boost::asio::ip::address_v4(data)); + } + else { + boost::asio::ip::address_v6::bytes_type data; + for (size_t i = 0; i < length; ++i) { + data[i] = address[i]; + } + address_ = boost::asio::ip::address(boost::asio::ip::address_v6(data)); + } } HostAddress::HostAddress(const boost::asio::ip::address& address) : address_(address) { } std::string HostAddress::toString() const { - return address_.to_string(); + return address_.to_string(); } bool HostAddress::isValid() const { - return !(address_.is_v4() && address_.to_v4().to_ulong() == 0); + return !(address_.is_v4() && address_.to_v4().to_ulong() == 0); } boost::asio::ip::address HostAddress::getRawAddress() const { - return address_; + return address_; } bool HostAddress::isLocalhost() const { - return address_ == localhost4 || address_ == localhost6; + return address_ == localhost4 || address_ == localhost6; } } |