mostly manual d pointer management

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-11-01 17:38:09 +00:00
parent c5b8c07f7e
commit 83625c5cf5
50 changed files with 122 additions and 108 deletions

View file

@ -42,6 +42,7 @@
#include "qthreadpool.h"
#include "qthreadpool_p.h"
#include "qelapsedtimer.h"
#include "qscopedpointer.h"
#ifndef QT_NO_THREAD

View file

@ -362,6 +362,7 @@ QAbstractFileEngine::QAbstractFileEngine(QAbstractFileEnginePrivate &dd) : d_ptr
*/
QAbstractFileEngine::~QAbstractFileEngine()
{
delete d_ptr;
}
/*!
@ -889,6 +890,7 @@ QAbstractFileEngineIterator::QAbstractFileEngineIterator(QDir::Filters filters,
*/
QAbstractFileEngineIterator::~QAbstractFileEngineIterator()
{
delete d;
}
/*!

View file

@ -190,7 +190,7 @@ protected:
QAbstractFileEngine();
QAbstractFileEngine(QAbstractFileEnginePrivate &);
QScopedPointer<QAbstractFileEnginePrivate> d_ptr;
QAbstractFileEnginePrivate* d_ptr;
private:
Q_DECLARE_PRIVATE(QAbstractFileEngine)
Q_DISABLE_COPY(QAbstractFileEngine)
@ -234,7 +234,7 @@ private:
friend class QDirIterator;
friend class QDirIteratorPrivate;
void setPath(const QString &path);
QScopedPointer<QAbstractFileEngineIteratorPrivate> d;
QAbstractFileEngineIteratorPrivate* d;
};
QT_END_NAMESPACE

View file

@ -260,6 +260,7 @@ QT_BEGIN_NAMESPACE
QDataStream::QDataStream()
{
d = Q_NULLPTR;
dev = 0;
owndev = false;
byteorder = BigEndian;
@ -280,9 +281,10 @@ QDataStream::QDataStream()
\sa setDevice(), device()
*/
QDataStream::QDataStream(QIODevice *d)
QDataStream::QDataStream(QIODevice *device)
{
dev = d; // set device
d = Q_NULLPTR;
dev = device; // set device
owndev = false;
byteorder = BigEndian; // default byte order
ver = QDataStream::Qt_Default;
@ -306,6 +308,7 @@ QDataStream::QDataStream(QIODevice *d)
QDataStream::QDataStream(QByteArray *a, QIODevice::OpenMode flags)
{
d = Q_NULLPTR;
QBuffer *buf = new QBuffer(a);
#ifndef QT_NO_QOBJECT
buf->blockSignals(true);
@ -329,6 +332,7 @@ QDataStream::QDataStream(QByteArray *a, QIODevice::OpenMode flags)
*/
QDataStream::QDataStream(const QByteArray &a)
{
d = Q_NULLPTR;
QBuffer *buf = new QBuffer;
#ifndef QT_NO_QOBJECT
buf->blockSignals(true);
@ -356,6 +360,7 @@ QDataStream::~QDataStream()
{
if (owndev)
delete dev;
delete d;
}
@ -433,7 +438,7 @@ QDataStream::FloatingPointPrecision QDataStream::floatingPointPrecision() const
void QDataStream::setFloatingPointPrecision(QDataStream::FloatingPointPrecision precision)
{
if (d == 0)
d.reset(new QDataStreamPrivate());
d = new QDataStreamPrivate();
d->floatingPointPrecision = precision;
}

View file

@ -161,7 +161,7 @@ public:
private:
Q_DISABLE_COPY(QDataStream)
QScopedPointer<QDataStreamPrivate> d;
QDataStreamPrivate* d;
QIODevice *dev;
bool owndev;

View file

@ -57,6 +57,7 @@
#include "qfilesystementry_p.h"
#include "qfilesystemmetadata_p.h"
#include "qfilesystemengine_p.h"
#include "qscopedpointer.h"
#ifdef QT_BUILD_CORE_LIB
# include "qresource.h"
@ -82,6 +83,7 @@ QDirPrivate::QDirPrivate(const QString &path, const QStringList &nameFilters_, Q
, nameFilters(nameFilters_)
, sort(sort_)
, filters(filters_)
, fileEngine(Q_NULLPTR)
, fileListsInitialized(false)
{
setPath(path.isEmpty() ? QString::fromLatin1(".") : path);
@ -105,15 +107,21 @@ QDirPrivate::QDirPrivate(const QDirPrivate &copy)
, nameFilters(copy.nameFilters)
, sort(copy.sort)
, filters(copy.filters)
, fileEngine(0)
, fileListsInitialized(false)
, dirEntry(copy.dirEntry)
, metaData(copy.metaData)
{
}
QDirPrivate::~QDirPrivate()
{
delete fileEngine;
}
bool QDirPrivate::exists() const
{
if (fileEngine.isNull()) {
if (!fileEngine) {
QFileSystemEngine::fillMetaData(dirEntry, metaData,
QFileSystemMetaData::ExistsAttribute | QFileSystemMetaData::DirectoryType); // always stat
return metaData.exists() && metaData.isDirectory();
@ -175,7 +183,7 @@ inline void QDirPrivate::resolveAbsoluteEntry() const
return;
QString absoluteName;
if (fileEngine.isNull()) {
if (!fileEngine) {
if (!dirEntry.isRelative() && dirEntry.isClean()) {
absoluteDirEntry = dirEntry;
return;
@ -315,7 +323,8 @@ inline void QDirPrivate::initFileLists(const QDir &dir) const
inline void QDirPrivate::initFileEngine()
{
fileEngine.reset(QFileSystemEngine::resolveEntryAndCreateLegacyEngine(dirEntry, metaData));
delete fileEngine;
fileEngine = QFileSystemEngine::resolveEntryAndCreateLegacyEngine(dirEntry, metaData);
}
/*!
@ -611,7 +620,7 @@ QString QDir::absolutePath() const
QString QDir::canonicalPath() const
{
const QDirPrivate* d = d_ptr.constData();
if (d->fileEngine.isNull()) {
if (!d->fileEngine) {
QFileSystemEntry answer = QFileSystemEngine::canonicalName(d->dirEntry, d->metaData);
return answer.filePath();
}
@ -1261,7 +1270,7 @@ bool QDir::mkdir(const QString &dirName) const
const QDirPrivate* d = d_ptr.constData();
QString fn = filePath(dirName);
if (d->fileEngine.isNull())
if (!d->fileEngine)
return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), false);
return d->fileEngine->mkdir(fn, false);
}
@ -1285,7 +1294,7 @@ bool QDir::rmdir(const QString &dirName) const
const QDirPrivate* d = d_ptr.constData();
QString fn = filePath(dirName);
if (d->fileEngine.isNull())
if (!d->fileEngine)
return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), false);
return d->fileEngine->rmdir(fn, false);
@ -1314,7 +1323,7 @@ bool QDir::mkpath(const QString &dirPath) const
const QDirPrivate* d = d_ptr.constData();
QString fn = filePath(dirPath);
if (d->fileEngine.isNull())
if (!d->fileEngine)
return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), true);
return d->fileEngine->mkdir(fn, true);
}
@ -1340,7 +1349,7 @@ bool QDir::rmpath(const QString &dirPath) const
const QDirPrivate* d = d_ptr.constData();
QString fn = filePath(dirPath);
if (d->fileEngine.isNull())
if (!d->fileEngine)
return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), true);
return d->fileEngine->rmdir(fn, true);
}
@ -1358,7 +1367,7 @@ bool QDir::isReadable() const
{
const QDirPrivate* d = d_ptr.constData();
if (d->fileEngine.isNull()) {
if (!d->fileEngine) {
if (!d->metaData.hasFlags(QFileSystemMetaData::UserReadPermission))
QFileSystemEngine::fillMetaData(d->dirEntry, d->metaData, QFileSystemMetaData::UserReadPermission);
@ -1403,7 +1412,7 @@ bool QDir::exists() const
*/
bool QDir::isRoot() const
{
if (d_ptr->fileEngine.isNull())
if (!d_ptr->fileEngine)
return d_ptr->dirEntry.isRoot();
return d_ptr->fileEngine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::RootFlag;
}
@ -1435,7 +1444,7 @@ bool QDir::isRoot() const
*/
bool QDir::isRelative() const
{
if (d_ptr->fileEngine.isNull())
if (!d_ptr->fileEngine)
return d_ptr->dirEntry.isRelative();
return d_ptr->fileEngine->isRelativePath();
}
@ -1452,7 +1461,7 @@ bool QDir::makeAbsolute()
{
const QDirPrivate *d = d_ptr.constData();
QScopedPointer<QDirPrivate> dir;
if (!d->fileEngine.isNull()) {
if (d->fileEngine) {
QString absolutePath = d->fileEngine->fileName(QAbstractFileEngine::AbsoluteName);
if (QDir::isRelativePath(absolutePath))
return false;
@ -1485,8 +1494,8 @@ bool QDir::operator==(const QDir &dir) const
if (d == other)
return true;
Qt::CaseSensitivity sensitive;
if (d->fileEngine.isNull() || other->fileEngine.isNull()) {
if (d->fileEngine.data() != other->fileEngine.data()) // one is native, the other is a custom file-engine
if (!d->fileEngine || !other->fileEngine) {
if (d->fileEngine != other->fileEngine) // one is native, the other is a custom file-engine
return false;
sensitive = QFileSystemEngine::isCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive;

View file

@ -55,6 +55,7 @@ public:
QDir::Filters filters_ = QDir::AllEntries);
QDirPrivate(const QDirPrivate &copy);
~QDirPrivate();
bool exists() const;
@ -78,7 +79,7 @@ public:
QDir::Filters filters;
QScopedPointer<QAbstractFileEngine> fileEngine;
QAbstractFileEngine* fileEngine;
mutable bool fileListsInitialized;
mutable QStringList files;

View file

@ -406,11 +406,12 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
\sa hasNext(), next(), IteratorFlags
*/
QDirIterator::QDirIterator(const QDir &dir, IteratorFlags flags)
: d(Q_NULLPTR)
{
// little trick to get hold of the QDirPrivate while there is no API on QDir to give it to us
class MyQDir : public QDir { public: const QDirPrivate *priv() const { return d_ptr.constData(); } };
const QDirPrivate *other = static_cast<const MyQDir*>(&dir)->priv();
d.reset(new QDirIteratorPrivate(other->dirEntry, other->nameFilters, other->filters, flags, !other->fileEngine.isNull()));
d = new QDirIteratorPrivate(other->dirEntry, other->nameFilters, other->filters, flags, other->fileEngine);
}
/*!
@ -472,6 +473,7 @@ QDirIterator::QDirIterator(const QString &path, const QStringList &nameFilters,
*/
QDirIterator::~QDirIterator()
{
delete d;
}
/*!

View file

@ -83,7 +83,7 @@ public:
private:
Q_DISABLE_COPY(QDirIterator)
QScopedPointer<QDirIteratorPrivate> d;
QDirIteratorPrivate* d;
friend class QDir;
};

View file

@ -111,6 +111,11 @@ public:
metaData = QFileSystemMetaData();
}
inline ~QFileInfoPrivate()
{
delete fileEngine;
}
inline void clearFlags() const {
fileFlags = 0;
cachedFlags = 0;
@ -134,7 +139,7 @@ public:
QFileSystemEntry fileEntry;
mutable QFileSystemMetaData metaData;
QScopedPointer<QAbstractFileEngine> const fileEngine;
QAbstractFileEngine* const fileEngine;
mutable QString fileNames[QAbstractFileEngine::NFileNames];
mutable QString fileOwners[2];

View file

@ -50,19 +50,21 @@ QT_BEGIN_NAMESPACE
QFSFileEngineIterator::QFSFileEngineIterator(QDir::Filters filters, const QStringList &filterNames)
: QAbstractFileEngineIterator(filters, filterNames)
, nativeIterator(Q_NULLPTR)
, done(false)
{
}
QFSFileEngineIterator::~QFSFileEngineIterator()
{
delete nativeIterator;
}
bool QFSFileEngineIterator::hasNext() const
{
if (!done && !nativeIterator) {
nativeIterator.reset(new QFileSystemIterator(QFileSystemEntry(path()),
filters(), nameFilters()));
nativeIterator = new QFileSystemIterator(QFileSystemEntry(path()),
filters(), nameFilters());
advance();
}
@ -88,7 +90,8 @@ void QFSFileEngineIterator::advance() const
nextInfo = QFileInfo(new QFileInfoPrivate(entry, data));
} else {
done = true;
nativeIterator.reset();
delete nativeIterator;
nativeIterator = Q_NULLPTR;
}
}

View file

@ -79,7 +79,7 @@ public:
private:
void advance() const;
mutable QScopedPointer<QFileSystemIterator> nativeIterator;
mutable QFileSystemIterator* nativeIterator;
mutable QFileInfo currentInfo;
mutable QFileInfo nextInfo;
mutable bool done;

View file

@ -405,6 +405,9 @@ QIODevice::~QIODevice()
#if defined QIODEVICE_DEBUG
printf("%p QIODevice::~QIODevice()\n", this);
#endif
#ifdef QT_NO_QOBJECT
delete d_ptr;
#endif
}
/*!

View file

@ -46,7 +46,6 @@
#include <QtCore/qobject.h>
#else
#include <QtCore/qobjectdefs.h>
#include <QtCore/qscopedpointer.h>
#endif
#include <QtCore/qstring.h>
@ -160,7 +159,7 @@ protected:
void setErrorString(const QString &errorString);
#ifdef QT_NO_QOBJECT
QScopedPointer<QIODevicePrivate> d_ptr;
QIODevicePrivate* d_ptr;
#endif
private:

View file

@ -88,7 +88,7 @@ protected:
QStringList children() const;
protected:
QScopedPointer<QResourcePrivate> d_ptr;
QResourcePrivate* d_ptr;
private:
Q_DECLARE_PRIVATE(QResource)

View file

@ -2472,6 +2472,7 @@ QSettings::~QSettings()
; // ok. then don't flush but at least don't throw in the destructor
}
}
delete d_ptr;
}
/*!

View file

@ -72,7 +72,7 @@ class Q_CORE_EXPORT QSettings
#ifndef QT_NO_QOBJECT
Q_OBJECT
#else
QScopedPointer<QSettingsPrivate> d_ptr;
QSettingsPrivate* d_ptr;
#endif
Q_DECLARE_PRIVATE(QSettings)

View file

@ -1109,6 +1109,7 @@ QTextStream::~QTextStream()
#endif
if (!d->writeBuffer.isEmpty())
d->flushWriteBuffer();
delete d_ptr;
}
/*!

View file

@ -191,7 +191,7 @@ private:
Q_DISABLE_COPY(QTextStream)
QScopedPointer<QTextStreamPrivate> d_ptr;
QTextStreamPrivate* d_ptr;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QTextStream::NumberFlags)

View file

@ -65,6 +65,7 @@
#include <qfunctions_p.h>
#include <qlocale_p.h>
#include <qmutexpool_p.h>
#include <qscopedpointer.h>
#if !defined(QT_NO_GLIB)
# include "qeventdispatcher_glib_p.h"

View file

@ -560,7 +560,7 @@ QObject::QObject(QObject *parent)
: d_ptr(new QObjectPrivate)
{
Q_D(QObject);
d_ptr->q_ptr = this;
d->q_ptr = this;
d->threadData = (parent && !parent->thread()) ? parent->d_func()->threadData : QThreadData::current();
d->threadData->ref();
if (parent) {
@ -583,7 +583,7 @@ QObject::QObject(QObjectPrivate &dd, QObject *parent)
: d_ptr(&dd)
{
Q_D(QObject);
d_ptr->q_ptr = this;
d->q_ptr = this;
d->threadData = (parent && !parent->thread()) ? parent->d_func()->threadData : QThreadData::current();
d->threadData->ref();
if (parent) {
@ -744,6 +744,8 @@ QObject::~QObject()
if (d->parent) // remove it from parent object
d->setParent_helper(0);
delete d_ptr;
}
QObjectPrivate::Connection::~Connection()

View file

@ -47,9 +47,9 @@
#include <QtCore/qobjectdefs.h>
#include <QtCore/qstring.h>
#include <QtCore/qlist.h>
#include <QtCore/qscopedpointer.h>
#ifdef QT_INCLUDE_COMPAT
#include <QtCore/qscopedpointer.h>
#include <QtCore/qcoreevent.h>
#endif
@ -233,12 +233,9 @@ protected:
virtual void connectNotify(const char *signal);
virtual void disconnectNotify(const char *signal);
protected:
QObject(QObjectPrivate &dd, QObject *parent = 0);
protected:
QScopedPointer<QObjectData> d_ptr;
QObjectData* d_ptr;
static const QMetaObject staticQtMetaObject;

View file

@ -181,6 +181,7 @@ QSystemSemaphore::QSystemSemaphore(const QString &key, int initialValue, AccessM
QSystemSemaphore::~QSystemSemaphore()
{
d->cleanHandle();
delete d;
}
/*!

View file

@ -43,7 +43,6 @@
#define QSYSTEMSEMAPHORE_H
#include <QtCore/qstring.h>
#include <QtCore/qscopedpointer.h>
QT_BEGIN_HEADER
@ -89,7 +88,7 @@ public:
private:
Q_DISABLE_COPY(QSystemSemaphore)
QScopedPointer<QSystemSemaphorePrivate> d;
QSystemSemaphorePrivate* d;
};
#endif // QT_NO_SYSTEMSEMAPHORE

View file

@ -45,10 +45,11 @@
#include "qmutexpool_p.h"
#include "qreadwritelock.h"
#include "qabstracteventdispatcher.h"
#include <qeventloop.h>
#include <qhash.h>
#include "qeventloop.h"
#include "qhash.h"
#include "qthread_p.h"
#include "qcoreapplication_p.h"
#include "qscopedpointer.h"
QT_BEGIN_NAMESPACE

View file

@ -53,6 +53,7 @@
#include "qstringmatcher.h"
#include "qvector.h"
#include "qfunctions_p.h"
#include "qscopedpointer.h"
#include <limits.h>

View file

@ -426,6 +426,7 @@ QXmlStreamReader::~QXmlStreamReader()
Q_D(QXmlStreamReader);
if (d->deleteDevice)
delete d->device;
delete d_ptr;
}
/*! \fn bool QXmlStreamReader::hasError() const
@ -3225,6 +3226,7 @@ QXmlStreamWriter::QXmlStreamWriter(QString *string)
*/
QXmlStreamWriter::~QXmlStreamWriter()
{
delete d_ptr;
}

View file

@ -339,7 +339,7 @@ public:
private:
Q_DISABLE_COPY(QXmlStreamReader)
Q_DECLARE_PRIVATE(QXmlStreamReader)
QScopedPointer<QXmlStreamReaderPrivate> d_ptr;
QXmlStreamReaderPrivate* d_ptr;
};
#endif // QT_NO_XMLSTREAMREADER
@ -414,7 +414,7 @@ public:
private:
Q_DISABLE_COPY(QXmlStreamWriter)
Q_DECLARE_PRIVATE(QXmlStreamWriter)
QScopedPointer<QXmlStreamWriterPrivate> d_ptr;
QXmlStreamWriterPrivate* d_ptr;
};
#endif // QT_NO_XMLSTREAMWRITER

View file

@ -277,7 +277,7 @@ void QDBusAdaptorConnector::polish()
void QDBusAdaptorConnector::relaySlot(void **argv)
{
QObjectPrivate *d = static_cast<QObjectPrivate *>(d_ptr.data());
QObjectPrivate *d = static_cast<QObjectPrivate *>(d_ptr);
if (Q_LIKELY(d->currentSender)) {
relay(d->currentSender->sender, d->currentSender->signal, argv);
} else {

View file

@ -1488,7 +1488,7 @@ QGraphicsItem::~QGraphicsItem()
if (d_ptr->transformData) {
for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) {
QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i);
static_cast<QGraphicsTransformPrivate *>(t->d_ptr.data())->item = 0;
static_cast<QGraphicsTransformPrivate *>(t->d_ptr)->item = 0;
delete t;
}
}

View file

@ -332,7 +332,7 @@ public:
*/
inline bool isPersistent(const QModelIndex &index) const
{
return static_cast<QAbstractItemModelPrivate *>(model->d_ptr.data())->persistent.indexes.contains(index);
return static_cast<QAbstractItemModelPrivate *>(model->d_ptr)->persistent.indexes.contains(index);
}
QModelIndexList selectedDraggableIndexes() const;

View file

@ -857,7 +857,7 @@ void QTreeModel::sortItems(QList<QTreeWidgetItem*> *items, int column, Qt::SortO
items->replace(r, item);
for (int c = 0; c < colCount; ++c) {
QModelIndex from = createIndex(oldRow, c, item);
if (static_cast<QAbstractItemModelPrivate *>(d_ptr.data())->persistent.indexes.contains(from)) {
if (static_cast<QAbstractItemModelPrivate *>(d_ptr)->persistent.indexes.contains(from)) {
QModelIndex to = createIndex(r, c, item);
fromList << from;
toList << to;

View file

@ -2119,7 +2119,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
//If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture
QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent);
if (scrollArea && scrollArea->viewport() == q) {
QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr.data();
QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr;
QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate);
oldBrushOrigin = painter->brushOrigin();
resetBrushOrigin = true;

View file

@ -50,6 +50,7 @@
#include <qendian.h>
#include <qdebug.h>
#include <qdir.h>
#include <qscopedpointer.h>
#if 0
#define ZDEBUG qDebug

View file

@ -619,6 +619,7 @@ QHttpHeader::QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header)
*/
QHttpHeader::~QHttpHeader()
{
delete d_ptr;
}
/*!

View file

@ -46,7 +46,6 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qmap.h>
#include <QtCore/qpair.h>
#include <QtCore/qscopedpointer.h>
QT_BEGIN_HEADER
@ -108,7 +107,7 @@ protected:
QHttpHeader(QHttpHeaderPrivate &dd, const QString &str = QString());
QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header);
QScopedPointer<QHttpHeaderPrivate> d_ptr;
QHttpHeaderPrivate* d_ptr;
private:
Q_DECLARE_PRIVATE(QHttpHeader)

View file

@ -486,7 +486,7 @@ QHostAddress::QHostAddress(const struct sockaddr *sockaddr)
Constructs a copy of the given \a address.
*/
QHostAddress::QHostAddress(const QHostAddress &address)
: d(new QHostAddressPrivate(*address.d.data()))
: d(new QHostAddressPrivate(*address.d))
{
}
@ -522,6 +522,7 @@ QHostAddress::QHostAddress(SpecialAddress address)
*/
QHostAddress::~QHostAddress()
{
delete d;
}
/*!
@ -530,7 +531,7 @@ QHostAddress::~QHostAddress()
*/
QHostAddress &QHostAddress::operator=(const QHostAddress &address)
{
*d.data() = *address.d.data();
d = address.d;
return *this;
}

View file

@ -44,7 +44,6 @@
#include <QtCore/qpair.h>
#include <QtCore/qstring.h>
#include <QtCore/qscopedpointer.h>
#include <QtNetwork/qabstractsocket.h>
struct sockaddr;
@ -122,7 +121,7 @@ public:
static QPair<QHostAddress, int> parseSubnet(const QString &subnet);
protected:
QScopedPointer<QHostAddressPrivate> d;
QHostAddressPrivate* d;
};
inline bool operator ==(QHostAddress::SpecialAddress address1, const QHostAddress &address2)

View file

@ -293,7 +293,7 @@ QHostInfo::QHostInfo(int id)
Constructs a copy of \a other.
*/
QHostInfo::QHostInfo(const QHostInfo &other)
: d(new QHostInfoPrivate(*other.d.data()))
: d(new QHostInfoPrivate(*other.d))
{
}
@ -303,7 +303,7 @@ QHostInfo::QHostInfo(const QHostInfo &other)
*/
QHostInfo &QHostInfo::operator=(const QHostInfo &other)
{
*d.data() = *other.d.data();
d = other.d;
return *this;
}
@ -312,6 +312,7 @@ QHostInfo &QHostInfo::operator=(const QHostInfo &other)
*/
QHostInfo::~QHostInfo()
{
delete d;
}
/*!

View file

@ -43,7 +43,6 @@
#define QHOSTINFO_H
#include <QtCore/qlist.h>
#include <QtCore/qscopedpointer.h>
#include <QtNetwork/qhostaddress.h>
QT_BEGIN_HEADER
@ -91,7 +90,7 @@ public:
static QString localDomainName();
private:
QScopedPointer<QHostInfoPrivate> d;
QHostInfoPrivate* d;
};
QT_END_NAMESPACE

View file

@ -165,7 +165,7 @@ QNetworkAddressEntry::QNetworkAddressEntry()
object \a other.
*/
QNetworkAddressEntry::QNetworkAddressEntry(const QNetworkAddressEntry &other)
: d(new QNetworkAddressEntryPrivate(*other.d.data()))
: d(new QNetworkAddressEntryPrivate(*other.d))
{
}
@ -174,7 +174,7 @@ QNetworkAddressEntry::QNetworkAddressEntry(const QNetworkAddressEntry &other)
*/
QNetworkAddressEntry &QNetworkAddressEntry::operator=(const QNetworkAddressEntry &other)
{
*d.data() = *other.d.data();
d = other.d;
return *this;
}
@ -183,6 +183,7 @@ QNetworkAddressEntry &QNetworkAddressEntry::operator=(const QNetworkAddressEntry
*/
QNetworkAddressEntry::~QNetworkAddressEntry()
{
delete d;
}
/*!

View file

@ -43,7 +43,6 @@
#define QNETWORKINTERFACE_H
#include <QtCore/qshareddata.h>
#include <QtCore/qscopedpointer.h>
#include <QtNetwork/qhostaddress.h>
#ifndef QT_NO_NETWORKINTERFACE
@ -79,7 +78,7 @@ public:
void setBroadcast(const QHostAddress &newBroadcast);
private:
QScopedPointer<QNetworkAddressEntryPrivate> d;
QNetworkAddressEntryPrivate* d;
};
class QNetworkInterfacePrivate;

View file

@ -58,6 +58,7 @@
#include "qendian.h"
#include "qnetworkinterface.h"
#include "qnetworkcommon_p.h"
#include "qscopedpointer.h"
QT_BEGIN_NAMESPACE

View file

@ -103,7 +103,7 @@ QSslCipher::QSslCipher(const QString &name, QSsl::SslProtocol protocol)
QSslCipher::QSslCipher(const QSslCipher &other)
: d(new QSslCipherPrivate)
{
*d.data() = *other.d.data();
d = other.d;
}
/*!
@ -111,6 +111,7 @@ QSslCipher::QSslCipher(const QSslCipher &other)
*/
QSslCipher::~QSslCipher()
{
delete d;
}
/*!
@ -119,7 +120,7 @@ QSslCipher::~QSslCipher()
*/
QSslCipher &QSslCipher::operator=(const QSslCipher &other)
{
*d.data() = *other.d.data();
d = other.d;
return *this;
}

View file

@ -44,7 +44,6 @@
#define QSSLCIPHER_H
#include <QtCore/qstring.h>
#include <QtCore/qscopedpointer.h>
#include <QtNetwork/qssl.h>
QT_BEGIN_HEADER
@ -75,7 +74,7 @@ public:
QSsl::SslProtocol protocol() const;
private:
QScopedPointer<QSslCipherPrivate> d;
QSslCipherPrivate* d;
friend class QSslSocketBackendPrivate;
};

View file

@ -107,34 +107,8 @@ public:
};
/*!
Constructs a QSslError object with no error and default certificate.
*/
// RVCT compiler in debug build does not like about default values in const-
// So as an workaround we define all constructor overloads here explicitly
QSslError::QSslError()
: d(new QSslErrorPrivate)
{
d->error = QSslError::NoError;
d->certificate = QSslCertificate();
}
/*!
Constructs a QSslError object. The argument specifies the \a
error that occurred.
*/
QSslError::QSslError(SslError error)
: d(new QSslErrorPrivate)
{
d->error = error;
d->certificate = QSslCertificate();
}
/*!
Constructs a QSslError object. The two arguments specify the \a
error that occurred, and which \a certificate the error relates to.
Constructs a QSslError object. The two arguments specify the
\a error that occurred, and which \a certificate the error relates to.
\sa QSslCertificate
*/
@ -151,7 +125,7 @@ QSslError::QSslError(SslError error, const QSslCertificate &certificate)
QSslError::QSslError(const QSslError &other)
: d(new QSslErrorPrivate)
{
*d.data() = *other.d.data();
d = other.d;
}
/*!
@ -159,6 +133,7 @@ QSslError::QSslError(const QSslError &other)
*/
QSslError::~QSslError()
{
delete d;
}
/*!
@ -168,7 +143,7 @@ QSslError::~QSslError()
*/
QSslError &QSslError::operator=(const QSslError &other)
{
*d.data() = *other.d.data();
d = other.d;
return *this;
}

View file

@ -83,11 +83,7 @@ public:
UnspecifiedError = -1
};
// RVCT compiler in debug build does not like about default values in const-
// So as an workaround we define all constructor overloads here explicitly
QSslError();
QSslError(SslError error);
QSslError(SslError error, const QSslCertificate &certificate);
QSslError(SslError error = QSslError::NoError, const QSslCertificate &certificate = QSslCertificate());
QSslError(const QSslError &other);
@ -100,9 +96,9 @@ public:
SslError error() const;
QString errorString() const;
QSslCertificate certificate() const;
private:
QScopedPointer<QSslErrorPrivate> d;
QSslErrorPrivate* d;
};
#ifndef QT_NO_DEBUG_STREAM

View file

@ -87,6 +87,7 @@ QtGradientStop::QtGradientStop(QtGradientStopsModel *model)
QtGradientStop::~QtGradientStop()
{
delete d_ptr;
}
class QtGradientStopsModelPrivate
@ -112,6 +113,7 @@ QtGradientStopsModel::QtGradientStopsModel(QObject *parent)
QtGradientStopsModel::~QtGradientStopsModel()
{
clear();
delete d_ptr;
}
QtGradientStopsModel::PositionStopMap QtGradientStopsModel::stops() const

View file

@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
class QColor;
class QtGradientStopsModel;
class QtGradientStopPrivate;
class QtGradientStopsModelPrivate;
class QtGradientStop
{
@ -64,7 +66,7 @@ private:
friend class QtGradientStopsModel;
QtGradientStop(QtGradientStopsModel *model = 0);
~QtGradientStop();
QScopedPointer<class QtGradientStopPrivate> d_ptr;
QtGradientStopPrivate* d_ptr;
};
class QtGradientStopsModel : public QObject
@ -111,7 +113,7 @@ signals:
void currentStopChanged(QtGradientStop *stop);
private:
QScopedPointer<class QtGradientStopsModelPrivate> d_ptr;
QtGradientStopsModelPrivate* d_ptr;
Q_DECLARE_PRIVATE(QtGradientStopsModel)
Q_DISABLE_COPY(QtGradientStopsModel)
};

View file

@ -54,6 +54,7 @@
#include <QtCore/qdir.h>
#include <QtCore/qprocess.h>
#include <QtCore/qdebug.h>
#include <QtCore/qscopedpointer.h>
#include "QtTest/qtestlog_p.h"
#include "QtTest/qtesttable_p.h"