aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-21 10:41:54 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 07:13:18 +0000
commit499ec43937e926e4f2fa57a9baa455fcb3862262 (patch)
tree206c90d47387f8322b68f5e3db613189397e1af3 /src/qml/jsruntime
parent53d1e9ed21d25e65a2f13606af479838f5f21fe7 (diff)
use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4arraybuffer.cpp4
-rw-r--r--src/qml/jsruntime/qv4arraybuffer_p.h4
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp12
-rw-r--r--src/qml/jsruntime/qv4arraydata_p.h2
-rw-r--r--src/qml/jsruntime/qv4context.cpp2
-rw-r--r--src/qml/jsruntime/qv4context_p.h4
-rw-r--r--src/qml/jsruntime/qv4dataview.cpp6
-rw-r--r--src/qml/jsruntime/qv4dateobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4engine.cpp44
-rw-r--r--src/qml/jsruntime/qv4engine_p.h2
-rw-r--r--src/qml/jsruntime/qv4errorobject_p.h4
-rw-r--r--src/qml/jsruntime/qv4executableallocator.cpp6
-rw-r--r--src/qml/jsruntime/qv4executableallocator_p.h8
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4functionobject_p.h4
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4identifier.cpp10
-rw-r--r--src/qml/jsruntime/qv4identifier_p.h2
-rw-r--r--src/qml/jsruntime/qv4identifiertable.cpp4
-rw-r--r--src/qml/jsruntime/qv4include.cpp4
-rw-r--r--src/qml/jsruntime/qv4internalclass.cpp16
-rw-r--r--src/qml/jsruntime/qv4internalclass_p.h8
-rw-r--r--src/qml/jsruntime/qv4jscall_p.h4
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4managed.cpp8
-rw-r--r--src/qml/jsruntime/qv4memberdata_p.h2
-rw-r--r--src/qml/jsruntime/qv4object.cpp24
-rw-r--r--src/qml/jsruntime/qv4object_p.h14
-rw-r--r--src/qml/jsruntime/qv4objectiterator.cpp8
-rw-r--r--src/qml/jsruntime/qv4objectiterator_p.h2
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp2
-rw-r--r--src/qml/jsruntime/qv4persistent.cpp16
-rw-r--r--src/qml/jsruntime/qv4persistent_p.h20
-rw-r--r--src/qml/jsruntime/qv4profiling_p.h4
-rw-r--r--src/qml/jsruntime/qv4property_p.h4
-rw-r--r--src/qml/jsruntime/qv4qmlcontext.cpp6
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp76
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h4
-rw-r--r--src/qml/jsruntime/qv4regexp.cpp4
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp38
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp12
-rw-r--r--src/qml/jsruntime/qv4runtimecodegen.cpp6
-rw-r--r--src/qml/jsruntime/qv4scopedvalue_p.h6
-rw-r--r--src/qml/jsruntime/qv4script.cpp16
-rw-r--r--src/qml/jsruntime/qv4script_p.h6
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4sparsearray.cpp40
-rw-r--r--src/qml/jsruntime/qv4sparsearray_p.h6
-rw-r--r--src/qml/jsruntime/qv4string.cpp2
-rw-r--r--src/qml/jsruntime/qv4string_p.h2
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4typedarray.cpp10
-rw-r--r--src/qml/jsruntime/qv4value_p.h6
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp2
54 files changed, 264 insertions, 264 deletions
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp
index f7b9e8acef..c4eddb6b2a 100644
--- a/src/qml/jsruntime/qv4arraybuffer.cpp
+++ b/src/qml/jsruntime/qv4arraybuffer.cpp
@@ -96,7 +96,7 @@ void Heap::ArrayBuffer::init(size_t length)
Object::init();
data = QTypedArrayData<char>::allocate(length + 1);
if (!data) {
- data = 0;
+ data = nullptr;
internalClass->engine->throwRangeError(QStringLiteral("ArrayBuffer: out of memory"));
return;
}
@@ -152,7 +152,7 @@ void ArrayBufferPrototype::init(ExecutionEngine *engine, Object *ctor)
ctor->defineReadonlyProperty(engine->id_prototype(), (o = this));
ctor->defineDefaultProperty(QStringLiteral("isView"), ArrayBufferCtor::method_isView, 1);
defineDefaultProperty(engine->id_constructor(), (o = ctor));
- defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, 0);
+ defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, nullptr);
defineDefaultProperty(QStringLiteral("slice"), method_slice, 2);
defineDefaultProperty(QStringLiteral("toString"), method_toString, 0);
}
diff --git a/src/qml/jsruntime/qv4arraybuffer_p.h b/src/qml/jsruntime/qv4arraybuffer_p.h
index e236a23d1f..59e78ee85f 100644
--- a/src/qml/jsruntime/qv4arraybuffer_p.h
+++ b/src/qml/jsruntime/qv4arraybuffer_p.h
@@ -93,8 +93,8 @@ struct Q_QML_PRIVATE_EXPORT ArrayBuffer : Object
QByteArray asByteArray() const;
uint byteLength() const { return d()->byteLength(); }
- char *data() { detach(); return d()->data ? d()->data->data() : 0; }
- const char *constData() { detach(); return d()->data ? d()->data->data() : 0; }
+ char *data() { detach(); return d()->data ? d()->data->data() : nullptr; }
+ const char *constData() { detach(); return d()->data ? d()->data->data() : nullptr; }
private:
void detach();
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index 5e971c8e9b..30c8527f21 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -50,7 +50,7 @@ using namespace QV4;
QT_WARNING_SUPPRESS_GCC_TAUTOLOGICAL_COMPARE_ON
const QV4::VTable QV4::ArrayData::static_vtbl = {
- 0,
+ nullptr,
0,
0,
QV4::ArrayData::IsExecutionContext,
@@ -69,7 +69,7 @@ const QV4::VTable QV4::ArrayData::static_vtbl = {
const ArrayVTable SimpleArrayData::static_vtbl =
{
- DEFINE_MANAGED_VTABLE_INT(SimpleArrayData, 0),
+ DEFINE_MANAGED_VTABLE_INT(SimpleArrayData, nullptr),
Heap::ArrayData::Simple,
SimpleArrayData::reallocate,
SimpleArrayData::get,
@@ -85,7 +85,7 @@ const ArrayVTable SimpleArrayData::static_vtbl =
const ArrayVTable SparseArrayData::static_vtbl =
{
- DEFINE_MANAGED_VTABLE_INT(SparseArrayData, 0),
+ DEFINE_MANAGED_VTABLE_INT(SparseArrayData, nullptr),
Heap::ArrayData::Sparse,
SparseArrayData::reallocate,
SparseArrayData::get,
@@ -170,7 +170,7 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt
newData->setType(newType);
if (d)
newData->d()->needsMark = d->d()->needsMark;
- newData->setAttrs(enforceAttributes ? reinterpret_cast<PropertyAttributes *>(newData->d()->values.values + alloc) : 0);
+ newData->setAttrs(enforceAttributes ? reinterpret_cast<PropertyAttributes *>(newData->d()->values.values + alloc) : nullptr);
o->setArrayData(newData);
if (d) {
@@ -203,7 +203,7 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt
if (d && d->type() == Heap::ArrayData::Sparse) {
Heap::SparseArrayData *old = static_cast<Heap::SparseArrayData *>(d->d());
sparse->sparse = old->sparse;
- old->sparse = 0;
+ old->sparse = nullptr;
lastFree = &sparse->sparse->freeList;
} else {
sparse->sparse = new SparseArray;
@@ -779,7 +779,7 @@ void ArrayData::sort(ExecutionEngine *engine, Object *thisObject, const Value &c
if (!sparse->sparse()->nEntries())
return;
- thisObject->setArrayData(0);
+ thisObject->setArrayData(nullptr);
ArrayData::realloc(thisObject, Heap::ArrayData::Simple, sparse->sparse()->nEntries(), sparse->attrs() ? true : false);
Heap::SimpleArrayData *d = thisObject->d()->arrayData.cast<Heap::SimpleArrayData>();
diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h
index d6549e44ee..9356670b6d 100644
--- a/src/qml/jsruntime/qv4arraydata_p.h
+++ b/src/qml/jsruntime/qv4arraydata_p.h
@@ -331,7 +331,7 @@ ArrayData::Index ArrayData::getValueOrSetter(uint index, PropertyAttributes *att
uint idx = mappedIndex(index);
if (idx == UINT_MAX) {
*attrs = Attr_Invalid;
- return { 0, 0 };
+ return { nullptr, 0 };
}
*attrs = attributes(index);
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 00d816fe91..020e519e74 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -302,7 +302,7 @@ ReturnedValue ExecutionContext::getProperty(String *name)
ReturnedValue ExecutionContext::getPropertyAndBase(String *name, Value *base)
{
- base->setM(0);
+ base->setM(nullptr);
name->makeIdentifier();
Heap::ExecutionContext *ctx = d();
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index dfac5534be..512bfa06d8 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -246,12 +246,12 @@ struct CatchContext : public ExecutionContext
inline CallContext *ExecutionContext::asCallContext()
{
- return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<CallContext *>(this) : 0;
+ return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<CallContext *>(this) : nullptr;
}
inline const CallContext *ExecutionContext::asCallContext() const
{
- return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<const CallContext *>(this) : 0;
+ return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<const CallContext *>(this) : nullptr;
}
} // namespace QV4
diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp
index 397ef1cfec..d894d909ff 100644
--- a/src/qml/jsruntime/qv4dataview.cpp
+++ b/src/qml/jsruntime/qv4dataview.cpp
@@ -88,9 +88,9 @@ void DataViewPrototype::init(ExecutionEngine *engine, Object *ctor)
ctor->defineReadonlyProperty(engine->id_length(), Primitive::fromInt32(3));
ctor->defineReadonlyProperty(engine->id_prototype(), (o = this));
defineDefaultProperty(engine->id_constructor(), (o = ctor));
- defineAccessorProperty(QStringLiteral("buffer"), method_get_buffer, 0);
- defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, 0);
- defineAccessorProperty(QStringLiteral("byteOffset"), method_get_byteOffset, 0);
+ defineAccessorProperty(QStringLiteral("buffer"), method_get_buffer, nullptr);
+ defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, nullptr);
+ defineAccessorProperty(QStringLiteral("byteOffset"), method_get_byteOffset, nullptr);
defineDefaultProperty(QStringLiteral("getInt8"), method_getChar<signed char>, 0);
defineDefaultProperty(QStringLiteral("getUint8"), method_getChar<unsigned char>, 0);
diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h
index a4ab0a27ed..2b9a580288 100644
--- a/src/qml/jsruntime/qv4dateobject_p.h
+++ b/src/qml/jsruntime/qv4dateobject_p.h
@@ -101,7 +101,7 @@ struct DateObject: Object {
template<>
inline const DateObject *Value::as() const {
- return isManaged() && m()->vtable()->type == Managed::Type_DateObject ? static_cast<const DateObject *>(this) : 0;
+ return isManaged() && m()->vtable()->type == Managed::Type_DateObject ? static_cast<const DateObject *>(this) : nullptr;
}
struct DateCtor: FunctionObject
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 4b5aadbdcf..168a2ea9d4 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -127,13 +127,13 @@ ExecutionEngine::ExecutionEngine()
, bumperPointerAllocator(new WTF::BumpPointerAllocator)
, jsStack(new WTF::PageAllocation)
, gcStack(new WTF::PageAllocation)
- , globalCode(0)
- , v8Engine(0)
- , argumentsAccessors(0)
+ , globalCode(nullptr)
+ , v8Engine(nullptr)
+ , argumentsAccessors(nullptr)
, nArgumentsAccessors(0)
, m_engineId(engineSerial.fetchAndAddOrdered(1))
- , regExpCache(0)
- , m_multiplyWrappedQObjects(0)
+ , regExpCache(nullptr)
+ , m_multiplyWrappedQObjects(nullptr)
#if defined(V4_ENABLE_JIT) && !defined(V4_BOOTSTRAP)
, m_canAllocateExecutableMemory(OSAllocator::canAllocateExecutableMemory())
#endif
@@ -314,7 +314,7 @@ ExecutionEngine::ExecutionEngine()
internalClasses[EngineBase::Class_RegExpExecArray] = ic->addMember(id_input(), Attr_Data, &index);
Q_ASSERT(index == RegExpObject::Index_ArrayInput);
- ic = newInternalClass(ErrorObject::staticVTable(), 0);
+ ic = newInternalClass(ErrorObject::staticVTable(), nullptr);
ic = ic->addMember((str = newIdentifier(QStringLiteral("stack"))), Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable, &index);
Q_ASSERT(index == ErrorObject::Index_Stack);
ic = ic->addMember((str = newIdentifier(QStringLiteral("fileName"))), Attr_Data|Attr_NotEnumerable, &index);
@@ -396,8 +396,8 @@ ExecutionEngine::ExecutionEngine()
jsObjects[DataView_Ctor] = memoryManager->allocObject<DataViewCtor>(global);
jsObjects[DataViewProto] = memoryManager->allocObject<DataViewPrototype>();
static_cast<DataViewPrototype *>(dataViewPrototype())->init(this, dataViewCtor());
- jsObjects[ValueTypeProto] = (Heap::Base *) 0;
- jsObjects[SignalHandlerProto] = (Heap::Base *) 0;
+ jsObjects[ValueTypeProto] = (Heap::Base *) nullptr;
+ jsObjects[SignalHandlerProto] = (Heap::Base *) nullptr;
for (int i = 0; i < Heap::TypedArray::NTypes; ++i) {
static_cast<Value &>(typedArrayCtors[i]) = memoryManager->allocObject<TypedArrayCtor>(global, Heap::TypedArray::Type(i));
@@ -480,7 +480,7 @@ ExecutionEngine::ExecutionEngine()
ExecutionEngine::~ExecutionEngine()
{
delete m_multiplyWrappedQObjects;
- m_multiplyWrappedQObjects = 0;
+ m_multiplyWrappedQObjects = nullptr;
delete identifierTable;
delete memoryManager;
@@ -531,7 +531,7 @@ InternalClass *ExecutionEngine::newClass(const InternalClass &other)
InternalClass *ExecutionEngine::newInternalClass(const VTable *vtable, Object *prototype)
{
- return internalClasses[EngineBase::Class_Empty]->changeVTable(vtable)->changePrototype(prototype ? prototype->d() : 0);
+ return internalClasses[EngineBase::Class_Empty]->changeVTable(vtable)->changePrototype(prototype ? prototype->d() : nullptr);
}
Heap::Object *ExecutionEngine::newObject()
@@ -733,18 +733,18 @@ Heap::Object *ExecutionEngine::newForEachIteratorObject(Object *o)
Heap::QmlContext *ExecutionEngine::qmlContext() const
{
if (!currentStackFrame)
- return 0;
+ return nullptr;
Heap::ExecutionContext *ctx = currentContext()->d();
if (ctx->type != Heap::ExecutionContext::Type_QmlContext && !ctx->outer)
- return 0;
+ return nullptr;
while (ctx->outer && ctx->outer->type != Heap::ExecutionContext::Type_GlobalContext)
ctx = ctx->outer;
Q_ASSERT(ctx);
if (ctx->type != Heap::ExecutionContext::Type_QmlContext)
- return 0;
+ return nullptr;
return static_cast<Heap::QmlContext *>(ctx);
}
@@ -753,7 +753,7 @@ QObject *ExecutionEngine::qmlScopeObject() const
{
Heap::QmlContext *ctx = qmlContext();
if (!ctx)
- return 0;
+ return nullptr;
return ctx->qml()->scopeObject;
}
@@ -783,7 +783,7 @@ QQmlContextData *ExecutionEngine::callingQmlContext() const
{
Heap::QmlContext *ctx = qmlContext();
if (!ctx)
- return 0;
+ return nullptr;
return ctx->qml()->context->contextData();
}
@@ -1091,7 +1091,7 @@ QQmlError ExecutionEngine::catchExceptionAsQmlError()
typedef QSet<QV4::Heap::Object *> V4ObjectSet;
static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int typeHint, bool createJSValueForObjects, V4ObjectSet *visitedObjects);
static QObject *qtObjectFromJS(QV4::ExecutionEngine *engine, const QV4::Value &value);
-static QVariant objectToVariant(QV4::ExecutionEngine *e, const QV4::Object *o, V4ObjectSet *visitedObjects = 0);
+static QVariant objectToVariant(QV4::ExecutionEngine *e, const QV4::Object *o, V4ObjectSet *visitedObjects = nullptr);
static bool convertToNativeQObject(QV4::ExecutionEngine *e, const QV4::Value &value,
const QByteArray &targetType,
void **result);
@@ -1105,7 +1105,7 @@ static QV4::ReturnedValue variantToJS(QV4::ExecutionEngine *v4, const QVariant &
QVariant ExecutionEngine::toVariant(const Value &value, int typeHint, bool createJSValueForObjects)
{
- return ::toVariant(this, value, typeHint, createJSValueForObjects, 0);
+ return ::toVariant(this, value, typeHint, createJSValueForObjects, nullptr);
}
@@ -1469,7 +1469,7 @@ static QV4::ReturnedValue variantMapToJS(QV4::ExecutionEngine *v4, const QVarian
// Returns the value if conversion succeeded, an empty handle otherwise.
QV4::ReturnedValue ExecutionEngine::metaTypeToJS(int type, const void *data)
{
- Q_ASSERT(data != 0);
+ Q_ASSERT(data != nullptr);
// check if it's one of the types we know
switch (QMetaType::Type(type)) {
@@ -1742,7 +1742,7 @@ bool ExecutionEngine::metaTypeFromJS(const Value *value, int type, void *data)
QByteArray className = name.left(name.size()-1);
QV4::ScopedObject p(scope, proto.getPointer());
if (QObject *qobject = qtObjectFromJS(this, p))
- canCast = qobject->qt_metacast(className) != 0;
+ canCast = qobject->qt_metacast(className) != nullptr;
}
if (canCast) {
QByteArray varTypeName = QMetaType::typeName(var.userType());
@@ -1756,7 +1756,7 @@ bool ExecutionEngine::metaTypeFromJS(const Value *value, int type, void *data)
}
}
} else if (value->isNull() && name.endsWith('*')) {
- *reinterpret_cast<void* *>(data) = 0;
+ *reinterpret_cast<void* *>(data) = nullptr;
return true;
} else if (type == qMetaTypeId<QJSValue>()) {
*reinterpret_cast<QJSValue*>(data) = QJSValue(this, value->asReturnedValue());
@@ -1784,7 +1784,7 @@ static bool convertToNativeQObject(QV4::ExecutionEngine *e, const QV4::Value &va
static QObject *qtObjectFromJS(QV4::ExecutionEngine *engine, const QV4::Value &value)
{
if (!value.isObject())
- return 0;
+ return nullptr;
QV4::Scope scope(engine);
QV4::Scoped<QV4::VariantObject> v(scope, value);
@@ -1797,7 +1797,7 @@ static QObject *qtObjectFromJS(QV4::ExecutionEngine *engine, const QV4::Value &v
}
QV4::Scoped<QV4::QObjectWrapper> wrapper(scope, value);
if (!wrapper)
- return 0;
+ return nullptr;
return wrapper->object();
}
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index a37c640431..5edf89f720 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -459,7 +459,7 @@ public:
StackTrace exceptionStackTrace;
ReturnedValue throwError(const Value &value);
- ReturnedValue catchException(StackTrace *trace = 0);
+ ReturnedValue catchException(StackTrace *trace = nullptr);
ReturnedValue throwError(const QString &message);
ReturnedValue throwSyntaxError(const QString &message);
diff --git a/src/qml/jsruntime/qv4errorobject_p.h b/src/qml/jsruntime/qv4errorobject_p.h
index a5ee0eb886..6b578e8c38 100644
--- a/src/qml/jsruntime/qv4errorobject_p.h
+++ b/src/qml/jsruntime/qv4errorobject_p.h
@@ -180,7 +180,7 @@ struct ErrorObject: Object {
template<>
inline const ErrorObject *Value::as() const {
- return isManaged() && m()->vtable()->isErrorObject ? reinterpret_cast<const ErrorObject *>(this) : 0;
+ return isManaged() && m()->vtable()->isErrorObject ? reinterpret_cast<const ErrorObject *>(this) : nullptr;
}
struct EvalErrorObject: ErrorObject {
@@ -322,7 +322,7 @@ struct URIErrorPrototype : ErrorObject
inline SyntaxErrorObject *ErrorObject::asSyntaxError()
{
- return d()->errorType == QV4::Heap::ErrorObject::SyntaxError ? static_cast<SyntaxErrorObject *>(this) : 0;
+ return d()->errorType == QV4::Heap::ErrorObject::SyntaxError ? static_cast<SyntaxErrorObject *>(this) : nullptr;
}
diff --git a/src/qml/jsruntime/qv4executableallocator.cpp b/src/qml/jsruntime/qv4executableallocator.cpp
index 64ac1267ce..6f04a712e6 100644
--- a/src/qml/jsruntime/qv4executableallocator.cpp
+++ b/src/qml/jsruntime/qv4executableallocator.cpp
@@ -159,7 +159,7 @@ ExecutableAllocator::~ExecutableAllocator()
ExecutableAllocator::Allocation *ExecutableAllocator::allocate(size_t size)
{
QMutexLocker locker(&mutex);
- Allocation *allocation = 0;
+ Allocation *allocation = nullptr;
// Code is best aligned to 16-byte boundaries.
size = WTF::roundUpToMultipleOf(16, size);
@@ -217,7 +217,7 @@ void ExecutableAllocator::free(Allocation *allocation)
if (!merged)
freeAllocations.insert(allocation->size, allocation);
- allocation = 0;
+ allocation = nullptr;
if (!chunk->firstAllocation->next) {
freeAllocations.remove(chunk->firstAllocation->size, chunk->firstAllocation);
@@ -235,7 +235,7 @@ ExecutableAllocator::ChunkOfPages *ExecutableAllocator::chunkForAllocation(Alloc
if (it != chunks.begin())
--it;
if (it == chunks.end())
- return 0;
+ return nullptr;
return *it;
}
diff --git a/src/qml/jsruntime/qv4executableallocator_p.h b/src/qml/jsruntime/qv4executableallocator_p.h
index 353a6eacff..2984a89df5 100644
--- a/src/qml/jsruntime/qv4executableallocator_p.h
+++ b/src/qml/jsruntime/qv4executableallocator_p.h
@@ -85,8 +85,8 @@ public:
: addr(0)
, size(0)
, free(true)
- , next(0)
- , prev(0)
+ , next(nullptr)
+ , prev(nullptr)
{}
void *start() const;
@@ -117,8 +117,8 @@ public:
struct ChunkOfPages
{
ChunkOfPages()
- : pages(0)
- , firstAllocation(0)
+ : pages(nullptr)
+ , firstAllocation(nullptr)
{}
~ChunkOfPages();
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 165f1801ea..a8c1640767 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -232,7 +232,7 @@ ReturnedValue FunctionCtor::callAsConstructor(const FunctionObject *f, const Val
if (!fe)
return scope.engine->throwSyntaxError(QLatin1String("Parse error"));
- Compiler::Module module(scope.engine->debugger() != 0);
+ Compiler::Module module(scope.engine->debugger() != nullptr);
Compiler::JSUnitGenerator jsGenerator(&module);
RuntimeCodegen cg(scope.engine, &jsGenerator, false);
@@ -351,7 +351,7 @@ ReturnedValue FunctionPrototype::method_bind(const FunctionObject *b, const Valu
return scope.engine->throwTypeError();
ScopedValue boundThis(scope, argc ? argv[0] : Primitive::undefinedValue());
- Scoped<MemberData> boundArgs(scope, (Heap::MemberData *)0);
+ Scoped<MemberData> boundArgs(scope, (Heap::MemberData *)nullptr);
if (argc > 1) {
boundArgs = MemberData::allocate(scope.engine, argc - 1);
boundArgs->d()->values.size = argc - 1;
@@ -440,7 +440,7 @@ void Heap::BoundFunction::init(QV4::ExecutionContext *scope, QV4::FunctionObject
Scope s(scope);
Heap::FunctionObject::init(scope, QStringLiteral("__bound function__"));
this->target.set(s.engine, target->d());
- this->boundArgs.set(s.engine, boundArgs ? boundArgs->d() : 0);
+ this->boundArgs.set(s.engine, boundArgs ? boundArgs->d() : nullptr);
this->boundThis.set(scope->engine(), boundThis);
ScopedObject f(s, this);
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index abd6f2dbcb..d6066ec648 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -84,7 +84,7 @@ DECLARE_HEAP_OBJECT(FunctionObject, Object) {
};
Q_QML_PRIVATE_EXPORT void init(QV4::ExecutionContext *scope, QV4::String *name, ReturnedValue (*code)(const QV4::FunctionObject *, const Value *thisObject, const Value *argv, int argc));
- void init(QV4::ExecutionContext *scope, QV4::String *name = 0, bool createProto = false);
+ void init(QV4::ExecutionContext *scope, QV4::String *name = nullptr, bool createProto = false);
void init(QV4::ExecutionContext *scope, QV4::Function *function, bool createProto = false);
void init(QV4::ExecutionContext *scope, const QString &name, bool createProto = false);
void init();
@@ -179,7 +179,7 @@ struct Q_QML_EXPORT FunctionObject: Object {
template<>
inline const FunctionObject *Value::as() const {
- return isManaged() && m()->vtable()->isFunctionObject ? reinterpret_cast<const FunctionObject *>(this) : 0;
+ return isManaged() && m()->vtable()->isFunctionObject ? reinterpret_cast<const FunctionObject *>(this) : nullptr;
}
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index 3214a716e8..f419ab53fe 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -375,12 +375,12 @@ ReturnedValue EvalFunction::evalCall(const Value *, const Value *argv, int argc,
if (function->isStrict() || isStrict) {
ScopedFunctionObject e(scope, FunctionObject::createScriptFunction(ctx, function));
ScopedValue thisObject(scope, directCall ? scope.engine->currentStackFrame->thisObject() : scope.engine->globalObject->asReturnedValue());
- return e->call(thisObject, 0, 0);
+ return e->call(thisObject, nullptr, 0);
}
ScopedValue thisObject(scope, scope.engine->currentStackFrame->thisObject());
- return function->call(thisObject, 0, 0, ctx);
+ return function->call(thisObject, nullptr, 0, ctx);
}
@@ -507,7 +507,7 @@ ReturnedValue GlobalFunctions::method_parseFloat(const FunctionObject *b, const
QByteArray ba = trimmed.toLatin1();
bool ok;
const char *begin = ba.constData();
- const char *end = 0;
+ const char *end = nullptr;
double d = qstrtod(begin, &end, &ok);
if (end - begin == 0)
RETURN_RESULT(Encode(std::numeric_limits<double>::quiet_NaN())); // 3
diff --git a/src/qml/jsruntime/qv4identifier.cpp b/src/qml/jsruntime/qv4identifier.cpp
index 116d4ec201..c122bcb51a 100644
--- a/src/qml/jsruntime/qv4identifier.cpp
+++ b/src/qml/jsruntime/qv4identifier.cpp
@@ -132,13 +132,13 @@ IdentifierHashEntry *IdentifierHash::addEntry(const Identifier *identifier)
const IdentifierHashEntry *IdentifierHash::lookup(const Identifier *identifier) const
{
if (!d)
- return 0;
+ return nullptr;
Q_ASSERT(d->entries);
uint idx = identifier->hashValue % d->alloc;
while (1) {
if (!d->entries[idx].identifier)
- return 0;
+ return nullptr;
if (d->entries[idx].identifier == identifier)
return d->entries + idx;
++idx;
@@ -149,14 +149,14 @@ const IdentifierHashEntry *IdentifierHash::lookup(const Identifier *identifier)
const IdentifierHashEntry *IdentifierHash::lookup(const QString &str) const
{
if (!d)
- return 0;
+ return nullptr;
Q_ASSERT(d->entries);
uint hash = String::createHashValue(str.constData(), str.length(), nullptr);
uint idx = hash % d->alloc;
while (1) {
if (!d->entries[idx].identifier)
- return 0;
+ return nullptr;
if (d->entries[idx].identifier->string == str)
return d->entries + idx;
++idx;
@@ -167,7 +167,7 @@ const IdentifierHashEntry *IdentifierHash::lookup(const QString &str) const
const IdentifierHashEntry *IdentifierHash::lookup(String *str) const
{
if (!d)
- return 0;
+ return nullptr;
if (str->d()->identifier)
return lookup(str->d()->identifier);
return lookup(str->toQString());
diff --git a/src/qml/jsruntime/qv4identifier_p.h b/src/qml/jsruntime/qv4identifier_p.h
index f0ff987608..21e4e8ea66 100644
--- a/src/qml/jsruntime/qv4identifier_p.h
+++ b/src/qml/jsruntime/qv4identifier_p.h
@@ -97,7 +97,7 @@ struct IdentifierHash
IdentifierHashData *d;
- IdentifierHash() : d(0) {}
+ IdentifierHash() : d(nullptr) {}
IdentifierHash(ExecutionEngine *engine);
inline IdentifierHash(const IdentifierHash &other);
inline ~IdentifierHash();
diff --git a/src/qml/jsruntime/qv4identifiertable.cpp b/src/qml/jsruntime/qv4identifiertable.cpp
index 3def6defbf..b77f9478d3 100644
--- a/src/qml/jsruntime/qv4identifiertable.cpp
+++ b/src/qml/jsruntime/qv4identifiertable.cpp
@@ -142,7 +142,7 @@ Identifier *IdentifierTable::identifierImpl(const Heap::String *str)
return str->identifier;
uint hash = str->hashValue();
if (str->subtype == Heap::String::StringType_ArrayIndex)
- return 0;
+ return nullptr;
uint idx = hash % alloc;
while (Heap::String *e = entries[idx]) {
@@ -161,7 +161,7 @@ Identifier *IdentifierTable::identifierImpl(const Heap::String *str)
Heap::String *IdentifierTable::stringFromIdentifier(Identifier *i)
{
if (!i)
- return 0;
+ return nullptr;
uint idx = i->hashValue % alloc;
while (1) {
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index d1ceb0a892..aaf5e3b857 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -61,7 +61,7 @@ QV4Include::QV4Include(const QUrl &url, QV4::ExecutionEngine *engine,
QV4::QmlContext *qmlContext, const QV4::Value &callback)
: v4(engine), m_url(url)
#if QT_CONFIG(qml_network)
- , m_redirectCount(0), m_network(0) , m_reply(0)
+ , m_redirectCount(0), m_network(nullptr) , m_reply(nullptr)
#endif
{
if (qmlContext)
@@ -88,7 +88,7 @@ QV4Include::~QV4Include()
{
#if QT_CONFIG(qml_network)
delete m_reply;
- m_reply = 0;
+ m_reply = nullptr;
#endif
}
diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp
index 4041052344..9da854e7d7 100644
--- a/src/qml/jsruntime/qv4internalclass.cpp
+++ b/src/qml/jsruntime/qv4internalclass.cpp
@@ -105,10 +105,10 @@ void PropertyHash::addEntry(const PropertyHash::Entry &entry, int classSize)
InternalClass::InternalClass(ExecutionEngine *engine)
: engine(engine)
- , vtable(0)
- , prototype(0)
- , m_sealed(0)
- , m_frozen(0)
+ , vtable(nullptr)
+ , prototype(nullptr)
+ , m_sealed(nullptr)
+ , m_frozen(nullptr)
, size(0)
, extensible(true)
{
@@ -124,8 +124,8 @@ InternalClass::InternalClass(const QV4::InternalClass &other)
, propertyTable(other.propertyTable)
, nameMap(other.nameMap)
, propertyData(other.propertyData)
- , m_sealed(0)
- , m_frozen(0)
+ , m_sealed(nullptr)
+ , m_frozen(nullptr)
, size(other.size)
, extensible(other.extensible)
, isUsedAsProto(other.isUsedAsProto)
@@ -223,7 +223,7 @@ InternalClass *InternalClass::changePrototypeImpl(Heap::Object *proto)
Q_ASSERT(prototype != proto);
Q_ASSERT(!proto || proto->internalClass->isUsedAsProto);
- Transition temp = { { nullptr }, 0, Transition::PrototypeChange };
+ Transition temp = { { nullptr }, nullptr, Transition::PrototypeChange };
temp.prototype = proto;
Transition &t = lookupOrInsertTransition(temp);
@@ -487,7 +487,7 @@ void InternalClass::destroy()
destroyStack.pop_back();
if (!next->engine)
continue;
- next->engine = 0;
+ next->engine = nullptr;
next->propertyTable.~PropertyHash();
next->nameMap.~SharedInternalClassData<Identifier *>();
next->propertyData.~SharedInternalClassData<PropertyAttributes>();
diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h
index 546073dcf5..b689272006 100644
--- a/src/qml/jsruntime/qv4internalclass_p.h
+++ b/src/qml/jsruntime/qv4internalclass_p.h
@@ -277,10 +277,10 @@ struct InternalClass : public QQmlJS::Managed {
}
static void addMember(Object *object, String *string, PropertyAttributes data, uint *index);
- Q_REQUIRED_RESULT InternalClass *addMember(String *string, PropertyAttributes data, uint *index = 0);
- Q_REQUIRED_RESULT InternalClass *addMember(Identifier *identifier, PropertyAttributes data, uint *index = 0);
- Q_REQUIRED_RESULT InternalClass *changeMember(Identifier *identifier, PropertyAttributes data, uint *index = 0);
- static void changeMember(Object *object, String *string, PropertyAttributes data, uint *index = 0);
+ Q_REQUIRED_RESULT InternalClass *addMember(String *string, PropertyAttributes data, uint *index = nullptr);
+ Q_REQUIRED_RESULT InternalClass *addMember(Identifier *identifier, PropertyAttributes data, uint *index = nullptr);
+ Q_REQUIRED_RESULT InternalClass *changeMember(Identifier *identifier, PropertyAttributes data, uint *index = nullptr);
+ static void changeMember(Object *object, String *string, PropertyAttributes data, uint *index = nullptr);
static void removeMember(Object *object, Identifier *id);
uint find(const String *string);
uint find(const Identifier *id)
diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h
index 6d641bf9c5..c676b57c51 100644
--- a/src/qml/jsruntime/qv4jscall_p.h
+++ b/src/qml/jsruntime/qv4jscall_p.h
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
struct JSCallData {
- JSCallData(const Scope &scope, int argc = 0, const Value *argv = 0, const Value *thisObject = 0)
+ JSCallData(const Scope &scope, int argc = 0, const Value *argv = nullptr, const Value *thisObject = nullptr)
: scope(scope), argc(argc)
{
if (thisObject)
@@ -124,7 +124,7 @@ struct ScopedStackFrame {
return;
frame.jsFrame = reinterpret_cast<CallData *>(scope.alloc(sizeof(CallData)/sizeof(Value)));
frame.jsFrame->context = context;
- frame.v4Function = frame.parent ? frame.parent->v4Function : 0;
+ frame.v4Function = frame.parent ? frame.parent->v4Function : nullptr;
scope.engine->currentStackFrame = &frame;
}
~ScopedStackFrame() {
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 51802d895b..99666806be 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -634,7 +634,7 @@ struct Stringify
return false;
}
- Stringify(ExecutionEngine *e) : v4(e), replacerFunction(0), propertyList(0), propertyListSize(0) {}
+ Stringify(ExecutionEngine *e) : v4(e), replacerFunction(nullptr), propertyList(nullptr), propertyListSize(0) {}
QString Str(const QString &key, const Value &v);
QString JA(ArrayObject *a);
@@ -920,11 +920,11 @@ ReturnedValue JsonObject::method_stringify(const FunctionObject *b, const Value
if (v->as<NumberObject>() || v->as<StringObject>() || v->isNumber())
*v = v->toString(scope.engine);
if (!v->isString()) {
- v->setM(0);
+ v->setM(nullptr);
} else {
for (uint j = 0; j <i; ++j) {
if (stringify.propertyList[j].m() == v->m()) {
- v->setM(0);
+ v->setM(nullptr);
break;
}
}
diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp
index 200380eda0..b50e5f0355 100644
--- a/src/qml/jsruntime/qv4managed.cpp
+++ b/src/qml/jsruntime/qv4managed.cpp
@@ -46,7 +46,7 @@ using namespace QV4;
const VTable Managed::static_vtbl =
{
- 0,
+ nullptr,
0,
0,
Managed::IsExecutionContext,
@@ -58,15 +58,15 @@ const VTable Managed::static_vtbl =
0,
Managed::MyType,
"Managed",
- 0,
- 0 /*markObjects*/,
+ nullptr,
+ nullptr /*markObjects*/,
isEqualTo
};
QString Managed::className() const
{
- const char *s = 0;
+ const char *s = nullptr;
switch (Type(d()->vtable()->type)) {
case Type_Invalid:
case Type_String:
diff --git a/src/qml/jsruntime/qv4memberdata_p.h b/src/qml/jsruntime/qv4memberdata_p.h
index 12eaf336b9..ac9671254d 100644
--- a/src/qml/jsruntime/qv4memberdata_p.h
+++ b/src/qml/jsruntime/qv4memberdata_p.h
@@ -93,7 +93,7 @@ struct MemberData : Managed
inline uint size() const { return d()->values.size; }
- static Heap::MemberData *allocate(QV4::ExecutionEngine *e, uint n, Heap::MemberData *old = 0);
+ static Heap::MemberData *allocate(QV4::ExecutionEngine *e, uint n, Heap::MemberData *old = nullptr);
};
}
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index aa8e850aed..8e9bf794a9 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -94,7 +94,7 @@ void Heap::Object::setUsedAsProto()
bool Object::setPrototype(Object *proto)
{
- Heap::Object *p = proto ? proto->d() : 0;
+ Heap::Object *p = proto ? proto->d() : nullptr;
Heap::Object *pp = p;
while (pp) {
if (pp == d())
@@ -193,8 +193,8 @@ void Object::defineAccessorProperty(String *name, ReturnedValue (*getter)(const
QV4::Scope scope(v4);
ScopedProperty p(scope);
ExecutionContext *global = v4->rootContext();
- p->setGetter(ScopedFunctionObject(scope, (getter ? FunctionObject::createBuiltinFunction(global, name, getter) : 0)));
- p->setSetter(ScopedFunctionObject(scope, (setter ? FunctionObject::createBuiltinFunction(global, name, setter) : 0)));
+ p->setGetter(ScopedFunctionObject(scope, (getter ? FunctionObject::createBuiltinFunction(global, name, getter) : nullptr)));
+ p->setSetter(ScopedFunctionObject(scope, (setter ? FunctionObject::createBuiltinFunction(global, name, setter) : nullptr)));
insertMember(name, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
}
@@ -321,7 +321,7 @@ MemberData::Index Object::getValueOrSetter(String *name, PropertyAttributes *att
o = o->prototype();
}
*attrs = Attr_Invalid;
- return { 0, 0 };
+ return { nullptr, nullptr };
}
ArrayData::Index Object::getValueOrSetter(uint index, PropertyAttributes *attrs)
@@ -346,7 +346,7 @@ ArrayData::Index Object::getValueOrSetter(uint index, PropertyAttributes *attrs)
o = o->prototype();
}
*attrs = Attr_Invalid;
- return { 0, 0 };
+ return { nullptr, 0 };
}
bool Object::hasProperty(String *name) const
@@ -484,7 +484,7 @@ bool Object::deleteIndexedProperty(Managed *m, uint index)
void Object::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *pd, PropertyAttributes *attrs)
{
Object *o = static_cast<Object *>(m);
- name->setM(0);
+ name->setM(nullptr);
*index = UINT_MAX;
if (o->arrayData()) {
@@ -508,7 +508,7 @@ void Object::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *
return;
}
}
- it->arrayNode = 0;
+ it->arrayNode = nullptr;
it->arrayIndex = UINT_MAX;
}
// dense arrays
@@ -628,7 +628,7 @@ bool Object::internalPut(String *name, const Value &value)
name->makeIdentifier();
Identifier *id = name->identifier();
- MemberData::Index memberIndex{0, 0};
+ MemberData::Index memberIndex{nullptr, nullptr};
uint member = internalClass()->find(id);
PropertyAttributes attrs;
if (member < UINT_MAX) {
@@ -704,7 +704,7 @@ bool Object::internalPutIndexed(uint index, const Value &value)
PropertyAttributes attrs;
- ArrayData::Index arrayIndex = arrayData() ? arrayData()->getValueOrSetter(index, &attrs) : ArrayData::Index{ 0, 0 };
+ ArrayData::Index arrayIndex = arrayData() ? arrayData()->getValueOrSetter(index, &attrs) : ArrayData::Index{ nullptr, 0 };
if (arrayIndex.isNull() && isStringObject()) {
if (index < static_cast<StringObject *>(this)->length())
@@ -898,7 +898,7 @@ bool Object::defineOwnProperty2(ExecutionEngine *engine, uint index, const Prope
return true;
}
- return __defineOwnProperty__(engine, index, 0, p, attrs);
+ return __defineOwnProperty__(engine, index, nullptr, p, attrs);
}
bool Object::__defineOwnProperty__(ExecutionEngine *engine, uint index, String *member, const Property *p, PropertyAttributes attrs)
@@ -949,8 +949,8 @@ bool Object::__defineOwnProperty__(ExecutionEngine *engine, uint index, String *
Q_ASSERT(arrayData());
setArrayAttributes(index, cattrs);
}
- current->setGetter(0);
- current->setSetter(0);
+ current->setGetter(nullptr);
+ current->setSetter(nullptr);
} else {
// 9c
cattrs.setType(PropertyAttributes::Data);
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index db57d1cf3f..1731ae3c76 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -236,8 +236,8 @@ struct Q_QML_EXPORT Object: Managed {
Heap::Object *prototype() const { return d()->prototype(); }
bool setPrototype(Object *proto);
- void getOwnProperty(String *name, PropertyAttributes *attrs, Property *p = 0);
- void getOwnProperty(uint index, PropertyAttributes *attrs, Property *p = 0);
+ void getOwnProperty(String *name, PropertyAttributes *attrs, Property *p = nullptr);
+ void getOwnProperty(uint index, PropertyAttributes *attrs, Property *p = nullptr);
MemberData::Index getValueOrSetter(String *name, PropertyAttributes *attrs);
ArrayData::Index getValueOrSetter(uint index, PropertyAttributes *attrs);
@@ -346,8 +346,8 @@ public:
}
void initSparseArray();
- SparseArrayNode *sparseBegin() { return arrayType() == Heap::ArrayData::Sparse ? d()->arrayData->sparse->begin() : 0; }
- SparseArrayNode *sparseEnd() { return arrayType() == Heap::ArrayData::Sparse ? d()->arrayData->sparse->end() : 0; }
+ SparseArrayNode *sparseBegin() { return arrayType() == Heap::ArrayData::Sparse ? d()->arrayData->sparse->begin() : nullptr; }
+ SparseArrayNode *sparseEnd() { return arrayType() == Heap::ArrayData::Sparse ? d()->arrayData->sparse->end() : nullptr; }
inline bool protoHasArray() {
Scope scope(engine());
@@ -360,9 +360,9 @@ public:
return false;
}
- inline ReturnedValue get(String *name, bool *hasProperty = 0) const
+ inline ReturnedValue get(String *name, bool *hasProperty = nullptr) const
{ return vtable()->get(this, name, hasProperty); }
- inline ReturnedValue getIndexed(uint idx, bool *hasProperty = 0) const
+ inline ReturnedValue getIndexed(uint idx, bool *hasProperty = nullptr) const
{ return vtable()->getIndexed(this, idx, hasProperty); }
// use the set variants instead, to customize throw behavior
@@ -551,7 +551,7 @@ inline void Object::arraySet(uint index, const Value &value)
template<>
inline const ArrayObject *Value::as() const {
- return isManaged() && m()->vtable()->type == Managed::Type_ArrayObject ? static_cast<const ArrayObject *>(this) : 0;
+ return isManaged() && m()->vtable()->type == Managed::Type_ArrayObject ? static_cast<const ArrayObject *>(this) : nullptr;
}
#ifndef V4_BOOTSTRAP
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp
index 0394c704f9..7bf7e1aa04 100644
--- a/src/qml/jsruntime/qv4objectiterator.cpp
+++ b/src/qml/jsruntime/qv4objectiterator.cpp
@@ -47,8 +47,8 @@ using namespace QV4;
void ObjectIterator::init(const Object *o)
{
- object->setM(o ? o->m() : 0);
- current->setM(o ? o->m() : 0);
+ object->setM(o ? o->m() : nullptr);
+ current->setM(o ? o->m() : nullptr);
if (object->as<ArgumentsObject>()) {
Scope scope(engine);
@@ -58,7 +58,7 @@ void ObjectIterator::init(const Object *o)
void ObjectIterator::next(Value *name, uint *index, Property *pd, PropertyAttributes *attrs)
{
- name->setM(0);
+ name->setM(nullptr);
*index = UINT_MAX;
if (!object->as<Object>()) {
@@ -100,7 +100,7 @@ void ObjectIterator::next(Value *name, uint *index, Property *pd, PropertyAttrib
if (flags & WithProtoChain)
current->setM(co->prototype());
else
- current->setM(0);
+ current->setM(nullptr);
arrayIndex = 0;
memberIndex = 0;
diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h
index 3e501f23ce..744d16301a 100644
--- a/src/qml/jsruntime/qv4objectiterator_p.h
+++ b/src/qml/jsruntime/qv4objectiterator_p.h
@@ -101,7 +101,7 @@ struct Q_QML_EXPORT ObjectIterator: ObjectIteratorData
init(o);
}
- void next(Value *name, uint *index, Property *pd, PropertyAttributes *attributes = 0);
+ void next(Value *name, uint *index, Property *pd, PropertyAttributes *attributes = nullptr);
ReturnedValue nextPropertyName(Value *value);
ReturnedValue nextPropertyNameAsString(Value *value);
ReturnedValue nextPropertyNameAsString();
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index a86352be40..b998b78520 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -638,7 +638,7 @@ ReturnedValue ObjectPrototype::method_set_proto(const FunctionObject *b, const V
THROW_TYPE_ERROR();
if (argv[0].isNull()) {
- o->setPrototype(0);
+ o->setPrototype(nullptr);
RETURN_UNDEFINED();
}
diff --git a/src/qml/jsruntime/qv4persistent.cpp b/src/qml/jsruntime/qv4persistent.cpp
index 973541553a..7fc74173e3 100644
--- a/src/qml/jsruntime/qv4persistent.cpp
+++ b/src/qml/jsruntime/qv4persistent.cpp
@@ -172,7 +172,7 @@ Value &PersistentValueStorage::Iterator::operator *()
PersistentValueStorage::PersistentValueStorage(ExecutionEngine *engine)
: engine(engine),
- firstPage(0)
+ firstPage(nullptr)
{
}
@@ -185,9 +185,9 @@ PersistentValueStorage::~PersistentValueStorage()
p->values[i] = Encode::undefined();
}
Page *n = p->header.next;
- p->header.engine = 0;
- p->header.prev = 0;
- p->header.next = 0;
+ p->header.engine = nullptr;
+ p->header.prev = nullptr;
+ p->header.next = nullptr;
Q_ASSERT(p->header.refCount);
p = n;
}
@@ -260,7 +260,7 @@ void PersistentValueStorage::freePage(void *page)
PersistentValue::PersistentValue(const PersistentValue &other)
- : val(0)
+ : val(nullptr)
{
if (other.val) {
val = other.engine()->memoryManager->m_persistentValues->allocate();
@@ -281,7 +281,7 @@ PersistentValue::PersistentValue(ExecutionEngine *engine, ReturnedValue value)
}
PersistentValue::PersistentValue(ExecutionEngine *engine, Object *object)
- : val(0)
+ : val(nullptr)
{
if (!object)
return;
@@ -358,7 +358,7 @@ void PersistentValue::set(ExecutionEngine *engine, Heap::Base *obj)
}
WeakValue::WeakValue(const WeakValue &other)
- : val(0)
+ : val(nullptr)
{
if (other.val) {
allocVal(other.engine());
@@ -418,6 +418,6 @@ void WeakValue::free()
PersistentValueStorage::free(val);
}
- val = 0;
+ val = nullptr;
}
diff --git a/src/qml/jsruntime/qv4persistent_p.h b/src/qml/jsruntime/qv4persistent_p.h
index 1f838f5531..5a0b2389e1 100644
--- a/src/qml/jsruntime/qv4persistent_p.h
+++ b/src/qml/jsruntime/qv4persistent_p.h
@@ -81,7 +81,7 @@ struct Q_QML_EXPORT PersistentValueStorage
Value &operator *();
};
Iterator begin() { return Iterator(firstPage, 0); }
- Iterator end() { return Iterator(0, 0); }
+ Iterator end() { return Iterator(nullptr, 0); }
static ExecutionEngine *getEngine(Value *v);
@@ -94,7 +94,7 @@ private:
class Q_QML_EXPORT PersistentValue
{
public:
- PersistentValue() : val(0) {}
+ PersistentValue() : val(nullptr) {}
PersistentValue(const PersistentValue &other);
PersistentValue &operator=(const PersistentValue &other);
PersistentValue &operator=(const WeakValue &other);
@@ -117,19 +117,19 @@ public:
}
Managed *asManaged() const {
if (!val)
- return 0;
+ return nullptr;
return val->managed();
}
template<typename T>
T *as() const {
if (!val)
- return 0;
+ return nullptr;
return val->as<T>();
}
ExecutionEngine *engine() const {
if (!val)
- return 0;
+ return nullptr;
return PersistentValueStorage::getEngine(val);
}
@@ -137,7 +137,7 @@ public:
bool isNullOrUndefined() const { return !val || val->isNullOrUndefined(); }
void clear() {
PersistentValueStorage::free(val);
- val = 0;
+ val = nullptr;
}
bool isEmpty() { return !val; }
@@ -148,7 +148,7 @@ private:
class Q_QML_EXPORT WeakValue
{
public:
- WeakValue() : val(0) {}
+ WeakValue() : val(nullptr) {}
WeakValue(const WeakValue &other);
WeakValue(ExecutionEngine *engine, const Value &value);
WeakValue &operator=(const WeakValue &other);
@@ -183,19 +183,19 @@ public:
}
Managed *asManaged() const {
if (!val)
- return 0;
+ return nullptr;
return val->managed();
}
template <typename T>
T *as() const {
if (!val)
- return 0;
+ return nullptr;
return val->as<T>();
}
ExecutionEngine *engine() const {
if (!val)
- return 0;
+ return nullptr;
return PersistentValueStorage::getEngine(val);
}
diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h
index c69d1e4cf6..e8c154e4e7 100644
--- a/src/qml/jsruntime/qv4profiling_p.h
+++ b/src/qml/jsruntime/qv4profiling_p.h
@@ -139,7 +139,7 @@ struct MemoryAllocationProperties {
class FunctionCall {
public:
- FunctionCall() : m_function(0), m_start(0), m_end(0)
+ FunctionCall() : m_function(nullptr), m_start(0), m_end(0)
{ Q_ASSERT_X(false, Q_FUNC_INFO, "Cannot construct a function call without function"); }
FunctionCall(Function *function, qint64 start, qint64 end) :
@@ -276,7 +276,7 @@ public:
// It's enough to ref() the function in the destructor as it will probably not disappear while
// it's executing ...
FunctionCallProfiler(ExecutionEngine *engine, Function *f)
- : profiler(0)
+ : profiler(nullptr)
{
Profiler *p = engine->profiler();
if (Q_UNLIKELY(p) && (p->featuresEnabled & (1 << Profiling::FeatureFunctionCall))) {
diff --git a/src/qml/jsruntime/qv4property_p.h b/src/qml/jsruntime/qv4property_p.h
index 2a5b6f7f74..7cb106c424 100644
--- a/src/qml/jsruntime/qv4property_p.h
+++ b/src/qml/jsruntime/qv4property_p.h
@@ -84,7 +84,7 @@ struct Property {
inline Heap::FunctionObject *getter() const { return reinterpret_cast<Heap::FunctionObject *>(value.heapObject()); }
inline Heap::FunctionObject *setter() const { return reinterpret_cast<Heap::FunctionObject *>(set.heapObject()); }
inline void setGetter(FunctionObject *g) { value = reinterpret_cast<Managed *>(g); }
- inline void setSetter(FunctionObject *s) { set = (s ? reinterpret_cast<Managed *>(s) : 0); }
+ inline void setSetter(FunctionObject *s) { set = (s ? reinterpret_cast<Managed *>(s) : nullptr); }
void copy(const Property *other, PropertyAttributes attrs) {
value = other->value;
@@ -92,7 +92,7 @@ struct Property {
set = other->set;
}
- explicit Property() { value = Encode::undefined(); set = Value::fromHeapObject(0); }
+ explicit Property() { value = Encode::undefined(); set = Value::fromHeapObject(nullptr); }
Property(Heap::FunctionObject *getter, Heap::FunctionObject *setter) {
value.setM(reinterpret_cast<Heap::Base *>(getter));
set.setM(reinterpret_cast<Heap::Base *>(setter));
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp
index cf4ef68bc0..040f060476 100644
--- a/src/qml/jsruntime/qv4qmlcontext.cpp
+++ b/src/qml/jsruntime/qv4qmlcontext.cpp
@@ -202,7 +202,7 @@ ReturnedValue QQmlContextWrapper::get(const Managed *m, String *name, bool *hasP
return result->asReturnedValue();
}
}
- scopeObject = 0;
+ scopeObject = nullptr;
// Search context object
@@ -272,7 +272,7 @@ bool QQmlContextWrapper::put(Managed *m, String *name, const Value &value)
if (scopeObject &&
QV4::QObjectWrapper::setQmlProperty(v4, context, scopeObject, name, QV4::QObjectWrapper::CheckRevision, value))
return true;
- scopeObject = 0;
+ scopeObject = nullptr;
// Search context object
if (context->contextObject &&
@@ -312,7 +312,7 @@ Heap::QmlContext *QmlContext::createWorkerContext(ExecutionContext *parent, cons
context->isInternal = true;
context->isJSContext = true;
- Scoped<QQmlContextWrapper> qml(scope, scope.engine->memoryManager->allocObject<QQmlContextWrapper>(context, (QObject*)0));
+ Scoped<QQmlContextWrapper> qml(scope, scope.engine->memoryManager->allocObject<QQmlContextWrapper>(context, (QObject*)nullptr));
qml->d()->isNullWrapper = true;
qml->setReadOnly(false);
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 9ee357eca5..5ebd385cfb 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -99,7 +99,7 @@ QPair<QObject *, int> QObjectMethod::extractQtMethod(const QV4::FunctionObject *
return qMakePair(method->object(), method->methodIndex());
}
- return qMakePair((QObject *)0, -1);
+ return qMakePair((QObject *)nullptr, -1);
}
static QPair<QObject *, int> extractQtSignal(const Value &value)
@@ -116,7 +116,7 @@ static QPair<QObject *, int> extractQtSignal(const Value &value)
return qMakePair(handler->object(), handler->signalIndex());
}
- return qMakePair((QObject *)0, -1);
+ return qMakePair((QObject *)nullptr, -1);
}
static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object,
@@ -126,7 +126,7 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object
QV4::Scope scope(v4);
if (property.isQObject()) {
- QObject *rv = 0;
+ QObject *rv = nullptr;
property.readProperty(object, &rv);
return QV4::QObjectWrapper::wrap(v4, rv);
} else if (property.isQList()) {
@@ -194,7 +194,7 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object
"'%s::%s'", p.typeName(), object->metaObject()->className(), p.name());
return QV4::Encode::undefined();
} else {
- QVariant v(property.propType(), (void *)0);
+ QVariant v(property.propType(), (void *)nullptr);
property.readProperty(object, v.data());
return scope.engine->fromVariant(v);
}
@@ -217,7 +217,7 @@ QQmlPropertyData *QObjectWrapper::findProperty(ExecutionEngine *engine, QObject
Q_UNUSED(revisionMode);
QQmlData *ddata = QQmlData::get(o, false);
- QQmlPropertyData *result = 0;
+ QQmlPropertyData *result = nullptr;
if (ddata && ddata->propertyCache)
result = ddata->propertyCache->property(name, o, qmlContext);
else
@@ -249,7 +249,7 @@ ReturnedValue QObjectWrapper::getProperty(ExecutionEngine *engine, QObject *obje
}
}
- QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0;
+ QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : nullptr;
if (captureRequired && ep && ep->propertyCapture && !property->isConstant())
ep->propertyCapture->captureProperty(object, property->coreIndex(), property->notifyIndex());
@@ -434,7 +434,7 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, QQmlP
return;
}
- QQmlBinding *newBinding = 0;
+ QQmlBinding *newBinding = nullptr;
QV4::Scope scope(engine);
QV4::ScopedFunctionObject f(scope, value);
if (f) {
@@ -496,9 +496,9 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, QQmlP
QMetaObject::metacall(object, QMetaObject::WriteProperty, property->coreIndex(), argv);
if (value.isNull() && property->isQObject()) {
- PROPERTY_STORE(QObject*, 0);
+ PROPERTY_STORE(QObject*, nullptr);
} else if (value.isUndefined() && property->isResettable()) {
- void *a[] = { 0 };
+ void *a[] = { nullptr };
QMetaObject::metacall(object, QMetaObject::ResetProperty, property->coreIndex(), a);
} else if (value.isUndefined() && property->propType() == qMetaTypeId<QVariant>()) {
PROPERTY_STORE(QVariant, QVariant());
@@ -531,7 +531,7 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, QQmlP
Q_ASSERT(vmemo);
vmemo->setVMEProperty(property->coreIndex(), value);
} else if (property->propType() == qMetaTypeId<QQmlScriptString>() && (value.isUndefined() || value.isPrimitive())) {
- QQmlScriptString ss(value.toQStringNoThrow(), 0 /* context */, object);
+ QQmlScriptString ss(value.toQStringNoThrow(), nullptr /* context */, object);
if (value.isNumber()) {
ss.d->numberValue = value.toNumber();
ss.d->isNumberLiteral = true;
@@ -549,7 +549,7 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, QQmlP
QQmlContextData *callingQmlContext = scope.engine->callingQmlContext();
if (!QQmlPropertyPrivate::write(object, *property, v, callingQmlContext)) {
- const char *valueType = 0;
+ const char *valueType = nullptr;
if (v.userType() == QVariant::Invalid) valueType = "null";
else valueType = QMetaType::typeName(v.userType());
@@ -590,7 +590,7 @@ ReturnedValue QObjectWrapper::wrap_slowPath(ExecutionEngine *engine, QObject *ob
} else {
// If this object is tainted, we have to check to see if it is in our
// tainted object list
- ScopedObject alternateWrapper(scope, (Object *)0);
+ ScopedObject alternateWrapper(scope, (Object *)nullptr);
if (engine->m_multiplyWrappedQObjects && ddata->hasTaintedV4Object)
alternateWrapper = engine->m_multiplyWrappedQObjects->value(object);
@@ -736,7 +736,7 @@ void QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, Value *name
static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()");
static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()");
- name->setM(0);
+ name->setM(nullptr);
*index = UINT_MAX;
QObjectWrapper *that = static_cast<QObjectWrapper*>(m);
@@ -813,7 +813,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
break;
QQmlMetaObject::ArgTypeStorage storage;
- int *argsTypes = QQmlMetaObject(r).methodParameterTypes(This->signalIndex, &storage, 0);
+ int *argsTypes = QQmlMetaObject(r).methodParameterTypes(This->signalIndex, &storage, nullptr);
int argCount = argsTypes ? argsTypes[0]:0;
@@ -842,7 +842,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
QQmlEnginePrivate::get(qmlEngine)->warning(error);
} else {
QMessageLogger(error.url().toString().toLatin1().constData(),
- error.line(), 0).warning().noquote()
+ error.line(), nullptr).warning().noquote()
<< error.toString();
}
}
@@ -1052,8 +1052,8 @@ void QObjectWrapper::destroyObject(bool lastCall)
if (ddata && ddata->ownContext) {
Q_ASSERT(ddata->ownContext == ddata->context);
ddata->ownContext->emitDestruction();
- ddata->ownContext = 0;
- ddata->context = 0;
+ ddata->ownContext = nullptr;
+ ddata->context = nullptr;
}
// This object is notionally destroyed now
ddata->isQueuedForDeletion = true;
@@ -1181,7 +1181,7 @@ static QV4::ReturnedValue CallMethod(const QQmlObjectOrGadget &object, int index
} else {
- void *args[] = { 0 };
+ void *args[] = { nullptr };
object.metacall(callType, index, args);
return Encode::undefined();
@@ -1354,7 +1354,7 @@ static const QQmlPropertyData * RelatedMethod(const QQmlObjectOrGadget &object,
const QQmlPropertyCache *propertyCache)
{
if (!current->isOverload())
- return 0;
+ return nullptr;
Q_ASSERT(!current->overrideIndexIsProperty());
@@ -1372,7 +1372,7 @@ static const QQmlPropertyData * RelatedMethod(const QQmlObjectOrGadget &object,
// If we've been called before with the same override index, then
// we can't go any further...
if (&dummy == current && dummy.coreIndex() == current->overrideIndex())
- return 0;
+ return nullptr;
QMetaMethod method = mo->method(current->overrideIndex());
dummy.load(method);
@@ -1407,7 +1407,7 @@ static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQ
if (data.hasArguments()) {
- int *args = 0;
+ int *args = nullptr;
QQmlMetaObject::ArgTypeStorage storage;
if (data.isConstructor())
@@ -1430,7 +1430,7 @@ static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQ
} else {
- return CallMethod(object, data.coreIndex(), returnType, 0, 0, engine, callArgs, callType);
+ return CallMethod(object, data.coreIndex(), returnType, 0, nullptr, engine, callArgs, callType);
}
}
@@ -1467,9 +1467,9 @@ static QV4::ReturnedValue CallOverloaded(const QQmlObjectOrGadget &object, const
do {
QQmlMetaObject::ArgTypeStorage storage;
int methodArgumentCount = 0;
- int *methodArgTypes = 0;
+ int *methodArgTypes = nullptr;
if (attempt->hasArguments()) {
- int *args = object.methodParameterTypes(attempt->coreIndex(), &storage, 0);
+ int *args = object.methodParameterTypes(attempt->coreIndex(), &storage, nullptr);
if (!args) // Must be an unknown argument
continue;
@@ -1497,7 +1497,7 @@ static QV4::ReturnedValue CallOverloaded(const QQmlObjectOrGadget &object, const
if (bestParameterScore == 0 && bestMatchScore == 0)
break; // We can't get better than that
- } while ((attempt = RelatedMethod(object, attempt, dummy, propertyCache)) != 0);
+ } while ((attempt = RelatedMethod(object, attempt, dummy, propertyCache)) != nullptr);
if (best.isValid()) {
return CallPrecise(object, best, engine, callArgs, callType);
@@ -1564,7 +1564,7 @@ void *CallArgument::dataPtr()
return stdVectorQModelIndexPtr;
else if (type != 0)
return (void *)&allocData;
- return 0;
+ return nullptr;
}
void CallArgument::initAsType(int callType)
@@ -1582,7 +1582,7 @@ void CallArgument::initAsType(int callType)
callType == QMetaType::Float) {
type = callType;
} else if (callType == QMetaType::QObjectStar) {
- qobjectPtr = 0;
+ qobjectPtr = nullptr;
type = callType;
} else if (callType == QMetaType::QString) {
qstringPtr = new (&allocData) QString();
@@ -1607,7 +1607,7 @@ void CallArgument::initAsType(int callType)
jsonValuePtr = new (&allocData) QJsonValue();
} else {
type = -1;
- qvariantPtr = new (&allocData) QVariant(callType, (void *)0);
+ qvariantPtr = new (&allocData) QVariant(callType, (void *)nullptr);
}
}
@@ -1659,7 +1659,7 @@ void CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const Q
qstringPtr = new (&allocData) QString(value.toQStringNoThrow());
type = callType;
} else if (callType == QMetaType::QObjectStar) {
- qobjectPtr = 0;
+ qobjectPtr = nullptr;
if (const QV4::QObjectWrapper *qobjectWrapper = value.as<QV4::QObjectWrapper>())
qobjectPtr = qobjectWrapper->object();
else if (const QV4::QQmlTypeWrapper *qmlTypeWrapper = value.as<QV4::QQmlTypeWrapper>())
@@ -1676,14 +1676,14 @@ void CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const Q
uint length = array->getLength();
for (uint ii = 0; ii < length; ++ii) {
- QObject *o = 0;
+ QObject *o = nullptr;
qobjectWrapper = array->getIndexed(ii);
if (!!qobjectWrapper)
o = qobjectWrapper->object();
qlistPtr->append(o);
}
} else {
- QObject *o = 0;
+ QObject *o = nullptr;
if (const QV4::QObjectWrapper *qobjectWrapper = value.as<QV4::QObjectWrapper>())
o = qobjectWrapper->object();
qlistPtr->append(o);
@@ -1740,7 +1740,7 @@ void CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const Q
qvariantPtr = new (&allocData) QVariant();
type = -1;
- QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0;
+ QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : nullptr;
QVariant v = scope.engine->toVariant(value, callType);
if (v.userType() == callType) {
@@ -1753,12 +1753,12 @@ void CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const Q
if (!mo.isNull()) {
QObject *obj = ep->toQObject(v);
- if (obj != 0 && !QQmlMetaObject::canConvert(obj, mo))
- obj = 0;
+ if (obj != nullptr && !QQmlMetaObject::canConvert(obj, mo))
+ obj = nullptr;
*qvariantPtr = QVariant(callType, &obj);
} else {
- *qvariantPtr = QVariant(callType, (void *)0);
+ *qvariantPtr = QVariant(callType, (void *)nullptr);
}
}
}
@@ -1957,7 +1957,7 @@ ReturnedValue QObjectMethod::callInternal(const Value *thisObject, const Value *
QQmlV4Function func(callData, rv, v4);
QQmlV4Function *funcptr = &func;
- void *args[] = { 0, &funcptr };
+ void *args[] = { nullptr, &funcptr };
object.metacall(QMetaObject::InvokeMetaMethod, method.coreIndex(), args);
return rv->asReturnedValue();
@@ -2089,9 +2089,9 @@ ReturnedValue QMetaObjectWrapper::callOverloadedConstructor(QV4::ExecutionEngine
const QQmlPropertyData & attempt = d()->constructors[i];
QQmlMetaObject::ArgTypeStorage storage;
int methodArgumentCount = 0;
- int *methodArgTypes = 0;
+ int *methodArgTypes = nullptr;
if (attempt.hasArguments()) {
- int *args = object.constructorParameterTypes(attempt.coreIndex(), &storage, 0);
+ int *args = object.constructorParameterTypes(attempt.coreIndex(), &storage, nullptr);
if (!args) // Must be an unknown argument
continue;
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 28717b5d80..1455acc1b3 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -166,8 +166,8 @@ struct Q_QML_EXPORT QObjectWrapper : public Object
QObject *object() const { return d()->object(); }
- ReturnedValue getQmlProperty(QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, bool *hasProperty = 0, bool includeImports = false) const;
- static ReturnedValue getQmlProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, bool *hasProperty = 0);
+ ReturnedValue getQmlProperty(QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, bool *hasProperty = nullptr, bool includeImports = false) const;
+ static ReturnedValue getQmlProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, bool *hasProperty = nullptr);
static bool setQmlProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, const Value &value);
diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp
index 36616bc024..d99536829b 100644
--- a/src/qml/jsruntime/qv4regexp.cpp
+++ b/src/qml/jsruntime/qv4regexp.cpp
@@ -48,7 +48,7 @@ RegExpCache::~RegExpCache()
{
for (RegExpCache::Iterator it = begin(), e = end(); it != e; ++it) {
if (RegExp *re = it.value().as<RegExp>())
- re->d()->cache = 0;
+ re->d()->cache = nullptr;
}
}
@@ -100,7 +100,7 @@ void Heap::RegExp::init(ExecutionEngine *engine, const QString &pattern, bool ig
valid = false;
- const char* error = 0;
+ const char* error = nullptr;
JSC::Yarr::YarrPattern yarrPattern(WTF::String(pattern), ignoreCase, multiLine, &error);
if (error)
return;
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 9a5afdf308..000e2c3a7e 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -283,25 +283,25 @@ void RegExpPrototype::init(ExecutionEngine *engine, Object *constructor)
ctor->defineReadonlyProperty(engine->id_length(), Primitive::fromInt32(2));
// Properties deprecated in the spec but required by "the web" :(
- ctor->defineAccessorProperty(QStringLiteral("lastMatch"), method_get_lastMatch_n<0>, 0);
- ctor->defineAccessorProperty(QStringLiteral("$&"), method_get_lastMatch_n<0>, 0);
- ctor->defineAccessorProperty(QStringLiteral("$1"), method_get_lastMatch_n<1>, 0);
- ctor->defineAccessorProperty(QStringLiteral("$2"), method_get_lastMatch_n<2>, 0);
- ctor->defineAccessorProperty(QStringLiteral("$3"), method_get_lastMatch_n<3>, 0);
- ctor->defineAccessorProperty(QStringLiteral("$4"), method_get_lastMatch_n<4>, 0);
- ctor->defineAccessorProperty(QStringLiteral("$5"), method_get_lastMatch_n<5>, 0);
- ctor->defineAccessorProperty(QStringLiteral("$6"), method_get_lastMatch_n<6>, 0);
- ctor->defineAccessorProperty(QStringLiteral("$7"), method_get_lastMatch_n<7>, 0);
- ctor->defineAccessorProperty(QStringLiteral("$8"), method_get_lastMatch_n<8>, 0);
- ctor->defineAccessorProperty(QStringLiteral("$9"), method_get_lastMatch_n<9>, 0);
- ctor->defineAccessorProperty(QStringLiteral("lastParen"), method_get_lastParen, 0);
- ctor->defineAccessorProperty(QStringLiteral("$+"), method_get_lastParen, 0);
- ctor->defineAccessorProperty(QStringLiteral("input"), method_get_input, 0);
- ctor->defineAccessorProperty(QStringLiteral("$_"), method_get_input, 0);
- ctor->defineAccessorProperty(QStringLiteral("leftContext"), method_get_leftContext, 0);
- ctor->defineAccessorProperty(QStringLiteral("$`"), method_get_leftContext, 0);
- ctor->defineAccessorProperty(QStringLiteral("rightContext"), method_get_rightContext, 0);
- ctor->defineAccessorProperty(QStringLiteral("$'"), method_get_rightContext, 0);
+ ctor->defineAccessorProperty(QStringLiteral("lastMatch"), method_get_lastMatch_n<0>, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$&"), method_get_lastMatch_n<0>, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$1"), method_get_lastMatch_n<1>, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$2"), method_get_lastMatch_n<2>, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$3"), method_get_lastMatch_n<3>, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$4"), method_get_lastMatch_n<4>, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$5"), method_get_lastMatch_n<5>, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$6"), method_get_lastMatch_n<6>, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$7"), method_get_lastMatch_n<7>, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$8"), method_get_lastMatch_n<8>, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$9"), method_get_lastMatch_n<9>, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("lastParen"), method_get_lastParen, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$+"), method_get_lastParen, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("input"), method_get_input, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$_"), method_get_input, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("leftContext"), method_get_leftContext, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$`"), method_get_leftContext, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("rightContext"), method_get_rightContext, nullptr);
+ ctor->defineAccessorProperty(QStringLiteral("$'"), method_get_rightContext, nullptr);
defineDefaultProperty(QStringLiteral("constructor"), (o = ctor));
defineDefaultProperty(QStringLiteral("exec"), method_exec, 1);
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index eb4f6a21fc..04cad8ddb7 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -382,11 +382,11 @@ double RuntimeHelpers::stringToNumber(const QString &string)
{
const QStringRef s = QStringRef(&string).trimmed();
if (s.startsWith(QLatin1String("0x")) || s.startsWith(QLatin1String("0X")))
- return s.toLong(0, 16);
+ return s.toLong(nullptr, 16);
bool ok;
QByteArray ba = s.toLatin1();
const char *begin = ba.constData();
- const char *end = 0;
+ const char *end = nullptr;
double d = qstrtod(begin, &end, &ok);
if (end - begin != ba.size()) {
if (ba == "Infinity" || ba == "+Infinity")
@@ -457,7 +457,7 @@ Heap::Object *RuntimeHelpers::convertToObject(ExecutionEngine *engine, const Val
case Value::Undefined_Type:
case Value::Null_Type:
engine->throwTypeError();
- return 0;
+ return nullptr;
case Value::Boolean_Type:
return engine->newBooleanObject(value.booleanValue());
case Value::Managed_Type:
@@ -680,7 +680,7 @@ bool Runtime::method_storeElement(ExecutionEngine *engine, const Value &object,
ReturnedValue Runtime::method_foreachIterator(ExecutionEngine *engine, const Value &in)
{
Scope scope(engine);
- ScopedObject o(scope, (Object *)0);
+ ScopedObject o(scope, (Object *)nullptr);
if (!in.isNullOrUndefined())
o = in.toObject(engine);
return engine->newForEachIteratorObject(o)->asReturnedValue();
@@ -1199,7 +1199,7 @@ ReturnedValue Runtime::method_createCatchContext(ExecutionContext *parent, int e
{
ExecutionEngine *e = parent->engine();
return parent->newCatchContext(e->currentStackFrame->v4Function->compilationUnit->runtimeStrings[exceptionVarNameIndex],
- e->catchException(0))->asReturnedValue();
+ e->catchException(nullptr))->asReturnedValue();
}
void Runtime::method_declareVar(ExecutionEngine *engine, bool deletable, int nameIndex)
@@ -1299,7 +1299,7 @@ ReturnedValue Runtime::method_loadQmlIdObject(ExecutionEngine *engine, const Val
if (!context || index >= (uint)context->idValueCount)
return Encode::undefined();
- QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0;
+ QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : nullptr;
if (ep && ep->propertyCapture)
ep->propertyCapture->captureProperty(&context->idValues[index].bindings);
diff --git a/src/qml/jsruntime/qv4runtimecodegen.cpp b/src/qml/jsruntime/qv4runtimecodegen.cpp
index 662a780e71..fe18ddf9ed 100644
--- a/src/qml/jsruntime/qv4runtimecodegen.cpp
+++ b/src/qml/jsruntime/qv4runtimecodegen.cpp
@@ -50,15 +50,15 @@ void RuntimeCodegen::generateFromFunctionExpression(const QString &fileName,
_module = module;
_module->fileName = fileName;
_module->finalUrl = fileName;
- _context = 0;
+ _context = nullptr;
Compiler::ScanFunctions scan(this, sourceCode, Compiler::GlobalCode);
// fake a global environment
- scan.enterEnvironment(0, Compiler::FunctionCode);
+ scan.enterEnvironment(nullptr, Compiler::FunctionCode);
scan(ast);
scan.leaveEnvironment();
- int index = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : 0);
+ int index = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : nullptr);
_module->rootContext = _module->functions.at(index);
}
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h
index afb5c21d36..bb20f384b3 100644
--- a/src/qml/jsruntime/qv4scopedvalue_p.h
+++ b/src/qml/jsruntime/qv4scopedvalue_p.h
@@ -209,7 +209,7 @@ struct Scoped
enum ConvertType { Convert };
QML_NEARLY_ALWAYS_INLINE void setPointer(const Managed *p) {
- ptr->setM(p ? p->m() : 0);
+ ptr->setM(p ? p->m() : nullptr);
}
QML_NEARLY_ALWAYS_INLINE Scoped(const Scope &scope)
@@ -244,7 +244,7 @@ struct Scoped
QML_NEARLY_ALWAYS_INLINE Scoped(const Scope &scope, const Value *v)
{
ptr = scope.engine->jsAlloca(1);
- setPointer(v ? v->as<T>() : 0);
+ setPointer(v ? v->as<T>() : nullptr);
}
QML_NEARLY_ALWAYS_INLINE Scoped(const Scope &scope, T *t)
@@ -290,7 +290,7 @@ struct Scoped
return *this;
}
Scoped<T> &operator=(Value *v) {
- setPointer(v ? v->as<T>() : 0);
+ setPointer(v ? v->as<T>() : nullptr);
return *this;
}
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 0c5f02bcfc..bb6608bec0 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -62,14 +62,14 @@ using namespace QV4;
Script::Script(ExecutionEngine *v4, QmlContext *qml, CompiledData::CompilationUnit *compilationUnit)
: line(1), column(0), context(v4->rootContext()), strictMode(false), inheritContext(true), parsed(false)
- , compilationUnit(compilationUnit), vmFunction(0), parseAsBinding(true)
+ , compilationUnit(compilationUnit), vmFunction(nullptr), parseAsBinding(true)
{
if (qml)
qmlContext.set(v4, *qml);
parsed = true;
- vmFunction = compilationUnit ? compilationUnit->linkToEngine(v4) : 0;
+ vmFunction = compilationUnit ? compilationUnit->linkToEngine(v4) : nullptr;
}
Script::~Script()
@@ -88,7 +88,7 @@ void Script::parse()
ExecutionEngine *v4 = context->engine();
Scope valueScope(v4);
- Module module(v4->debugger() != 0);
+ Module module(v4->debugger() != nullptr);
Engine ee, *engine = &ee;
Lexer lexer(engine);
@@ -149,10 +149,10 @@ ReturnedValue Script::run()
if (qmlContext.isUndefined()) {
TemporaryAssignment<Function*> savedGlobalCode(engine->globalCode, vmFunction);
- return vmFunction->call(engine->globalObject, 0, 0, context);
+ return vmFunction->call(engine->globalObject, nullptr, 0, context);
} else {
Scoped<QmlContext> qml(valueScope, qmlContext.value());
- return vmFunction->call(0, 0, 0, qml);
+ return vmFunction->call(nullptr, nullptr, 0, qml);
}
}
@@ -199,14 +199,14 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile(QV4::Compi
if (!errors.isEmpty()) {
if (reportedErrors)
*reportedErrors << errors;
- return 0;
+ return nullptr;
}
Program *program = AST::cast<Program *>(parser.rootNode());
if (!program) {
// if parsing was successful, and we have no program, then
// we're done...:
- return 0;
+ return nullptr;
}
Codegen cg(unitGenerator, /*strict mode*/false);
@@ -216,7 +216,7 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile(QV4::Compi
if (!errors.isEmpty()) {
if (reportedErrors)
*reportedErrors << errors;
- return 0;
+ return nullptr;
}
return cg.generateCompilationUnit(/*generate unit data*/false);
diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h
index 6ba405f828..24291b9aa6 100644
--- a/src/qml/jsruntime/qv4script_p.h
+++ b/src/qml/jsruntime/qv4script_p.h
@@ -68,11 +68,11 @@ struct Q_QML_EXPORT Script {
Script(ExecutionContext *scope, QV4::Compiler::CompilationMode mode, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0)
: sourceFile(source), line(line), column(column), sourceCode(sourceCode)
, context(scope), strictMode(false), inheritContext(false), parsed(false), compilationMode(mode)
- , vmFunction(0), parseAsBinding(false) {}
+ , vmFunction(nullptr), parseAsBinding(false) {}
Script(ExecutionEngine *engine, QmlContext *qml, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0)
: sourceFile(source), line(line), column(column), sourceCode(sourceCode)
, context(engine->rootContext()), strictMode(false), inheritContext(true), parsed(false)
- , vmFunction(0), parseAsBinding(true) {
+ , vmFunction(nullptr), parseAsBinding(true) {
if (qml)
qmlContext.set(engine, *qml);
}
@@ -100,7 +100,7 @@ struct Q_QML_EXPORT Script {
static QQmlRefPointer<CompiledData::CompilationUnit> precompile(
QV4::Compiler::Module *module, Compiler::JSUnitGenerator *unitGenerator,
const QString &fileName, const QString &finalUrl, const QString &source,
- QList<QQmlError> *reportedErrors = 0, QQmlJS::Directives *directivesCollector = 0);
+ QList<QQmlError> *reportedErrors = nullptr, QQmlJS::Directives *directivesCollector = nullptr);
static Script *createFromFileOrCache(ExecutionEngine *engine, QmlContext *qmlContext, const QString &fileName, const QUrl &originalUrl);
static ReturnedValue evaluate(ExecutionEngine *engine, const QString &script, QmlContext *qmlContext);
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 78413f1b0e..7d29d0b517 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -340,7 +340,7 @@ public:
void containerAdvanceIterator(ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs)
{
- name->setM(0);
+ name->setM(nullptr);
*index = UINT_MAX;
if (d()->isReference) {
@@ -535,7 +535,7 @@ public:
{
Q_ASSERT(d()->object);
Q_ASSERT(d()->isReference);
- void *a[] = { d()->container, 0 };
+ void *a[] = { d()->container, nullptr };
QMetaObject::metacall(d()->object, QMetaObject::ReadProperty, d()->propertyIndex, a);
}
@@ -545,7 +545,7 @@ public:
Q_ASSERT(d()->isReference);
int status = -1;
QQmlPropertyData::WriteFlags flags = QQmlPropertyData::DontRemoveBinding;
- void *a[] = { d()->container, 0, &status, &flags };
+ void *a[] = { d()->container, nullptr, &status, &flags };
QMetaObject::metacall(d()->object, QMetaObject::WriteProperty, d()->propertyIndex, a);
}
diff --git a/src/qml/jsruntime/qv4sparsearray.cpp b/src/qml/jsruntime/qv4sparsearray.cpp
index f295e74adc..2a3e28bf63 100644
--- a/src/qml/jsruntime/qv4sparsearray.cpp
+++ b/src/qml/jsruntime/qv4sparsearray.cpp
@@ -89,20 +89,20 @@ const SparseArrayNode *SparseArrayNode::previousNode() const
SparseArrayNode *SparseArrayNode::copy(SparseArray *d) const
{
- SparseArrayNode *n = d->createNode(size_left, 0, false);
+ SparseArrayNode *n = d->createNode(size_left, nullptr, false);
n->value = value;
n->setColor(color());
if (left) {
n->left = left->copy(d);
n->left->setParent(n);
} else {
- n->left = 0;
+ n->left = nullptr;
}
if (right) {
n->right = right->copy(d);
n->right->setParent(n);
} else {
- n->right = 0;
+ n->right = nullptr;
}
return n;
}
@@ -119,7 +119,7 @@ void SparseArray::rotateLeft(SparseArrayNode *x)
SparseArrayNode *&root = header.left;
SparseArrayNode *y = x->right;
x->right = y->left;
- if (y->left != 0)
+ if (y->left != nullptr)
y->left->setParent(x);
y->setParent(x->parent());
if (x == root)
@@ -146,7 +146,7 @@ void SparseArray::rotateRight(SparseArrayNode *x)
SparseArrayNode *&root = header.left;
SparseArrayNode *y = x->left;
x->left = y->right;
- if (y->right != 0)
+ if (y->right != nullptr)
y->right->setParent(x);
y->setParent(x->parent());
if (x == root)
@@ -209,7 +209,7 @@ void SparseArray::deleteNode(SparseArrayNode *z)
SparseArrayNode *y = z;
SparseArrayNode *x;
SparseArrayNode *x_parent;
- if (y->left == 0) {
+ if (y->left == nullptr) {
x = y->right;
if (y == mostLeftNode) {
if (x)
@@ -217,11 +217,11 @@ void SparseArray::deleteNode(SparseArrayNode *z)
else
mostLeftNode = y->parent();
}
- } else if (y->right == 0) {
+ } else if (y->right == nullptr) {
x = y->left;
} else {
y = y->right;
- while (y->left != 0)
+ while (y->left != nullptr)
y = y->left;
x = y->right;
}
@@ -261,7 +261,7 @@ void SparseArray::deleteNode(SparseArrayNode *z)
y->size_left = 0;
}
if (y->color() != SparseArrayNode::Red) {
- while (x != root && (x == 0 || x->color() == SparseArrayNode::Black)) {
+ while (x != root && (x == nullptr || x->color() == SparseArrayNode::Black)) {
if (x == x_parent->left) {
SparseArrayNode *w = x_parent->right;
if (w->color() == SparseArrayNode::Red) {
@@ -270,13 +270,13 @@ void SparseArray::deleteNode(SparseArrayNode *z)
rotateLeft(x_parent);
w = x_parent->right;
}
- if ((w->left == 0 || w->left->color() == SparseArrayNode::Black) &&
- (w->right == 0 || w->right->color() == SparseArrayNode::Black)) {
+ if ((w->left == nullptr || w->left->color() == SparseArrayNode::Black) &&
+ (w->right == nullptr || w->right->color() == SparseArrayNode::Black)) {
w->setColor(SparseArrayNode::Red);
x = x_parent;
x_parent = x_parent->parent();
} else {
- if (w->right == 0 || w->right->color() == SparseArrayNode::Black) {
+ if (w->right == nullptr || w->right->color() == SparseArrayNode::Black) {
if (w->left)
w->left->setColor(SparseArrayNode::Black);
w->setColor(SparseArrayNode::Red);
@@ -298,13 +298,13 @@ void SparseArray::deleteNode(SparseArrayNode *z)
rotateRight(x_parent);
w = x_parent->left;
}
- if ((w->right == 0 || w->right->color() == SparseArrayNode::Black) &&
- (w->left == 0 || w->left->color() == SparseArrayNode::Black)) {
+ if ((w->right == nullptr || w->right->color() == SparseArrayNode::Black) &&
+ (w->left == nullptr || w->left->color() == SparseArrayNode::Black)) {
w->setColor(SparseArrayNode::Red);
x = x_parent;
x_parent = x_parent->parent();
} else {
- if (w->left == 0 || w->left->color() == SparseArrayNode::Black) {
+ if (w->left == nullptr || w->left->color() == SparseArrayNode::Black) {
if (w->right)
w->right->setColor(SparseArrayNode::Black);
w->setColor(SparseArrayNode::Red);
@@ -363,8 +363,8 @@ SparseArrayNode *SparseArray::createNode(uint sl, SparseArrayNode *parent, bool
Q_CHECK_PTR(node);
node->p = (quintptr)parent;
- node->left = 0;
- node->right = 0;
+ node->left = nullptr;
+ node->right = nullptr;
node->size_left = sl;
node->value = UINT_MAX;
++numEntries;
@@ -397,15 +397,15 @@ SparseArray::SparseArray()
{
freeList = Primitive::emptyValue(UINT_MAX).asReturnedValue();
header.p = 0;
- header.left = 0;
- header.right = 0;
+ header.left = nullptr;
+ header.right = nullptr;
mostLeftNode = &header;
}
SparseArray::SparseArray(const SparseArray &other)
{
header.p = 0;
- header.right = 0;
+ header.right = nullptr;
if (other.header.left) {
header.left = other.header.left->copy(this);
header.left->setParent(&header);
diff --git a/src/qml/jsruntime/qv4sparsearray_p.h b/src/qml/jsruntime/qv4sparsearray_p.h
index ca6abcda89..51869b259f 100644
--- a/src/qml/jsruntime/qv4sparsearray_p.h
+++ b/src/qml/jsruntime/qv4sparsearray_p.h
@@ -109,7 +109,7 @@ struct SparseArrayNode
inline SparseArrayNode *SparseArrayNode::lowerBound(uint akey)
{
SparseArrayNode *n = this;
- SparseArrayNode *last = 0;
+ SparseArrayNode *last = nullptr;
while (n) {
if (akey <= n->size_left) {
last = n;
@@ -126,7 +126,7 @@ inline SparseArrayNode *SparseArrayNode::lowerBound(uint akey)
inline SparseArrayNode *SparseArrayNode::upperBound(uint akey)
{
SparseArrayNode *n = this;
- SparseArrayNode *last = 0;
+ SparseArrayNode *last = nullptr;
while (n) {
if (akey < n->size_left) {
last = n;
@@ -223,7 +223,7 @@ inline SparseArrayNode *SparseArray::findNode(uint akey) const
}
}
- return 0;
+ return nullptr;
}
inline uint SparseArray::pop_front()
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index 40280534c4..8f6f50338e 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -174,7 +174,7 @@ void Heap::String::simplifyString() const
text = result.data_ptr();
text->ref.ref();
const ComplexString *cs = static_cast<const ComplexString *>(this);
- identifier = 0;
+ identifier = nullptr;
cs->left = cs->right = nullptr;
internalClass->engine->memoryManager->changeUnmanagedHeapSizeUsage(qptrdiff(text->size) * (qptrdiff)sizeof(QChar));
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h
index 679cb7329c..5466cc274d 100644
--- a/src/qml/jsruntime/qv4string_p.h
+++ b/src/qml/jsruntime/qv4string_p.h
@@ -282,7 +282,7 @@ struct ComplexString : String {
template<>
inline const String *Value::as() const {
- return isManaged() && m()->vtable()->isString ? static_cast<const String *>(this) : 0;
+ return isManaged() && m()->vtable()->isString ? static_cast<const String *>(this) : nullptr;
}
template<>
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 8125aa53b2..e5a02fdc22 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -86,7 +86,7 @@ Heap::String *Heap::StringObject::getIndex(uint index) const
{
QString str = string->toQString();
if (index >= (uint)str.length())
- return 0;
+ return nullptr;
return internalClass->engine->newString(str.mid(index, 1));
}
@@ -109,7 +109,7 @@ bool StringObject::deleteIndexedProperty(Managed *m, uint index)
void StringObject::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs)
{
- name->setM(0);
+ name->setM(nullptr);
StringObject *s = static_cast<StringObject *>(m);
uint slen = s->d()->string->toQString().length();
if (it->arrayIndex <= slen) {
@@ -717,7 +717,7 @@ ReturnedValue StringPrototype::method_split(const FunctionObject *b, const Value
Scoped<RegExpObject> re(scope, separatorValue);
if (re) {
if (re->value()->pattern->isEmpty()) {
- re = (RegExpObject *)0;
+ re = (RegExpObject *)nullptr;
separatorValue = scope.engine->newString();
}
}
diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp
index 4ba31f9b6e..ea1532b8ce 100644
--- a/src/qml/jsruntime/qv4typedarray.cpp
+++ b/src/qml/jsruntime/qv4typedarray.cpp
@@ -399,10 +399,10 @@ void TypedArrayPrototype::init(ExecutionEngine *engine, TypedArrayCtor *ctor)
ctor->defineReadonlyProperty(engine->id_prototype(), (o = this));
ctor->defineReadonlyProperty(QStringLiteral("BYTES_PER_ELEMENT"), Primitive::fromInt32(operations[ctor->d()->type].bytesPerElement));
defineDefaultProperty(engine->id_constructor(), (o = ctor));
- defineAccessorProperty(QStringLiteral("buffer"), method_get_buffer, 0);
- defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, 0);
- defineAccessorProperty(QStringLiteral("byteOffset"), method_get_byteOffset, 0);
- defineAccessorProperty(QStringLiteral("length"), method_get_length, 0);
+ defineAccessorProperty(QStringLiteral("buffer"), method_get_buffer, nullptr);
+ defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, nullptr);
+ defineAccessorProperty(QStringLiteral("byteOffset"), method_get_byteOffset, nullptr);
+ defineAccessorProperty(QStringLiteral("length"), method_get_length, nullptr);
defineReadonlyProperty(QStringLiteral("BYTES_PER_ELEMENT"), Primitive::fromInt32(operations[ctor->d()->type].bytesPerElement));
defineDefaultProperty(QStringLiteral("set"), method_set, 1);
@@ -514,7 +514,7 @@ ReturnedValue TypedArrayPrototype::method_set(const FunctionObject *b, const Val
RETURN_UNDEFINED();
}
- char *srcCopy = 0;
+ char *srcCopy = nullptr;
if (buffer->d() == srcBuffer->d()) {
// same buffer, need to take a temporary copy, to not run into problems
srcCopy = new char[srcTypedArray->d()->byteLength];
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index b3f04d69be..97ed13cd91 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -426,7 +426,7 @@ public:
template <typename T>
const T *as() const {
if (!isManaged())
- return 0;
+ return nullptr;
Q_ASSERT(m()->vtable());
#if !defined(QT_NO_QOBJECT_CHECK)
@@ -438,7 +438,7 @@ public:
return static_cast<const T *>(this);
vt = vt->parent;
}
- return 0;
+ return nullptr;
}
template <typename T>
T *as() {
@@ -474,7 +474,7 @@ public:
Value &operator=(ReturnedValue v) { _val = v; return *this; }
Value &operator=(Managed *m) {
if (!m) {
- setM(0);
+ setM(nullptr);
} else {
_val = reinterpret_cast<Value *>(m)->_val;
}
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index d44c219d18..feeeee527a 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -553,7 +553,7 @@ QV4::ReturnedValue VME::exec(const FunctionObject *fo, const Value *thisObject,
Profiling::FunctionCallProfiler profiler(engine, function); // start execution profiling
QV4::Debugging::Debugger *debugger = engine->debugger();
- const uchar *exceptionHandler = 0;
+ const uchar *exceptionHandler = nullptr;
QV4::Value &accumulator = frame.jsFrame->accumulator;
QV4::ReturnedValue acc = Encode::undefined();