diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-06-30 22:11:15 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-07-18 06:20:23 +0000 |
commit | cdd2f8eb344bded7918994d5d23151564587abcc (patch) | |
tree | e6667124bb226fb17e42b9bf6659344ca1fe45d7 /src/corelib/tools/qscopedpointer.h | |
parent | 0aa5092576a0dbcc2de3bef8622d5863e2f1fffb (diff) |
QtCore: Use Q_NULLPTR instead of 0 in smart pointer headers
This is in preparation of adding -Wzero-as-null-pointer-constant (or similar)
to the headers check.
Not caught by the headersclean check, because they are in template code.
Task-number: QTBUG-45291
Change-Id: I7294404225a19a1c58f91e6e47a9d650179ea83c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qscopedpointer.h')
-rw-r--r-- | src/corelib/tools/qscopedpointer.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index 819ab00584..8d478f81f9 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -91,7 +91,7 @@ class QScopedPointer { typedef T *QScopedPointer:: *RestrictedBool; public: - explicit inline QScopedPointer(T *p = 0) : d(p) + explicit inline QScopedPointer(T *p = Q_NULLPTR) : d(p) { } @@ -121,12 +121,12 @@ public: #if defined(Q_QDOC) inline operator bool() const { - return isNull() ? 0 : &QScopedPointer::d; + return isNull() ? Q_NULLPTR : &QScopedPointer::d; } #else inline operator RestrictedBool() const { - return isNull() ? 0 : &QScopedPointer::d; + return isNull() ? Q_NULLPTR : &QScopedPointer::d; } #endif @@ -140,7 +140,7 @@ public: return !d; } - inline void reset(T *other = 0) + inline void reset(T *other = Q_NULLPTR) { if (d == other) return; @@ -152,7 +152,7 @@ public: inline T *take() { T *oldD = d; - d = 0; + d = Q_NULLPTR; return oldD; } @@ -206,10 +206,10 @@ template <typename T, typename Cleanup = QScopedPointerArrayDeleter<T> > class QScopedArrayPointer : public QScopedPointer<T, Cleanup> { public: - inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(0) {} + inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(Q_NULLPTR) {} template <typename D> - explicit inline QScopedArrayPointer(D *p, typename QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = 0) + explicit inline QScopedArrayPointer(D *p, typename QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = Q_NULLPTR) : QScopedPointer<T, Cleanup>(p) { } |