diff options
Diffstat (limited to 'tdecore')
-rw-r--r-- | tdecore/network/tdesocketaddress.cpp | 47 | ||||
-rw-r--r-- | tdecore/tdeconfigbase.cpp | 4 |
2 files changed, 47 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: diff --git a/tdecore/tdeconfigbase.cpp b/tdecore/tdeconfigbase.cpp index f4b2722fa..417999df6 100644 --- a/tdecore/tdeconfigbase.cpp +++ b/tdecore/tdeconfigbase.cpp @@ -479,7 +479,9 @@ TQVariant TDEConfigBase::readPropertyEntry( const char *pKey, case TQVariant::Quaternion: case TQVariant::UserType: #endif // USE_QT4 + { break; + } } Q_ASSERT( 0 ); @@ -1404,7 +1406,9 @@ void TDEConfigBase::writeEntry ( const char *pKey, const TQVariant &prop, case TQVariant::Quaternion: case TQVariant::UserType: #endif // USE_QT4 + { break; + } } Q_ASSERT( 0 ); |