diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp index c5c35d522a..261a1eccd6 100644 --- a/src/network/access/qhttpthreaddelegate.cpp +++ b/src/network/access/qhttpthreaddelegate.cpp @@ -567,11 +567,6 @@ void QHttpThreadDelegate::synchronousFinishedWithErrorSlot(QNetworkReply::Networ httpReply = nullptr; } -static void downloadBufferDeleter(char *ptr) -{ - delete[] ptr; -} - void QHttpThreadDelegate::headerChangedSlot() { if (!httpReply) @@ -592,7 +587,7 @@ void QHttpThreadDelegate::headerChangedSlot() QT_TRY { char *buf = new char[httpReply->contentLength()]; // throws if allocation fails if (buf) { - downloadBuffer = QSharedPointer(buf, downloadBufferDeleter); + downloadBuffer = QSharedPointer(buf, [](auto p) { delete[] p; }); httpReply->setUserProvidedDownloadBuffer(buf); } } QT_CATCH(const std::bad_alloc &) { diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 2c713e69fd..8b2acfdb4e 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -519,11 +519,6 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QIODevice *data) _q_copyReadyRead(); } -static void downloadBufferDeleter(char *ptr) -{ - delete[] ptr; -} - char* QNetworkReplyImplPrivate::getDownloadBuffer(qint64 size) { Q_Q(QNetworkReplyImpl); @@ -536,7 +531,7 @@ char* QNetworkReplyImplPrivate::getDownloadBuffer(qint64 size) downloadBufferCurrentSize = 0; downloadBufferMaximumSize = size; downloadBuffer = new char[downloadBufferMaximumSize]; // throws if allocation fails - downloadBufferPointer = QSharedPointer(downloadBuffer, downloadBufferDeleter); + downloadBufferPointer = QSharedPointer(downloadBuffer, [](auto p) { delete[] p; }); q->setAttribute(QNetworkRequest::DownloadBufferAttribute, QVariant::fromValue > (downloadBufferPointer)); }