diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-07 13:05:48 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-07 23:02:47 +0200 |
commit | 564b59d903683b14c75b72a3e93367717f201def (patch) | |
tree | 03ffe749d83dce84429a7db484bf92795047036f /src/corelib/kernel | |
parent | b5fc1e4e2643e73d3b44c483d159529f8deb8af1 (diff) |
Another round of replacing 0 with nullptr
This time based on grepping to also include documentation, tests and
examples previously missed by the automatic tool.
Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_cf_p.h | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 14 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win_p.h | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qjni.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qjni_p.h | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qpoll.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qproperty.h | 6 | ||||
-rw-r--r-- | src/corelib/kernel/qsystemerror.cpp | 2 |
9 files changed, 19 insertions, 19 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_cf_p.h b/src/corelib/kernel/qeventdispatcher_cf_p.h index eb84b0a64c..2d76bf53da 100644 --- a/src/corelib/kernel/qeventdispatcher_cf_p.h +++ b/src/corelib/kernel/qeventdispatcher_cf_p.h @@ -209,7 +209,7 @@ class Q_CORE_EXPORT QEventDispatcherCoreFoundation : public QAbstractEventDispat Q_OBJECT public: - explicit QEventDispatcherCoreFoundation(QObject *parent = 0); + explicit QEventDispatcherCoreFoundation(QObject *parent = nullptr); void startingUp() override; ~QEventDispatcherCoreFoundation(); diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 03d003bb0f..44487d57e2 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -162,8 +162,8 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA #else auto q = reinterpret_cast<QEventDispatcherWin32 *>(GetWindowLong(hwnd, GWL_USERDATA)); #endif - QEventDispatcherWin32Private *d = 0; - if (q != 0) + QEventDispatcherWin32Private *d = nullptr; + if (q != nullptr) d = q->d_func(); switch (message) { @@ -187,7 +187,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA break; } if (type >= 0) { - Q_ASSERT(d != 0); + Q_ASSERT(d != nullptr); QSNDict *sn_vec[4] = { &d->sn_read, &d->sn_write, &d->sn_except, &d->sn_read }; QSNDict *dict = sn_vec[type]; @@ -217,7 +217,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA return 0; } case WM_QT_ACTIVATENOTIFIERS: { - Q_ASSERT(d != 0); + Q_ASSERT(d != nullptr); // Postpone activation if we have unhandled socket notifier messages // in the queue. WM_QT_ACTIVATENOTIFIERS will be posted again as a result of @@ -242,7 +242,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA return 0; } case WM_TIMER: - Q_ASSERT(d != 0); + Q_ASSERT(d != nullptr); if (wp == d->sendPostedEventsTimerId) q->sendPostedEvents(); @@ -250,7 +250,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA d->sendTimerEvent(wp); return 0; case WM_QT_SENDPOSTEDEVENTS: - Q_ASSERT(d != 0); + Q_ASSERT(d != nullptr); // We send posted events manually, if the window procedure was invoked // by the foreign event loop (e.g. from the native modal dialog). @@ -268,7 +268,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) { QEventDispatcherWin32 *q = qobject_cast<QEventDispatcherWin32 *>(QAbstractEventDispatcher::instance()); - Q_ASSERT(q != 0); + Q_ASSERT(q != nullptr); QEventDispatcherWin32Private *d = q->d_func(); MSG *msg = reinterpret_cast<MSG *>(lp); // Windows unexpectedly passes PM_NOYIELD flag to the hook procedure, diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index 9ee4eb725d..a5c063e062 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -73,7 +73,7 @@ class Q_CORE_EXPORT QEventDispatcherWin32 : public QAbstractEventDispatcher Q_DECLARE_PRIVATE(QEventDispatcherWin32) public: - explicit QEventDispatcherWin32(QObject *parent = 0); + explicit QEventDispatcherWin32(QObject *parent = nullptr); ~QEventDispatcherWin32(); bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags) override; @@ -103,7 +103,7 @@ public: HWND internalHwnd(); protected: - QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent = 0); + QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent = nullptr); virtual void sendPostedEvents(); void doUnregisterSocketNotifier(QSocketNotifier *notifier); void doUnregisterEventNotifier(QWinEventNotifier *notifier); diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp index 5f652d70e3..b593483e59 100644 --- a/src/corelib/kernel/qjni.cpp +++ b/src/corelib/kernel/qjni.cpp @@ -81,7 +81,7 @@ static QByteArray toBinaryEncClassName(const QByteArray &className) return QByteArray(className).replace('/', '.'); } -static jclass getCachedClass(const QByteArray &classBinEnc, bool *isCached = 0) +static jclass getCachedClass(const QByteArray &classBinEnc, bool *isCached = nullptr) { QReadLocker locker(cachedClassesLock); const QHash<QString, jclass>::const_iterator &it = cachedClasses->constFind(QString::fromLatin1(classBinEnc)); diff --git a/src/corelib/kernel/qjni_p.h b/src/corelib/kernel/qjni_p.h index ec8525e6e1..b5139d404b 100644 --- a/src/corelib/kernel/qjni_p.h +++ b/src/corelib/kernel/qjni_p.h @@ -72,7 +72,7 @@ public: ~QJNIEnvironmentPrivate(); JNIEnv *operator->(); operator JNIEnv*() const; - static jclass findClass(const char *className, JNIEnv *env = 0); + static jclass findClass(const char *className, JNIEnv *env = nullptr); private: friend class QAndroidJniEnvironment; diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index b3807b145d..60588e9329 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -579,7 +579,7 @@ const QMetaObject *QMetaType::metaObject() const } /*! - \fn void *QMetaType::create(const void *copy = 0) const + \fn void *QMetaType::create(const void *copy = nullptr) const \since 5.0 Returns a copy of \a copy, assuming it is of the type that this @@ -624,7 +624,7 @@ void QMetaType::destroy(void *data) const } /*! - \fn void *QMetaType::construct(void *where, const void *copy = 0) const + \fn void *QMetaType::construct(void *where, const void *copy = nullptr) const \since 5.0 Constructs a value of the type that this QMetaType instance diff --git a/src/corelib/kernel/qpoll.cpp b/src/corelib/kernel/qpoll.cpp index 8b87bfe79d..f41c413db6 100644 --- a/src/corelib/kernel/qpoll.cpp +++ b/src/corelib/kernel/qpoll.cpp @@ -177,7 +177,7 @@ int qt_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts) } fd_set read_fds, write_fds, except_fds; - struct timeval tv, *ptv = 0; + struct timeval tv, *ptv = nullptr; if (timeout_ts) { tv = timespecToTimeval(*timeout_ts); diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index 156696dace..ab93cdccc6 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -207,7 +207,7 @@ public: namespace Qt { template <typename Functor> auto makePropertyBinding(Functor &&f, const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION, - std::enable_if_t<std::is_invocable_v<Functor>> * = 0) + std::enable_if_t<std::is_invocable_v<Functor>> * = nullptr) { return QPropertyBinding<std::invoke_result_t<Functor>>(std::forward<Functor>(f), location); } @@ -321,7 +321,7 @@ public: #ifndef Q_CLANG_QDOC template <typename Functor> explicit QProperty(Functor &&f, const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION, - typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * = 0) + typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * = nullptr) : QProperty(QPropertyBinding<T>(std::forward<Functor>(f), location)) {} #else @@ -821,7 +821,7 @@ public: #ifndef Q_CLANG_QDOC template <typename Functor> explicit QObjectBindableProperty(Functor &&f, const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION, - typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * = 0) + typename std::enable_if_t<std::is_invocable_r_v<T, Functor&>> * = nullptr) : QObjectBindableProperty(QPropertyBinding<T>(std::forward<Functor>(f), location)) {} #else diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp index a2df9dee93..030c38e045 100644 --- a/src/corelib/kernel/qsystemerror.cpp +++ b/src/corelib/kernel/qsystemerror.cpp @@ -76,7 +76,7 @@ namespace { static QString windowsErrorString(int errorCode) { QString ret; - wchar_t *string = 0; + wchar_t *string = nullptr; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, NULL, errorCode, |