Merge "Port from QScopedPointer to std::unique_ptr"

This commit is contained in:
Volker Hilsheimer 2021-03-13 00:06:16 +01:00 committed by Qt CI Bot
commit 8962fed044
4 changed files with 18 additions and 6 deletions

View File

@ -49,6 +49,9 @@
QT_BEGIN_NAMESPACE
static_assert(QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
&& sizeof(QScopedPointer<QNetworkAddressEntryPrivate>) == sizeof(std::unique_ptr<QNetworkAddressEntryPrivate>));
static QList<QNetworkInterfacePrivate *> postProcess(QList<QNetworkInterfacePrivate *> list)
{
// Some platforms report a netmask but don't report a broadcast address
@ -204,7 +207,7 @@ QNetworkAddressEntry::QNetworkAddressEntry()
object \a other.
*/
QNetworkAddressEntry::QNetworkAddressEntry(const QNetworkAddressEntry &other)
: d(new QNetworkAddressEntryPrivate(*other.d.data()))
: d(new QNetworkAddressEntryPrivate(*other.d.get()))
{
}
@ -213,7 +216,7 @@ QNetworkAddressEntry::QNetworkAddressEntry(const QNetworkAddressEntry &other)
*/
QNetworkAddressEntry &QNetworkAddressEntry::operator=(const QNetworkAddressEntry &other)
{
*d.data() = *other.d.data();
*d.get() = *other.d.get();
return *this;
}

View File

@ -45,6 +45,8 @@
#include <QtCore/qscopedpointer.h>
#include <QtNetwork/qhostaddress.h>
#include <memory>
#ifndef QT_NO_NETWORKINTERFACE
QT_BEGIN_NAMESPACE
@ -96,7 +98,8 @@ public:
bool isTemporary() const { return !isPermanent(); }
private:
QScopedPointer<QNetworkAddressEntryPrivate> d;
// ### Qt 7: make implicitly shared
std::unique_ptr<QNetworkAddressEntryPrivate> d;
};
Q_DECLARE_SHARED(QNetworkAddressEntry)

View File

@ -68,6 +68,9 @@
QT_BEGIN_NAMESPACE
static_assert(QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
&& sizeof(QScopedPointer<QSslCipherPrivate>) == sizeof(std::unique_ptr<QSslCipherPrivate>));
/*!
Constructs an empty QSslCipher object.
*/
@ -127,7 +130,7 @@ QSslCipher::QSslCipher(const QString &name, QSsl::SslProtocol protocol)
QSslCipher::QSslCipher(const QSslCipher &other)
: d(new QSslCipherPrivate)
{
*d.data() = *other.d.data();
*d.get() = *other.d.get();
}
/*!
@ -143,7 +146,7 @@ QSslCipher::~QSslCipher()
*/
QSslCipher &QSslCipher::operator=(const QSslCipher &other)
{
*d.data() = *other.d.data();
*d.get() = *other.d.get();
return *this;
}

View File

@ -46,6 +46,8 @@
#include <QtCore/qscopedpointer.h>
#include <QtNetwork/qssl.h>
#include <memory>
QT_BEGIN_NAMESPACE
@ -81,7 +83,8 @@ public:
QSsl::SslProtocol protocol() const;
private:
QScopedPointer<QSslCipherPrivate> d;
// ### Qt 7: make implicitly shared
std::unique_ptr<QSslCipherPrivate> d;
friend class QSslSocketBackendPrivate;
};