From 41e7b71c410b77a81d09d3cc2e169ffd7975b4d2 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Tue, 12 Mar 2019 11:46:26 +0100 Subject: More nullptr usage in headers Diff generated by running clang-tidy's modernize-use-nullptr checker on the CMake-based Qt version. Skipping src/3rdparty, examples/, tests/ Change-Id: Ib182074e2e2fd52f63093f73b3e2e4c0cb7af188 Reviewed-by: Friedemann Kleint Reviewed-by: Simon Hausmann --- src/corelib/thread/qatomic_bootstrap.h | 2 +- src/corelib/thread/qresultstore.h | 4 ++-- src/corelib/thread/qthread_p.h | 12 ++++++------ src/corelib/thread/qthreadpool_p.h | 2 +- src/corelib/thread/qthreadstorage.h | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qatomic_bootstrap.h b/src/corelib/thread/qatomic_bootstrap.h index b463f817bd..27a67fb2ee 100644 --- a/src/corelib/thread/qatomic_bootstrap.h +++ b/src/corelib/thread/qatomic_bootstrap.h @@ -65,7 +65,7 @@ template struct QAtomicOps: QGenericAtomicOps > return --_q_value != 0; } - static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue = 0) Q_DECL_NOTHROW + static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW { if (currentValue) *currentValue = _q_value; diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h index 1f29e8d187..7a65089396 100644 --- a/src/corelib/thread/qresultstore.h +++ b/src/corelib/thread/qresultstore.h @@ -142,7 +142,7 @@ public: template int addResult(int index, const T *result) { - if (result == 0) + if (result == nullptr) return addResult(index, static_cast(nullptr)); else return addResult(index, static_cast(new T(*result))); @@ -158,7 +158,7 @@ public: int addResults(int index, const QVector *results, int totalCount) { if (m_filterMode == true && results->count() != totalCount && 0 == results->count()) - return addResults(index, 0, 0, totalCount); + return addResults(index, nullptr, 0, totalCount); else return addResults(index, new QVector(*results), results->count(), totalCount); } diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 7d9442ab79..e614ddd004 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -89,7 +89,7 @@ public: QEvent *event; int priority; inline QPostEvent() - : receiver(0), event(0), priority(0) + : receiver(nullptr), event(nullptr), priority(0) { } inline QPostEvent(QObject *r, QEvent *e, int p) : receiver(r), event(e), priority(p) @@ -148,7 +148,7 @@ private: class Q_CORE_EXPORT QDaemonThread : public QThread { public: - QDaemonThread(QObject *parent = 0); + QDaemonThread(QObject *parent = nullptr); ~QDaemonThread(); }; @@ -157,7 +157,7 @@ class QThreadPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QThread) public: - QThreadPrivate(QThreadData *d = 0); + QThreadPrivate(QThreadData *d = nullptr); ~QThreadPrivate(); void setPriority(QThread::Priority prio); @@ -248,7 +248,7 @@ public: #endif static void clearCurrentThreadData(); static QThreadData *get2(QThread *thread) - { Q_ASSERT_X(thread != 0, "QThread", "internal error"); return thread->d_func()->data; } + { Q_ASSERT_X(thread != nullptr, "QThread", "internal error"); return thread->d_func()->data; } void ref(); @@ -281,7 +281,7 @@ public: public: FlaggedDebugSignatures() : idx(0) - { std::fill_n(locations, Count, static_cast(0)); } + { std::fill_n(locations, Count, static_cast(nullptr)); } void store(const char* method) { locations[idx++ % Count] = method; } @@ -328,7 +328,7 @@ class QAdoptedThread : public QThread Q_DECLARE_PRIVATE(QThread) public: - QAdoptedThread(QThreadData *data = 0); + QAdoptedThread(QThreadData *data = nullptr); ~QAdoptedThread(); void init(); diff --git a/src/corelib/thread/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h index 952e02ef20..01852d8366 100644 --- a/src/corelib/thread/qthreadpool_p.h +++ b/src/corelib/thread/qthreadpool_p.h @@ -162,7 +162,7 @@ public: void tryToStartMoreThreads(); bool tooManyThreadsActive() const; - void startThread(QRunnable *runnable = 0); + void startThread(QRunnable *runnable = nullptr); void reset(); bool waitForDone(int msecs); bool waitForDone(const QDeadlineTimer &timer); diff --git a/src/corelib/thread/qthreadstorage.h b/src/corelib/thread/qthreadstorage.h index 55fc482da3..9eb8672e92 100644 --- a/src/corelib/thread/qthreadstorage.h +++ b/src/corelib/thread/qthreadstorage.h @@ -69,7 +69,7 @@ inline T *&qThreadStorage_localData(QThreadStorageData &d, T **) { void **v = d.get(); - if (!v) v = d.set(0); + if (!v) v = d.set(nullptr); return *(reinterpret_cast(v)); } @@ -139,7 +139,7 @@ public: inline ~QThreadStorage() { } inline bool hasLocalData() const - { return d.get() != 0; } + { return d.get() != nullptr; } inline T& localData() { return qThreadStorage_localData(d, reinterpret_cast(0)); } -- cgit v1.2.3