diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-05 07:29:16 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 23:38:48 +0200 |
commit | 958cd3ee1094a068b6d0ff27c73a4b3caff088ad (patch) | |
tree | 6d3816fedf5dab2307675fd6ef70d39758e246f5 /src/quick/util/qquickpixmapcache.cpp | |
parent | e8e03215654ca730243336a80453cf9396cbdf58 (diff) |
Port from container::count() and length() to size()
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8:
auto QtContainerClass = anyOf(
expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o),
expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o));
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container',
with the extended set of container classes recognized.
Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quick/util/qquickpixmapcache.cpp')
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 97942f56b8..3244b78e78 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -466,7 +466,7 @@ static QString existingImageFileForPath(const QString &localFile) return localFile; QString tryFile = localFile + QStringLiteral(".xxxx"); - const int suffixIdx = localFile.length() + 1; + const int suffixIdx = localFile.size() + 1; for (const QString &suffix : backendSupport()->fileSuffixes) { tryFile.replace(suffixIdx, 10, suffix); if (QFileInfo::exists(tryFile)) @@ -674,7 +674,7 @@ void QQuickPixmapReader::processJobs() // Clean cancelled jobs if (!cancelled.isEmpty()) { - for (int i = 0; i < cancelled.count(); ++i) { + for (int i = 0; i < cancelled.size(); ++i) { QQuickPixmapReply *job = cancelled.at(i); #if QT_CONFIG(qml_network) QNetworkReply *reply = networkJobs.key(job, 0); @@ -702,7 +702,7 @@ void QQuickPixmapReader::processJobs() if (!jobs.isEmpty()) { // Find a job we can use bool usableJob = false; - for (int i = jobs.count() - 1; !usableJob && i >= 0; i--) { + for (int i = jobs.size() - 1; !usableJob && i >= 0; i--) { QQuickPixmapReply *job = jobs.at(i); const QUrl url = job->url; QString localFile; @@ -720,7 +720,7 @@ void QQuickPixmapReader::processJobs() localFile = QQmlFile::urlToLocalFileOrQrc(url); usableJob = !localFile.isEmpty() #if QT_CONFIG(qml_network) - || networkJobs.count() < IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT + || networkJobs.size() < IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT #endif ; } @@ -1315,7 +1315,7 @@ void QQuickPixmapData::addToCache() pixmapStore()->m_cache.insert(key, this); inCache = true; PIXMAP_PROFILE(pixmapCountChanged<QQuickProfiler::PixmapCacheCountChanged>( - url, pixmapStore()->m_cache.count())); + url, pixmapStore()->m_cache.size())); } } @@ -1329,7 +1329,7 @@ void QQuickPixmapData::removeFromCache(QQuickPixmapStore *store) store->m_cache.remove(key); inCache = false; PIXMAP_PROFILE(pixmapCountChanged<QQuickProfiler::PixmapCacheCountChanged>( - url, store->m_cache.count())); + url, store->m_cache.size())); } } |