aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/objects/qthttp/qhttp.cpp
diff options
context:
space:
mode:
authorGravatar Alexey Sokolov2016-04-30 18:23:42 +0100
committerGravatar Alexey Sokolov2016-04-30 18:50:44 +0100
commit505d0768f8392e3c4775425dd97f41e1c829ef44 (patch)
tree55dfa35f2e180b4186baf00ffbfd2ee38c0f1c18 /src/modules/objects/qthttp/qhttp.cpp
parentUpdate my clang-format to 3.8.0 (diff)
downloadKVIrc-505d0768f8392e3c4775425dd97f41e1c829ef44.tar.gz
KVIrc-505d0768f8392e3c4775425dd97f41e1c829ef44.tar.bz2
KVIrc-505d0768f8392e3c4775425dd97f41e1c829ef44.zip
Apply clang-tidy: modernize-use-nullptr
Diffstat (limited to 'src/modules/objects/qthttp/qhttp.cpp')
-rw-r--r--src/modules/objects/qthttp/qhttp.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/modules/objects/qthttp/qhttp.cpp b/src/modules/objects/qthttp/qhttp.cpp
index f6de5e6a5..ad865d31a 100644
--- a/src/modules/objects/qthttp/qhttp.cpp
+++ b/src/modules/objects/qthttp/qhttp.cpp
@@ -99,10 +99,10 @@ public:
Q_DECLARE_PUBLIC(QHttp)
inline QHttpPrivate(QHttp * parent)
- : socket(0), reconnectAttempts(2),
+ : socket(nullptr), reconnectAttempts(2),
deleteSocket(0), state(QHttp::Unconnected),
error(QHttp::NoError), port(0), mode(QHttp::ConnectionModeHttp),
- toDevice(0), postDevice(0), bytesDone(0), chunkedSize(-1),
+ toDevice(nullptr), postDevice(nullptr), bytesDone(0), chunkedSize(-1),
repost(false), pendingPost(false), q_ptr(parent)
{
}
@@ -245,7 +245,7 @@ private:
void QHttpNormalRequest::start(QHttp * http)
{
if(!http->d->socket)
- http->d->setSock(0);
+ http->d->setSock(nullptr);
http->d->header = header;
if(is_ba)
@@ -254,7 +254,7 @@ void QHttpNormalRequest::start(QHttp * http)
if(http->d->buffer.size() >= 0)
http->d->header.setContentLength(http->d->buffer.size());
- http->d->postDevice = 0;
+ http->d->postDevice = nullptr;
}
else
{
@@ -268,14 +268,14 @@ void QHttpNormalRequest::start(QHttp * http)
}
else
{
- http->d->postDevice = 0;
+ http->d->postDevice = nullptr;
}
}
if(to && (to->isOpen() || to->open(QIODevice::WriteOnly)))
http->d->toDevice = to;
else
- http->d->toDevice = 0;
+ http->d->toDevice = nullptr;
http->d->reconnectAttempts = 2;
http->d->_q_slotSendRequest();
@@ -294,7 +294,7 @@ QHttpRequestHeader QHttpNormalRequest::requestHeader()
QIODevice * QHttpNormalRequest::sourceDevice()
{
if(is_ba)
- return 0;
+ return nullptr;
return data.dev;
}
@@ -358,11 +358,11 @@ public:
QIODevice * sourceDevice()
{
- return 0;
+ return nullptr;
}
QIODevice * destinationDevice()
{
- return 0;
+ return nullptr;
}
private:
@@ -407,11 +407,11 @@ public:
QIODevice * sourceDevice()
{
- return 0;
+ return nullptr;
}
QIODevice * destinationDevice()
{
- return 0;
+ return nullptr;
}
private:
@@ -456,11 +456,11 @@ public:
inline QIODevice * sourceDevice()
{
- return 0;
+ return nullptr;
}
inline QIODevice * destinationDevice()
{
- return 0;
+ return nullptr;
}
private:
@@ -486,11 +486,11 @@ public:
QIODevice * sourceDevice()
{
- return 0;
+ return nullptr;
}
QIODevice * destinationDevice()
{
- return 0;
+ return nullptr;
}
private:
@@ -519,11 +519,11 @@ public:
QIODevice * sourceDevice()
{
- return 0;
+ return nullptr;
}
QIODevice * destinationDevice()
{
- return 0;
+ return nullptr;
}
};
@@ -1963,7 +1963,7 @@ qint64 QHttp::bytesAvailable() const
*/
qint64 QHttp::read(char * data, qint64 maxlen)
{
- if(data == 0 && maxlen != 0)
+ if(data == nullptr && maxlen != 0)
{
qWarning("QHttp::read: Null pointer error");
return -1;
@@ -2059,7 +2059,7 @@ QHttpResponseHeader QHttp::lastResponse() const
QIODevice * QHttp::currentSourceDevice() const
{
if(d->pending.isEmpty())
- return 0;
+ return nullptr;
return d->pending.first()->sourceDevice();
}
@@ -2076,7 +2076,7 @@ QIODevice * QHttp::currentSourceDevice() const
QIODevice * QHttp::currentDestinationDevice() const
{
if(d->pending.isEmpty())
- return 0;
+ return nullptr;
return d->pending.first()->destinationDevice();
}
@@ -2285,7 +2285,7 @@ int QHttp::get(const QString & path, QIODevice * to)
{
QHttpRequestHeader header(QLatin1String("GET"), path);
header.setValue(QLatin1String("Connection"), QLatin1String("Keep-Alive"));
- return d->addRequest(new QHttpPGHRequest(header, (QIODevice *)0, to));
+ return d->addRequest(new QHttpPGHRequest(header, (QIODevice *)nullptr, to));
}
/*!
@@ -2359,7 +2359,7 @@ int QHttp::head(const QString & path)
{
QHttpRequestHeader header(QLatin1String("HEAD"), path);
header.setValue(QLatin1String("Connection"), QLatin1String("Keep-Alive"));
- return d->addRequest(new QHttpPGHRequest(header, (QIODevice *)0, 0));
+ return d->addRequest(new QHttpPGHRequest(header, (QIODevice *)nullptr, nullptr));
}
/*!
@@ -2688,7 +2688,7 @@ void QHttpPrivate::_q_slotClosed()
finishedWithError(QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Server closed connection unexpectedly")), QHttp::UnexpectedClose);
}
- postDevice = 0;
+ postDevice = nullptr;
if(state != QHttp::Closing)
setState(QHttp::Closing);
QMetaObject::invokeMethod(q, "_q_slotDoFinished", Qt::QueuedConnection);
@@ -2741,7 +2741,7 @@ void QHttpPrivate::_q_slotConnected()
void QHttpPrivate::_q_slotError(QAbstractSocket::SocketError err)
{
Q_Q(QHttp);
- postDevice = 0;
+ postDevice = nullptr;
if(state == QHttp::Connecting || state == QHttp::Reading || state == QHttp::Sending)
{
@@ -2830,7 +2830,7 @@ void QHttpPrivate::postMoreData()
}
if(postDevice->atEnd())
{
- postDevice = 0;
+ postDevice = nullptr;
}
socket->write(arr, n);
@@ -3023,7 +3023,7 @@ void QHttpPrivate::_q_slotReadyRead()
else
{
qint64 n = socket->bytesAvailable();
- QByteArray * arr = 0;
+ QByteArray * arr = nullptr;
if(chunkedSize != -1)
{
// transfer-encoding is chunked
@@ -3138,7 +3138,7 @@ void QHttpPrivate::_q_slotReadyRead()
qint64 bytesWritten;
bytesWritten = toDevice->write(*arr, n);
delete arr;
- arr = 0;
+ arr = nullptr;
// if writing to the device does not succeed, quit with error
if(bytesWritten == -1 || bytesWritten < n)
{
@@ -3161,7 +3161,7 @@ void QHttpPrivate::_q_slotReadyRead()
char * ptr = rba.reserve(arr->size());
memcpy(ptr, arr->data(), arr->size());
delete arr;
- arr = 0;
+ arr = nullptr;
#if defined(QHTTP_DEBUG)
qDebug("QHttp::_q_slotReadyRead(): read %lld bytes (%lld bytes done)", n, bytesDone + q->bytesAvailable());
#endif
@@ -3262,7 +3262,7 @@ void QHttpPrivate::closeConn()
if(state == QHttp::Closing || state == QHttp::Unconnected)
return;
- postDevice = 0;
+ postDevice = nullptr;
setState(QHttp::Closing);
// Already closed ?
@@ -3288,7 +3288,7 @@ void QHttpPrivate::setSock(QTcpSocket * sock)
delete socket;
// use the new QTcpSocket socket, or create one if socket is 0.
- deleteSocket = (sock == 0);
+ deleteSocket = (sock == nullptr);
socket = sock;
if(!socket)
{