replace 0 with Q_NULLPTR in QSharedDataPointer and QExplicitlySharedDataPointer

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2020-02-10 17:38:56 +00:00
parent 5df7658d86
commit 8fb3224ff8

View file

@ -73,7 +73,7 @@ public:
inline bool operator==(const QSharedDataPointer<T> &other) const { return d == other.d; }
inline bool operator!=(const QSharedDataPointer<T> &other) const { return d != other.d; }
inline QSharedDataPointer() { d = 0; }
inline QSharedDataPointer() { d = Q_NULLPTR; }
inline ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; }
explicit QSharedDataPointer(T *data);
@ -101,7 +101,7 @@ public:
return *this;
}
#ifdef Q_COMPILER_RVALUE_REFS
QSharedDataPointer(QSharedDataPointer &&o) : d(o.d) { o.d = 0; }
QSharedDataPointer(QSharedDataPointer &&o) : d(o.d) { o.d = Q_NULLPTR; }
inline QSharedDataPointer<T> &operator=(QSharedDataPointer<T> &&other)
{ qSwap(d, other.d); return *this; }
#endif
@ -139,17 +139,17 @@ public:
if(d && !d->ref.deref())
delete d;
d = 0;
d = Q_NULLPTR;
}
inline operator bool () const { return d != 0; }
inline operator bool () const { return d != Q_NULLPTR; }
inline bool operator==(const QExplicitlySharedDataPointer<T> &other) const { return d == other.d; }
inline bool operator!=(const QExplicitlySharedDataPointer<T> &other) const { return d != other.d; }
inline bool operator==(const T *ptr) const { return d == ptr; }
inline bool operator!=(const T *ptr) const { return d != ptr; }
inline QExplicitlySharedDataPointer() { d = 0; }
inline QExplicitlySharedDataPointer() { d = Q_NULLPTR; }
inline ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; }
explicit QExplicitlySharedDataPointer(T *data);
@ -185,7 +185,7 @@ public:
return *this;
}
#ifdef Q_COMPILER_RVALUE_REFS
inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) : d(o.d) { o.d = 0; }
inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) : d(o.d) { o.d = Q_NULLPTR; }
inline QExplicitlySharedDataPointer<T> &operator=(QExplicitlySharedDataPointer<T> &&other)
{ qSwap(d, other.d); return *this; }
#endif