From 5747f3139219abd6c8670953620cee1f5584caba Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 29 Jul 2020 16:30:13 +0200 Subject: Another round of 0->nullptr cleanup Change-Id: Ic8db7dc252f8fea46eb5a4f334726d6c7f4645a6 Reviewed-by: Sona Kurazyan --- src/corelib/animation/qabstractanimation.cpp | 4 ++-- src/corelib/animation/qpropertyanimation.cpp | 2 +- src/corelib/kernel/qabstracteventdispatcher.cpp | 4 ++-- src/corelib/kernel/qmetaobjectbuilder.cpp | 2 +- src/corelib/kernel/qobject.cpp | 4 ++-- src/corelib/plugin/qlibrary.cpp | 2 +- src/corelib/text/qunicodetools.cpp | 6 +++--- src/corelib/thread/qthreadstorage.cpp | 8 ++++---- src/corelib/tools/qsharedpointer.cpp | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index b7136dc055..52adc343ab 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -235,7 +235,7 @@ QUnifiedTimer *QUnifiedTimer::instance(bool create) inst = new QUnifiedTimer; unifiedTimer()->setLocalData(inst); } else { - inst = unifiedTimer() ? unifiedTimer()->localData() : 0; + inst = unifiedTimer() ? unifiedTimer()->localData() : nullptr; } return inst; } @@ -565,7 +565,7 @@ QAnimationTimer *QAnimationTimer::instance(bool create) inst = new QAnimationTimer; animationTimer()->setLocalData(inst); } else { - inst = animationTimer() ? animationTimer()->localData() : 0; + inst = animationTimer() ? animationTimer()->localData() : nullptr; } #else Q_UNUSED(create); diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index d014b5c441..be2bed0a07 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -271,7 +271,7 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState, QPropertyAnimationPair key(d->targetValue, d->propertyName); if (newState == Running) { d->updateMetaProperty(); - animToStop = hash.value(key, 0); + animToStop = hash.value(key, nullptr); hash.insert(key, this); locker.unlock(); // update the default start value diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index e77e8d3865..72504a178d 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -429,7 +429,7 @@ void QAbstractEventDispatcher::installNativeEventFilter(QAbstractNativeEventFilt Q_D(QAbstractEventDispatcher); // clean up unused items in the list - d->eventFilters.removeAll(0); + d->eventFilters.removeAll(nullptr); d->eventFilters.removeAll(filterObj); d->eventFilters.prepend(filterObj); } @@ -452,7 +452,7 @@ void QAbstractEventDispatcher::removeNativeEventFilter(QAbstractNativeEventFilte Q_D(QAbstractEventDispatcher); for (int i = 0; i < d->eventFilters.count(); ++i) { if (d->eventFilters.at(i) == filter) { - d->eventFilters[i] = 0; + d->eventFilters[i] = nullptr; break; } } diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp index c578b88429..514cfeac55 100644 --- a/src/corelib/kernel/qmetaobjectbuilder.cpp +++ b/src/corelib/kernel/qmetaobjectbuilder.cpp @@ -1669,7 +1669,7 @@ static const QMetaObject *resolveClassName if (name == QByteArray("QObject")) return &QObject::staticMetaObject; else - return references.value(name, 0); + return references.value(name, nullptr); } /*! diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 0e65580e7f..b26bd0298e 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2035,7 +2035,7 @@ void QObjectPrivate::deleteChildren() // delete siblings for (int i = 0; i < children.count(); ++i) { currentChildBeingDeleted = children.at(i); - children[i] = 0; + children[i] = nullptr; delete currentChildBeingDeleted; } children.clear(); @@ -2076,7 +2076,7 @@ void QObjectPrivate::setParent_helper(QObject *o) if (index < 0) { // we're probably recursing into setParent() from a ChildRemoved event, don't do anything } else if (parentD->isDeletingChildren) { - parentD->children[index] = 0; + parentD->children[index] = nullptr; } else { parentD->children.removeAt(index); if (sendChildEvents && parentD->receiveChildEvents) { diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index cd9f9e2546..4712251aa8 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -419,7 +419,7 @@ inline void QLibraryStore::cleanup() #endif } delete lib; - it.value() = 0; + it.value() = nullptr; } } diff --git a/src/corelib/text/qunicodetools.cpp b/src/corelib/text/qunicodetools.cpp index 4f5ccb6fcc..9e56686893 100644 --- a/src/corelib/text/qunicodetools.cpp +++ b/src/corelib/text/qunicodetools.cpp @@ -1323,8 +1323,8 @@ typedef int (*th_brk_def) (const unsigned char*, int*, size_t); typedef size_t (*th_next_cell_def) (const unsigned char *, size_t, struct thcell_t *, int); /* libthai related function handles */ -static th_brk_def th_brk = 0; -static th_next_cell_def th_next_cell = 0; +static th_brk_def th_brk = nullptr; +static th_next_cell_def th_next_cell = nullptr; static int init_libthai() { static bool initialized = false; @@ -1363,7 +1363,7 @@ static void thaiAssignAttributes(const ushort *string, uint len, QCharAttributes { char s[128]; char *cstr = s; - int *break_positions = 0; + int *break_positions = nullptr; int brp[128]; int brp_size = 0; uint numbreaks, i, j, cell_length; diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp index 9c9a63d29b..7f78f69bc7 100644 --- a/src/corelib/thread/qthreadstorage.cpp +++ b/src/corelib/thread/qthreadstorage.cpp @@ -92,7 +92,7 @@ QThreadStorageData::QThreadStorageData(void (*func)(void *)) return; } for (id = 0; id < destr->count(); id++) { - if (destr->at(id) == 0) + if (destr->at(id) == nullptr) break; } if (id == destr->count()) { @@ -108,7 +108,7 @@ QThreadStorageData::~QThreadStorageData() DEBUG_MSG("QThreadStorageData: Released id %d", id); QMutexLocker locker(&destructorsMutex); if (destructors()) - (*destructors())[id] = 0; + (*destructors())[id] = nullptr; } void **QThreadStorageData::get() const @@ -152,7 +152,7 @@ void **QThreadStorageData::set(void *p) QMutexLocker locker(&destructorsMutex); DestructorMap *destr = destructors(); - void (*destructor)(void *) = destr ? destr->value(id) : 0; + void (*destructor)(void *) = destr ? destr->value(id) : nullptr; locker.unlock(); void *q = value; @@ -201,7 +201,7 @@ void QThreadStorageData::finish(void **p) if (tls->size() > i) { //re reset the tls in case it has been recreated by its own destructor. - (*tls)[i] = 0; + (*tls)[i] = nullptr; } } tls->clear(); diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 499546da4b..e47e0fb960 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -1567,7 +1567,7 @@ void QtSharedPointer::internalSafetyCheckAdd(const void *d_ptr, const volatile v //qDebug("Adding d=%p value=%p", d_ptr, ptr); - const void *other_d_ptr = kp->dataPointers.value(ptr, 0); + const void *other_d_ptr = kp->dataPointers.value(ptr, nullptr); if (Q_UNLIKELY(other_d_ptr)) { # ifdef BACKTRACE_SUPPORTED printBacktrace(knownPointers()->dPointers.value(other_d_ptr).backtrace); -- cgit v1.2.3