diff options
author | Michele Calgaro <[email protected]> | 2021-01-03 16:25:52 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2021-01-03 16:25:52 +0900 |
commit | 05ee12e2df827059e6f1d01524c19905501cf105 (patch) | |
tree | 877b5f52ae689fb9e39eea1a8e06e650e2bedf3e /tdecore/network/tdesocketaddress.cpp | |
parent | 90bf87760453c5fb32e6b135dfcfadc2d7700886 (diff) | |
download | tdelibs-05ee12e2df827059e6f1d01524c19905501cf105.tar.gz tdelibs-05ee12e2df827059e6f1d01524c19905501cf105.zip |
Fixed more uncrustify's code formatting offending files.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'tdecore/network/tdesocketaddress.cpp')
-rw-r--r-- | tdecore/network/tdesocketaddress.cpp | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/tdecore/network/tdesocketaddress.cpp b/tdecore/network/tdesocketaddress.cpp index 86d85c29c..36adaa631 100644 --- a/tdecore/network/tdesocketaddress.cpp +++ b/tdecore/network/tdesocketaddress.cpp @@ -191,17 +191,19 @@ TQString KIpAddress::toString() const char buf[sizeof "1111:2222:3333:4444:5555:6666:255.255.255.255" + 2]; buf[0] = '\0'; switch (m_version) - { + { case 4: inet_ntop(AF_INET, m_data, buf, sizeof(buf) - 1); return TQString::fromLatin1(buf); case 6: + { #ifdef AF_INET6 inet_ntop(AF_INET6, m_data, buf, sizeof(buf) - 1); #endif return TQString::fromLatin1(buf); } + } return TQString::null; } @@ -294,11 +296,15 @@ public: switch (addr.generic->sa_family) { case AF_INET: + { return; // nothing to do here + } #ifdef AF_INET6 case AF_INET6: + { oldport = addr.in6->sin6_port; break; + } #endif } @@ -319,12 +325,16 @@ public: switch (addr.generic->sa_family) { case AF_INET: + { oldport = addr.in->sin_port; break; + } #ifdef AF_INET6 case AF_INET6: + { return; // nothing to do here + } #endif } @@ -517,12 +527,15 @@ bool TDESocketAddress::operator ==(const TDESocketAddress& other) const switch (d->addr.generic->sa_family) { case AF_INET: + { Q_ASSERT(d->reallen == SOCKADDR_IN_LEN); Q_ASSERT(other.d->reallen == SOCKADDR_IN_LEN); return memcmp(d->addr.in, other.d->addr.in, SOCKADDR_IN_LEN) == 0; + } #ifdef AF_INET6 case AF_INET6: + { Q_ASSERT(d->reallen >= MIN_SOCKADDR_IN6_LEN); Q_ASSERT(other.d->reallen >= MIN_SOCKADDR_IN6_LEN); @@ -540,6 +553,7 @@ bool TDESocketAddress::operator ==(const TDESocketAddress& other) const # endif return memcmp(d->addr.in6, other.d->addr.in6, d->reallen) == 0; + } #endif case AF_UNIX: @@ -566,10 +580,11 @@ TQString TDESocketAddress::nodeName() const switch (d->addr.generic->sa_family) { - case AF_INET: #ifdef AF_INET6 case AF_INET6: - +#endif + case AF_INET: +#ifdef AF_INET6 TQString scopeid("%"); if (d->addr.generic->sa_family == AF_INET6 && d->addr.in6->sin6_scope_id) scopeid += TQString::number(d->addr.in6->sin6_scope_id); @@ -592,10 +607,10 @@ TQString TDESocketAddress::serviceName() const switch (d->addr.generic->sa_family) { - case AF_INET: #ifdef AF_INET6 case AF_INET6: #endif + case AF_INET: return TQString::number(d->ref.port()); case AF_UNIX: @@ -652,11 +667,15 @@ int TDESocketAddress::ianaFamily(int af) switch (af) { case AF_INET: + { return 1; + } #ifdef AF_INET6 case AF_INET6: + { return 2; + } #endif default: @@ -669,11 +688,15 @@ int TDESocketAddress::fromIanaFamily(int iana) switch (iana) { case 1: + { return AF_INET; + } #ifdef AF_INET6 case 2: + { return AF_INET6; + } #endif default: @@ -743,11 +766,15 @@ int KInetSocketAddress::ipVersion() const switch (d->addr.generic->sa_family) { case AF_INET: + { return 4; + } #ifdef AF_INET6 case AF_INET6: + { return 6; + } #endif } @@ -762,10 +789,14 @@ KIpAddress KInetSocketAddress::ipAddress() const switch (d->addr.generic->sa_family) { case AF_INET: + { return KIpAddress(&d->addr.in->sin_addr, 4); + } #ifdef AF_INET6 case AF_INET6: + { return KIpAddress(&d->addr.in6->sin6_addr, 6); + } #endif } @@ -803,11 +834,15 @@ TQ_UINT16 KInetSocketAddress::port() const switch (d->addr.generic->sa_family) { case AF_INET: + { return ntohs(d->addr.in->sin_port); + } #ifdef AF_INET6 case AF_INET6: + { return ntohs(d->addr.in6->sin6_port); + } #endif } @@ -822,13 +857,17 @@ KInetSocketAddress& KInetSocketAddress::setPort(TQ_UINT16 port) switch (d->addr.generic->sa_family) { case AF_INET: + { d->addr.in->sin_port = htons(port); break; + } #ifdef AF_INET6 case AF_INET6: + { d->addr.in6->sin6_port = htons(port); break; + } #endif default: |