From 5eb52b725526c26d0efa3856b6aba1919010f8fd Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 8 Oct 2022 19:56:03 +0200 Subject: Port from container::count() and length() to size() - V5 This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(, "count", "size"); renameMethod(, "length", "size"); except that on() was replaced with a matcher that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Change-Id: I58e1b41b91c34d2e860dbb5847b3752edbfc6fc9 Reviewed-by: Qt CI Bot Reviewed-by: Ulf Hermann --- src/qml/jsapi/qjsmanagedvalue.cpp | 6 ++-- src/qml/jsapi/qjsvalue.cpp | 4 +-- src/qml/jsruntime/qv4errorobject.cpp | 2 +- src/qml/jsruntime/qv4executablecompilationunit.cpp | 2 +- src/qml/jsruntime/qv4qobjectwrapper.cpp | 2 +- src/qml/jsruntime/qv4runtime.cpp | 6 ++-- src/qml/jsruntime/qv4stringobject.cpp | 2 +- src/qml/memory/qv4mm.cpp | 2 +- src/qml/qml/ftw/qhashedstring_p.h | 2 +- src/qml/qml/qqmlcontext.cpp | 2 +- src/qml/qml/qqmljavascriptexpression.cpp | 2 +- src/qml/qml/qqmllist.h | 2 +- src/qml/qml/qqmlmetatype.cpp | 2 +- src/qml/qml/qqmlpluginimporter.cpp | 2 +- src/qml/qml/qqmlpropertycache.cpp | 34 +++++++++++----------- src/qml/qml/qqmlpropertycache_p.h | 14 ++++----- src/qml/qml/qqmlpropertycachecreator_p.h | 4 +-- src/qml/qml/qqmlproxymetaobject.cpp | 8 ++--- src/qml/qml/qqmltypecompiler.cpp | 4 +-- src/qml/qml/qqmltypeloader.cpp | 2 +- src/qml/qml/qqmltypemodule.cpp | 2 +- src/qml/qml/qqmlvaluetype.cpp | 2 +- src/qml/qml/qqmlvmemetaobject.cpp | 4 +-- 23 files changed, 56 insertions(+), 56 deletions(-) (limited to 'src/qml') diff --git a/src/qml/jsapi/qjsmanagedvalue.cpp b/src/qml/jsapi/qjsmanagedvalue.cpp index 8d00ecb2f9..8ae1ef3dd2 100644 --- a/src/qml/jsapi/qjsmanagedvalue.cpp +++ b/src/qml/jsapi/qjsmanagedvalue.cpp @@ -958,7 +958,7 @@ QJSValue QJSManagedValue::call(const QJSValueList &arguments) const QV4::ExecutionEngine *engine = f->engine(); QV4::Scope scope(engine); - QV4::JSCallArguments jsCallData(scope, arguments.length()); + QV4::JSCallArguments jsCallData(scope, arguments.size()); *jsCallData.thisObject = engine->globalObject; int i = 0; for (const QJSValue &arg : arguments) { @@ -997,7 +997,7 @@ QJSValue QJSManagedValue::callWithInstance(const QJSValue &instance, } QV4::Scope scope(engine); - QV4::JSCallArguments jsCallData(scope, arguments.length()); + QV4::JSCallArguments jsCallData(scope, arguments.size()); *jsCallData.thisObject = QJSValuePrivate::convertToReturnedValue(engine, instance); int i = 0; for (const QJSValue &arg : arguments) { @@ -1030,7 +1030,7 @@ QJSValue QJSManagedValue::callAsConstructor(const QJSValueList &arguments) const QV4::ExecutionEngine *engine = f->engine(); QV4::Scope scope(engine); - QV4::JSCallArguments jsCallData(scope, arguments.length()); + QV4::JSCallArguments jsCallData(scope, arguments.size()); int i = 0; for (const QJSValue &arg : arguments) { if (Q_UNLIKELY(!QJSValuePrivate::checkEngine(engine, arg))) { diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index 18ad1ebdfd..5c864f9928 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -489,7 +489,7 @@ double QJSValue::toNumber() const bool QJSValue::toBool() const { if (const QString *string = QJSValuePrivate::asQString(this)) - return string->length() > 0; + return string->size() > 0; return caughtResult(this, &QV4::Value::toBoolean); } @@ -665,7 +665,7 @@ QJSValue QJSValue::call(const QJSValueList &args) const Q_ASSERT(engine); Scope scope(engine); - JSCallArguments jsCallData(scope, args.length()); + JSCallArguments jsCallData(scope, args.size()); *jsCallData.thisObject = engine->globalObject; for (int i = 0; i < args.size(); ++i) { if (!QJSValuePrivate::checkEngine(engine, args.at(i))) { diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index 207e72e149..516c81864f 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -119,7 +119,7 @@ ReturnedValue ErrorObject::method_get_stack(const FunctionObject *b, const Value return v4->throwTypeError(); if (!This->d()->stack) { QString trace; - for (int i = 0; i < This->d()->stackTrace->count(); ++i) { + for (int i = 0; i < This->d()->stackTrace->size(); ++i) { if (i > 0) trace += QLatin1Char('\n'); const StackFrame &frame = This->d()->stackTrace->at(i); diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp index 357bf242da..3c6b3754c1 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit.cpp +++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp @@ -885,7 +885,7 @@ bool ExecutableCompilationUnit::saveToDisk(const QUrl &unitUrl, QString *errorSt bool ResolvedTypeReferenceMap::addToHash( QCryptographicHash *hash, QHash *checksums) const { - std::vector keys (count()); + std::vector keys (size()); int i = 0; for (auto it = constBegin(), end = constEnd(); it != end; ++it) { keys[i] = it.key(); diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 0755dff34d..f0fc6dc7b3 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1229,7 +1229,7 @@ ReturnedValue QObjectWrapper::method_disconnect(const FunctionObject *b, const V static void markChildQObjectsRecursively(QObject *parent, MarkStack *markStack) { const QObjectList &children = parent->children(); - for (int i = 0; i < children.count(); ++i) { + for (int i = 0; i < children.size(); ++i) { QObject *child = children.at(i); if (!child) continue; diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 971edc770a..65fada93b5 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -213,7 +213,7 @@ void RuntimeHelpers::numberToString(QString *result, double num, int radix) *result = qdtoa(num, &decpt, &sign); if (decpt <= ecma_shortest_low || decpt > ecma_shortest_high) { - if (result->length() > 1) + if (result->size() > 1) result->insert(1, dot); result->append(QLatin1Char('e')); if (decpt > 0) @@ -221,10 +221,10 @@ void RuntimeHelpers::numberToString(QString *result, double num, int radix) result->append(QString::number(decpt - 1)); } else if (decpt <= 0) { result->prepend(QLatin1String("0.") + QString(-decpt, zero)); - } else if (decpt < result->length()) { + } else if (decpt < result->size()) { result->insert(decpt, dot); } else { - result->append(QString(decpt - result->length(), zero)); + result->append(QString(decpt - result->size(), zero)); } if (sign && num) diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 40d1f9bfaf..98bb6347d3 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -682,7 +682,7 @@ ReturnedValue StringPrototype::method_repeat(const FunctionObject *b, const Valu static void appendReplacementString(QString *result, const QString &input, const QString& replaceValue, uint* matchOffsets, int captureCount) { - result->reserve(result->length() + replaceValue.size()); + result->reserve(result->size() + replaceValue.size()); for (int i = 0; i < replaceValue.size(); ++i) { if (replaceValue.at(i) == QLatin1Char('$') && i < replaceValue.size() - 1) { ushort ch = replaceValue.at(i + 1).unicode(); diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp index 8e41dc8e3d..cbcfc4ca0d 100644 --- a/src/qml/memory/qv4mm.cpp +++ b/src/qml/memory/qv4mm.cpp @@ -1075,7 +1075,7 @@ void MemoryManager::runGC() std::swap(freedObjectStats, *freedObjectStatsGlobal()); typedef std::pair ObjectStatInfo; std::vector freedObjectsSorted; - freedObjectsSorted.reserve(freedObjectStats.count()); + freedObjectsSorted.reserve(freedObjectStats.size()); for (auto it = freedObjectStats.constBegin(); it != freedObjectStats.constEnd(); ++it) { freedObjectsSorted.push_back(std::make_pair(it.key(), it.value())); } diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h index ae61ca0c83..5e002fcbee 100644 --- a/src/qml/qml/ftw/qhashedstring_p.h +++ b/src/qml/qml/ftw/qhashedstring_p.h @@ -424,7 +424,7 @@ quint32 QHashedString::stringHash(const char *data, int length) void QHashedString::computeHash() const { - m_hash = stringHash(constData(), length()); + m_hash = stringHash(constData(), size()); } namespace QtPrivate { diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp index 7a81f1b8b2..a43bded441 100644 --- a/src/qml/qml/qqmlcontext.cpp +++ b/src/qml/qml/qqmlcontext.cpp @@ -480,7 +480,7 @@ qsizetype QQmlContextPrivate::context_count(QQmlListProperty *prop) if (d->propertyValue(contextProperty).userType() != qMetaTypeId >()) return 0; else - return ((const QList *)d->propertyValue(contextProperty).constData())->count(); + return ((const QList *)d->propertyValue(contextProperty).constData())->size(); } QObject *QQmlContextPrivate::context_at(QQmlListProperty *prop, qsizetype index) diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 3fb1bd45cd..304c5da29a 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -176,7 +176,7 @@ public: ~QQmlJavaScriptExpressionCapture() { if (capture.errorString) { - for (int ii = 0; ii < capture.errorString->count(); ++ii) + for (int ii = 0; ii < capture.errorString->size(); ++ii) qWarning("%s", qPrintable(capture.errorString->at(ii))); delete capture.errorString; capture.errorString = nullptr; diff --git a/src/qml/qml/qqmllist.h b/src/qml/qml/qqmllist.h index 294c666aba..c54ebf0677 100644 --- a/src/qml/qml/qqmllist.h +++ b/src/qml/qml/qqmllist.h @@ -89,7 +89,7 @@ private: reinterpret_cast *>(p->data)->append(v); } static qsizetype qlist_count(QQmlListProperty *p) { - return reinterpret_cast *>(p->data)->count(); + return reinterpret_cast *>(p->data)->size(); } static T *qlist_at(QQmlListProperty *p, qsizetype idx) { return reinterpret_cast *>(p->data)->at(idx); diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index a8d0eaa825..7e71a364d0 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -1483,7 +1483,7 @@ QList QQmlMetaType::qmlTypeNames() const QQmlMetaTypeDataPtr data; QList names; - names.reserve(data->nameToType.count()); + names.reserve(data->nameToType.size()); QQmlMetaTypeData::Names::ConstIterator it = data->nameToType.cbegin(); while (it != data->nameToType.cend()) { QQmlType t(*it); diff --git a/src/qml/qml/qqmlpluginimporter.cpp b/src/qml/qml/qqmlpluginimporter.cpp index 3fbf2d332b..0fa2dcf701 100644 --- a/src/qml/qml/qqmlpluginimporter.cpp +++ b/src/qml/qml/qqmlpluginimporter.cpp @@ -506,7 +506,7 @@ bool QQmlPluginImporter::populatePluginDataVector(QVector &res QTypeRevision QQmlPluginImporter::importPlugins() { const auto qmldirPlugins = qmldir->plugins(); - const int qmldirPluginCount = qmldirPlugins.count(); + const int qmldirPluginCount = qmldirPlugins.size(); QTypeRevision importVersion = version; // If the path contains a version marker or if we have more than one plugin, diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 2b029a583c..9bad4c833c 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -166,9 +166,9 @@ QQmlPropertyCache::Ptr QQmlPropertyCache::copy(const QQmlMetaObjectPointer &mo, QQmlPropertyCache::Ptr cache = QQmlPropertyCache::Ptr( new QQmlPropertyCache(mo), QQmlPropertyCache::Ptr::Adopt); cache->_parent.reset(this); - cache->propertyIndexCacheStart = propertyIndexCache.count() + propertyIndexCacheStart; - cache->methodIndexCacheStart = methodIndexCache.count() + methodIndexCacheStart; - cache->signalHandlerIndexCacheStart = signalHandlerIndexCache.count() + signalHandlerIndexCacheStart; + cache->propertyIndexCacheStart = propertyIndexCache.size() + propertyIndexCacheStart; + cache->methodIndexCacheStart = methodIndexCache.size() + methodIndexCacheStart; + cache->signalHandlerIndexCacheStart = signalHandlerIndexCache.size() + signalHandlerIndexCacheStart; cache->stringCache.linkAndReserve(stringCache, reserve); cache->allowedRevisionCache = allowedRevisionCache; cache->_defaultPropertyName = _defaultPropertyName; @@ -214,7 +214,7 @@ void QQmlPropertyCache::appendProperty(const QString &name, QQmlPropertyData::Fl if (overrideResult == InvalidOverride) return; - int index = propertyIndexCache.count(); + int index = propertyIndexCache.size(); propertyIndexCache.append(data); setNamedProperty(name, index + propertyOffset(), propertyIndexCache.data() + index, @@ -246,10 +246,10 @@ void QQmlPropertyCache::appendSignal(const QString &name, QQmlPropertyData::Flag if (overrideResult == InvalidOverride) return; - int methodIndex = methodIndexCache.count(); + int methodIndex = methodIndexCache.size(); methodIndexCache.append(data); - int signalHandlerIndex = signalHandlerIndexCache.count(); + int signalHandlerIndex = signalHandlerIndexCache.size(); signalHandlerIndexCache.append(handler); QString handlerName = QLatin1String("on") + name; @@ -283,7 +283,7 @@ void QQmlPropertyCache::appendMethod(const QString &name, QQmlPropertyData::Flag new (args->types + ii + 1) QMetaType(parameterTypes.at(ii)); data.setArguments(args); - int methodIndex = methodIndexCache.count(); + int methodIndex = methodIndexCache.size(); methodIndexCache.append(data); setNamedProperty(name, methodIndex + methodOffset(), methodIndexCache.data() + methodIndex, @@ -435,8 +435,8 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, data->load(m); - Q_ASSERT((allowedRevisionCache.count() - 1) < Q_INT16_MAX); - data->setMetaObjectOffset(allowedRevisionCache.count() - 1); + Q_ASSERT((allowedRevisionCache.size() - 1) < Q_INT16_MAX); + data->setMetaObjectOffset(allowedRevisionCache.size() - 1); if (data->isSignal()) { sigdata = &signalHandlerIndexCache[signalHandlerIndex - signalHandlerIndexCacheStart]; @@ -516,8 +516,8 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, data->load(p); data->setTypeVersion(typeVersion); - Q_ASSERT((allowedRevisionCache.count() - 1) < Q_INT16_MAX); - data->setMetaObjectOffset(allowedRevisionCache.count() - 1); + Q_ASSERT((allowedRevisionCache.size() - 1) < Q_INT16_MAX); + data->setMetaObjectOffset(allowedRevisionCache.size() - 1); QQmlPropertyData *old = nullptr; @@ -591,9 +591,9 @@ void QQmlPropertyCache::invalidate(const QMetaObject *metaObject) int reserve = pc + mc + sc; if (parent()) { - propertyIndexCacheStart = parent()->propertyIndexCache.count() + parent()->propertyIndexCacheStart; - methodIndexCacheStart = parent()->methodIndexCache.count() + parent()->methodIndexCacheStart; - signalHandlerIndexCacheStart = parent()->signalHandlerIndexCache.count() + parent()->signalHandlerIndexCacheStart; + propertyIndexCacheStart = parent()->propertyIndexCache.size() + parent()->propertyIndexCacheStart; + methodIndexCacheStart = parent()->methodIndexCache.size() + parent()->methodIndexCacheStart; + signalHandlerIndexCacheStart = parent()->signalHandlerIndexCache.size() + parent()->signalHandlerIndexCacheStart; stringCache.linkAndReserve(parent()->stringCache, reserve); append(metaObject, QTypeRevision()); } else { @@ -980,8 +980,8 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const for (StringCache::ConstIterator iter = stringCache.begin(), cend = stringCache.end(); iter != cend; ++iter) Insert::in(this, properties, methods, iter, iter.value().second); - Q_ASSERT(properties.size() == propertyIndexCache.count()); - Q_ASSERT(methods.size() == methodIndexCache.count()); + Q_ASSERT(properties.size() == propertyIndexCache.size()); + Q_ASSERT(methods.size() == methodIndexCache.size()); std::sort(properties.begin(), properties.end(), Sort::lt); std::sort(methods.begin(), methods.end(), Sort::lt); @@ -1019,7 +1019,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const QQmlPropertyCacheMethodArguments *arguments = nullptr; if (data->hasArguments()) { arguments = data->arguments(); - for (int ii = 0, end = arguments->names ? arguments->names->length() : 0; + for (int ii = 0, end = arguments->names ? arguments->names->size() : 0; ii < end; ++ii) { if (ii != 0) signature.append(','); diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index 7677735f99..1ba23a15e3 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -343,7 +343,7 @@ inline const QQmlPropertyData *QQmlPropertyCache::property(int index) const inline const QQmlPropertyData *QQmlPropertyCache::method(int index) const { - if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.count())) + if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.size())) return nullptr; if (index < methodIndexCacheStart) @@ -358,7 +358,7 @@ inline const QQmlPropertyData *QQmlPropertyCache::method(int index) const */ inline const QQmlPropertyData *QQmlPropertyCache::signal(int index) const { - if (index < 0 || index >= (signalHandlerIndexCacheStart + signalHandlerIndexCache.count())) + if (index < 0 || index >= (signalHandlerIndexCacheStart + signalHandlerIndexCache.size())) return nullptr; if (index < signalHandlerIndexCacheStart) @@ -379,7 +379,7 @@ inline QQmlEnumData *QQmlPropertyCache::qmlEnum(int index) const inline int QQmlPropertyCache::methodIndexToSignalIndex(int index) const { - if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.count())) + if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.size())) return index; if (index < methodIndexCacheStart) @@ -419,7 +419,7 @@ bool QQmlPropertyCache::isAllowedInRevision(const QQmlPropertyData *data) const return true; Q_ASSERT(offset >= 0); - Q_ASSERT(offset < allowedRevisionCache.length()); + Q_ASSERT(offset < allowedRevisionCache.size()); const QTypeRevision allowed = allowedRevisionCache[offset]; if (requested.hasMajorVersion()) { @@ -434,7 +434,7 @@ bool QQmlPropertyCache::isAllowedInRevision(const QQmlPropertyData *data) const int QQmlPropertyCache::propertyCount() const { - return propertyIndexCacheStart + propertyIndexCache.count(); + return propertyIndexCacheStart + propertyIndexCache.size(); } int QQmlPropertyCache::propertyOffset() const @@ -444,7 +444,7 @@ int QQmlPropertyCache::propertyOffset() const int QQmlPropertyCache::methodCount() const { - return methodIndexCacheStart + methodIndexCache.count(); + return methodIndexCacheStart + methodIndexCache.size(); } int QQmlPropertyCache::methodOffset() const @@ -454,7 +454,7 @@ int QQmlPropertyCache::methodOffset() const int QQmlPropertyCache::signalCount() const { - return signalHandlerIndexCacheStart + signalHandlerIndexCache.count(); + return signalHandlerIndexCacheStart + signalHandlerIndexCache.size(); } int QQmlPropertyCache::signalOffset() const diff --git a/src/qml/qml/qqmlpropertycachecreator_p.h b/src/qml/qml/qqmlpropertycachecreator_p.h index aec5848a18..41b50ed1dc 100644 --- a/src/qml/qml/qqmlpropertycachecreator_p.h +++ b/src/qml/qml/qqmlpropertycachecreator_p.h @@ -1013,8 +1013,8 @@ inline QQmlError QQmlPropertyCacheAliasCreator::appendAliasesTo QQmlPropertyCache::Ptr propertyCache = propertyCaches->ownAt(objectIndex); Q_ASSERT(propertyCache); - int effectiveSignalIndex = propertyCache->signalHandlerIndexCacheStart + propertyCache->propertyIndexCache.count(); - int effectivePropertyIndex = propertyCache->propertyIndexCacheStart + propertyCache->propertyIndexCache.count(); + int effectiveSignalIndex = propertyCache->signalHandlerIndexCacheStart + propertyCache->propertyIndexCache.size(); + int effectivePropertyIndex = propertyCache->propertyIndexCacheStart + propertyCache->propertyIndexCache.size(); int aliasIndex = 0; auto alias = object.aliasesBegin(); diff --git a/src/qml/qml/qqmlproxymetaobject.cpp b/src/qml/qml/qqmlproxymetaobject.cpp index 9a5347bd74..ad67856c02 100644 --- a/src/qml/qml/qqmlproxymetaobject.cpp +++ b/src/qml/qml/qqmlproxymetaobject.cpp @@ -32,8 +32,8 @@ QQmlProxyMetaObject::~QQmlProxyMetaObject() QObject *QQmlProxyMetaObject::getProxy(int index) { if (!proxies) { - proxies = new QObject *[metaObjects->count()]; - ::memset(proxies, 0, sizeof(QObject *) * metaObjects->count()); + proxies = new QObject *[metaObjects->size()]; + ::memset(proxies, 0, sizeof(QObject *) * metaObjects->size()); } if (!proxies[index]) { @@ -71,7 +71,7 @@ int QQmlProxyMetaObject::metaCall(QObject *o, QMetaObject::Call c, int id, void if (id < metaObjects->constLast().propertyOffset) break; - for (int ii = 0; ii < metaObjects->count(); ++ii) { + for (int ii = 0; ii < metaObjects->size(); ++ii) { const int globalPropertyOffset = metaObjects->at(ii).propertyOffset; if (id < globalPropertyOffset) continue; @@ -94,7 +94,7 @@ int QQmlProxyMetaObject::metaCall(QObject *o, QMetaObject::Call c, int id, void return -1; } - for (int ii = 0; ii < metaObjects->count(); ++ii) { + for (int ii = 0; ii < metaObjects->size(); ++ii) { const int globalMethodOffset = metaObjects->at(ii).methodOffset; if (id < globalMethodOffset) continue; diff --git a/src/qml/qml/qqmltypecompiler.cpp b/src/qml/qml/qqmltypecompiler.cpp index 521e5c7851..203a004765 100644 --- a/src/qml/qml/qqmltypecompiler.cpp +++ b/src/qml/qml/qqmltypecompiler.cpp @@ -833,7 +833,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents( } qmlObjects->append(syntheticComponent); - const int componentIndex = qmlObjects->count() - 1; + const int componentIndex = qmlObjects->size() - 1; // Keep property caches symmetric QQmlPropertyCache::ConstPtr componentCache = QQmlMetaType::propertyCache(&QQmlComponent::staticMetaObject); @@ -863,7 +863,7 @@ bool QQmlComponentAndAliasResolver::resolve(int root) // someItemDelegate: Item {} // In the implicit case Item is surrounded by a synthetic Component {} because the property // on the left hand side is of QQmlComponent type. - const int objCountWithoutSynthesizedComponents = qmlObjects->count(); + const int objCountWithoutSynthesizedComponents = qmlObjects->size(); const int startObjectIndex = root == 0 ? root : root+1; // root+1, as ic root is handled at the end for (int i = startObjectIndex; i < objCountWithoutSynthesizedComponents; ++i) { QmlIR::Object *obj = qmlObjects->at(i); diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 1780879755..7b763030f3 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -615,7 +615,7 @@ bool QQmlTypeLoader::Blob::addLibraryImport(const QQmlTypeLoader::Blob::PendingI scriptImported(blob, import->location, script.nameSpace, import->qualifier); } } - if (!qmldir.plugins().count()) { + if (!qmldir.plugins().size()) { // If the qmldir does not register a plugin, we might still have declaratively // registered types (if we are dealing with an application instead of a library) auto module = QQmlMetaType::typeModule(import->uri, import->version); diff --git a/src/qml/qml/qqmltypemodule.cpp b/src/qml/qml/qqmltypemodule.cpp index 35e6e72544..b188b7fb90 100644 --- a/src/qml/qml/qqmltypemodule.cpp +++ b/src/qml/qml/qqmltypemodule.cpp @@ -54,7 +54,7 @@ void QQmlTypeModule::remove(const QQmlTypePrivate *type) QQmlType QQmlTypeModule::findType(const QList *types, QTypeRevision version) { if (types) { - for (int ii = 0; ii < types->count(); ++ii) + for (int ii = 0; ii < types->size(); ++ii) if (types->at(ii)->version.minorVersion() <= version.minorVersion()) return QQmlType(types->at(ii)); } diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp index 7365255935..cf11a3f06d 100644 --- a/src/qml/qml/qqmlvaluetype.cpp +++ b/src/qml/qml/qqmlvaluetype.cpp @@ -386,7 +386,7 @@ void QQmlEasingValueType::setBezierCurve(const QVariantList &customCurveVariant) if (customCurveVariant.isEmpty()) return; - if ((customCurveVariant.count() % 6) != 0) + if ((customCurveVariant.size() % 6) != 0) return; auto convert = [](const QVariant &v, qreal &r) { diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index 0f4828ac83..3db088705e 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -93,7 +93,7 @@ static void list_append(QQmlListProperty *prop, QObject *o) static qsizetype list_count(QQmlListProperty *prop) { - return ResolvedList(prop).list()->count(); + return ResolvedList(prop).list()->size(); } static QObject *list_at(QQmlListProperty *prop, qsizetype index) @@ -1044,7 +1044,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * auto arguments = methodData->hasArguments() ? methodData->arguments() : nullptr; if (arguments && arguments->names) { - const quint32 parameterCount = arguments->names->count(); + const quint32 parameterCount = arguments->names->size(); Q_ASSERT(parameterCount == function->formalParameterCount()); if (void *result = a[0]) arguments->types[0].destruct(result); -- cgit v1.2.3