Another round of 0->nullptr cleanup

Change-Id: Ic8db7dc252f8fea46eb5a4f334726d6c7f4645a6
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2020-07-29 16:30:13 +02:00
parent 4ed483b0e2
commit 5747f31392
49 changed files with 123 additions and 121 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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

View File

@ -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;
}
}

View File

@ -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);
}
/*!

View File

@ -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) {

View File

@ -419,7 +419,7 @@ inline void QLibraryStore::cleanup()
#endif
}
delete lib;
it.value() = 0;
it.value() = nullptr;
}
}

View File

@ -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;

View File

@ -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();

View File

@ -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);

View File

@ -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
}

View File

@ -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)

View File

@ -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;

View File

@ -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")) {

View File

@ -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)));

View File

@ -224,8 +224,8 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
buffer = reinterpret_cast<uint *>(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;

View File

@ -538,7 +538,7 @@ bool QImageReaderPrivate::initHandler()
// probe the file extension
if (deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly) && autoDetectImageFormat) {
Q_ASSERT(qobject_cast<QFile*>(device) != 0); // future-proofing; for now this should always be the case, so...
Q_ASSERT(qobject_cast<QFile*>(device) != nullptr); // future-proofing; for now this should always be the case, so...
QFile *file = static_cast<QFile *>(device);
if (file->error() == QFileDevice::ResourceError) {

View File

@ -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<QStandardItem*> &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 QList<QStandardI
rows += count;
int index = childIndex(row, 0);
if (index != -1)
children.insert(index, columnCount() * count, 0);
children.insert(index, columnCount() * count, nullptr);
}
if (!items.isEmpty()) {
int index = childIndex(row, 0);
@ -555,7 +555,7 @@ bool QStandardItemPrivate::insertColumns(int column, int count, const QList<QSta
columns += count;
int index = childIndex(0, column);
for (int row = 0; row < rowCount(); ++row) {
children.insert(index, count, 0);
children.insert(index, count, nullptr);
index += columnCount();
}
}
@ -661,7 +661,7 @@ void QStandardItemModelPrivate::rowsInserted(QStandardItem *parent,
{
Q_Q(QStandardItemModel);
if (parent == root.data())
rowHeaderItems.insert(row, count, 0);
rowHeaderItems.insert(row, count, nullptr);
q->endInsertRows();
}
@ -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;
}

View File

@ -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<QOpenGLSharedResource *> QOpenGLMultiGroupSharedResource::resources() const
{
QList<QOpenGLSharedResource *> result;
for (QList<QOpenGLContextGroup *>::const_iterator it = m_groups.constBegin(); it != m_groups.constEnd(); ++it) {
QOpenGLSharedResource *resource = (*it)->d_func()->m_resources.value(const_cast<QOpenGLMultiGroupSharedResource *>(this), 0);
QOpenGLSharedResource *resource = (*it)->d_func()->m_resources.value(const_cast<QOpenGLMultiGroupSharedResource *>(this), nullptr);
if (resource)
result << resource;
}

View File

@ -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<T *>(group->d_func()->m_resources.value(this, 0));
T *resource = static_cast<T *>(group->d_func()->m_resources.value(this, nullptr));
if (!resource) {
resource = new T(context);
insert(context, resource);

View File

@ -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);

View File

@ -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

View File

@ -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::RBNode *, PathSimplifier::RBNode *> PathSimplifier::outerBounds(const QPoint &point)
{
RBNode *current = m_elementList.root;
QPair<RBNode *, RBNode *> result(0, 0);
QPair<RBNode *, RBNode *> result(nullptr, nullptr);
while (current) {
const Element *element = current->data;

View File

@ -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;

View File

@ -1061,7 +1061,7 @@ template <typename T>
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSimple::bounds(const QPodPoint &point) const
{
QRBTree<int>::Node *current = m_edgeList.root;
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> result(0, 0);
QPair<QRBTree<int>::Node *, QRBTree<int>::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 <typename T>
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSimple::outerBounds(const QPodPoint &point) const
{
QRBTree<int>::Node *current = m_edgeList.root;
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> result(0, 0);
QPair<QRBTree<int>::Node *, QRBTree<int>::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<T>::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);
}

View File

@ -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;
}

View File

@ -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)

View File

@ -80,16 +80,16 @@ Q_DECLARE_LOGGING_CATEGORY(qLcTray)
ResourceHelper::ResourceHelper()
{
std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(0));
std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(0));
std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(nullptr));
std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(nullptr));
}
void ResourceHelper::clear()
{
qDeleteAll(palettes, palettes + QPlatformTheme::NPalettes);
qDeleteAll(fonts, fonts + QPlatformTheme::NFonts);
std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(0));
std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(0));
std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(nullptr));
std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(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;
}
}

View File

@ -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))

View File

@ -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);

View File

@ -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<QFontEngine *>(this))) {

View File

@ -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<type>(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)

View File

@ -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<QTextDocumentPrivate *>(this);
QTextFormat fmt = formats.objectFormat(objectIndex);

View File

@ -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<QTextTable *>(frame) != 0)
if (qobject_cast<QTextTable *>(frame) != nullptr)
fd->sizeDirty = frameSpansIntoNextPage;
}

View File

@ -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);
}
}
}

View File

@ -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);

View File

@ -66,7 +66,7 @@ QBasicPlatformVulkanInstance::QBasicPlatformVulkanInstance()
m_vkGetInstanceProcAddr(nullptr),
m_ownsVkInst(false),
m_errorCode(VK_SUCCESS),
m_debugCallback(0)
m_debugCallback(VK_NULL_HANDLE)
{
}

View File

@ -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();

View File

@ -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";

View File

@ -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); \

View File

@ -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()))

View File

@ -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.

View File

@ -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))))

View File

@ -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); }

View File

@ -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

View File

@ -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 [] = {

View File

@ -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),

View File

@ -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();
}

View File

@ -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();