diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-21 13:57:27 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-21 13:33:06 +0000 |
commit | 28e8aa4027cffc81b1a19b2b06c0d4c4033795fe (patch) | |
tree | c47fc69d7b653c8b7c42be6c2bfb5736d5406e34 /src | |
parent | 280b13ba66e4143ed02433539a612816768a7d2e (diff) | |
download | qtwebsockets-28e8aa4027cffc81b1a19b2b06c0d4c4033795fe.tar.gz |
Fix QScopedPointer usage warnings
Switching to std::unique_ptr since we move the data, and mark move
operators noexcept.
Change-Id: I8548a0a2b07cb5108823a081dd1ea68e4bb1800d
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 53d0cbea2bb1e274876e11cb0c56b414623cfc2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/websockets/qwebsocketcorsauthenticator.cpp | 11 | ||||
-rw-r--r-- | src/websockets/qwebsocketcorsauthenticator.h | 12 |
2 files changed, 9 insertions, 14 deletions
diff --git a/src/websockets/qwebsocketcorsauthenticator.cpp b/src/websockets/qwebsocketcorsauthenticator.cpp index 5d1cde4..4de1922 100644 --- a/src/websockets/qwebsocketcorsauthenticator.cpp +++ b/src/websockets/qwebsocketcorsauthenticator.cpp @@ -122,33 +122,30 @@ QWebSocketCorsAuthenticator::operator =(const QWebSocketCorsAuthenticator &other return *this; } -#ifdef Q_COMPILER_RVALUE_REFS /*! Move-constructs a QWebSocketCorsAuthenticator, making it point at the same object \a other was pointing to. */ -QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(QWebSocketCorsAuthenticator &&other) : - d_ptr(other.d_ptr.take()) +QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(QWebSocketCorsAuthenticator &&other) noexcept : + d_ptr(other.d_ptr.release()) {} /*! Move-assigns \a other to this instance. */ QWebSocketCorsAuthenticator & -QWebSocketCorsAuthenticator::operator =(QWebSocketCorsAuthenticator &&other) +QWebSocketCorsAuthenticator::operator =(QWebSocketCorsAuthenticator &&other) noexcept { qSwap(d_ptr, other.d_ptr); return *this; } -#endif - /*! Swaps \a other with this authenticator. This operation is very fast and never fails. */ -void QWebSocketCorsAuthenticator::swap(QWebSocketCorsAuthenticator &other) +void QWebSocketCorsAuthenticator::swap(QWebSocketCorsAuthenticator &other) noexcept { if (&other != this) qSwap(d_ptr, other.d_ptr); diff --git a/src/websockets/qwebsocketcorsauthenticator.h b/src/websockets/qwebsocketcorsauthenticator.h index b58316a..0185d5a 100644 --- a/src/websockets/qwebsocketcorsauthenticator.h +++ b/src/websockets/qwebsocketcorsauthenticator.h @@ -40,7 +40,7 @@ #define QWEBSOCKETCORSAUTHENTICATOR_H #include "QtWebSockets/qwebsockets_global.h" -#include <QtCore/QScopedPointer> +#include <memory> QT_BEGIN_NAMESPACE @@ -55,12 +55,10 @@ public: ~QWebSocketCorsAuthenticator(); explicit QWebSocketCorsAuthenticator(const QWebSocketCorsAuthenticator &other); -#ifdef Q_COMPILER_RVALUE_REFS - QWebSocketCorsAuthenticator(QWebSocketCorsAuthenticator &&other); - QWebSocketCorsAuthenticator &operator =(QWebSocketCorsAuthenticator &&other); -#endif + QWebSocketCorsAuthenticator(QWebSocketCorsAuthenticator &&other) noexcept; + QWebSocketCorsAuthenticator &operator =(QWebSocketCorsAuthenticator &&other) noexcept; - void swap(QWebSocketCorsAuthenticator &other); + void swap(QWebSocketCorsAuthenticator &other) noexcept; QWebSocketCorsAuthenticator &operator =(const QWebSocketCorsAuthenticator &other); @@ -70,7 +68,7 @@ public: bool allowed() const; private: - QScopedPointer<QWebSocketCorsAuthenticatorPrivate> d_ptr; + std::unique_ptr<QWebSocketCorsAuthenticatorPrivate> d_ptr; }; QT_END_NAMESPACE |