summaryrefslogtreecommitdiffstats
path: root/src/network/ssl
diff options
context:
space:
mode:
authorHarald Fernengel <harald@trolltech.com>2009-08-20 13:56:20 (GMT)
committerHarald Fernengel <harald@trolltech.com>2009-08-20 15:12:18 (GMT)
commitcba8480bb6b2552b20e3d923ea9425291e38c156 (patch)
tree398310f04a3da369c2ee1b3397e2a4443d12d158 /src/network/ssl
parentfe00645222c4a96a966c8f6938286cf136a6377a (diff)
downloadQt-cba8480bb6b2552b20e3d923ea9425291e38c156.zip
Qt-cba8480bb6b2552b20e3d923ea9425291e38c156.tar.gz
Qt-cba8480bb6b2552b20e3d923ea9425291e38c156.tar.bz2
Use QExcplicitlySharedDataPointer
Getting us closer to removing QScopedSharedPointer
Diffstat (limited to 'src/network/ssl')
-rw-r--r--src/network/ssl/qsslcertificate.cpp7
-rw-r--r--src/network/ssl/qsslcertificate.h3
-rw-r--r--src/network/ssl/qsslcertificate_p.h1
-rw-r--r--src/network/ssl/qsslkey.cpp13
-rw-r--r--src/network/ssl/qsslkey.h6
-rw-r--r--src/network/ssl/qsslkey_p.h4
6 files changed, 14 insertions, 20 deletions
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 2ea6d9f..a09b8c43 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -159,9 +159,8 @@ QSslCertificate::QSslCertificate(const QByteArray &data, QSsl::EncodingFormat fo
/*!
Constructs an identical copy of \a other.
*/
-QSslCertificate::QSslCertificate(const QSslCertificate &other) : d(other.d.data())
+QSslCertificate::QSslCertificate(const QSslCertificate &other) : d(other.d)
{
- d->ref.ref();
}
/*!
@@ -177,7 +176,7 @@ QSslCertificate::~QSslCertificate()
*/
QSslCertificate &QSslCertificate::operator=(const QSslCertificate &other)
{
- d.assign(other.d.data());
+ d = other.d;
return *this;
}
@@ -243,7 +242,7 @@ void QSslCertificate::clear()
{
if (isNull())
return;
- d.reset(new QSslCertificatePrivate);
+ d = new QSslCertificatePrivate;
}
/*!
diff --git a/src/network/ssl/qsslcertificate.h b/src/network/ssl/qsslcertificate.h
index a62412e..d664434 100644
--- a/src/network/ssl/qsslcertificate.h
+++ b/src/network/ssl/qsslcertificate.h
@@ -47,6 +47,7 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qcryptographichash.h>
#include <QtCore/qregexp.h>
+#include <QtCore/qsharedpointer.h>
#include <QtNetwork/qssl.h>
typedef struct x509_st X509; // ### check if this works
@@ -118,7 +119,7 @@ public:
Qt::HANDLE handle() const;
private:
- QScopedSharedPointer<QSslCertificatePrivate> d;
+ QExplicitlySharedDataPointer<QSslCertificatePrivate> d;
friend class QSslCertificatePrivate;
friend class QSslSocketBackendPrivate;
};
diff --git a/src/network/ssl/qsslcertificate_p.h b/src/network/ssl/qsslcertificate_p.h
index bae5ad8..0a5bc54 100644
--- a/src/network/ssl/qsslcertificate_p.h
+++ b/src/network/ssl/qsslcertificate_p.h
@@ -71,7 +71,6 @@ public:
: null(true), x509(0)
{
QSslSocketPrivate::ensureInitialized();
- ref = 1;
}
~QSslCertificatePrivate()
diff --git a/src/network/ssl/qsslkey.cpp b/src/network/ssl/qsslkey.cpp
index 474e5ee..fceeb84 100644
--- a/src/network/ssl/qsslkey.cpp
+++ b/src/network/ssl/qsslkey.cpp
@@ -269,9 +269,8 @@ QSslKey::QSslKey(QIODevice *device, QSsl::KeyAlgorithm algorithm, QSsl::Encoding
/*!
Constructs an identical copy of \a other.
*/
-QSslKey::QSslKey(const QSslKey &other) : d(other.d.data())
+QSslKey::QSslKey(const QSslKey &other) : d(other.d)
{
- d->ref.ref();
}
/*!
@@ -289,7 +288,7 @@ QSslKey::~QSslKey()
*/
QSslKey &QSslKey::operator=(const QSslKey &other)
{
- d.assign(other.d.data());
+ d = other.d;
return *this;
}
@@ -310,13 +309,7 @@ bool QSslKey::isNull() const
*/
void QSslKey::clear()
{
- d.reset(new QSslKeyPrivate);
-
- //### old code: is this really correct???
- //if (!d->ref.deref()) {
- // delete d;
- // d = new QSslKeyPrivate;
- //}
+ d = new QSslKeyPrivate;
}
/*!
diff --git a/src/network/ssl/qsslkey.h b/src/network/ssl/qsslkey.h
index 5132dae..d5a85b3 100644
--- a/src/network/ssl/qsslkey.h
+++ b/src/network/ssl/qsslkey.h
@@ -45,7 +45,7 @@
#include <QtCore/qnamespace.h>
#include <QtCore/qbytearray.h>
-#include <QtCore/qscopedpointer.h>
+#include <QtCore/qsharedpointer.h>
#include <QtNetwork/qssl.h>
QT_BEGIN_HEADER
@@ -59,7 +59,7 @@ QT_MODULE(Network)
template <typename A, typename B> struct QPair;
class QIODevice;
-
+
class QSslKeyPrivate;
class Q_NETWORK_EXPORT QSslKey
{
@@ -93,7 +93,7 @@ public:
inline bool operator!=(const QSslKey &key) const { return !operator==(key); }
private:
- QScopedSharedPointer<QSslKeyPrivate> d;
+ QExplicitlySharedDataPointer<QSslKeyPrivate> d;
friend class QSslCertificate;
};
diff --git a/src/network/ssl/qsslkey_p.h b/src/network/ssl/qsslkey_p.h
index fe7f198..df5d7b2 100644
--- a/src/network/ssl/qsslkey_p.h
+++ b/src/network/ssl/qsslkey_p.h
@@ -69,7 +69,6 @@ public:
, dsa(0)
{
clear();
- ref = 1;
}
inline ~QSslKeyPrivate()
@@ -91,6 +90,9 @@ public:
DSA *dsa;
QAtomicInt ref;
+
+private:
+ Q_DISABLE_COPY(QSslKeyPrivate)
};
QT_END_NAMESPACE