diff options
author | Marc Mutz <[email protected]> | 2023-07-04 14:40:10 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2023-07-04 18:16:37 +0200 |
commit | 5b7c8eb9849855fac16d91c47803d0ef16a8e9a8 (patch) | |
tree | fa48e7a2b20188b6de114b5ffef2d1750c5ced2e | |
parent | f0ae4b07ebb3c86a6bc6ca0e375c06cd51f45324 (diff) |
QtNetwork: replace clashing statics with lambdas I: downloadBufferDeleter
Detected with -unity-build-batch-size 103.
Pick-to: 6.6 6.5
Task-number: QTBUG-115031
Change-Id: Ia67082efbdb3f403a8c8010ec15f9f796f97feb6
Reviewed-by: MÃ¥rten Nordheim <[email protected]>
-rw-r--r-- | src/network/access/qhttpthreaddelegate.cpp | 7 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyimpl.cpp | 7 |
2 files changed, 2 insertions, 12 deletions
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp index c5c35d522a3..261a1eccd67 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<char>(buf, downloadBufferDeleter); + downloadBuffer = QSharedPointer<char>(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 2c713e69fd5..8b2acfdb4e8 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<char>(downloadBuffer, downloadBufferDeleter); + downloadBufferPointer = QSharedPointer<char>(downloadBuffer, [](auto p) { delete[] p; }); q->setAttribute(QNetworkRequest::DownloadBufferAttribute, QVariant::fromValue<QSharedPointer<char> > (downloadBufferPointer)); } |