summaryrefslogtreecommitdiffstats
path: root/src/linguist/shared/ioutils.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-05 08:17:22 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-06 18:20:17 +0200
commitc338447261878111df7198fbd96051926464e865 (patch)
treed21b5af1efae225f75d5c05dfe370daefb1ea1d1 /src/linguist/shared/ioutils.cpp
parent6495329e6de803025e6e4e8291b648f94893551c (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: I95f6410e57a6a92b1cf91bbedfbe3d517cab6b44 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/linguist/shared/ioutils.cpp')
-rw-r--r--src/linguist/shared/ioutils.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/linguist/shared/ioutils.cpp b/src/linguist/shared/ioutils.cpp
index 5a5c45526..71bf0020c 100644
--- a/src/linguist/shared/ioutils.cpp
+++ b/src/linguist/shared/ioutils.cpp
@@ -136,7 +136,7 @@ bool isSpecialChar(ushort c, const uchar (&iqm)[16])
inline static
bool hasSpecialChars(const QString &arg, const uchar (&iqm)[16])
{
- for (int x = arg.length() - 1; x >= 0; --x) {
+ for (int x = arg.size() - 1; x >= 0; --x) {
if (isSpecialChar(arg.unicode()[x].unicode(), iqm))
return true;
}
@@ -151,7 +151,7 @@ QString IoUtils::shellQuoteUnix(const QString &arg)
0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x78
}; // 0-32 \'"$`<>|;&(){}*?#!~[]
- if (!arg.length())
+ if (!arg.size())
return QString::fromLatin1("''");
QString ret(arg);
@@ -179,7 +179,7 @@ QString IoUtils::shellQuoteWin(const QString &arg)
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10
}; // &()<>^|
- if (!arg.length())
+ if (!arg.size())
return QString::fromLatin1("\"\"");
QString ret(arg);
@@ -195,7 +195,7 @@ QString IoUtils::shellQuoteWin(const QString &arg)
// to the called process verbatim. In the unquoted state, the circumflex escapes
// meta chars (including itself and quotes), and is removed from the command.
bool quoted = true;
- for (int i = 0; i < ret.length(); i++) {
+ for (int i = 0; i < ret.size(); i++) {
QChar c = ret.unicode()[i];
if (c.unicode() == '"')
quoted = !quoted;