summaryrefslogtreecommitdiffstats
path: root/src/network/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/kernel')
-rw-r--r--src/network/kernel/qauthenticator.cpp10
-rw-r--r--src/network/kernel/qdnslookup.cpp4
-rw-r--r--src/network/kernel/qdnslookup_unix.cpp8
-rw-r--r--src/network/kernel/qhostaddress.cpp2
-rw-r--r--src/network/kernel/qhostinfo.cpp25
-rw-r--r--src/network/kernel/qhostinfo_p.h7
-rw-r--r--src/network/kernel/qhostinfo_unix.cpp8
-rw-r--r--src/network/kernel/qnetworkinterface.cpp4
-rw-r--r--src/network/kernel/qnetworkinterface_p.h2
-rw-r--r--src/network/kernel/qnetworkinterface_unix_p.h2
-rw-r--r--src/network/kernel/qnetworkproxy.cpp19
-rw-r--r--src/network/kernel/qnetworkproxy_mac.cpp7
-rw-r--r--src/network/kernel/qurlinfo.cpp10
13 files changed, 36 insertions, 72 deletions
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 33a30eb1cd..e9a8e2a9e5 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -158,7 +158,7 @@ static QByteArray qGssapiContinue(QAuthenticatorPrivate *ctx,
Constructs an empty authentication object.
*/
QAuthenticator::QAuthenticator()
- : d(0)
+ : d(nullptr)
{
}
@@ -175,7 +175,7 @@ QAuthenticator::~QAuthenticator()
Constructs a copy of \a other.
*/
QAuthenticator::QAuthenticator(const QAuthenticator &other)
- : d(0)
+ : d(nullptr)
{
if (other.d)
*this = other;
@@ -1227,7 +1227,7 @@ QByteArray qEncodeHmacMd5(QByteArray &key, const QByteArray &message)
static QByteArray qCreatev2Hash(const QAuthenticatorPrivate *ctx,
QNtlmPhase3Block *phase3)
{
- Q_ASSERT(phase3 != 0);
+ Q_ASSERT(phase3 != nullptr);
// since v2 Hash is need for both NTLMv2 and LMv2 it is calculated
// only once and stored and reused
if(phase3->v2Hash.size() == 0) {
@@ -1284,7 +1284,7 @@ static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx,
const QNtlmPhase2Block& ch,
QNtlmPhase3Block *phase3)
{
- Q_ASSERT(phase3 != 0);
+ Q_ASSERT(phase3 != nullptr);
// return value stored in phase3
qCreatev2Hash(ctx, phase3);
@@ -1351,7 +1351,7 @@ static QByteArray qEncodeLmv2Response(const QAuthenticatorPrivate *ctx,
const QNtlmPhase2Block& ch,
QNtlmPhase3Block *phase3)
{
- Q_ASSERT(phase3 != 0);
+ Q_ASSERT(phase3 != nullptr);
// return value stored in phase3
qCreatev2Hash(ctx, phase3);
diff --git a/src/network/kernel/qdnslookup.cpp b/src/network/kernel/qdnslookup.cpp
index 1b66829070..ab1be02b6b 100644
--- a/src/network/kernel/qdnslookup.cpp
+++ b/src/network/kernel/qdnslookup.cpp
@@ -481,7 +481,7 @@ void QDnsLookup::abort()
{
Q_D(QDnsLookup);
if (d->runnable) {
- d->runnable = 0;
+ d->runnable = nullptr;
d->reply = QDnsLookupReply();
d->reply.error = QDnsLookup::OperationCancelledError;
d->reply.errorString = tr("Operation cancelled");
@@ -992,7 +992,7 @@ void QDnsLookupPrivate::_q_lookupFinished(const QDnsLookupReply &_reply)
qDebug("DNS reply for %s: %i (%s)", qPrintable(name), _reply.error, qPrintable(_reply.errorString));
#endif
reply = _reply;
- runnable = 0;
+ runnable = nullptr;
isFinished = true;
emit q->finished();
}
diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
index ee7484ab35..12b40fc35d 100644
--- a/src/network/kernel/qdnslookup_unix.cpp
+++ b/src/network/kernel/qdnslookup_unix.cpp
@@ -73,13 +73,13 @@ QT_BEGIN_NAMESPACE
typedef struct __res_state* res_state;
#endif
typedef int (*dn_expand_proto)(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
-static dn_expand_proto local_dn_expand = 0;
+static dn_expand_proto local_dn_expand = nullptr;
typedef void (*res_nclose_proto)(res_state);
-static res_nclose_proto local_res_nclose = 0;
+static res_nclose_proto local_res_nclose = nullptr;
typedef int (*res_ninit_proto)(res_state);
-static res_ninit_proto local_res_ninit = 0;
+static res_ninit_proto local_res_ninit = nullptr;
typedef int (*res_nquery_proto)(res_state, const char *, int, int, unsigned char *, int);
-static res_nquery_proto local_res_nquery = 0;
+static res_nquery_proto local_res_nquery = nullptr;
// Custom deleter to close resolver state.
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp
index b54fb349fb..ed1c23ed6e 100644
--- a/src/network/kernel/qhostaddress.cpp
+++ b/src/network/kernel/qhostaddress.cpp
@@ -144,7 +144,7 @@ static bool parseIp6(const QString &address, QIPAddressUtils::IPv6Address &addr,
} else {
scopeId->clear();
}
- return QIPAddressUtils::parseIp6(addr, tmp.constBegin(), tmp.constEnd()) == 0;
+ return QIPAddressUtils::parseIp6(addr, tmp.constBegin(), tmp.constEnd()) == nullptr;
}
bool QHostAddressPrivate::parse(const QString &ipString)
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index 9dbb154914..93be053ef3 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -383,34 +383,13 @@ QHostInfo QHostInfo::fromName(const QString &name)
return hostInfo;
}
-#ifndef QT_NO_BEARERMANAGEMENT
-QHostInfo QHostInfoPrivate::fromName(const QString &name, QSharedPointer<QNetworkSession> session)
-{
-#if defined QHOSTINFO_DEBUG
- qDebug("QHostInfoPrivate::fromName(\"%s\") with session %p",name.toLatin1().constData(), session.data());
-#endif
-
- QHostInfo hostInfo = QHostInfoAgent::fromName(name, session);
- QHostInfoLookupManager* manager = theHostInfoLookupManager();
- manager->cache.put(name, hostInfo);
- return hostInfo;
-}
-#endif
-
-#ifndef QT_NO_BEARERMANAGEMENT
-QHostInfo QHostInfoAgent::fromName(const QString &hostName, QSharedPointer<QNetworkSession>)
-{
- return QHostInfoAgent::fromName(hostName);
-}
-#endif
-
QHostInfo QHostInfoAgent::reverseLookup(const QHostAddress &address)
{
QHostInfo results;
// Reverse lookup
sockaddr_in sa4;
sockaddr_in6 sa6;
- sockaddr *sa = 0;
+ sockaddr *sa = nullptr;
QT_SOCKLEN_T saSize;
if (address.protocol() == QAbstractSocket::IPv4Protocol) {
sa = reinterpret_cast<sockaddr *>(&sa4);
@@ -455,7 +434,7 @@ QHostInfo QHostInfoAgent::lookup(const QString &hostName)
return results;
}
- addrinfo *res = 0;
+ addrinfo *res = nullptr;
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index 1798ceab0a..d7875a0673 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -119,9 +119,6 @@ class QHostInfoAgent
{
public:
static QHostInfo fromName(const QString &hostName);
-#ifndef QT_NO_BEARERMANAGEMENT
- static QHostInfo fromName(const QString &hostName, QSharedPointer<QNetworkSession> networkSession);
-#endif
private:
static QHostInfo lookup(const QString &hostName);
static QHostInfo reverseLookup(const QHostAddress &address);
@@ -136,10 +133,6 @@ public:
lookupId(0)
{
}
-#ifndef QT_NO_BEARERMANAGEMENT
- //not a public API yet
- static QHostInfo fromName(const QString &hostName, QSharedPointer<QNetworkSession> networkSession);
-#endif
static int lookupHostImpl(const QString &name,
const QObject *receiver,
QtPrivate::QSlotObjectBase *slotObj,
diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
index 78a05f8407..625fbabf31 100644
--- a/src/network/kernel/qhostinfo_unix.cpp
+++ b/src/network/kernel/qhostinfo_unix.cpp
@@ -80,12 +80,12 @@ enum LibResolvFeature {
typedef struct __res_state *res_state_ptr;
typedef int (*res_init_proto)(void);
-static res_init_proto local_res_init = 0;
+static res_init_proto local_res_init = nullptr;
typedef int (*res_ninit_proto)(res_state_ptr);
-static res_ninit_proto local_res_ninit = 0;
+static res_ninit_proto local_res_ninit = nullptr;
typedef void (*res_nclose_proto)(res_state_ptr);
-static res_nclose_proto local_res_nclose = 0;
-static res_state_ptr local_res = 0;
+static res_nclose_proto local_res_nclose = nullptr;
+static res_state_ptr local_res = nullptr;
#if QT_CONFIG(library) && !defined(Q_OS_QNX)
namespace {
diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp
index d43dba3e0c..eed57f8a32 100644
--- a/src/network/kernel/qnetworkinterface.cpp
+++ b/src/network/kernel/qnetworkinterface.cpp
@@ -627,7 +627,7 @@ bool QNetworkAddressEntry::isPermanent() const
Constructs an empty network interface object.
*/
QNetworkInterface::QNetworkInterface()
- : d(0)
+ : d(nullptr)
{
}
@@ -746,7 +746,7 @@ QString QNetworkInterface::humanReadableName() const
*/
QNetworkInterface::InterfaceFlags QNetworkInterface::flags() const
{
- return d ? d->flags : InterfaceFlags(0);
+ return d ? d->flags : InterfaceFlags{};
}
/*!
diff --git a/src/network/kernel/qnetworkinterface_p.h b/src/network/kernel/qnetworkinterface_p.h
index 44e27a7e34..b879a397f2 100644
--- a/src/network/kernel/qnetworkinterface_p.h
+++ b/src/network/kernel/qnetworkinterface_p.h
@@ -82,7 +82,7 @@ public:
class QNetworkInterfacePrivate: public QSharedData
{
public:
- QNetworkInterfacePrivate() : index(0), flags(nullptr)
+ QNetworkInterfacePrivate() : index(0)
{ }
~QNetworkInterfacePrivate()
{ }
diff --git a/src/network/kernel/qnetworkinterface_unix_p.h b/src/network/kernel/qnetworkinterface_unix_p.h
index 553af5a303..e5c8909eca 100644
--- a/src/network/kernel/qnetworkinterface_unix_p.h
+++ b/src/network/kernel/qnetworkinterface_unix_p.h
@@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE
static QNetworkInterface::InterfaceFlags convertFlags(uint rawFlags)
{
- QNetworkInterface::InterfaceFlags flags = nullptr;
+ QNetworkInterface::InterfaceFlags flags;
flags |= (rawFlags & IFF_UP) ? QNetworkInterface::IsUp : QNetworkInterface::InterfaceFlag(0);
flags |= (rawFlags & IFF_RUNNING) ? QNetworkInterface::IsRunning : QNetworkInterface::InterfaceFlag(0);
flags |= (rawFlags & IFF_BROADCAST) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0);
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index a2a89ed94b..3cabdd0bd5 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -241,7 +241,7 @@
#include "qstringlist.h"
#include "qurl.h"
-#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
#include <QtNetwork/QNetworkConfiguration>
#endif
@@ -254,13 +254,13 @@ class QGlobalNetworkProxy
{
public:
QGlobalNetworkProxy()
- : applicationLevelProxy(0)
- , applicationLevelProxyFactory(0)
+ : applicationLevelProxy(nullptr)
+ , applicationLevelProxyFactory(nullptr)
#if QT_CONFIG(socks5)
- , socks5SocketEngineHandler(0)
+ , socks5SocketEngineHandler(nullptr)
#endif
#if QT_CONFIG(http)
- , httpSocketEngineHandler(0)
+ , httpSocketEngineHandler(nullptr)
#endif
#ifdef QT_USE_SYSTEM_PROXIES
, useSystemProxies(true)
@@ -313,7 +313,7 @@ public:
applicationLevelProxy = new QNetworkProxy;
*applicationLevelProxy = proxy;
delete applicationLevelProxyFactory;
- applicationLevelProxyFactory = 0;
+ applicationLevelProxyFactory = nullptr;
useSystemProxies = false;
}
@@ -501,7 +501,7 @@ template<> void QSharedDataPointer<QNetworkProxyPrivate>::detach()
\sa setType(), setApplicationProxy()
*/
QNetworkProxy::QNetworkProxy()
- : d(0)
+ : d(nullptr)
{
// make sure we have QGlobalNetworkProxy singleton created, otherwise
// you don't have any socket engine handler created when directly setting
@@ -984,11 +984,6 @@ template<> void QSharedDataPointer<QNetworkProxyQueryPrivate>::detach()
like choosing an caching HTTP proxy for HTTP-based connections,
but a more powerful SOCKSv5 proxy for all others.
- The network configuration specifies which configuration to use,
- when bearer management is used. For example on a mobile phone
- the proxy settings are likely to be different for the cellular
- network vs WLAN.
-
Some of the criteria may not make sense in all of the types of
query. The following table lists the criteria that are most
commonly used, according to the type of query.
diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp
index 92f91956b9..67fda24ea6 100644
--- a/src/network/kernel/qnetworkproxy_mac.cpp
+++ b/src/network/kernel/qnetworkproxy_mac.cpp
@@ -210,16 +210,14 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
QList<QNetworkProxy> result;
// obtain a dictionary to the proxy settings:
- CFDictionaryRef dict = SCDynamicStoreCopyProxies(NULL);
+ const QCFType<CFDictionaryRef> dict = SCDynamicStoreCopyProxies(NULL);
if (!dict) {
qWarning("QNetworkProxyFactory::systemProxyForQuery: SCDynamicStoreCopyProxies returned NULL");
return result; // failed
}
- if (isHostExcluded(dict, query.peerHostName())) {
- CFRelease(dict);
+ if (isHostExcluded(dict, query.peerHostName()))
return result; // no proxy for this host
- }
// is there a PAC enabled? If so, use it first.
CFNumberRef pacEnabled;
@@ -329,7 +327,6 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
result << https;
}
- CFRelease(dict);
return result;
}
diff --git a/src/network/kernel/qurlinfo.cpp b/src/network/kernel/qurlinfo.cpp
index 7ae6822fb4..e6f2e70ff4 100644
--- a/src/network/kernel/qurlinfo.cpp
+++ b/src/network/kernel/qurlinfo.cpp
@@ -126,7 +126,7 @@ public:
QUrlInfo::QUrlInfo()
{
- d = 0;
+ d = nullptr;
}
/*!
@@ -139,7 +139,7 @@ QUrlInfo::QUrlInfo(const QUrlInfo &ui)
d = new QUrlInfoPrivate;
*d = *ui.d;
} else {
- d = 0;
+ d = nullptr;
}
}
@@ -443,7 +443,7 @@ QUrlInfo &QUrlInfo::operator=(const QUrlInfo &ui)
*d = *ui.d;
} else {
delete d;
- d = 0;
+ d = nullptr;
}
return *this;
}
@@ -683,7 +683,7 @@ bool QUrlInfo::equal(const QUrlInfo &i1, const QUrlInfo &i2,
bool QUrlInfo::operator==(const QUrlInfo &other) const
{
if (!d)
- return other.d == 0;
+ return other.d == nullptr;
if (!other.d)
return false;
@@ -721,7 +721,7 @@ bool QUrlInfo::operator==(const QUrlInfo &other) const
*/
bool QUrlInfo::isValid() const
{
- return d != 0;
+ return d != nullptr;
}
QT_END_NAMESPACE