diff options
Diffstat (limited to 'src/network/kernel')
| -rw-r--r-- | src/network/kernel/qhostaddress.cpp | 34 | ||||
| -rw-r--r-- | src/network/kernel/qhostaddress.h | 2 | ||||
| -rw-r--r-- | src/network/kernel/qnetworkdatagram.cpp | 2 | ||||
| -rw-r--r-- | src/network/kernel/qnetworkproxy_mac.cpp | 15 |
4 files changed, 47 insertions, 6 deletions
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 1a960e4f7d..b8c0584a62 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -282,21 +282,27 @@ bool QNetmaskAddress::setAddress(const QHostAddress &address) d->clear(); return false; // invalid IP-style netmask - // the rest always falls through case 254: ++netmask; + Q_FALLTHROUGH(); case 252: ++netmask; + Q_FALLTHROUGH(); case 248: ++netmask; + Q_FALLTHROUGH(); case 240: ++netmask; + Q_FALLTHROUGH(); case 224: ++netmask; + Q_FALLTHROUGH(); case 192: ++netmask; + Q_FALLTHROUGH(); case 128: ++netmask; + Q_FALLTHROUGH(); case 0: break; } @@ -1233,11 +1239,37 @@ QDebug operator<<(QDebug d, const QHostAddress &address) } #endif +/*! + \since 5.0 + \relates QHostAddress + Returns a hash of the host address \a key, using \a seed to seed the calculation. +*/ uint qHash(const QHostAddress &key, uint seed) Q_DECL_NOTHROW { return qHashBits(key.d->a6.c, 16, seed); } +/*! + \relates QHostAddress + \fn operator==(QHostAddress::SpecialAddress lhs, const QHostAddress &rhs) + + Returns \c true if special address \a lhs is the same as host address \a rhs; + otherwise returns \c false. + + \sa isEqual() +*/ + +/*! + \relates QHostAddress + \since 5.9 + \fn operator!=(QHostAddress::SpecialAddress lhs, const QHostAddress &rhs) + + Returns \c false if special address \a lhs is the same as host address \a rhs; + otherwise returns \c true. + + \sa isEqual() +*/ + #ifndef QT_NO_DATASTREAM /*! \relates QHostAddress diff --git a/src/network/kernel/qhostaddress.h b/src/network/kernel/qhostaddress.h index 3898fb02a8..fdbdbfc72c 100644 --- a/src/network/kernel/qhostaddress.h +++ b/src/network/kernel/qhostaddress.h @@ -161,6 +161,8 @@ Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QHostAddress) inline bool operator ==(QHostAddress::SpecialAddress address1, const QHostAddress &address2) { return address2 == address1; } +inline bool operator!=(QHostAddress::SpecialAddress lhs, const QHostAddress &rhs) +{ return rhs != lhs; } #ifndef QT_NO_DEBUG_STREAM Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QHostAddress &); diff --git a/src/network/kernel/qnetworkdatagram.cpp b/src/network/kernel/qnetworkdatagram.cpp index ba8a063edf..88ca763187 100644 --- a/src/network/kernel/qnetworkdatagram.cpp +++ b/src/network/kernel/qnetworkdatagram.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE /*! \class QNetworkDatagram - \brief The QNetworkDatagram class provides the data and matadata of a UDP datagram. + \brief The QNetworkDatagram class provides the data and metadata of a UDP datagram. \since 5.8 \ingroup network \inmodule QtNetwork diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index c13a472b90..92f91956b9 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -189,12 +189,19 @@ struct PACInfo { void proxyAutoConfigCallback(void *client, CFArrayRef proxylist, CFErrorRef error) { - PACInfo *info = reinterpret_cast<PACInfo *>(reinterpret_cast<CFStreamClientContext *>(client)->info); + Q_ASSERT(client); + + PACInfo *info = static_cast<PACInfo *>(client); info->done = true; - if (proxylist) + + if (error) { + CFRetain(error); + info->error = error; + } + if (proxylist) { CFRetain(proxylist); - info->proxies = proxylist; - info->error = error; + info->proxies = proxylist; + } } } // anon namespace |
