Skip to content

Commit

Permalink
Use nullptr instead of 0
Browse files Browse the repository at this point in the history
Change-Id: I37e776b84193d705b48d5d75ad620fd41b271d9e
Reviewed-by: Timur Pocheptsov <[email protected]>
  • Loading branch information
jsfdez committed Jul 16, 2018
1 parent 9a3359b commit 435d1d5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/network/access/qnetworkaccessmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void QNetworkAccessManager::setProxy(const QNetworkProxy &proxy)
Q_D(QNetworkAccessManager);
delete d->proxyFactory;
d->proxy = proxy;
d->proxyFactory = 0;
d->proxyFactory = nullptr;
}

/*!
Expand Down Expand Up @@ -1804,7 +1804,7 @@ void QNetworkAccessManagerPrivate::destroyThread()
delete thread;
else
QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread = 0;
thread = nullptr;
}
}

Expand Down
11 changes: 6 additions & 5 deletions src/network/access/qnetworkaccessmanager_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ class QNetworkAccessManagerPrivate: public QObjectPrivate
{
public:
QNetworkAccessManagerPrivate()
: networkCache(0), cookieJar(0),
thread(0),
: networkCache(nullptr),
cookieJar(nullptr),
thread(nullptr),
#ifndef QT_NO_NETWORKPROXY
proxyFactory(0),
proxyFactory(nullptr),
#endif
#ifndef QT_NO_BEARERMANAGEMENT
lastSessionState(QNetworkSession::Invalid),
Expand Down Expand Up @@ -130,7 +131,7 @@ class QNetworkAccessManagerPrivate: public QObjectPrivate
bool allowAuthenticationReuse = true);
void cacheCredentials(const QUrl &url, const QAuthenticator *auth);
QNetworkAuthenticationCredential *fetchCachedCredentials(const QUrl &url,
const QAuthenticator *auth = 0);
const QAuthenticator *auth = nullptr);

#ifndef QT_NO_NETWORKPROXY
void proxyAuthenticationRequired(const QUrl &url,
Expand All @@ -140,7 +141,7 @@ class QNetworkAccessManagerPrivate: public QObjectPrivate
QNetworkProxy *lastProxyAuthentication);
void cacheProxyCredentials(const QNetworkProxy &proxy, const QAuthenticator *auth);
QNetworkAuthenticationCredential *fetchCachedProxyCredentials(const QNetworkProxy &proxy,
const QAuthenticator *auth = 0);
const QAuthenticator *auth = nullptr);
QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query);
#endif

Expand Down
32 changes: 16 additions & 16 deletions src/network/access/qnetworkreplyhttpimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class QNetworkProxy;
static inline bool isSeparator(char c)
{
static const char separators[] = "()<>@,;:\\\"/[]?={}";
return isLWS(c) || strchr(separators, c) != 0;
return isLWS(c) || strchr(separators, c) != nullptr;
}

// ### merge with nextField in cookiejar.cpp
Expand Down Expand Up @@ -438,26 +438,26 @@ void QNetworkReplyHttpImpl::sslConfigurationImplementation(QSslConfiguration &co

QNetworkReplyHttpImplPrivate::QNetworkReplyHttpImplPrivate()
: QNetworkReplyPrivate()
, manager(0)
, managerPrivate(0)
, manager(nullptr)
, managerPrivate(nullptr)
, synchronous(false)
, state(Idle)
, statusCode(0)
, uploadByteDevicePosition(false)
, uploadDeviceChoking(false)
, outgoingData(0)
, outgoingData(nullptr)
, bytesUploaded(-1)
, cacheLoadDevice(0)
, cacheLoadDevice(nullptr)
, loadingFromCache(false)
, cacheSaveDevice(0)
, cacheSaveDevice(nullptr)
, cacheEnabled(false)
, resumeOffset(0)
, preMigrationDownloaded(-1)
, bytesDownloaded(0)
, bytesBuffered(0)
, downloadBufferReadPosition(0)
, downloadBufferCurrentSize(0)
, downloadZerocopyBuffer(0)
, downloadZerocopyBuffer(nullptr)
, pendingDownloadDataEmissions(QSharedPointer<QAtomicInt>::create())
, pendingDownloadProgressEmissions(QSharedPointer<QAtomicInt>::create())
#ifndef QT_NO_SSL
Expand Down Expand Up @@ -618,7 +618,7 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
{
Q_Q(QNetworkReplyHttpImpl);

QThread *thread = 0;
QThread *thread = nullptr;
if (synchronous) {
// A synchronous HTTP request uses its own thread
thread = new QThread();
Expand Down Expand Up @@ -1031,7 +1031,7 @@ void QNetworkReplyHttpImplPrivate::initCacheSaveDevice()
managerPrivate->networkCache->metaObject()->className());

managerPrivate->networkCache->remove(url);
cacheSaveDevice = 0;
cacheSaveDevice = nullptr;
cacheEnabled = false;
}
}
Expand Down Expand Up @@ -1973,7 +1973,7 @@ void QNetworkReplyHttpImplPrivate::_q_cacheLoadReadyRead()
qint64 actualCount = cacheLoadDevice->read(&c, 1);
if (actualCount < 0) {
cacheLoadDevice->deleteLater();
cacheLoadDevice = 0;
cacheLoadDevice = nullptr;
QMetaObject::invokeMethod(q, "_q_finished", Qt::QueuedConnection);
} else if (actualCount == 1) {
// This is most probably not happening since most QIODevice returned something proper for bytesAvailable()
Expand All @@ -1983,7 +1983,7 @@ void QNetworkReplyHttpImplPrivate::_q_cacheLoadReadyRead()
} else if ((!cacheLoadDevice->isSequential() && cacheLoadDevice->atEnd())) {
// This codepath is in case the cache device is a QBuffer, e.g. from QNetworkDiskCache.
cacheLoadDevice->deleteLater();
cacheLoadDevice = 0;
cacheLoadDevice = nullptr;
QMetaObject::invokeMethod(q, "_q_finished", Qt::QueuedConnection);
}
}
Expand All @@ -2010,7 +2010,7 @@ void QNetworkReplyHttpImplPrivate::_q_cacheSaveDeviceAboutToClose()
{
// do not keep a dangling pointer to the device around (device
// is closing because e.g. QAbstractNetworkCache::remove() was called).
cacheSaveDevice = 0;
cacheSaveDevice = nullptr;
}

void QNetworkReplyHttpImplPrivate::_q_bufferOutgoingData()
Expand Down Expand Up @@ -2162,7 +2162,7 @@ QNonContiguousByteDevice* QNetworkReplyHttpImplPrivate::createUploadByteDevice()
else if (outgoingData) {
uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(outgoingData);
} else {
return 0;
return nullptr;
}

// We want signal emissions only for normal asynchronous uploads
Expand Down Expand Up @@ -2335,7 +2335,7 @@ void QNetworkReplyHttpImplPrivate::createCache()

bool QNetworkReplyHttpImplPrivate::isCachingEnabled() const
{
return (cacheEnabled && managerPrivate->networkCache != 0);
return (cacheEnabled && managerPrivate->networkCache != nullptr);
}

void QNetworkReplyHttpImplPrivate::setCachingEnabled(bool enable)
Expand All @@ -2359,7 +2359,7 @@ void QNetworkReplyHttpImplPrivate::setCachingEnabled(bool enable)
// ok... but you should make up your mind
qDebug("QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false)");
managerPrivate->networkCache->remove(url);
cacheSaveDevice = 0;
cacheSaveDevice = nullptr;
cacheEnabled = false;
}
}
Expand All @@ -2376,7 +2376,7 @@ void QNetworkReplyHttpImplPrivate::completeCacheSave()
} else if (cacheEnabled && cacheSaveDevice) {
managerPrivate->networkCache->insert(cacheSaveDevice);
}
cacheSaveDevice = 0;
cacheSaveDevice = nullptr;
cacheEnabled = false;
}

Expand Down

0 comments on commit 435d1d5

Please sign in to comment.