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/concurrent/qtconcurrentthreadengine.cpp | 6 +++--- 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 +- src/dbus/qdbus_symbols.cpp | 4 ++-- src/dbus/qdbusconnection.cpp | 2 +- src/dbus/qdbusintegrator.cpp | 8 ++++---- src/gui/accessible/linux/atspiadaptor.cpp | 6 +++--- src/gui/accessible/linux/qspiaccessiblebridge.cpp | 2 +- src/gui/image/qimage_conversions.cpp | 4 ++-- src/gui/image/qimagereader.cpp | 2 +- src/gui/itemmodels/qstandarditemmodel.cpp | 22 +++++++++++----------- src/gui/kernel/qopenglcontext.cpp | 4 ++-- src/gui/kernel/qopenglcontext_p.h | 2 +- src/gui/kernel/qwindowsysteminterface_p.h | 2 +- src/gui/painting/qcompositionfunctions.cpp | 18 ++++++++++-------- src/gui/painting/qpathsimplifier.cpp | 8 ++++---- src/gui/painting/qpdf.cpp | 2 +- src/gui/painting/qtriangulator.cpp | 6 +++--- src/gui/painting/webgradients.cpp | 2 +- src/gui/platform/unix/qeventdispatcher_glib.cpp | 4 ++-- src/gui/platform/unix/qgenericunixthemes.cpp | 18 +++++++++--------- src/gui/text/freetype/qfontengine_ft.cpp | 4 ++-- src/gui/text/qfont.cpp | 2 +- src/gui/text/qfontengine.cpp | 2 +- src/gui/text/qfontengine_qpf2.cpp | 4 ++-- src/gui/text/qtextdocument_p.cpp | 2 +- src/gui/text/qtextdocumentlayout.cpp | 2 +- src/gui/text/qtextodfwriter.cpp | 2 +- src/gui/util/qgridlayoutengine.cpp | 4 ++-- src/gui/vulkan/qbasicvulkanplatforminstance.cpp | 2 +- src/network/access/qhttpnetworkconnection_p.h | 4 ++-- src/network/access/qhttpthreaddelegate.cpp | 2 +- src/network/ssl/qsslsocket_openssl_symbols_p.h | 16 ++++++++-------- src/sql/kernel/qsqlquery.cpp | 2 +- src/tools/moc/main.cpp | 2 +- src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp | 2 +- src/tools/qlalr/compress.cpp | 8 ++++---- src/tools/qlalr/cppgenerator.cpp | 4 ++-- src/tools/qlalr/grammar.cpp | 4 ++-- src/tools/qlalr/recognizer.cpp | 2 +- src/tools/rcc/rcc.cpp | 14 +++++++------- src/tools/uic/cpp/cppwriteinitialization.cpp | 4 ++-- 49 files changed, 123 insertions(+), 121 deletions(-) (limited to 'src') diff --git a/src/concurrent/qtconcurrentthreadengine.cpp b/src/concurrent/qtconcurrentthreadengine.cpp index 2c6e052621..081018fbcc 100644 --- a/src/concurrent/qtconcurrentthreadengine.cpp +++ b/src/concurrent/qtconcurrentthreadengine.cpp @@ -161,7 +161,7 @@ bool ThreadEngineBarrier::releaseUnlessLast() } ThreadEngineBase::ThreadEngineBase(QThreadPool *pool) - : futureInterface(0), threadPool(pool) + : futureInterface(nullptr), threadPool(pool) { setAutoDelete(false); } @@ -242,7 +242,7 @@ void ThreadEngineBase::waitForResume() bool ThreadEngineBase::isProgressReportingEnabled() { // If we don't have a QFuture, there is no-one to report the progress to. - return (futureInterface != 0); + return (futureInterface != nullptr); } void ThreadEngineBase::setProgressValue(int progress) @@ -278,7 +278,7 @@ void ThreadEngineBase::startThreads() void ThreadEngineBase::threadExit() { - const bool asynchronous = futureInterface != 0; + const bool asynchronous = (futureInterface != nullptr); const int lastThread = (barrier.release() == 0); if (lastThread && asynchronous) 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); diff --git a/src/dbus/qdbus_symbols.cpp b/src/dbus/qdbus_symbols.cpp index 1e2cbf6da6..dd74307fda 100644 --- a/src/dbus/qdbus_symbols.cpp +++ b/src/dbus/qdbus_symbols.cpp @@ -133,7 +133,7 @@ void (*qdbus_resolve_conditionally(const char *name))() #else Q_UNUSED(name); #endif - return 0; + return nullptr; } void (*qdbus_resolve_me(const char *name))() @@ -149,7 +149,7 @@ void (*qdbus_resolve_me(const char *name))() return ptr; #else Q_UNUSED(name); - return 0; + return nullptr; #endif } diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 329a539e23..78c596bea6 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -99,7 +99,7 @@ QDBusConnectionPrivate *QDBusConnectionManager::busConnection(QDBusConnection::B QDBusConnectionPrivate *QDBusConnectionManager::connection(const QString &name) const { - return connectionHash.value(name, 0); + return connectionHash.value(name, nullptr); } void QDBusConnectionManager::removeConnection(const QString &name) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 07816568e5..ac55b7cb76 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -930,7 +930,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q // let's create the parameter list // first one is the return type -- add it below - params.append(0); + params.append(nullptr); // add the input parameters int i; @@ -1186,7 +1186,7 @@ bool QDBusConnectionPrivate::handleError(const QDBusErrorInternal &error) void QDBusConnectionPrivate::timerEvent(QTimerEvent *e) { { - DBusTimeout *timeout = timeouts.value(e->timerId(), 0); + DBusTimeout *timeout = timeouts.value(e->timerId(), nullptr); if (timeout) q_dbus_timeout_handle(timeout); } @@ -2582,7 +2582,7 @@ QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &pa // service must be a unique connection name if (!interface.isEmpty()) { QDBusReadLocker locker(FindMetaObject1Action, this); - QDBusMetaObject *mo = cachedMetaObjects.value(interface, 0); + QDBusMetaObject *mo = cachedMetaObjects.value(interface, nullptr); if (mo) return mo; } @@ -2599,7 +2599,7 @@ QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &pa QDBusWriteLocker locker(FindMetaObject2Action, this); QDBusMetaObject *mo = nullptr; if (!interface.isEmpty()) - mo = cachedMetaObjects.value(interface, 0); + mo = cachedMetaObjects.value(interface, nullptr); if (mo) // maybe it got created when we switched from read to write lock return mo; diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp index a0c41fb7b3..8feaf58ca1 100644 --- a/src/gui/accessible/linux/atspiadaptor.cpp +++ b/src/gui/accessible/linux/atspiadaptor.cpp @@ -858,7 +858,7 @@ QAccessibleInterface *AtSpiAdaptor::interfaceFromPath(const QString& dbusPath) c QStringList parts = dbusPath.split(QLatin1Char('/')); if (parts.size() != 6) { qCDebug(lcAccessibilityAtspi) << "invalid path: " << dbusPath; - return 0; + return nullptr; } QString objectString = parts.at(5); @@ -1613,7 +1613,7 @@ bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QSt } QAccessibleInterface * childInterface(interface->childAt(x, y)); - QAccessibleInterface * iface = 0; + QAccessibleInterface * iface = nullptr; while (childInterface) { iface = childInterface; childInterface = iface->childAt(x, y); @@ -2301,7 +2301,7 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString connection.send(message.createReply(QVariant::fromValue(QDBusVariant( QVariant::fromValue(interface->tableInterface()->selectedRowCount()))))); } else if (function == QLatin1String("GetSummary")) { - QAccessibleInterface * summary = interface->tableInterface() ? interface->tableInterface()->summary() : 0; + QAccessibleInterface *summary = interface->tableInterface() ? interface->tableInterface()->summary() : nullptr; QSpiObjectReference ref(connection, QDBusObjectPath(pathForInterface(summary))); connection.send(message.createReply(QVariant::fromValue(QDBusVariant(QVariant::fromValue(ref))))); } else if (function == QLatin1String("GetAccessibleAt")) { diff --git a/src/gui/accessible/linux/qspiaccessiblebridge.cpp b/src/gui/accessible/linux/qspiaccessiblebridge.cpp index fb4bf1f27b..9b9b7a46a5 100644 --- a/src/gui/accessible/linux/qspiaccessiblebridge.cpp +++ b/src/gui/accessible/linux/qspiaccessiblebridge.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE */ QSpiAccessibleBridge::QSpiAccessibleBridge() - : cache(0), dec(0), dbusAdaptor(0) + : cache(nullptr), dec(nullptr), dbusAdaptor(nullptr) { dbusConnection = new DBusConnection(); connect(dbusConnection, SIGNAL(enabledChanged(bool)), this, SLOT(enabledChanged(bool))); diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 773face2d4..f0c1951b94 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -224,8 +224,8 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio buffer = reinterpret_cast(destData) + x; else l = qMin(l, BufferSize); - const uint *ptr = fetch(buffer, srcData, x, l, 0, ditherPtr); - store(destData, ptr, x, l, 0, ditherPtr); + const uint *ptr = fetch(buffer, srcData, x, l, nullptr, ditherPtr); + store(destData, ptr, x, l, nullptr, ditherPtr); x += l; } srcData += src->bytes_per_line; diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index a3ff898222..0702e2bb23 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -538,7 +538,7 @@ bool QImageReaderPrivate::initHandler() // probe the file extension if (deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly) && autoDetectImageFormat) { - Q_ASSERT(qobject_cast(device) != 0); // future-proofing; for now this should always be the case, so... + Q_ASSERT(qobject_cast(device) != nullptr); // future-proofing; for now this should always be the case, so... QFile *file = static_cast(device); if (file->error() == QFileDevice::ResourceError) { diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index e4d9bcbb71..9bb0d9aa98 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -189,7 +189,7 @@ void QStandardItemPrivate::childDeleted(QStandardItem *child) int index = childIndex(child); Q_ASSERT(index != -1); const auto modelIndex = child->index(); - children.replace(index, 0); + children.replace(index, nullptr); emit model->dataChanged(modelIndex, modelIndex); } @@ -481,7 +481,7 @@ bool QStandardItemPrivate::insertRows(int row, const QList &item rows += count; int index = childIndex(row, 0); if (index != -1) - children.insert(index, columnCount() * count, 0); + children.insert(index, columnCount() * count, nullptr); } for (int i = 0; i < items.count(); ++i) { QStandardItem *item = items.at(i); @@ -511,7 +511,7 @@ bool QStandardItemPrivate::insertRows(int row, int count, const QListendInsertRows(); } @@ -673,7 +673,7 @@ void QStandardItemModelPrivate::columnsInserted(QStandardItem *parent, { Q_Q(QStandardItemModel); if (parent == root.data()) - columnHeaderItems.insert(column, count, 0); + columnHeaderItems.insert(column, count, nullptr); q->endInsertColumns(); } @@ -1881,7 +1881,7 @@ QStandardItem *QStandardItem::takeChild(int row, int column) item = d->children.at(index); if (item) item->d_func()->setParentAndModel(nullptr, nullptr); - d->children.replace(index, 0); + d->children.replace(index, nullptr); } return item; } @@ -2195,9 +2195,9 @@ QStandardItemModel::QStandardItemModel(int rows, int columns, QObject *parent) Q_D(QStandardItemModel); d->init(); d->root->insertColumns(0, columns); - d->columnHeaderItems.insert(0, columns, 0); + d->columnHeaderItems.insert(0, columns, nullptr); d->root->insertRows(0, rows); - d->rowHeaderItems.insert(0, rows, 0); + d->rowHeaderItems.insert(0, rows, nullptr); d->root->d_func()->setModel(this); } @@ -2754,7 +2754,7 @@ QStandardItem *QStandardItemModel::takeHorizontalHeaderItem(int column) QStandardItem *headerItem = d->columnHeaderItems.at(column); if (headerItem) { headerItem->d_func()->setParentAndModel(nullptr, nullptr); - d->columnHeaderItems.replace(column, 0); + d->columnHeaderItems.replace(column, nullptr); } return headerItem; } @@ -2776,7 +2776,7 @@ QStandardItem *QStandardItemModel::takeVerticalHeaderItem(int row) QStandardItem *headerItem = d->rowHeaderItems.at(row); if (headerItem) { headerItem->d_func()->setParentAndModel(nullptr, nullptr); - d->rowHeaderItems.replace(row, 0); + d->rowHeaderItems.replace(row, nullptr); } return headerItem; } diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 51bf5cf336..82da0f8146 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1247,14 +1247,14 @@ void QOpenGLMultiGroupSharedResource::insert(QOpenGLContext *context, QOpenGLSha QOpenGLSharedResource *QOpenGLMultiGroupSharedResource::value(QOpenGLContext *context) { QOpenGLContextGroup *group = context->shareGroup(); - return group->d_func()->m_resources.value(this, 0); + return group->d_func()->m_resources.value(this, nullptr); } QList QOpenGLMultiGroupSharedResource::resources() const { QList result; for (QList::const_iterator it = m_groups.constBegin(); it != m_groups.constEnd(); ++it) { - QOpenGLSharedResource *resource = (*it)->d_func()->m_resources.value(const_cast(this), 0); + QOpenGLSharedResource *resource = (*it)->d_func()->m_resources.value(const_cast(this), nullptr); if (resource) result << resource; } diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index b3c0658d60..7bba323120 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -174,7 +174,7 @@ public: // Have to use our own mutex here, not the group's, since // m_groups has to be protected too against any concurrent access. QMutexLocker locker(&m_mutex); - T *resource = static_cast(group->d_func()->m_resources.value(this, 0)); + T *resource = static_cast(group->d_func()->m_resources.value(this, nullptr)); if (!resource) { resource = new T(context); insert(context, resource); diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index bca4786b6d..1cf060cfff 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -471,7 +471,7 @@ public: void prepend(WindowSystemEvent *e) { const QMutexLocker locker(&mutex); impl.prepend(e); } WindowSystemEvent *takeFirstOrReturnNull() - { const QMutexLocker locker(&mutex); return impl.empty() ? 0 : impl.takeFirst(); } + { const QMutexLocker locker(&mutex); return impl.empty() ? nullptr : impl.takeFirst(); } WindowSystemEvent *takeFirstNonUserInputOrReturnNull() { const QMutexLocker locker(&mutex); diff --git a/src/gui/painting/qcompositionfunctions.cpp b/src/gui/painting/qcompositionfunctions.cpp index ced213e36d..0d1e540c7a 100644 --- a/src/gui/painting/qcompositionfunctions.cpp +++ b/src/gui/painting/qcompositionfunctions.cpp @@ -3089,11 +3089,12 @@ CompositionFunctionSolid64 qt_functionForModeSolid64_C[] = { comp_func_solid_Difference_rgb64, comp_func_solid_Exclusion_rgb64, #else - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, #endif - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; CompositionFunction qt_functionForMode_C[] = { @@ -3164,11 +3165,12 @@ CompositionFunction64 qt_functionForMode64_C[] = { comp_func_Difference_rgb64, comp_func_Exclusion_rgb64, #else - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, #endif - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; QT_END_NAMESPACE diff --git a/src/gui/painting/qpathsimplifier.cpp b/src/gui/painting/qpathsimplifier.cpp index 256a2fefe7..74313c9ca2 100644 --- a/src/gui/painting/qpathsimplifier.cpp +++ b/src/gui/painting/qpathsimplifier.cpp @@ -880,9 +880,9 @@ void PathSimplifier::connectElements() #ifndef QT_NO_DEBUG for (int i = 0; i < m_elements.size(); ++i) { const Element *element = m_elements.at(i); - Q_ASSERT(element->next == 0 || element->next->previous == element); - Q_ASSERT(element->previous == 0 || element->previous->next == element); - Q_ASSERT((element->next == 0) == (element->previous == 0)); + Q_ASSERT(element->next == nullptr || element->next->previous == element); + Q_ASSERT(element->previous == nullptr || element->previous->next == element); + Q_ASSERT((element->next == nullptr) == (element->previous == nullptr)); } #endif } @@ -1442,7 +1442,7 @@ bool PathSimplifier::elementIsLeftOf(const Element *left, const Element *right) QPair PathSimplifier::outerBounds(const QPoint &point) { RBNode *current = m_elementList.root; - QPair result(0, 0); + QPair result(nullptr, nullptr); while (current) { const Element *element = current->data; diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 925244a5a8..d510e28c6f 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -3038,7 +3038,7 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) noEmbed = true; } - QFontSubset *font = fonts.value(face_id, 0); + QFontSubset *font = fonts.value(face_id, nullptr); if (!font) { font = new QFontSubset(fe, requestObject()); font->noEmbed = noEmbed; diff --git a/src/gui/painting/qtriangulator.cpp b/src/gui/painting/qtriangulator.cpp index d3080aeb58..1c21706fbd 100644 --- a/src/gui/painting/qtriangulator.cpp +++ b/src/gui/painting/qtriangulator.cpp @@ -1061,7 +1061,7 @@ template QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSimple::bounds(const QPodPoint &point) const { QRBTree::Node *current = m_edgeList.root; - QPair::Node *, QRBTree::Node *> result(0, 0); + QPair::Node *, QRBTree::Node *> result(nullptr, nullptr); while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); @@ -1110,7 +1110,7 @@ template QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSimple::outerBounds(const QPodPoint &point) const { QRBTree::Node *current = m_edgeList.root; - QPair::Node *, QRBTree::Node *> result(0, 0); + QPair::Node *, QRBTree::Node *> result(nullptr, nullptr); while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); @@ -1309,7 +1309,7 @@ void QTriangulator::ComplexToSimple::calculateIntersections() int vertex = (event.type == Event::Upper ? m_edges.at(event.edge).upper() : m_edges.at(event.edge).lower()); QIntersectionPoint eventPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point); - if (range.first != 0) { + if (range.first != nullptr) { splitEdgeListRange(range.first, range.second, vertex, eventPoint); reorderEdgeListRange(range.first, range.second); } diff --git a/src/gui/painting/webgradients.cpp b/src/gui/painting/webgradients.cpp index 33bbcc4319..d837c4383c 100644 --- a/src/gui/painting/webgradients.cpp +++ b/src/gui/painting/webgradients.cpp @@ -572,7 +572,7 @@ static Q_CONSTEXPR QGradient::QGradientData qt_preset_gradient_data[] = { static void *qt_preset_gradient_dummy() { union {void *p; uint i;}; - p = 0; + p = nullptr; i |= uint(QGradient::ObjectMode); return p; } diff --git a/src/gui/platform/unix/qeventdispatcher_glib.cpp b/src/gui/platform/unix/qeventdispatcher_glib.cpp index 42b66af686..eaa27de25c 100644 --- a/src/gui/platform/unix/qeventdispatcher_glib.cpp +++ b/src/gui/platform/unix/qeventdispatcher_glib.cpp @@ -64,7 +64,7 @@ static gboolean userEventSourcePrepare(GSource *source, gint *timeout) static gboolean userEventSourceCheck(GSource *source) { - return userEventSourcePrepare(source, 0); + return userEventSourcePrepare(source, nullptr); } static gboolean userEventSourceDispatch(GSource *source, GSourceFunc, gpointer) @@ -111,7 +111,7 @@ QPAEventDispatcherGlib::~QPAEventDispatcherGlib() g_source_destroy(&d->userEventSource->source); g_source_unref(&d->userEventSource->source); - d->userEventSource = 0; + d->userEventSource = nullptr; } bool QPAEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) diff --git a/src/gui/platform/unix/qgenericunixthemes.cpp b/src/gui/platform/unix/qgenericunixthemes.cpp index 352c975400..92bf4a14ec 100644 --- a/src/gui/platform/unix/qgenericunixthemes.cpp +++ b/src/gui/platform/unix/qgenericunixthemes.cpp @@ -80,16 +80,16 @@ Q_DECLARE_LOGGING_CATEGORY(qLcTray) ResourceHelper::ResourceHelper() { - std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast(0)); - std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast(0)); + std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast(nullptr)); + std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast(nullptr)); } void ResourceHelper::clear() { qDeleteAll(palettes, palettes + QPlatformTheme::NPalettes); qDeleteAll(fonts, fonts + QPlatformTheme::NFonts); - std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast(0)); - std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast(0)); + std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast(nullptr)); + std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast(nullptr)); } const char *QGenericUnixTheme::name = "generic"; @@ -162,7 +162,7 @@ const QFont *QGenericUnixTheme::font(Font type) const case QPlatformTheme::FixedFont: return &d->fixedFont; default: - return 0; + return nullptr; } } @@ -532,7 +532,7 @@ QFont *QKdeThemePrivate::kdeFont(const QVariant &fontValue) return new QFont(font); } } - return 0; + return nullptr; } @@ -621,7 +621,7 @@ QPlatformTheme *QKdeTheme::createKdeTheme() const QByteArray kdeVersionBA = qgetenv("KDE_SESSION_VERSION"); const int kdeVersion = kdeVersionBA.toInt(); if (kdeVersion < 4) - return 0; + return nullptr; if (kdeVersion > 4) // Plasma 5 follows XDG spec @@ -665,7 +665,7 @@ QPlatformTheme *QKdeTheme::createKdeTheme() kdeDirs.removeDuplicates(); if (kdeDirs.isEmpty()) { qWarning("Unable to determine KDE dirs"); - return 0; + return nullptr; } return new QKdeTheme(kdeDirs, kdeVersion); @@ -782,7 +782,7 @@ const QFont *QGnomeTheme::font(Font type) const case QPlatformTheme::FixedFont: return d->fixedFont; default: - return 0; + return nullptr; } } diff --git a/src/gui/text/freetype/qfontengine_ft.cpp b/src/gui/text/freetype/qfontengine_ft.cpp index e916d7242f..42cf147901 100644 --- a/src/gui/text/freetype/qfontengine_ft.cpp +++ b/src/gui/text/freetype/qfontengine_ft.cpp @@ -220,7 +220,7 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, QtFreetypeData *freetypeData = qt_getFreetypeData(); - QFreetypeFace *freetype = freetypeData->faces.value(face_id, 0); + QFreetypeFace *freetype = freetypeData->faces.value(face_id, nullptr); if (freetype) { freetype->ref.ref(); } else { @@ -1396,7 +1396,7 @@ void QFontEngineFT::TransformedGlyphSets::moveToFront(int i) QFontEngineFT::QGlyphSet *QFontEngineFT::loadGlyphSet(const QTransform &matrix) { if (matrix.type() > QTransform::TxShear || !cacheEnabled) - return 0; + return nullptr; // FT_Set_Transform only supports scalable fonts if (!FT_IS_SCALABLE(freetype->face)) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 9005c11792..dab787bbde 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2667,7 +2667,7 @@ void QFontCache::cleanup() // no cache - just ignore } if (cache && cache->hasLocalData()) - cache->setLocalData(0); + cache->setLocalData(nullptr); } static QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(0); diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index d3c8c1a840..819b2d14f8 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -230,7 +230,7 @@ bool QFontEngine::supportsScript(QChar::Script script) const if (qt_useHarfbuzzNG()) { // in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table uint len; - if (getSfntTableData(MAKE_TAG('m','o','r','t'), 0, &len) || getSfntTableData(MAKE_TAG('m','o','r','x'), 0, &len)) + if (getSfntTableData(MAKE_TAG('m','o','r','t'), nullptr, &len) || getSfntTableData(MAKE_TAG('m','o','r','x'), nullptr, &len)) return true; if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast(this))) { diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp index 7178ef2928..3b904e122a 100644 --- a/src/gui/text/qfontengine_qpf2.cpp +++ b/src/gui/text/qfontengine_qpf2.cpp @@ -90,7 +90,7 @@ static const QFontEngineQPF2::TagType tagTypes[QFontEngineQPF2::NumTags] = { #define READ_VERIFY(type, variable) \ if (tagPtr + sizeof(type) > endPtr) { \ DEBUG_VERIFY() << "read verify failed in line" << __LINE__; \ - return 0; \ + return nullptr; \ } \ variable = qFromBigEndian(tagPtr); \ DEBUG_VERIFY() << "read value" << variable << "of type " #type; \ @@ -113,7 +113,7 @@ T readValue(const uchar *&data) #define VERIFY_TAG(condition) \ if (!(condition)) { \ DEBUG_VERIFY() << "verifying tag condition " #condition " failed in line" << __LINE__ << "with tag" << tag; \ - return 0; \ + return nullptr; \ } static inline const uchar *verifyTag(const uchar *tagPtr, const uchar *endPtr) diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 94efb4a94d..d6da0f38d2 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -1601,7 +1601,7 @@ QTextObject *QTextDocumentPrivate::objectForIndex(int objectIndex) const if (objectIndex < 0) return nullptr; - QTextObject *object = objects.value(objectIndex, 0); + QTextObject *object = objects.value(objectIndex, nullptr); if (!object) { QTextDocumentPrivate *that = const_cast(this); QTextFormat fmt = formats.objectFormat(objectIndex); diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index d6e2441862..8ea3a655b7 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2909,7 +2909,7 @@ void QTextDocumentLayoutPrivate::positionFloat(QTextFrame *frame, QTextLine *cur // If the frame is a table, then positioning it will affect the size if it covers more than // one page, because of page breaks and repeating the header. - if (qobject_cast(frame) != 0) + if (qobject_cast(frame) != nullptr) fd->sizeDirty = frameSpansIntoNextPage; } diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 62a655b43c..ef51c967b0 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -312,7 +312,7 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc .arg(block.textList()->formatIndex())); } else { - m_listStack.push(0); + m_listStack.push(nullptr); } } } diff --git a/src/gui/util/qgridlayoutengine.cpp b/src/gui/util/qgridlayoutengine.cpp index 4c36ff197b..d875db0da6 100644 --- a/src/gui/util/qgridlayoutengine.cpp +++ b/src/gui/util/qgridlayoutengine.cpp @@ -1255,7 +1255,7 @@ void QGridLayoutEngine::maybeExpandGrid(int row, int column, Qt::Orientation ori Q_ASSERT(newIndex > oldIndex); q_grid[newIndex] = q_grid[oldIndex]; - q_grid[oldIndex] = 0; + q_grid[oldIndex] = nullptr; } } } @@ -1264,7 +1264,7 @@ void QGridLayoutEngine::maybeExpandGrid(int row, int column, Qt::Orientation ori void QGridLayoutEngine::regenerateGrid() { - q_grid.fill(0); + q_grid.fill(nullptr); for (int i = q_items.count() - 1; i >= 0; --i) { QGridLayoutItem *item = q_items.at(i); diff --git a/src/gui/vulkan/qbasicvulkanplatforminstance.cpp b/src/gui/vulkan/qbasicvulkanplatforminstance.cpp index 97d5a7643f..01d6179166 100644 --- a/src/gui/vulkan/qbasicvulkanplatforminstance.cpp +++ b/src/gui/vulkan/qbasicvulkanplatforminstance.cpp @@ -66,7 +66,7 @@ QBasicPlatformVulkanInstance::QBasicPlatformVulkanInstance() m_vkGetInstanceProcAddr(nullptr), m_ownsVkInst(false), m_errorCode(VK_SUCCESS), - m_debugCallback(0) + m_debugCallback(VK_NULL_HANDLE) { } diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 7aecbba2a4..5bda507920 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -101,9 +101,9 @@ public: explicit QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false, ConnectionType connectionType = ConnectionTypeHTTP, - QObject *parent = 0); + QObject *parent = nullptr); QHttpNetworkConnection(quint16 channelCount, const QString &hostName, quint16 port = 80, - bool encrypt = false, QObject *parent = 0, + bool encrypt = false, QObject *parent = nullptr, ConnectionType connectionType = ConnectionTypeHTTP); ~QHttpNetworkConnection(); diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp index a1d8873fe3..05b720c4df 100644 --- a/src/network/access/qhttpthreaddelegate.cpp +++ b/src/network/access/qhttpthreaddelegate.cpp @@ -257,7 +257,7 @@ void QHttpThreadDelegate::startRequestSynchronously() synchronousRequestLoop.exec(); connections.localData()->releaseEntry(cacheKey); - connections.setLocalData(0); + connections.setLocalData(nullptr); #ifdef QHTTPTHREADDELEGATE_DEBUG qDebug() << "QHttpThreadDelegate::startRequestSynchronously() thread=" << QThread::currentThreadId() << "finished"; diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index 815986554a..744e5e34f9 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE # define DEFINEFUNC(ret, func, arg, a, err, funcret) \ typedef ret (*_q_PTR_##func)(arg); \ - static _q_PTR_##func _q_##func = 0; \ + static _q_PTR_##func _q_##func = nullptr; \ ret q_##func(arg) { \ if (Q_UNLIKELY(!_q_##func)) { \ qsslSocketUnresolvedSymbolWarning(#func); \ @@ -98,7 +98,7 @@ QT_BEGIN_NAMESPACE // ret func(arg1, arg2) # define DEFINEFUNC2(ret, func, arg1, a, arg2, b, err, funcret) \ typedef ret (*_q_PTR_##func)(arg1, arg2); \ - static _q_PTR_##func _q_##func = 0; \ + static _q_PTR_##func _q_##func = nullptr; \ ret q_##func(arg1, arg2) { \ if (Q_UNLIKELY(!_q_##func)) { \ qsslSocketUnresolvedSymbolWarning(#func);\ @@ -110,7 +110,7 @@ QT_BEGIN_NAMESPACE // ret func(arg1, arg2, arg3) # define DEFINEFUNC3(ret, func, arg1, a, arg2, b, arg3, c, err, funcret) \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3); \ - static _q_PTR_##func _q_##func = 0; \ + static _q_PTR_##func _q_##func = nullptr; \ ret q_##func(arg1, arg2, arg3) { \ if (Q_UNLIKELY(!_q_##func)) { \ qsslSocketUnresolvedSymbolWarning(#func); \ @@ -122,7 +122,7 @@ QT_BEGIN_NAMESPACE // ret func(arg1, arg2, arg3, arg4) # define DEFINEFUNC4(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, err, funcret) \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4); \ - static _q_PTR_##func _q_##func = 0; \ + static _q_PTR_##func _q_##func = nullptr; \ ret q_##func(arg1, arg2, arg3, arg4) { \ if (Q_UNLIKELY(!_q_##func)) { \ qsslSocketUnresolvedSymbolWarning(#func); \ @@ -134,7 +134,7 @@ QT_BEGIN_NAMESPACE // ret func(arg1, arg2, arg3, arg4, arg5) # define DEFINEFUNC5(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, err, funcret) \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5); \ - static _q_PTR_##func _q_##func = 0; \ + static _q_PTR_##func _q_##func = nullptr; \ ret q_##func(arg1, arg2, arg3, arg4, arg5) { \ if (Q_UNLIKELY(!_q_##func)) { \ qsslSocketUnresolvedSymbolWarning(#func); \ @@ -146,7 +146,7 @@ QT_BEGIN_NAMESPACE // ret func(arg1, arg2, arg3, arg4, arg6) # define DEFINEFUNC6(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, arg6, f, err, funcret) \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6); \ - static _q_PTR_##func _q_##func = 0; \ + static _q_PTR_##func _q_##func = nullptr; \ ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6) { \ if (Q_UNLIKELY(!_q_##func)) { \ qsslSocketUnresolvedSymbolWarning(#func); \ @@ -158,7 +158,7 @@ QT_BEGIN_NAMESPACE // ret func(arg1, arg2, arg3, arg4, arg6, arg7) # define DEFINEFUNC7(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, arg6, f, arg7, g, err, funcret) \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7); \ - static _q_PTR_##func _q_##func = 0; \ + static _q_PTR_##func _q_##func = nullptr; \ ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { \ if (Q_UNLIKELY(!_q_##func)) { \ qsslSocketUnresolvedSymbolWarning(#func); \ @@ -170,7 +170,7 @@ QT_BEGIN_NAMESPACE // ret func(arg1, arg2, arg3, arg4, arg6, arg7, arg8, arg9) # define DEFINEFUNC9(ret, func, arg1, a, arg2, b, arg3, c, arg4, d, arg5, e, arg6, f, arg7, g, arg8, h, arg9, i, err, funcret) \ typedef ret (*_q_PTR_##func)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \ - static _q_PTR_##func _q_##func = 0; \ + static _q_PTR_##func _q_##func = nullptr; \ ret q_##func(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { \ if (Q_UNLIKELY(!_q_##func)) { \ qsslSocketUnresolvedSymbolWarning(#func); \ diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index 8a3c50ac64..5909709edc 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -64,7 +64,7 @@ public: static QSqlQueryPrivate* shared_null(); }; -Q_GLOBAL_STATIC_WITH_ARGS(QSqlQueryPrivate, nullQueryPrivate, (0)) +Q_GLOBAL_STATIC_WITH_ARGS(QSqlQueryPrivate, nullQueryPrivate, (nullptr)) Q_GLOBAL_STATIC(QSqlNullDriver, nullDriver) Q_GLOBAL_STATIC_WITH_ARGS(QSqlNullResult, nullResult, (nullDriver())) diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 61f3666b16..1cb383c92f 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -242,7 +242,7 @@ int runMoc(int argc, char **argv) QString filename; QString output; QFile in; - FILE *out = 0; + FILE *out = nullptr; // Note that moc isn't translated. // If you use this code as an example for a translated app, make sure to translate the strings. diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index e48ac6a75e..a99ac6a7c2 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp @@ -196,7 +196,7 @@ static QString generateInterfaceXml(const ClassDef *mo) // start with properties: if (flags & (QDBusConnection::ExportScriptableProperties | QDBusConnection::ExportNonScriptableProperties)) { - static const char *accessvalues[] = {0, "read", "write", "readwrite"}; + static const char *accessvalues[] = {nullptr, "read", "write", "readwrite"}; for (const PropertyDef &mp : mo->propertyList) { if (!((!mp.scriptable.isEmpty() && (flags & QDBusConnection::ExportScriptableProperties)) || (!mp.scriptable.isEmpty() && (flags & QDBusConnection::ExportNonScriptableProperties)))) diff --git a/src/tools/qlalr/compress.cpp b/src/tools/qlalr/compress.cpp index ae0fbaca9d..18f9fb4b58 100644 --- a/src/tools/qlalr/compress.cpp +++ b/src/tools/qlalr/compress.cpp @@ -74,10 +74,10 @@ public: public: inline UncompressedRow (): _M_index (0), - _M_begin (0), - _M_end (0), - _M_beginNonZeros (0), - _M_endNonZeros (0) {} + _M_begin (nullptr), + _M_end (nullptr), + _M_beginNonZeros (nullptr), + _M_endNonZeros (nullptr) {} inline UncompressedRow (int index, const_iterator begin, const_iterator end) { assign (index, begin, end); } diff --git a/src/tools/qlalr/cppgenerator.cpp b/src/tools/qlalr/cppgenerator.cpp index cff97b132a..7efe94a5c2 100644 --- a/src/tools/qlalr/cppgenerator.cpp +++ b/src/tools/qlalr/cppgenerator.cpp @@ -325,10 +325,10 @@ void CppGenerator::operator () () compressed_goto (pgoto, state_count, non_terminal_count); delete[] table; - table = 0; + table = nullptr; delete[] pgoto; - pgoto = 0; + pgoto = nullptr; #undef ACTION #undef GOTO diff --git a/src/tools/qlalr/grammar.cpp b/src/tools/qlalr/grammar.cpp index f633962815..2ab6504bf8 100644 --- a/src/tools/qlalr/grammar.cpp +++ b/src/tools/qlalr/grammar.cpp @@ -33,8 +33,8 @@ QT_BEGIN_NAMESPACE const char *const grammar::spell [] = { "end of file", "identifier", "string literal", "%decl", "%expect", "%expect-lr", "%impl", "%left", "%merged_output", "%nonassoc", - "%parser", "%prec", "%right", "%start", "%token", "%token_prefix", ":", "|", ";", 0, - 0, 0 + "%parser", "%prec", "%right", "%start", "%token", "%token_prefix", ":", "|", ";", nullptr, + nullptr, nullptr }; const short grammar::lhs [] = { diff --git a/src/tools/qlalr/recognizer.cpp b/src/tools/qlalr/recognizer.cpp index 3da54c0c6a..760a094460 100644 --- a/src/tools/qlalr/recognizer.cpp +++ b/src/tools/qlalr/recognizer.cpp @@ -37,7 +37,7 @@ Recognizer::Recognizer (Grammar *grammar, bool no_lines): tos(0), stack_size(0), - state_stack(0), + state_stack(nullptr), _M_line(1), _M_action_line(0), _M_grammar(grammar), diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 8b1ebad14c..924f2904f0 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -150,7 +150,7 @@ RCCFileInfo::RCCFileInfo(const QString &name, const QFileInfo &fileInfo, m_language = language; m_country = country; m_flags = flags; - m_parent = 0; + m_parent = nullptr; m_nameOffset = 0; m_dataOffset = 0; m_childOffset = 0; @@ -461,7 +461,7 @@ RCCResourceLibrary::Strings::Strings() : } RCCResourceLibrary::RCCResourceLibrary(quint8 formatVersion) - : m_root(0), + : m_root(nullptr), m_format(C_Code), m_verbose(false), m_compressionAlgo(CONSTANT_COMPRESSALGO_DEFAULT), @@ -472,8 +472,8 @@ RCCResourceLibrary::RCCResourceLibrary(quint8 formatVersion) m_dataOffset(0), m_overallFlags(0), m_useNameSpace(CONSTANT_USENAMESPACE), - m_errorDevice(0), - m_outDevice(0), + m_errorDevice(nullptr), + m_outDevice(nullptr), m_formatVersion(formatVersion), m_noZstd(false) { @@ -707,7 +707,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice, return false; } - if (m_root == 0) { + if (m_root == nullptr) { const QString msg = QString::fromLatin1("RCC: Warning: No resources in '%1'.\n").arg(fname); m_errorDevice->write(msg.toUtf8()); if (!listMode && m_format == Binary) { @@ -770,9 +770,9 @@ void RCCResourceLibrary::reset() { if (m_root) { delete m_root; - m_root = 0; + m_root = nullptr; } - m_errorDevice = 0; + m_errorDevice = nullptr; m_failedResources.clear(); } diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 6d68dc0d78..29c054bc22 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -649,7 +649,7 @@ void WriteInitialization::acceptWidget(DomWidget *node) } if (node->elementLayout().isEmpty()) - m_layoutChain.push(0); + m_layoutChain.push(nullptr); m_layoutWidget = false; if (className == QLatin1String("QWidget") && !node->hasAttributeNative()) { @@ -662,7 +662,7 @@ void WriteInitialization::acceptWidget(DomWidget *node) } } m_widgetChain.push(node); - m_layoutChain.push(0); + m_layoutChain.push(nullptr); TreeWalker::acceptWidget(node); m_layoutChain.pop(); m_widgetChain.pop(); -- cgit v1.2.3