Port from container.count()/length() to size()

This is semantic patch using ClangTidyTransformator:

  auto QtContainerClass = 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'.

<classes> are:

    // sequential:
    "QByteArray",
    "QList",
    "QQueue",
    "QStack",
    "QString",
    "QVarLengthArray",
    "QVector",
    // associative:
    "QHash",
    "QMultiHash",
    "QMap",
    "QMultiMap",
    "QSet",
    // Qt has no QMultiSet

Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Marc Mutz 2022-09-30 14:09:04 +02:00
parent 109e088c7c
commit df9d882d41
502 changed files with 3297 additions and 3297 deletions

View File

@ -65,7 +65,7 @@ struct FileInfoCacheKey
return hash;
}
inline bool isRelativePath(const QString &file) {
int length = file.length();
int length = file.size();
if (!length)
return true;

View File

@ -524,14 +524,14 @@ bool ProjectBuilderMakefileGenerator::replaceLibrarySuffix(const QString &lib_fi
warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.",
qPrintable(librarySuffix), qPrintable(library));
} else {
library.replace(pos, librarySuffix.length(), suffixSetting);
library.replace(pos, librarySuffix.size(), suffixSetting);
if (name.endsWith(librarySuffix))
name.chop(librarySuffix.length());
name.chop(librarySuffix.size());
}
} else {
int pos = library.lastIndexOf(name);
if (pos != -1)
library.insert(pos + name.length(), suffixSetting);
library.insert(pos + name.size(), suffixSetting);
}
}
}
@ -955,7 +955,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
const int slsh = library.lastIndexOf(Option::dir_sep);
if(name.isEmpty()) {
if(slsh != -1)
name = library.right(library.length() - slsh - 1);
name = library.right(library.size() - slsh - 1);
}
if(slsh != -1) {
const QString path = QFileInfo(library.left(slsh)).absoluteFilePath();
@ -1970,7 +1970,7 @@ ProjectBuilderMakefileGenerator::pbxbuild()
static QString quotedStringLiteral(const QString &value)
{
QString result;
const int len = value.length();
const int len = value.size();
result.reserve(int(len * 1.1) + 2);
result += QLatin1Char('"');

View File

@ -113,7 +113,7 @@ MakefileGenerator::initOutPaths()
if(!fi.makeAbsolute()) {
QString cache_r = fi.path(), pwd = Option::output_dir;
if(pwd.startsWith(cache_r) && !pwd.startsWith(root)) {
pwd = root + pwd.mid(cache_r.length());
pwd = root + pwd.mid(cache_r.size());
if(exists(pwd))
v.insert("QMAKE_ABSOLUTE_SOURCE_PATH", ProStringList(pwd));
}
@ -288,7 +288,7 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString
real_dir = dir;
if(!(flags & VPATH_NoFixify))
real_dir = fileFixify(real_dir, FileFixifyBackwards) + '/';
regex.remove(0, dir.length());
regex.remove(0, dir.size());
}
if(real_dir.isEmpty() || exists(real_dir)) {
QStringList files = QDir(real_dir).entryList(QStringList(regex),
@ -491,7 +491,7 @@ MakefileGenerator::init()
inn.toLatin1().constData());
continue;
}
outn = fileFixify(inn.left(inn.length() - 3), FileFixifyBackwards);
outn = fileFixify(inn.left(inn.size() - 3), FileFixifyBackwards);
}
const ProKey confign(sub + ".CONFIG");
@ -512,7 +512,7 @@ MakefileGenerator::init()
QString line = QString::fromLatin1(in.readLine());
if (line.startsWith("!!IF ")) {
if (state.isEmpty() || state.top() == IN_CONDITION) {
QString test = line.mid(5, line.length()-(5+1));
QString test = line.mid(5, line.size()-(5+1));
if (project->test(test, inn, count))
state.push(IN_CONDITION);
else
@ -525,7 +525,7 @@ MakefileGenerator::init()
warn_msg(WarnLogic, "(%s:%d): Unexpected else condition",
in.fileName().toLatin1().constData(), count);
} else if (state.top() == PENDING_CONDITION) {
QString test = line.mid(7, line.length()-(7+1));
QString test = line.mid(7, line.size()-(7+1));
if (project->test(test, inn, count)) {
state.pop();
state.push(IN_CONDITION);
@ -634,7 +634,7 @@ MakefileGenerator::init()
}
{ //do the path fixifying
ProStringList paths;
for(x = 0; x < compilers.count(); ++x) {
for(x = 0; x < compilers.size(); ++x) {
if(!paths.contains(compilers.at(x).variable_in))
paths << compilers.at(x).variable_in;
}
@ -653,7 +653,7 @@ MakefileGenerator::init()
if(noIO() || !doDepends() || project->isActiveConfig("GNUmake"))
QMakeSourceFileInfo::setDependencyMode(QMakeSourceFileInfo::NonRecursive);
for(x = 0; x < compilers.count(); ++x)
for(x = 0; x < compilers.size(); ++x)
initCompiler(compilers.at(x));
//merge actual compiler outputs into their variable_out. This is done last so that
@ -764,7 +764,7 @@ MakefileGenerator::init()
incDirs.join(QString(" :: ")).toLatin1().constData());
//add to dependency engine
for(x = 0; x < compilers.count(); ++x) {
for(x = 0; x < compilers.size(); ++x) {
const MakefileGenerator::Compiler &comp = compilers.at(x);
if(!(comp.flags & Compiler::CompilerNoCheckDeps)) {
const ProKey ikey(comp.variable_in);
@ -820,7 +820,7 @@ MakefileGenerator::init()
QString dir, regex = Option::normalizePath(dep);
if (regex.lastIndexOf('/') != -1) {
dir = regex.left(regex.lastIndexOf('/') + 1);
regex.remove(0, dir.length());
regex.remove(0, dir.size());
}
QStringList files = QDir(dir).entryList(QStringList(regex));
if(files.isEmpty()) {
@ -1173,7 +1173,7 @@ QString
MakefileGenerator::filePrefixRoot(const QString &root, const QString &path)
{
QString ret(path);
if(path.length() > 2 && path[1] == ':') //c:\foo
if(path.size() > 2 && path[1] == ':') //c:\foo
ret.insert(2, root);
else
ret.prepend(root);
@ -1249,14 +1249,14 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
qPrintable(wild), qPrintable((*it).toQString()),
qPrintable(base_path));
} else {
QString dir_sfx = dirstr.mid(base_path.length());
QString dir_sfx = dirstr.mid(base_path.size());
dst_dir += dir_sfx;
if (!dir_sfx.isEmpty() && !made_dirs.contains(dir_sfx)) {
made_dirs.insert(dir_sfx);
QString tmp_dst = fileFixify(dst_dir, FileFixifyAbsolute, false);
tmp_dst.chop(1);
inst << mkdir_p_asstring(filePrefixRoot(root, tmp_dst));
for (int i = dst.length(); i < dst_dir.length(); i++) {
for (int i = dst.size(); i < dst_dir.size(); i++) {
if (dst_dir.at(i) == Option::dir_sep) {
QString subd = dst_dir.left(i);
if (!removed_dirs.contains(subd)) {
@ -1616,7 +1616,7 @@ MakefileGenerator::replaceExtraCompilerVariables(
QFileInfo fi(fileInfo(Option::normalizePath(in.at(i))));
QString ext;
// Ensure complementarity with QMAKE_FILE_BASE
int baseLen = fi.completeBaseName().length();
int baseLen = fi.completeBaseName().size();
if(baseLen == 0)
ext = fi.fileName();
else
@ -1682,7 +1682,7 @@ MakefileGenerator::replaceExtraCompilerVariables(
fullVal = val.join(' ');
}
ret.replace(match.capturedStart(), match.capturedLength(), fullVal);
rep += fullVal.length();
rep += fullVal.size();
} else {
rep = match.capturedEnd();
}
@ -1998,8 +1998,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
QString files;
const int commandlineLimit = 2047; // NT limit, expanded
for (const QString &file : qAsConst(dels)) {
if(del_statement.length() + files.length() +
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
if(del_statement.size() + files.size() +
qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) {
cleans.append(files);
files.clear();
}
@ -2382,7 +2382,7 @@ MakefileGenerator::findSubDirsSubTargets() const
if(new_slsh != -1)
basename = basename.mid(new_slsh+1);
if(st->profile != basename + Option::pro_ext)
st->makefile += "." + st->profile.left(st->profile.length() - Option::pro_ext.length());
st->makefile += "." + st->profile.left(st->profile.size() - Option::pro_ext.size());
}
}
const ProKey dkey(fixedSubdir + ".depends");
@ -2521,7 +2521,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
if(!out_directory.isEmpty() && !out_directory.endsWith(Option::dir_sep))
out_directory += Option::dir_sep;
if(!abs_source_path.isEmpty() && out_directory.startsWith(abs_source_path))
out_directory = Option::output_dir + out_directory.mid(abs_source_path.length());
out_directory = Option::output_dir + out_directory.mid(abs_source_path.size());
QString out_directory_cdin = out_directory.isEmpty() ? QString("\n\t")
: "\n\tcd " + escapeFilePath(out_directory) + " && ";
@ -2534,7 +2534,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
out = subtarget->makefile;
in = escapeFilePath(fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute));
if(out.startsWith(in_directory))
out = out.mid(in_directory.length());
out = out.mid(in_directory.size());
out = escapeFilePath(out);
t << subtarget->target << "-qmake_all: ";
if (flags & SubTargetOrdered) {
@ -2699,7 +2699,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
if(!out_directory.isEmpty() && !out_directory.endsWith(Option::dir_sep))
out_directory += Option::dir_sep;
if(!abs_source_path.isEmpty() && out_directory.startsWith(abs_source_path))
out_directory = Option::output_dir + out_directory.mid(abs_source_path.length());
out_directory = Option::output_dir + out_directory.mid(abs_source_path.size());
if(!recurse.contains(subtarget->name))
continue;
@ -2714,7 +2714,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
out = subtarget->makefile;
in = escapeFilePath(fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute));
if (out.startsWith(in_directory))
out = out.mid(in_directory.length());
out = out.mid(in_directory.size());
out = escapeFilePath(out);
}
@ -3016,7 +3016,7 @@ MakefileGenerator::fileFixify(const QString &file, FileFixifyTypes fix, bool can
if(ret == match_dir) {
ret = "";
} else if(ret.startsWith(match_dir + Option::dir_sep)) {
ret = ret.mid(match_dir.length() + Option::dir_sep.length());
ret = ret.mid(match_dir.size() + Option::dir_sep.size());
} else {
//figure out the depth
int depth = 4;
@ -3038,7 +3038,7 @@ MakefileGenerator::fileFixify(const QString &file, FileFixifyTypes fix, bool can
break;
if(ret.startsWith(match_dir + Option::dir_sep)) {
//concat
int remlen = ret.length() - (match_dir.length() + 1);
int remlen = ret.size() - (match_dir.size() + 1);
if(remlen < 0)
remlen = 0;
ret = ret.right(remlen);
@ -3112,12 +3112,12 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca
QList<QMakeLocalFileName> depdirs = QMakeSourceFileInfo::dependencyPaths();
depdirs.prepend(fileInfo(file.real()).absoluteDir().path());
QString pwd = qmake_getpwd();
if(pwd.at(pwd.length()-1) != '/')
if(pwd.at(pwd.size()-1) != '/')
pwd += '/';
for(int i = 0; i < depdirs.count(); i++) {
for(int i = 0; i < depdirs.size(); i++) {
QString dir = depdirs.at(i).real();
if(!QDir::isRelativePath(dir) && dir.startsWith(pwd))
dir = dir.mid(pwd.length());
dir = dir.mid(pwd.size());
if(QDir::isRelativePath(dir)) {
if(!dir.endsWith(Option::dir_sep))
dir += Option::dir_sep;
@ -3233,7 +3233,7 @@ MakefileGenerator::pkgConfigFileName(bool fixify)
ret = project->first("TARGET").toQString();
int slsh = ret.lastIndexOf(Option::dir_sep);
if (slsh != -1)
ret = ret.right(ret.length() - slsh - 1);
ret = ret.right(ret.size() - slsh - 1);
if (ret.startsWith("lib"))
ret = ret.mid(3);
int dot = ret.indexOf('.');

View File

@ -164,7 +164,7 @@ void QMakeSourceFileInfo::setDependencyPaths(const QList<QMakeLocalFileName> &l)
{
// Ensure that depdirs does not contain the same paths several times, to minimize the stats
QList<QMakeLocalFileName> ll;
for (int i = 0; i < l.count(); ++i) {
for (int i = 0; i < l.size(); ++i) {
if (!ll.contains(l.at(i)))
ll.append(l.at(i));
}

View File

@ -52,7 +52,7 @@ public:
void
BuildsMetaMakefileGenerator::clearBuilds()
{
for(int i = 0; i < makefiles.count(); i++) {
for(int i = 0; i < makefiles.size(); i++) {
Build *build = makefiles[i];
if(QMakeProject *p = build->makefile->projectFile()) {
if(p != project)
@ -126,7 +126,7 @@ BuildsMetaMakefileGenerator::write()
bool ret = true;
const QString &output_name = Option::output.fileName();
for(int i = 0; ret && i < makefiles.count(); i++) {
for(int i = 0; ret && i < makefiles.size(); i++) {
Option::output.setFileName(output_name);
Build *build = makefiles[i];
@ -223,7 +223,7 @@ void BuildsMetaMakefileGenerator::accumulateVariableFromBuilds(const ProKey &nam
void BuildsMetaMakefileGenerator::checkForConflictingTargets() const
{
if (makefiles.count() < 3) {
if (makefiles.size() < 3) {
// Checking for conflicts only makes sense if we have more than one BUILD,
// and the last entry in makefiles is the "glue" Build.
return;
@ -234,7 +234,7 @@ void BuildsMetaMakefileGenerator::checkForConflictingTargets() const
}
using TargetInfo = std::pair<Build *, ProString>;
QList<TargetInfo> targets;
const int last = makefiles.count() - 1;
const int last = makefiles.size() - 1;
targets.resize(last);
for (int i = 0; i < last; ++i) {
Build *b = makefiles.at(i);
@ -324,7 +324,7 @@ SubdirsMetaMakefileGenerator::init()
if(!subdir.isRelative()) { //we can try to make it relative
QString subdir_path = subdir.filePath();
if(subdir_path.startsWith(thispwd))
subdir = QFileInfo(subdir_path.mid(thispwd.length()));
subdir = QFileInfo(subdir_path.mid(thispwd.size()));
}
//handle sub project
@ -391,12 +391,12 @@ SubdirsMetaMakefileGenerator::write()
const QString &pwd = qmake_getpwd();
const QString &output_dir = Option::output_dir;
const QString &output_name = Option::output.fileName();
for(int i = 0; ret && i < subs.count(); i++) {
for(int i = 0; ret && i < subs.size(); i++) {
const Subdir *sub = subs.at(i);
qmake_setpwd(sub->input_dir);
Option::output_dir = QFileInfo(sub->output_dir).absoluteFilePath();
Option::output.setFileName(sub->output_file);
if(i != subs.count()-1) {
if(i != subs.size()-1) {
for (int ind = 0; ind < sub->indent; ++ind)
printf(" ");
printf("Writing %s\n", QDir::cleanPath(Option::output_dir+"/"+
@ -414,7 +414,7 @@ SubdirsMetaMakefileGenerator::write()
SubdirsMetaMakefileGenerator::~SubdirsMetaMakefileGenerator()
{
for(int i = 0; i < subs.count(); i++)
for(int i = 0; i < subs.size(); i++)
delete subs[i];
subs.clear();
}

View File

@ -87,7 +87,7 @@ ProjectGenerator::init()
int s = regex.lastIndexOf(Option::dir_sep);
if(s != -1) {
dir = regex.left(s+1);
regex = regex.right(regex.length() - (s+1));
regex = regex.right(regex.size() - (s+1));
}
const QDir d(dir);
if (Option::recursive) {
@ -155,7 +155,7 @@ ProjectGenerator::init()
int s = regx.lastIndexOf(Option::dir_sep);
if(s != -1) {
dir = regx.left(s+1);
regx = regx.right(regx.length() - (s+1));
regx = regx.right(regx.size() - (s+1));
}
QStringList files = QDir(dir).entryList(QDir::nameFiltersFromString(regx),
QDir::Dirs | QDir::NoDotAndDotDot);
@ -231,7 +231,7 @@ ProjectGenerator::init()
}
if(!h_ext.isEmpty()) {
for(int cppit = 0; cppit < Option::cpp_ext.size(); ++cppit) {
QString src(dep.left(dep.length() - h_ext.length()) +
QString src(dep.left(dep.size() - h_ext.size()) +
Option::cpp_ext.at(cppit));
if(exists(src)) {
ProStringList &srcl = v["SOURCES"];
@ -358,7 +358,7 @@ ProjectGenerator::addFile(QString file)
int s = file.lastIndexOf(Option::dir_sep);
if(s != -1)
dir = file.left(s+1);
if(file.mid(dir.length(), Option::h_moc_mod.length()) == Option::h_moc_mod)
if(file.mid(dir.size(), Option::h_moc_mod.size()) == Option::h_moc_mod)
return false;
ProKey where;
@ -428,9 +428,9 @@ ProjectGenerator::getWritableVar(const char *vk, bool)
else
ret = v + " += ";
QString join = vals.join(' ');
if(ret.length() + join.length() > 80) {
if(ret.size() + join.size() > 80) {
QString spaces;
for(int i = 0; i < ret.length(); i++)
for(int i = 0; i < ret.size(); i++)
spaces += " ";
join = vals.join(" \\\n" + spaces);
}

View File

@ -48,7 +48,7 @@ UnixMakefileGenerator::init()
for (const ProString &iif : project->values("QMAKE_INTERNAL_INCLUDED_FILES")) {
if (iif == project->cacheFile())
continue;
if (iif.startsWith(sroot) && iif.at(sroot.length()) == QLatin1Char('/'))
if (iif.startsWith(sroot) && iif.at(sroot.size()) == QLatin1Char('/'))
project->values("DISTFILES") += fileFixify(iif.toQString(), FileFixifyRelative);
}
@ -101,7 +101,7 @@ UnixMakefileGenerator::init()
const ProStringList &rpathdirs = project->values("QMAKE_RPATHDIR");
for (int i = 0; i < rpathdirs.size(); ++i) {
QString rpathdir = rpathdirs[i].toQString();
if (rpathdir.length() > 1 && rpathdir.at(0) == '$' && rpathdir.at(1) != '(') {
if (rpathdir.size() > 1 && rpathdir.at(0) == '$' && rpathdir.at(1) != '(') {
rpathdir.replace(0, 1, "\\$$"); // Escape from make and the shell
} else if (!rpathdir.startsWith('@') && fileInfo(rpathdir).isRelative()) {
QString rpathbase = project->first("QMAKE_REL_RPATH_BASE").toQString();
@ -436,7 +436,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
break;
}
} else {
if (opt.length() == 10)
if (opt.size() == 10)
++it;
// Skip
}
@ -689,7 +689,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
QString link = Option::fixPathToTargetOS(destdir + links[i], false);
int lslash = link.lastIndexOf(Option::dir_sep);
if(lslash != -1)
link = link.right(link.length() - (lslash + 1));
link = link.right(link.size() - (lslash + 1));
QString dst_link = escapeFilePath(
filePrefixRoot(root, fileFixify(targetdir + link, FileFixifyAbsolute)));
ret += "\n\t-$(SYMLINK) $(TARGET) " + dst_link;

View File

@ -105,11 +105,11 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::
if (!out_directory.isEmpty() && !out_directory.endsWith(Option::dir_sep))
out_directory += Option::dir_sep;
if (!abs_source_path.isEmpty() && out_directory.startsWith(abs_source_path))
out_directory = Option::output_dir + out_directory.mid(abs_source_path.length());
out_directory = Option::output_dir + out_directory.mid(abs_source_path.size());
QString dist_directory = out_directory;
if (dist_directory.endsWith(Option::dir_sep))
dist_directory.chop(Option::dir_sep.length());
dist_directory.chop(Option::dir_sep.size());
if (!dist_directory.startsWith(Option::dir_sep))
dist_directory.prepend(Option::dir_sep);
@ -121,7 +121,7 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::
QString out = subtarget->makefile;
QString in = escapeFilePath(fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute));
if (out.startsWith(in_directory))
out.remove(0, in_directory.length());
out.remove(0, in_directory.size());
t << subtarget->target << "-distdir: FORCE";
writeSubTargetCall(t, in_directory, in, out_directory, escapeFilePath(out),
@ -303,7 +303,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
for(QStringList::Iterator cit = Option::c_ext.begin();
cit != Option::c_ext.end(); ++cit) {
if((*it).endsWith((*cit))) {
d_file = (*it).left((*it).length() - (*cit).length()).toQString();
d_file = (*it).left((*it).length() - (*cit).size()).toQString();
break;
}
}
@ -311,7 +311,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
for(QStringList::Iterator cppit = Option::cpp_ext.begin();
cppit != Option::cpp_ext.end(); ++cppit) {
if((*it).endsWith((*cppit))) {
d_file = (*it).left((*it).length() - (*cppit).length()).toQString();
d_file = (*it).left((*it).length() - (*cppit).size()).toQString();
break;
}
}
@ -388,7 +388,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
//incremental target
QString incr_target = var("TARGET") + "_incremental";
if(incr_target.indexOf(Option::dir_sep) != -1)
incr_target = incr_target.right(incr_target.length() -
incr_target = incr_target.right(incr_target.size() -
(incr_target.lastIndexOf(Option::dir_sep) + 1));
QString incr_deps, incr_objs;
if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") {
@ -489,7 +489,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QString incr_target = var("QMAKE_ORIG_TARGET").replace(
QRegularExpression("\\." + s_ext), "").replace(QRegularExpression("^lib"), "") + "_incremental";
if(incr_target.indexOf(Option::dir_sep) != -1)
incr_target = incr_target.right(incr_target.length() -
incr_target = incr_target.right(incr_target.size() -
(incr_target.lastIndexOf(Option::dir_sep) + 1));
if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") {
@ -1395,7 +1395,7 @@ UnixMakefileGenerator::libtoolFileName(bool fixify)
QString ret = var("TARGET");
int slsh = ret.lastIndexOf(Option::dir_sep);
if(slsh != -1)
ret = ret.right(ret.length() - slsh - 1);
ret = ret.right(ret.size() - slsh - 1);
int dot = ret.indexOf('.');
if(dot != -1)
ret = ret.left(dot);
@ -1465,7 +1465,7 @@ UnixMakefileGenerator::writeLibtoolFile()
mkdir(fileInfo(fname).path());
int slsh = lname.lastIndexOf(Option::dir_sep);
if(slsh != -1)
lname = lname.right(lname.length() - slsh - 1);
lname = lname.right(lname.size() - slsh - 1);
QFile ft(fname);
if(!ft.open(QIODevice::WriteOnly))
return;
@ -1495,7 +1495,7 @@ UnixMakefileGenerator::writeLibtoolFile()
t << "'\n\n";
t << "# The name of the static archive.\n"
<< "old_library='" << escapeFilePath(lname.left(lname.length()-Option::libtool_ext.length()))
<< "old_library='" << escapeFilePath(lname.left(lname.size()-Option::libtool_ext.size()))
<< ".a'\n\n";
t << "# Libraries that this one depends upon.\n";

View File

@ -574,7 +574,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
{
if (tool.SingleProjects.count() == 0) {
if (tool.SingleProjects.size() == 0) {
warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output");
return;
}
@ -589,7 +589,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< tag("ItemGroup")
<< attrTag("Label", "ProjectConfigurations");
for (int i = 0; i < tool.SingleProjects.count(); ++i) {
for (int i = 0; i < tool.SingleProjects.size(); ++i) {
xml << tag("ProjectConfiguration")
<< attrTag("Include" , tool.SingleProjects.at(i).Configuration.Name)
<< tagValue("Configuration", tool.SingleProjects.at(i).Configuration.ConfigurationName)
@ -613,7 +613,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
// config part.
xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props");
for (int i = 0; i < tool.SingleProjects.count(); ++i)
for (int i = 0; i < tool.SingleProjects.size(); ++i)
write(xml, tool.SingleProjects.at(i).Configuration);
xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props");
@ -623,7 +623,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< closetag();
// PropertySheets
for (int i = 0; i < tool.SingleProjects.count(); ++i) {
for (int i = 0; i < tool.SingleProjects.size(); ++i) {
xml << tag("ImportGroup")
<< attrTag("Condition", generateCondition(tool.SingleProjects.at(i).Configuration))
<< attrTag("Label", "PropertySheets");
@ -641,7 +641,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< closetag();
xml << tag("PropertyGroup");
for (int i = 0; i < tool.SingleProjects.count(); ++i) {
for (int i = 0; i < tool.SingleProjects.size(); ++i) {
const VCConfiguration &config = tool.SingleProjects.at(i).Configuration;
const QString condition = generateCondition(config);
@ -708,7 +708,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
}
xml << closetag();
for (int i = 0; i < tool.SingleProjects.count(); ++i) {
for (int i = 0; i < tool.SingleProjects.size(); ++i) {
const VCConfiguration &config = tool.SingleProjects.at(i).Configuration;
xml << tag("ItemDefinitionGroup")
@ -1737,7 +1737,7 @@ void VCXProjectWriter::addFilters(VCProject &project, XmlOutput &xmlFilter, cons
{
bool added = false;
for (int i = 0; i < project.SingleProjects.count(); ++i) {
for (int i = 0; i < project.SingleProjects.size(); ++i) {
const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername);
if(!filter.Files.isEmpty() && !added) {
xmlFilter << tag("Filter")
@ -1759,10 +1759,10 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu
else
root.reset(new XTreeNode);
for (int i = 0; i < project.SingleProjects.count(); ++i) {
for (int i = 0; i < project.SingleProjects.size(); ++i) {
const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername);
// Merge all files in this filter to root tree
for (int x = 0; x < filter.Files.count(); ++x)
for (int x = 0; x < filter.Files.size(); ++x)
root->addElement(filter.Files.at(x));
}
@ -1789,8 +1789,8 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml
// We need to check if the file has any custom build step.
// If there is one then it has to be included with "CustomBuild Include"
bool hasCustomBuildStep = false;
QVarLengthArray<OutputFilterData> data(project.SingleProjects.count());
for (int i = 0; i < project.SingleProjects.count(); ++i) {
QVarLengthArray<OutputFilterData> data(project.SingleProjects.size());
for (int i = 0; i < project.SingleProjects.size(); ++i) {
data[i].filter = project.SingleProjects.at(i).filterByName(cleanFilterName);
if (!data[i].filter.Config) // only if the filter is not empty
continue;
@ -1812,7 +1812,7 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml
}
bool fileAdded = false;
for (int i = 0; i < project.SingleProjects.count(); ++i) {
for (int i = 0; i < project.SingleProjects.size(); ++i) {
OutputFilterData *d = &data[i];
if (!d->filter.Config) // only if the filter is not empty
continue;

View File

@ -290,7 +290,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
for (int y = 0; directories[y]; y++) {
QString dirTemp = project->first(directories[y]).toQString();
if (dirTemp.endsWith("\\"))
dirTemp.truncate(dirTemp.length()-1);
dirTemp.truncate(dirTemp.size()-1);
if(!dirTemp.isEmpty())
source_directories.insert(dirTemp);
}

View File

@ -2304,7 +2304,7 @@ void VCFilter::modifyPCHstage(QString str)
VCFilterFile VCFilter::findFile(const QString &filePath, bool *found) const
{
for (int i = 0; i < Files.count(); ++i) {
for (int i = 0; i < Files.size(); ++i) {
const VCFilterFile &f = Files.at(i);
if (f.file == filePath) {
*found = true;
@ -2330,7 +2330,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile);
// Remove the fake file suffix we've added initially to generate correct command lines.
inFile.chop(Project->customBuildToolFilterFileSuffix.length());
inFile.chop(Project->customBuildToolFilterFileSuffix.size());
// qDebug("*** Extra compiler file has object mapped file '%s' => '%s'", qPrintable(inFile), qPrintable(objectMappedFile.join(' ')));
}
@ -2595,7 +2595,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
void VCProjectWriter::write(XmlOutput &xml, VCProject &tool)
{
if (tool.SingleProjects.count() == 0) {
if (tool.SingleProjects.size() == 0) {
warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output");
return;
}
@ -2615,7 +2615,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< closetag(_Platforms)
<< tag(_Configurations);
// Output each configuration
for (int i = 0; i < tool.SingleProjects.count(); ++i)
for (int i = 0; i < tool.SingleProjects.size(); ++i)
write(xml, tool.SingleProjects.at(i).Configuration);
xml << closetag(_Configurations)
<< tag(q_Files);
@ -2930,7 +2930,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool)
void VCProjectWriter::write(XmlOutput &xml, VCFilter &tool)
{
if(!tool.Files.count())
if(!tool.Files.size())
return;
if (!tool.Name.isEmpty()) {
@ -2940,7 +2940,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCFilter &tool)
<< attrS(_UniqueIdentifier, tool.Guid)
<< attrT(_ParseFiles, tool.ParseFiles);
}
for (int i = 0; i < tool.Files.count(); ++i) {
for (int i = 0; i < tool.Files.size(); ++i) {
const VCFilterFile &info = tool.Files.at(i);
xml << tag(q_File)
<< attrS(_RelativePath, Option::fixPathToTargetOS(info.file))
@ -2964,11 +2964,11 @@ void VCProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, const QSt
QString name, extfilter, guid;
triState parse = unset;
for (int i = 0; i < project.SingleProjects.count(); ++i) {
for (int i = 0; i < project.SingleProjects.size(); ++i) {
const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername);
// Merge all files in this filter to root tree
for (int x = 0; x < filter.Files.count(); ++x)
for (int x = 0; x < filter.Files.size(); ++x)
root->addElement(filter.Files.at(x));
// Save filter setting from first filter. Next filters
@ -3003,7 +3003,7 @@ void VCProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, cons
{
xml << tag(q_File)
<< attrS(_RelativePath, Option::fixPathToTargetOS(info.file));
for (int i = 0; i < project.SingleProjects.count(); ++i) {
for (int i = 0; i < project.SingleProjects.size(); ++i) {
VCFilter filter = project.SingleProjects.at(i).filterByName(filtername);
if (filter.Config) // only if the filter is not empty
outputFileConfig(filter, xml, info.file);

View File

@ -142,14 +142,14 @@ bool VcprojGenerator::writeProjectMakefile()
// Generate project file
if(project->first("TEMPLATE") == "vcapp" ||
project->first("TEMPLATE") == "vclib") {
if (!mergedProjects.count()) {
if (!mergedProjects.size()) {
warn_msg(WarnLogic, "Generator: MSVC.NET: no single configuration created, cannot output project!");
return false;
}
debug_msg(1, "Generator: MSVC.NET: Writing project file");
VCProject mergedProject;
for (int i = 0; i < mergedProjects.count(); ++i) {
for (int i = 0; i < mergedProjects.size(); ++i) {
VCProjectSingleConfig *singleProject = &(mergedProjects.at(i)->vcProject);
mergedProject.SingleProjects += *singleProject;
for (int j = 0; j < singleProject->ExtraCompilersFiles.count(); ++j) {
@ -159,7 +159,7 @@ bool VcprojGenerator::writeProjectMakefile()
}
}
if(mergedProjects.count() > 1 &&
if(mergedProjects.size() > 1 &&
mergedProjects.at(0)->vcProject.Name ==
mergedProjects.at(1)->vcProject.Name)
mergedProjects.at(0)->writePrlFile();
@ -418,7 +418,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
newDep->uuid = tmp_proj.isEmpty("QMAKE_UUID") ? getProjectUUID(Option::fixPathToLocalOS(vcprojDir + QDir::separator() + vcproj)).toString().toUpper(): tmp_proj.first("QMAKE_UUID").toQString();
// We want to store it as the .lib name.
if (newDep->target.endsWith(".dll"))
newDep->target = newDep->target.left(newDep->target.length()-3) + "lib";
newDep->target = newDep->target.left(newDep->target.size()-3) + "lib";
projGuids.insert(newDep->projectName, newDep->target);
if (tmpList.size()) {
@ -1213,7 +1213,7 @@ void VcprojGenerator::initDeploymentTool()
continue;
// We want to deploy .dlls not .libs
if (dllName.endsWith(QLatin1String(".lib")))
dllName.replace(dllName.length() - 3, 3, QLatin1String("dll"));
dllName.replace(dllName.size() - 3, 3, QLatin1String("dll"));
// Use only the file name and check in Qt's install path and LIBPATHs to check for existence
dllName.remove(0, dllName.lastIndexOf(QLatin1Char('/')) + 1);
QFileInfo info;

View File

@ -479,8 +479,8 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
const int commandlineLimit = 2047; // NT limit, expanded
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
file = ' ' + escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
if(del_statement.length() + files.length() +
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
if(del_statement.size() + files.size() +
qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) {
t << "\n\t" << del_statement << files;
files.clear();
}
@ -508,8 +508,8 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
const int commandlineLimit = 2047; // NT limit, expanded
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
file = " " + escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
if(del_statement.length() + files.length() +
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
if(del_statement.size() + files.size() +
qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) {
t << "\n\t" << del_statement << files;
files.clear();
}
@ -749,7 +749,7 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
QString dst_prl = Option::fixPathToTargetOS(project->first("QMAKE_INTERNAL_PRL_FILE").toQString());
int slsh = dst_prl.lastIndexOf(Option::dir_sep);
if(slsh != -1)
dst_prl = dst_prl.right(dst_prl.length() - slsh - 1);
dst_prl = dst_prl.right(dst_prl.size() - slsh - 1);
dst_prl = filePrefixRoot(root, targetdir + dst_prl);
if (!ret.isEmpty())
ret += "\n\t";

View File

@ -240,9 +240,9 @@ void XmlOutput::closeTag()
{
switch(currentState) {
case Bare:
if (tagStack.count())
if (tagStack.size())
//warn_msg(WarnLogic, "<Root>: Cannot close tag in Bare state, %d tags on stack", tagStack.count());
qDebug("<Root>: Cannot close tag in Bare state, %d tags on stack", int(tagStack.count()));
qDebug("<Root>: Cannot close tag in Bare state, %d tags on stack", int(tagStack.size()));
else
//warn_msg(WarnLogic, "<Root>: Cannot close tag, no tags on stack");
qDebug("<Root>: Cannot close tag, no tags on stack");
@ -271,7 +271,7 @@ void XmlOutput::closeTo(const QString &tag)
qDebug("<%s>: Cannot close to tag <%s>, not on stack", tagStack.last().toLatin1().constData(), tag.toLatin1().constData());
return;
}
int left = tagStack.count();
int left = tagStack.size();
while (left-- && cont) {
cont = tagStack.last().compare(tag) != 0;
closeTag();
@ -280,7 +280,7 @@ void XmlOutput::closeTo(const QString &tag)
void XmlOutput::closeAll()
{
if (!tagStack.count())
if (!tagStack.size())
return;
closeTo(QString());
}
@ -315,7 +315,7 @@ void XmlOutput::addAttribute(const QString &attribute, const QString &value)
case Tag:
//warn_msg(WarnLogic, "<%s>: Cannot add attribute since tags not open", tagStack.last().toLatin1().constData());
qDebug("<%s>: Cannot add attribute (%s) since tag's not open",
(tagStack.count() ? tagStack.last().toLatin1().constData() : "Root"),
(tagStack.size() ? tagStack.last().toLatin1().constData() : "Root"),
attribute.toLatin1().constData());
return;
case Attribute:
@ -333,7 +333,7 @@ void XmlOutput::addAttributeTag(const QString &attribute, const QString &value)
case Tag:
//warn_msg(WarnLogic, "<%s>: Cannot add attribute since tags not open", tagStack.last().toLatin1().constData());
qDebug("<%s>: Cannot add attribute (%s) since tag's not open",
(tagStack.count() ? tagStack.last().toLatin1().constData() : "Root"),
(tagStack.size() ? tagStack.last().toLatin1().constData() : "Root"),
attribute.toLatin1().constData());
return;
case Attribute:

View File

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

View File

@ -40,13 +40,13 @@ ProString::ProString(const ProString &other, OmitPreHashing) :
}
ProString::ProString(const QString &str, DoPreHashing) :
m_string(str), m_offset(0), m_length(str.length()), m_file(0)
m_string(str), m_offset(0), m_length(str.size()), m_file(0)
{
updatedHash();
}
ProString::ProString(const QString &str) :
m_string(str), m_offset(0), m_length(str.length()), m_file(0), m_hash(0x80000000)
m_string(str), m_offset(0), m_length(str.size()), m_file(0), m_hash(0x80000000)
{
}
@ -84,7 +84,7 @@ ProString::ProString(const QString &str, int offset, int length) :
void ProString::setValue(const QString &str)
{
m_string = str, m_offset = 0, m_length = str.length(), m_hash = 0x80000000;
m_string = str, m_offset = 0, m_length = str.size(), m_hash = 0x80000000;
}
size_t ProString::updatedHash() const
@ -121,7 +121,7 @@ ProKey::ProKey(const QString &str, int off, int len, uint hash) :
void ProKey::setValue(const QString &str)
{
m_string = str, m_offset = 0, m_length = str.length();
m_string = str, m_offset = 0, m_length = str.size();
updatedHash();
}
@ -144,7 +144,7 @@ ProString &ProString::prepend(const ProString &other)
} else {
m_string = other.toQStringView() + toQStringView();
m_offset = 0;
m_length = m_string.length();
m_length = m_string.size();
if (!m_file)
m_file = other.m_file;
m_hash = 0x80000000;
@ -156,10 +156,10 @@ ProString &ProString::prepend(const ProString &other)
ProString &ProString::append(const QLatin1String other)
{
if (other.size()) {
if (m_length != m_string.length()) {
if (m_length != m_string.size()) {
m_string = toQStringView() + other;
m_offset = 0;
m_length = m_string.length();
m_length = m_string.size();
} else {
Q_ASSERT(m_offset == 0);
m_string.append(other);
@ -172,10 +172,10 @@ ProString &ProString::append(const QLatin1String other)
ProString &ProString::append(QChar other)
{
if (m_length != m_string.length()) {
if (m_length != m_string.size()) {
m_string = toQStringView() + other;
m_offset = 0;
m_length = m_string.length();
m_length = m_string.size();
} else {
Q_ASSERT(m_offset == 0);
m_string.append(other);
@ -192,14 +192,14 @@ ProString &ProString::append(const ProString &other, bool *pending)
if (!m_length) {
*this = other;
} else {
if (m_length != m_string.length())
if (m_length != m_string.size())
m_string = toQString();
if (pending && !*pending) {
m_string += QLatin1Char(' ') + other.toQStringView();
} else {
m_string += other.toQStringView();
}
m_length = m_string.length();
m_length = m_string.size();
m_offset = 0;
if (other.m_file)
m_file = other.m_file;
@ -242,7 +242,7 @@ ProString &ProString::append(const ProStringList &other, bool *pending, bool ski
const ProString &str = other.at(i);
m_string += str.toQStringView();
}
m_length = m_string.length();
m_length = m_string.size();
if (other.last().m_file)
m_file = other.last().m_file;
m_hash = 0x80000000;

View File

@ -687,7 +687,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
outstr = QLatin1Char(' ');
}
QString numstr = QString::number(num, obase);
int space = width - outstr.length() - numstr.length();
int space = width - outstr.size() - numstr.size();
if (space <= 0) {
outstr += numstr;
} else if (leftalign) {
@ -936,7 +936,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
for (int i = 0; i < args.size(); ++i) {
QString str = args.at(i).toQString();
QChar *i_data = str.data();
int i_len = str.length();
int i_len = str.size();
for (int x = 0; x < i_len; ++x) {
if (*(i_data+x) == QLatin1Char('\\') && x < i_len-1) {
if (*(i_data+x+1) == QLatin1Char('\\')) {
@ -988,7 +988,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
rstr = rstr.toUpper();
} else {
rstr = rstr.toLower();
if (func_t == E_TITLE && rstr.length() > 0)
if (func_t == E_TITLE && rstr.size() > 0)
rstr[0] = rstr.at(0).toTitleCase();
}
ret << u1.extract(rstr);
@ -1569,7 +1569,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
const ProStringList &configs = values(statics.strCONFIG);
for (int i = configs.size() - 1; i >= 0; i--) {
for (int mut = 0; mut < mutuals.count(); mut++) {
for (int mut = 0; mut < mutuals.size(); mut++) {
if (configs[i].toQStringView() == mutuals[mut].trimmed())
return returnBool(configs[i] == args[0]);
}
@ -1605,7 +1605,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
Qt::SkipEmptyParts);
for (int i = l.size() - 1; i >= 0; i--) {
const ProString &val = l[i];
for (int mut = 0; mut < mutuals.count(); mut++) {
for (int mut = 0; mut < mutuals.size(); mut++) {
if (val.toQStringView() == mutuals[mut].trimmed()) {
if (val == qry)
return ReturnTrue;

View File

@ -859,13 +859,13 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
}
QChar sep = val.at(1);
auto func = val.split(sep, Qt::KeepEmptyParts);
if (func.count() < 3 || func.count() > 4) {
if (func.size() < 3 || func.size() > 4) {
evalError(fL1S("The s/// function expects 3 or 4 arguments."));
return ReturnTrue;
}
bool global = false, quote = false, case_sense = false;
if (func.count() == 4) {
if (func.size() == 4) {
global = func[3].indexOf(QLatin1Char('g')) != -1;
case_sense = func[3].indexOf(QLatin1Char('i')) == -1;
quote = func[3].indexOf(QLatin1Char('q')) != -1;
@ -1570,7 +1570,7 @@ ProString QMakeEvaluator::propertyValue(const ProKey &name) const
ProFile *QMakeEvaluator::currentProFile() const
{
if (m_profileStack.count() > 0)
if (m_profileStack.size() > 0)
return m_profileStack.top();
return nullptr;
}
@ -1693,12 +1693,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFunction(
m_locationStack.push(m_current);
ProStringList args;
for (int i = 0; i < argumentsList.count(); ++i) {
for (int i = 0; i < argumentsList.size(); ++i) {
args += argumentsList[i];
m_valuemapStack.top()[ProKey(QString::number(i+1))] = argumentsList[i];
}
m_valuemapStack.top()[statics.strARGS] = args;
m_valuemapStack.top()[statics.strARGC] = ProStringList(ProString(QString::number(argumentsList.count())));
m_valuemapStack.top()[statics.strARGC] = ProStringList(ProString(QString::number(argumentsList.size())));
vr = visitProBlock(func.pro(), func.tokPtr());
if (vr == ReturnReturn)
vr = ReturnTrue;

View File

@ -213,8 +213,8 @@ void QMakeGlobals::setDirectories(const QString &input_dir, const QString &outpu
QString dstpath = output_dir;
if (!dstpath.endsWith(QLatin1Char('/')))
dstpath += QLatin1Char('/');
int srcLen = srcpath.length();
int dstLen = dstpath.length();
int srcLen = srcpath.size();
int dstLen = dstpath.size();
int lastSl = -1;
while (++lastSl, --srcLen, --dstLen,
srcLen && dstLen && srcpath.at(srcLen) == dstpath.at(dstLen))
@ -230,9 +230,9 @@ QString QMakeGlobals::shadowedPath(const QString &fileName) const
if (source_root.isEmpty())
return fileName;
if (fileName.startsWith(source_root)
&& (fileName.length() == source_root.length()
|| fileName.at(source_root.length()) == QLatin1Char('/'))) {
return build_root + fileName.mid(source_root.length());
&& (fileName.size() == source_root.size()
|| fileName.at(source_root.size()) == QLatin1Char('/'))) {
return build_root + fileName.mid(source_root.size());
}
return QString();
}
@ -272,7 +272,7 @@ QString QMakeGlobals::expandEnvVars(const QString &str) const
startIndex = string.indexOf(QLatin1Char('$'), startIndex);
if (startIndex < 0)
break;
if (string.length() < startIndex + 3)
if (string.size() < startIndex + 3)
break;
if (string.at(startIndex + 1) != QLatin1Char('(')) {
startIndex++;
@ -283,7 +283,7 @@ QString QMakeGlobals::expandEnvVars(const QString &str) const
break;
QString value = getEnv(string.mid(startIndex + 2, endIndex - startIndex - 2));
string.replace(startIndex, endIndex - startIndex + 1, value);
startIndex += value.length();
startIndex += value.size();
}
return string;
}

View File

@ -732,7 +732,7 @@ void QMakeParser::read(ProFile *pro, QStringView in, int line, SubGrammar gramma
if (!m_blockstack.top().braceLevel) {
parseError(fL1S("Excess closing brace."));
} else if (!--m_blockstack.top().braceLevel
&& m_blockstack.count() != 1) {
&& m_blockstack.size() != 1) {
leaveScope(tokPtr);
m_state = StNew;
m_canElse = false;
@ -1246,7 +1246,7 @@ bool QMakeParser::resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort
// The string is typically longer than the variable reference, so we need
// to ensure that there is enough space in the output buffer - as unlikely
// as an overflow is to actually happen in practice.
int need = (in.length() - (cur - (const ushort *)in.constData()) + 2) * 5 + out.length();
int need = (in.length() - (cur - (const ushort *)in.constData()) + 2) * 5 + out.size();
int tused = *tokPtr - (ushort *)tokBuff->constData();
int xused;
int total;
@ -1277,9 +1277,9 @@ bool QMakeParser::resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort
}
xprPtr -= 2; // Was set up for variable reference
xprPtr[-2] = TokLiteral | needSep;
xprPtr[-1] = out.length();
memcpy(xprPtr, out.constData(), out.length() * 2);
*ptr = xprPtr + out.length();
xprPtr[-1] = out.size();
memcpy(xprPtr, out.constData(), out.size() * 2);
*ptr = xprPtr + out.size();
return true;
}
@ -1539,7 +1539,7 @@ QString QMakeParser::formatProBlock(const QString &block)
QString outStr;
outStr += fL1S("\n << TS(");
int offset = 0;
getBlock(reinterpret_cast<const ushort *>(block.constData()), block.length(),
getBlock(reinterpret_cast<const ushort *>(block.constData()), block.size(),
offset, &outStr, 0);
outStr += QLatin1Char(')');
return outStr;

View File

@ -479,7 +479,7 @@ int runQMake(int argc, char **argv)
Option::output_dir = dir.path();
QString absoluteFilePath = QDir::cleanPath(fi.absoluteFilePath());
Option::output.setFileName(absoluteFilePath.mid(Option::output_dir.length() + 1));
Option::output.setFileName(absoluteFilePath.mid(Option::output_dir.size() + 1));
}
QMakeProperty prop;
@ -531,7 +531,7 @@ int runQMake(int argc, char **argv)
if(!qmake_setpwd(fn.left(di)))
fprintf(stderr, "Cannot find directory: %s\n",
QDir::toNativeSeparators(fn.left(di)).toLatin1().constData());
fn = fn.right(fn.length() - di - 1);
fn = fn.right(fn.size() - di - 1);
}
Option::prepareProject(fn);

View File

@ -77,7 +77,7 @@ static Option::QMAKE_MODE default_mode(QString progname)
{
int s = progname.lastIndexOf(QDir::separator());
if(s != -1)
progname = progname.right(progname.length() - (s + 1));
progname = progname.right(progname.size() - (s + 1));
if(progname == "qmakegen")
return Option::QMAKE_GENERATE_PROJECT;
else if(progname == "qt-config")
@ -465,7 +465,7 @@ bool Option::postProcessProject(QMakeProject *project)
if (!project->buildRoot().isEmpty() && Option::output_dir.startsWith(project->buildRoot()))
Option::mkfile::cachefile_depth =
Option::output_dir.mid(project->buildRoot().length()).count('/');
Option::output_dir.mid(project->buildRoot().size()).count('/');
return true;
}
@ -528,7 +528,7 @@ Option::fixString(QString string, uchar flags)
if ((string.startsWith("\"") && string.endsWith("\"")) ||
(string.startsWith("\'") && string.endsWith("\'")))
string = string.mid(1, string.length()-2);
string = string.mid(1, string.size()-2);
//cache
//qDebug() << "Fix" << orig_string << "->" << string;

View File

@ -10,7 +10,7 @@ QT_BEGIN_NAMESPACE
void qmakePropertyPrinter(const QList<QPair<QString, QString>> &values)
{
// Assume single property request
if (values.count() == 1) {
if (values.size() == 1) {
std::cout << qPrintable(values.at(0).second) << std::endl;
return;
}

View File

@ -76,7 +76,7 @@ void QMakeLibraryInfo::sysrootify(QString &path)
if (sysroot.isEmpty())
return;
if (path.length() > 2 && path.at(1) == QLatin1Char(':')
if (path.size() > 2 && path.at(1) == QLatin1Char(':')
&& (path.at(2) == QLatin1Char('/') || path.at(2) == QLatin1Char('\\'))) {
path.replace(0, 2, sysroot); // Strip out the drive on Windows targets
} else {
@ -217,7 +217,7 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group
startIndex = ret.indexOf(QLatin1Char('$'), startIndex);
if (startIndex < 0)
break;
if (ret.length() < startIndex + 3)
if (ret.size() < startIndex + 3)
break;
if (ret.at(startIndex + 1) != QLatin1Char('(')) {
startIndex++;
@ -231,7 +231,7 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group
QString value =
QString::fromLocal8Bit(qgetenv(envVarName.toLocal8Bit().constData()));
ret.replace(startIndex, endIndex - startIndex + 1, value);
startIndex += value.length();
startIndex += value.size();
}
config->endGroup();

View File

@ -65,7 +65,7 @@ public:
void reserveSpace(int resultCount)
{
currentResultCount = resultCount;
resizeList(qMax(resultCount, vector.count()));
resizeList(qMax(resultCount, vector.size()));
}
void reportResults(int begin)

View File

@ -283,7 +283,7 @@ void QUnifiedTimer::updateAnimationTimers()
QScopedValueRollback<bool> guard(insideTick, true);
if (profilerCallback)
profilerCallback(delta);
for (currentAnimationIdx = 0; currentAnimationIdx < animationTimers.count(); ++currentAnimationIdx) {
for (currentAnimationIdx = 0; currentAnimationIdx < animationTimers.size(); ++currentAnimationIdx) {
QAbstractAnimationTimer *animation = animationTimers.at(currentAnimationIdx);
animation->updateAnimationsTime(delta);
}
@ -294,7 +294,7 @@ void QUnifiedTimer::updateAnimationTimers()
int QUnifiedTimer::runningAnimationCount()
{
int count = 0;
for (int i = 0; i < animationTimers.count(); ++i)
for (int i = 0; i < animationTimers.size(); ++i)
count += animationTimers.at(i)->runningAnimationCount();
return count;
}
@ -309,7 +309,7 @@ void QUnifiedTimer::localRestart()
if (insideRestart)
return;
if (!pausedAnimationTimers.isEmpty() && (animationTimers.count() + animationTimersToStart.count() == pausedAnimationTimers.count())) {
if (!pausedAnimationTimers.isEmpty() && (animationTimers.size() + animationTimersToStart.size() == pausedAnimationTimers.size())) {
driver->stop();
int closestTimeToFinish = closestPausedAnimationTimerTimeToFinish();
// use a precise timer if the pause will be short
@ -327,7 +327,7 @@ void QUnifiedTimer::restart()
{
{
QScopedValueRollback<bool> guard(insideRestart, true);
for (int i = 0; i < animationTimers.count(); ++i)
for (int i = 0; i < animationTimers.size(); ++i)
animationTimers.at(i)->restartAnimationTimer();
}
@ -568,7 +568,7 @@ void QAnimationTimer::updateAnimationsTime(qint64 delta)
//when the CPU load is high
if (delta) {
QScopedValueRollback<bool> guard(insideTick, true);
for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) {
for (currentAnimationIdx = 0; currentAnimationIdx < animations.size(); ++currentAnimationIdx) {
QAbstractAnimation *animation = animations.at(currentAnimationIdx);
int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime
+ (animation->direction() == QAbstractAnimation::Forward ? delta : -delta);

View File

@ -247,7 +247,7 @@ public:
void updateAnimationsTime(qint64 delta) override;
//useful for profiling/debugging
int runningAnimationCount() override { return animations.count(); }
int runningAnimationCount() override { return animations.size(); }
private Q_SLOTS:
void startAnimations();

View File

@ -138,7 +138,7 @@ int QAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const
void QAnimationGroup::addAnimation(QAbstractAnimation *animation)
{
Q_D(QAnimationGroup);
insertAnimation(d->animations.count(), animation);
insertAnimation(d->animations.size(), animation);
}
/*!
@ -261,7 +261,7 @@ void QAnimationGroupPrivate::clear(bool onDestruction)
const QList<QAbstractAnimation *> animationsCopy = animations; // taking a copy
animations.clear();
// Clearing backwards so the indices doesn't change while we remove animations.
for (int i = animationsCopy.count() - 1; i >= 0; --i) {
for (int i = animationsCopy.size() - 1; i >= 0; --i) {
QAbstractAnimation *animation = animationsCopy.at(i);
animation->setParent(nullptr);
QAbstractAnimationPrivate::get(animation)->group = nullptr;

View File

@ -172,7 +172,7 @@ void QSequentialAnimationGroupPrivate::rewindForwards(const AnimationIndex &newA
// we need to force activation because setCurrentAnimation will have no effect
activateCurrentAnimation();
else
setCurrentAnimation(animations.count() - 1, true);
setCurrentAnimation(animations.size() - 1, true);
}
// and now we need to fast rewind from the current position to
@ -396,7 +396,7 @@ void QSequentialAnimationGroupPrivate::setCurrentAnimation(int index, bool inter
// currentAnimation.removeBindingUnlessInWrapper()
// is not necessary here, since it is read only
index = qMin(index, animations.count() - 1);
index = qMin(index, animations.size() - 1);
if (index == -1) {
Q_ASSERT(animations.isEmpty());
@ -517,7 +517,7 @@ void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnim
disconnectUncontrolledAnimation(currentAnimation);
if (index < animations.count())
if (index < animations.size())
setCurrentAnimation(index); //let's try to take the next one
else if (index > 0)
setCurrentAnimation(index - 1);

View File

@ -547,7 +547,7 @@ QString QLibraryInfoPrivate::path(QLibraryInfo::LibraryPath p, UsageMode usageMo
startIndex = ret.indexOf(u'$', startIndex);
if (startIndex < 0)
break;
if (ret.length() < startIndex + 3)
if (ret.size() < startIndex + 3)
break;
if (ret.at(startIndex + 1) != u'(') {
startIndex++;
@ -559,7 +559,7 @@ QString QLibraryInfoPrivate::path(QLibraryInfo::LibraryPath p, UsageMode usageMo
auto envVarName = QStringView{ret}.mid(startIndex + 2, endIndex - startIndex - 2);
QString value = QString::fromLocal8Bit(qgetenv(envVarName.toLocal8Bit().constData()));
ret.replace(startIndex, endIndex - startIndex + 1, value);
startIndex += value.length();
startIndex += value.size();
}
config->endGroup();

View File

@ -1183,7 +1183,7 @@ void QMessagePattern::setPattern(const QString &pattern)
tokens[i] = timeTokenC;
int spaceIdx = lexeme.indexOf(QChar::fromLatin1(' '));
if (spaceIdx > 0)
timeArgs.append(lexeme.mid(spaceIdx + 1, lexeme.length() - spaceIdx - 2));
timeArgs.append(lexeme.mid(spaceIdx + 1, lexeme.size() - spaceIdx - 2));
else
timeArgs.append(QString());
} else if (lexeme.startsWith(QLatin1StringView(backtraceTokenC))) {

View File

@ -276,19 +276,19 @@ static bool readEtcFile(QUnixOSVersion &v, const char *filename,
line.setRawData(ptr, eol - ptr);
if (line.startsWith(idKey)) {
ptr += idKey.length();
ptr += idKey.size();
v.productType = unquote(ptr, eol);
continue;
}
if (line.startsWith(prettyNameKey)) {
ptr += prettyNameKey.length();
ptr += prettyNameKey.size();
v.prettyName = unquote(ptr, eol);
continue;
}
if (line.startsWith(versionKey)) {
ptr += versionKey.length();
ptr += versionKey.size();
v.productVersion = unquote(ptr, eol);
continue;
}
@ -325,7 +325,7 @@ static bool readEtcLsbRelease(QUnixOSVersion &v)
int fd = qt_safe_open(distrorelease, O_RDONLY);
if (fd != -1) {
QT_STATBUF sbuf;
if (QT_FSTAT(fd, &sbuf) != -1 && sbuf.st_size > v.prettyName.length()) {
if (QT_FSTAT(fd, &sbuf) != -1 && sbuf.st_size > v.prettyName.size()) {
// file apparently contains interesting information
QByteArray buffer(sbuf.st_size, Qt::Uninitialized);
buffer.resize(qt_safe_read(fd, buffer.data(), sbuf.st_size));

View File

@ -112,7 +112,7 @@ public:
inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(const char* t) { stream->ts << QString::fromUtf8(t); return maybeSpace(); }
inline QDebug &operator<<(const char16_t *t) { stream->ts << QStringView(t); return maybeSpace(); }
inline QDebug &operator<<(const QString & t) { putString(t.constData(), size_t(t.length())); return maybeSpace(); }
inline QDebug &operator<<(const QString & t) { putString(t.constData(), size_t(t.size())); return maybeSpace(); }
inline QDebug &operator<<(QStringView s) { putString(s.data(), size_t(s.size())); return maybeSpace(); }
inline QDebug &operator<<(QUtf8StringView s) { putByteArray(reinterpret_cast<const char*>(s.data()), s.size(), ContainsBinary); return maybeSpace(); }
inline QDebug &operator<<(QLatin1StringView t) { putByteArray(t.latin1(), t.size(), ContainsLatin1); return maybeSpace(); }

View File

@ -144,12 +144,12 @@ inline void QDirPrivate::setPath(const QString &path)
{
QString p = QDir::fromNativeSeparators(path);
if (p.endsWith(u'/')
&& p.length() > 1
&& p.size() > 1
#if defined(Q_OS_WIN)
&& (!(p.length() == 3 && p.at(1).unicode() == ':' && p.at(0).isLetter()))
#endif
) {
p.truncate(p.length() - 1);
p.truncate(p.size() - 1);
}
dirEntry = QFileSystemEntry(p, QFileSystemEntry::FromInternalPath());
@ -1052,7 +1052,7 @@ Q_GLOBAL_STATIC(DirSearchPaths, dirSearchPaths)
*/
void QDir::setSearchPaths(const QString &prefix, const QStringList &searchPaths)
{
if (prefix.length() < 2) {
if (prefix.size() < 2) {
qWarning("QDir::setSearchPaths: Prefix must be longer than 1 character");
return;
}
@ -2303,7 +2303,7 @@ static QString qt_cleanPath(const QString &path, bool *ok)
QString ret = qt_normalizePathSegments(name, OSSupportsUncPaths ? QDirPrivate::AllowUncPaths : QDirPrivate::DefaultNormalization, ok);
// Strip away last slash except for root directories
if (ret.length() > 1 && ret.endsWith(u'/')) {
if (ret.size() > 1 && ret.endsWith(u'/')) {
#if defined (Q_OS_WIN)
if (!(ret.length() == 3 && ret.at(1) == u':'))
#endif

View File

@ -591,7 +591,7 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link,
Q_CHECK_FILE_NAME(link, link);
QByteArray s = qt_readlink(link.nativeFilePath().constData());
if (s.length() > 0) {
if (s.size() > 0) {
QString ret;
if (!data.hasFlags(QFileSystemMetaData::DirectoryType))
fillMetaData(link, data, QFileSystemMetaData::DirectoryType);
@ -713,13 +713,13 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
QFileSystemEntry cur(currentPath());
result = cur.nativeFilePath();
}
if (!orig.isEmpty() && !(orig.length() == 1 && orig[0] == '.')) {
if (!orig.isEmpty() && !(orig.size() == 1 && orig[0] == '.')) {
if (!result.isEmpty() && !result.endsWith('/'))
result.append('/');
result.append(orig);
}
if (result.length() == 1 && result[0] == '/')
if (result.size() == 1 && result[0] == '/')
return QFileSystemEntry(result, QFileSystemEntry::FromNativePath());
const bool isDir = result.endsWith('/');
@ -1152,7 +1152,7 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo
if (removeEmptyParents) {
QString dirName = QDir::cleanPath(entry.filePath());
for (int oldslash = 0, slash=dirName.length(); slash > 0; oldslash = slash) {
for (int oldslash = 0, slash=dirName.size(); slash > 0; oldslash = slash) {
const QByteArray chunk = QFile::encodeName(dirName.left(slash));
QT_STATBUF st;
if (QT_STAT(chunk.constData(), &st) != -1) {

View File

@ -468,7 +468,7 @@ void QFSFileEnginePrivate::unmapAll()
{
if (!maps.isEmpty()) {
const QList<uchar*> keys = maps.keys(); // Make a copy since unmap() modifies the map.
for (int i = 0; i < keys.count(); ++i)
for (int i = 0; i < keys.size(); ++i)
unmap(keys.at(i));
}
}

View File

@ -779,7 +779,7 @@ int QResourceRoot::findNode(const QString &_path, const QLocale &locale) const
if (!root.endsWith(u'/'))
root += u'/';
if (path.size() >= root.size() && path.startsWith(root))
path = path.mid(root.length() - 1);
path = path.mid(root.size() - 1);
if (path.isEmpty())
path = u'/';
}

View File

@ -356,7 +356,7 @@ QVariant QSettingsPrivate::stringListToVariantList(const QStringList &l)
const QString &str = outStringList.at(i);
if (str.startsWith(u'@')) {
if (str.length() < 2 || str.at(1) != u'@') {
if (str.size() < 2 || str.at(1) != u'@') {
QVariantList variantList;
variantList.reserve(l.count());
for (const auto &s : l)
@ -509,7 +509,7 @@ QVariant QSettingsPrivate::stringToVariant(const QString &s)
void QSettingsPrivate::iniEscapedKey(const QString &key, QByteArray &result)
{
result.reserve(result.length() + key.length() * 3 / 2);
result.reserve(result.size() + key.size() * 3 / 2);
for (qsizetype i = 0; i < key.size(); ++i) {
uint ch = key.at(i).unicode();
@ -538,7 +538,7 @@ bool QSettingsPrivate::iniUnescapedKey(QByteArrayView key, QString &result)
{
const QString decoded = QString::fromUtf8(key);
const qsizetype size = decoded.size();
result.reserve(result.length() + size);
result.reserve(result.size() + size);
qsizetype i = 0;
bool lowercaseOnly = true;
while (i < size) {
@ -731,7 +731,7 @@ StSkipSpaces:
// fallthrough
StNormal:
qsizetype chopLimit = stringResult.length();
qsizetype chopLimit = stringResult.size();
while (i < str.size()) {
switch (str.at(i)) {
case '\\':
@ -769,7 +769,7 @@ StNormal:
} else {
// the character is skipped
}
chopLimit = stringResult.length();
chopLimit = stringResult.size();
break;
case '"':
++i;
@ -856,7 +856,7 @@ end:
QStringList QSettingsPrivate::splitArgs(const QString &s, qsizetype idx)
{
qsizetype l = s.length();
qsizetype l = s.size();
Q_ASSERT(l > 0);
Q_ASSERT(s.at(idx) == u'(');
Q_ASSERT(s.at(l - 1) == u')');

View File

@ -269,7 +269,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
result = QDir::homePath() + value.mid(5);
else
result = value.toString();
if (result.length() > 1 && result.endsWith(u'/'))
if (result.size() > 1 && result.endsWith(u'/'))
result.chop(1);
}
}

View File

@ -711,8 +711,8 @@ void QStorageInfoPrivate::initRootPath()
const QString mountDir = it.rootPath();
const QByteArray fsName = it.fileSystemType();
// we try to find most suitable entry
if (isParentOf(mountDir, oldRootPath) && maxLength < mountDir.length()) {
maxLength = mountDir.length();
if (isParentOf(mountDir, oldRootPath) && maxLength < mountDir.size()) {
maxLength = mountDir.size();
rootPath = mountDir;
device = it.device();
fileSystemType = fsName;

View File

@ -45,7 +45,7 @@ QTemporaryFileName::QTemporaryFileName(const QString &templateName)
{
// Ensure there is a placeholder mask
QString qfilename = QDir::fromNativeSeparators(templateName);
uint phPos = qfilename.length();
uint phPos = qfilename.size();
uint phLength = 0;
while (phPos != 0) {

View File

@ -510,7 +510,7 @@ public:
ErrorCode validityError(QString *source = nullptr, qsizetype *position = nullptr) const;
bool validateComponent(Section section, const QString &input, qsizetype begin, qsizetype end);
bool validateComponent(Section section, const QString &input)
{ return validateComponent(section, input, 0, input.length()); }
{ return validateComponent(section, input, 0, input.size()); }
// no QString scheme() const;
void appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;
@ -1191,7 +1191,7 @@ static const QChar *parseIpFuture(QString &host, const QChar *begin, const QChar
// uppercase the version, if necessary
if (begin[2].unicode() >= 'a')
host[host.length() - 2] = QChar{begin[2].unicode() - 0x20};
host[host.size() - 2] = QChar{begin[2].unicode() - 0x20};
begin += 4;
--end;
@ -1341,7 +1341,7 @@ QUrlPrivate::setHost(const QString &value, qsizetype from, qsizetype iend, QUrl:
}
// recurse
return setHost(s, 0, s.length(), QUrl::StrictMode);
return setHost(s, 0, s.size(), QUrl::StrictMode);
}
s = qt_ACE_do(value.mid(from, iend - from), NormalizeAce, ForbidLeadingDot, {});
@ -1377,7 +1377,7 @@ inline void QUrlPrivate::parse(const QString &url, QUrl::ParsingMode parsingMode
qsizetype colon = -1;
qsizetype question = -1;
qsizetype hash = -1;
const qsizetype len = url.length();
const qsizetype len = url.size();
const QChar *const begin = url.constData();
const ushort *const data = reinterpret_cast<const ushort *>(begin);
@ -1628,7 +1628,7 @@ inline QUrlPrivate::ErrorCode QUrlPrivate::validityError(QString *source, qsizet
if (path.isEmpty())
return NoError;
if (path.at(0) == u'/') {
if (hasAuthority() || path.length() == 1 || path.at(1) != u'/')
if (hasAuthority() || path.size() == 1 || path.at(1) != u'/')
return NoError;
if (source) {
*source = path;
@ -1648,7 +1648,7 @@ inline QUrlPrivate::ErrorCode QUrlPrivate::validityError(QString *source, qsizet
return NoError;
// check for a path of "text:text/"
for (qsizetype i = 0; i < path.length(); ++i) {
for (qsizetype i = 0; i < path.size(); ++i) {
ushort c = path.at(i).unicode();
if (c == '/') {
// found the slash before the colon
@ -1956,7 +1956,7 @@ void QUrl::setScheme(const QString &scheme)
d->flags &= ~QUrlPrivate::IsLocalFile;
d->scheme.clear();
} else {
d->setScheme(scheme, scheme.length(), /* do set error */ true);
d->setScheme(scheme, scheme.size(), /* do set error */ true);
}
}
@ -2016,7 +2016,7 @@ void QUrl::setAuthority(const QString &authority, ParsingMode mode)
return;
}
d->setAuthority(authority, 0, authority.length(), mode);
d->setAuthority(authority, 0, authority.size(), mode);
if (authority.isNull()) {
// QUrlPrivate::setAuthority cleared almost everything
// but it leaves the Host bit set
@ -2087,7 +2087,7 @@ void QUrl::setUserInfo(const QString &userInfo, ParsingMode mode)
return;
}
d->setUserInfo(trimmed, 0, trimmed.length());
d->setUserInfo(trimmed, 0, trimmed.size());
if (userInfo.isNull()) {
// QUrlPrivate::setUserInfo cleared almost everything
// but it leaves the UserName bit set
@ -2159,7 +2159,7 @@ void QUrl::setUserName(const QString &userName, ParsingMode mode)
mode = TolerantMode;
}
d->setUserName(data, 0, data.length());
d->setUserName(data, 0, data.size());
if (userName.isNull())
d->sectionIsPresent &= ~QUrlPrivate::UserName;
else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::UserName, userName))
@ -2222,7 +2222,7 @@ void QUrl::setPassword(const QString &password, ParsingMode mode)
mode = TolerantMode;
}
d->setPassword(data, 0, data.length());
d->setPassword(data, 0, data.size());
if (password.isNull())
d->sectionIsPresent &= ~QUrlPrivate::Password;
else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Password, password))
@ -2284,7 +2284,7 @@ void QUrl::setHost(const QString &host, ParsingMode mode)
mode = TolerantMode;
}
if (d->setHost(data, 0, data.length(), mode)) {
if (d->setHost(data, 0, data.size(), mode)) {
if (host.isNull())
d->sectionIsPresent &= ~QUrlPrivate::Host;
} else if (!data.startsWith(u'[')) {
@ -2293,7 +2293,7 @@ void QUrl::setHost(const QString &host, ParsingMode mode)
data.prepend(u'[');
data.append(u']');
if (!d->setHost(data, 0, data.length(), mode)) {
if (!d->setHost(data, 0, data.size(), mode)) {
// failed again
if (data.contains(u':')) {
// source data contains ':', so it's an IPv6 error
@ -2330,7 +2330,7 @@ QString QUrl::host(ComponentFormattingOptions options) const
if (d) {
d->appendHost(result, options);
if (result.startsWith(u'['))
result = result.mid(1, result.length() - 2);
result = result.mid(1, result.size() - 2);
}
return result;
}
@ -2409,7 +2409,7 @@ void QUrl::setPath(const QString &path, ParsingMode mode)
mode = TolerantMode;
}
d->setPath(data, 0, data.length());
d->setPath(data, 0, data.size());
// optimized out, since there is no path delimiter
// if (path.isNull())
@ -2545,7 +2545,7 @@ void QUrl::setQuery(const QString &query, ParsingMode mode)
mode = TolerantMode;
}
d->setQuery(data, 0, data.length());
d->setQuery(data, 0, data.size());
if (query.isNull())
d->sectionIsPresent &= ~QUrlPrivate::Query;
else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Query, query))
@ -2643,7 +2643,7 @@ void QUrl::setFragment(const QString &fragment, ParsingMode mode)
mode = TolerantMode;
}
d->setFragment(data, 0, data.length());
d->setFragment(data, 0, data.size());
if (fragment.isNull())
d->sectionIsPresent &= ~QUrlPrivate::Fragment;
else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Fragment, fragment))
@ -2937,7 +2937,7 @@ QUrl QUrl::adjusted(QUrl::FormattingOptions options) const
that.detach();
QString path;
d->appendPath(path, options | FullyEncoded, QUrlPrivate::Path);
that.d->setPath(path, 0, path.length());
that.d->setPath(path, 0, path.size());
}
return that;
}
@ -3346,7 +3346,7 @@ QUrl QUrl::fromLocalFile(const QString &localFile)
QString deslashified = fromNativeSeparators(localFile);
// magic for drives on windows
if (deslashified.length() > 1 && deslashified.at(1) == u':' && deslashified.at(0) != u'/') {
if (deslashified.size() > 1 && deslashified.at(1) == u':' && deslashified.at(0) != u'/') {
deslashified.prepend(u'/');
} else if (deslashified.startsWith("//"_L1)) {
// magic for shared drive on windows
@ -3367,7 +3367,7 @@ QUrl QUrl::fromLocalFile(const QString &localFile)
// Path hostname is not a valid URL host, so set it entirely in the path
// (by leaving deslashified unchanged)
} else if (indexOfPath > 2) {
deslashified = deslashified.right(deslashified.length() - indexOfPath);
deslashified = deslashified.right(deslashified.size() - indexOfPath);
} else {
deslashified.clear();
}
@ -3431,16 +3431,16 @@ bool QUrl::isParentOf(const QUrl &childUrl) const
if (!d)
return ((childUrl.scheme().isEmpty())
&& (childUrl.authority().isEmpty())
&& childPath.length() > 0 && childPath.at(0) == u'/');
&& childPath.size() > 0 && childPath.at(0) == u'/');
QString ourPath = path();
return ((childUrl.scheme().isEmpty() || d->scheme == childUrl.scheme())
&& (childUrl.authority().isEmpty() || authority() == childUrl.authority())
&& childPath.startsWith(ourPath)
&& ((ourPath.endsWith(u'/') && childPath.length() > ourPath.length())
|| (!ourPath.endsWith(u'/') && childPath.length() > ourPath.length()
&& childPath.at(ourPath.length()) == u'/')));
&& ((ourPath.endsWith(u'/') && childPath.size() > ourPath.size())
|| (!ourPath.endsWith(u'/') && childPath.size() > ourPath.size()
&& childPath.at(ourPath.size()) == u'/')));
}
@ -3488,7 +3488,7 @@ QDebug operator<<(QDebug d, const QUrl &url)
static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, qsizetype errorPosition)
{
QChar c = size_t(errorPosition) < size_t(errorSource.length()) ?
QChar c = size_t(errorPosition) < size_t(errorSource.size()) ?
errorSource.at(errorPosition) : QChar(QChar::Null);
switch (errorCode) {

View File

@ -177,7 +177,7 @@ Q_AUTOTEST_EXPORT QString qt_punycodeDecoder(const QString &pc)
// Do not try to decode strings longer than allowable for a domain label.
// Non-ASCII strings are not allowed here anyway, so there is no need
// to account for surrogates.
if (pc.length() > MaxDomainLabelLength)
if (pc.size() > MaxDomainLabelLength)
return QString();
// strip any ACE prefix
@ -709,7 +709,7 @@ bool DomainValidityChecker::checkLabel(const QString &label, QUrl::AceProcessing
if (label != label.normalized(QString::NormalizationForm_C))
return false;
if (label.length() >= 4) {
if (label.size() >= 4) {
// This assumes that the first two characters are in BMP, but that's ok
// because non-BMP characters are unlikely to be used for specifying
// future extensions.

View File

@ -515,7 +515,7 @@ QString QUrlQuery::query(QUrl::ComponentFormattingOptions encoding) const
{
int size = 0;
for ( ; it != end; ++it)
size += it->first.length() + 1 + it->second.length() + 1;
size += it->first.size() + 1 + it->second.size() + 1;
result.reserve(size + size / 4);
}

View File

@ -840,13 +840,13 @@ void QAbstractItemModelPrivate::removePersistentIndexData(QPersistentModelIndexD
Q_UNUSED(removed);
}
// make sure our optimization still works
for (int i = persistent.moved.count() - 1; i >= 0; --i) {
for (int i = persistent.moved.size() - 1; i >= 0; --i) {
int idx = persistent.moved.at(i).indexOf(data);
if (idx >= 0)
persistent.moved[i].remove(idx);
}
// update the references to invalidated persistent indexes
for (int i = persistent.invalidated.count() - 1; i >= 0; --i) {
for (int i = persistent.invalidated.size() - 1; i >= 0; --i) {
int idx = persistent.invalidated.at(i).indexOf(data);
if (idx >= 0)
persistent.invalidated[i].remove(idx);
@ -2775,15 +2775,15 @@ bool QAbstractItemModel::decodeData(int row, int column, const QModelIndex &pare
// Compute the number of continuous rows upon insertion and modify the rows to match
QList<int> rowsToInsert(bottom + 1);
for (int i = 0; i < rows.count(); ++i)
for (int i = 0; i < rows.size(); ++i)
rowsToInsert[rows.at(i)] = 1;
for (int i = 0; i < rowsToInsert.count(); ++i) {
for (int i = 0; i < rowsToInsert.size(); ++i) {
if (rowsToInsert.at(i) == 1){
rowsToInsert[i] = dragRowCount;
++dragRowCount;
}
}
for (int i = 0; i < rows.count(); ++i)
for (int i = 0; i < rows.size(); ++i)
rows[i] = top + rowsToInsert.at(rows.at(i));
QBitArray isWrittenTo(dragRowCount * dragColumnCount);
@ -3473,7 +3473,7 @@ QModelIndexList QAbstractItemModel::persistentIndexList() const
{
Q_D(const QAbstractItemModel);
QModelIndexList result;
result.reserve(d->persistent.indexes.count());
result.reserve(d->persistent.indexes.size());
for (auto *data : qAsConst(d->persistent.indexes))
result.append(data->index);
return result;

View File

@ -688,7 +688,7 @@ void QConcatenateTablesProxyModelPrivate::updateColumnCount()
int QConcatenateTablesProxyModelPrivate::columnCountAfterChange(const QAbstractItemModel *model, int newCount) const
{
int newColumnCount = 0;
for (int i = 0; i < m_models.count(); ++i) {
for (int i = 0; i < m_models.size(); ++i) {
const QAbstractItemModel *mod = m_models.at(i);
const int colCount = mod == model ? newCount : mod->columnCount();
if (i == 0)

View File

@ -878,7 +878,7 @@ static QItemSelection mergeRowLengths(const QList<QPair<QPersistentModelIndex, u
QItemSelection result;
int i = 0;
while (i < rowLengths.count()) {
while (i < rowLengths.size()) {
const QPersistentModelIndex &tl = rowLengths.at(i).first;
if (!tl.isValid()) {
++i;
@ -886,7 +886,7 @@ static QItemSelection mergeRowLengths(const QList<QPair<QPersistentModelIndex, u
}
QPersistentModelIndex br = tl;
const uint length = rowLengths.at(i).second;
while (++i < rowLengths.count()) {
while (++i < rowLengths.size()) {
const QPersistentModelIndex &next = rowLengths.at(i).first;
if (!next.isValid())
continue;
@ -916,7 +916,7 @@ static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes)
QItemSelection colSpans;
// merge columns
int i = 0;
while (i < indexes.count()) {
while (i < indexes.size()) {
const QPersistentModelIndex &tl = indexes.at(i);
if (!tl.isValid()) {
++i;
@ -926,7 +926,7 @@ static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes)
QModelIndex brParent = br.parent();
int brRow = br.row();
int brColumn = br.column();
while (++i < indexes.count()) {
while (++i < indexes.size()) {
const QPersistentModelIndex &next = indexes.at(i);
if (!next.isValid())
continue;

View File

@ -959,12 +959,12 @@ void QSortFilterProxyModelPrivate::source_items_inserted(
it = create_mapping(source_parent);
Mapping *m = it.value();
QModelIndex proxy_parent = q->mapFromSource(source_parent);
if (m->source_rows.count() > 0) {
q->beginInsertRows(proxy_parent, 0, m->source_rows.count() - 1);
if (m->source_rows.size() > 0) {
q->beginInsertRows(proxy_parent, 0, m->source_rows.size() - 1);
q->endInsertRows();
}
if (m->source_columns.count() > 0) {
q->beginInsertColumns(proxy_parent, 0, m->source_columns.count() - 1);
if (m->source_columns.size() > 0) {
q->beginInsertColumns(proxy_parent, 0, m->source_columns.size() - 1);
q->endInsertColumns();
}
return;
@ -1190,7 +1190,7 @@ void QSortFilterProxyModelPrivate::proxy_item_range(
{
proxy_low = INT_MAX;
proxy_high = INT_MIN;
for (int i = 0; i < source_items.count(); ++i) {
for (int i = 0; i < source_items.size(); ++i) {
int proxy_item = source_to_proxy.at(source_items.at(i));
Q_ASSERT(proxy_item != -1);
if (proxy_item < proxy_low)
@ -1223,7 +1223,7 @@ QModelIndexPairList QSortFilterProxyModelPrivate::store_persistent_indexes() con
{
Q_Q(const QSortFilterProxyModel);
QModelIndexPairList source_indexes;
source_indexes.reserve(persistent.indexes.count());
source_indexes.reserve(persistent.indexes.size());
for (const QPersistentModelIndexData *data : qAsConst(persistent.indexes)) {
const QModelIndex &proxy_index = data->index;
QModelIndex source_index = q->mapToSource(proxy_index);
@ -1327,7 +1327,7 @@ QSet<int> QSortFilterProxyModelPrivate::handle_filter_changed(
Q_Q(QSortFilterProxyModel);
// Figure out which mapped items to remove
QList<int> source_items_remove;
for (int i = 0; i < proxy_to_source.count(); ++i) {
for (int i = 0; i < proxy_to_source.size(); ++i) {
const int source_item = proxy_to_source.at(i);
if ((orient == Qt::Vertical)
? !filterAcceptsRowInternal(source_item, source_parent)
@ -1435,7 +1435,7 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc
QList<int> source_rows_insert;
QList<int> source_rows_change;
QList<int> source_rows_resort;
int end = qMin(source_bottom_right.row(), m->proxy_rows.count() - 1);
int end = qMin(source_bottom_right.row(), m->proxy_rows.size() - 1);
for (int source_row = source_top_left.row(); source_row <= end; ++source_row) {
if (dynamic_sortfilter && !change_in_unmapped_parent) {
if (m->proxy_rows.at(source_row) != -1) {
@ -2155,7 +2155,7 @@ QModelIndex QSortFilterProxyModel::index(int row, int column, const QModelIndex
QModelIndex source_parent = mapToSource(parent); // parent is already mapped at this point
IndexMap::const_iterator it = d->create_mapping(source_parent); // but make sure that the children are mapped
if (it.value()->source_rows.count() <= row || it.value()->source_columns.count() <= column)
if (it.value()->source_rows.size() <= row || it.value()->source_columns.size() <= column)
return QModelIndex();
return d->create_index(row, column, it);
@ -2186,7 +2186,7 @@ QModelIndex QSortFilterProxyModel::sibling(int row, int column, const QModelInde
return QModelIndex();
const IndexMap::const_iterator it = d->index_to_iterator(idx);
if (it.value()->source_rows.count() <= row || it.value()->source_columns.count() <= column)
if (it.value()->source_rows.size() <= row || it.value()->source_columns.size() <= column)
return QModelIndex();
return d->create_index(row, column, it);
@ -2202,7 +2202,7 @@ int QSortFilterProxyModel::rowCount(const QModelIndex &parent) const
if (parent.isValid() && !source_parent.isValid())
return 0;
IndexMap::const_iterator it = d->create_mapping(source_parent);
return it.value()->source_rows.count();
return it.value()->source_rows.size();
}
/*!
@ -2215,7 +2215,7 @@ int QSortFilterProxyModel::columnCount(const QModelIndex &parent) const
if (parent.isValid() && !source_parent.isValid())
return 0;
IndexMap::const_iterator it = d->create_mapping(source_parent);
return it.value()->source_columns.count();
return it.value()->source_columns.size();
}
/*!
@ -2234,7 +2234,7 @@ bool QSortFilterProxyModel::hasChildren(const QModelIndex &parent) const
return true; //we assume we might have children that can be fetched
QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value();
return m->source_rows.count() != 0 && m->source_columns.count() != 0;
return m->source_rows.size() != 0 && m->source_columns.size() != 0;
}
/*!
@ -2268,15 +2268,15 @@ QVariant QSortFilterProxyModel::headerData(int section, Qt::Orientation orientat
{
Q_D(const QSortFilterProxyModel);
IndexMap::const_iterator it = d->create_mapping(QModelIndex());
if (it.value()->source_rows.count() * it.value()->source_columns.count() > 0)
if (it.value()->source_rows.size() * it.value()->source_columns.size() > 0)
return QAbstractProxyModel::headerData(section, orientation, role);
int source_section;
if (orientation == Qt::Vertical) {
if (section < 0 || section >= it.value()->source_rows.count())
if (section < 0 || section >= it.value()->source_rows.size())
return QVariant();
source_section = it.value()->source_rows.at(section);
} else {
if (section < 0 || section >= it.value()->source_columns.count())
if (section < 0 || section >= it.value()->source_columns.size())
return QVariant();
source_section = it.value()->source_columns.at(section);
}
@ -2291,15 +2291,15 @@ bool QSortFilterProxyModel::setHeaderData(int section, Qt::Orientation orientati
{
Q_D(QSortFilterProxyModel);
IndexMap::const_iterator it = d->create_mapping(QModelIndex());
if (it.value()->source_rows.count() * it.value()->source_columns.count() > 0)
if (it.value()->source_rows.size() * it.value()->source_columns.size() > 0)
return QAbstractProxyModel::setHeaderData(section, orientation, value, role);
int source_section;
if (orientation == Qt::Vertical) {
if (section < 0 || section >= it.value()->source_rows.count())
if (section < 0 || section >= it.value()->source_rows.size())
return false;
source_section = it.value()->source_rows.at(section);
} else {
if (section < 0 || section >= it.value()->source_columns.count())
if (section < 0 || section >= it.value()->source_columns.size())
return false;
source_section = it.value()->source_columns.at(section);
}
@ -2359,10 +2359,10 @@ bool QSortFilterProxyModel::insertRows(int row, int count, const QModelIndex &pa
if (parent.isValid() && !source_parent.isValid())
return false;
QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value();
if (row > m->source_rows.count())
if (row > m->source_rows.size())
return false;
int source_row = (row >= m->source_rows.count()
? m->proxy_rows.count()
int source_row = (row >= m->source_rows.size()
? m->proxy_rows.size()
: m->source_rows.at(row));
return d->model->insertRows(source_row, count, source_parent);
}
@ -2379,10 +2379,10 @@ bool QSortFilterProxyModel::insertColumns(int column, int count, const QModelInd
if (parent.isValid() && !source_parent.isValid())
return false;
QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value();
if (column > m->source_columns.count())
if (column > m->source_columns.size())
return false;
int source_column = (column >= m->source_columns.count()
? m->proxy_columns.count()
int source_column = (column >= m->source_columns.size()
? m->proxy_columns.size()
: m->source_columns.at(column));
return d->model->insertColumns(source_column, count, source_parent);
}
@ -2399,10 +2399,10 @@ bool QSortFilterProxyModel::removeRows(int row, int count, const QModelIndex &pa
if (parent.isValid() && !source_parent.isValid())
return false;
QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value();
if (row + count > m->source_rows.count())
if (row + count > m->source_rows.size())
return false;
if ((count == 1)
|| ((d->source_sort_column < 0) && (m->proxy_rows.count() == m->source_rows.count()))) {
|| ((d->source_sort_column < 0) && (m->proxy_rows.size() == m->source_rows.size()))) {
int source_row = m->source_rows.at(row);
return d->model->removeRows(source_row, count, source_parent);
}
@ -2414,7 +2414,7 @@ bool QSortFilterProxyModel::removeRows(int row, int count, const QModelIndex &pa
rows.append(m->source_rows.at(i));
std::sort(rows.begin(), rows.end());
int pos = rows.count() - 1;
int pos = rows.size() - 1;
bool ok = true;
while (pos >= 0) {
const int source_end = rows.at(pos--);
@ -2441,9 +2441,9 @@ bool QSortFilterProxyModel::removeColumns(int column, int count, const QModelInd
if (parent.isValid() && !source_parent.isValid())
return false;
QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value();
if (column + count > m->source_columns.count())
if (column + count > m->source_columns.size())
return false;
if ((count == 1) || (m->proxy_columns.count() == m->source_columns.count())) {
if ((count == 1) || (m->proxy_columns.size() == m->source_columns.size())) {
int source_column = m->source_columns.at(column);
return d->model->removeColumns(source_column, count, source_parent);
}
@ -2453,7 +2453,7 @@ bool QSortFilterProxyModel::removeColumns(int column, int count, const QModelInd
for (int i = column; i < column + count; ++i)
columns.append(m->source_columns.at(i));
int pos = columns.count() - 1;
int pos = columns.size() - 1;
bool ok = true;
while (pos >= 0) {
const int source_end = columns.at(pos--);

View File

@ -382,7 +382,7 @@ void QAbstractEventDispatcher::installNativeEventFilter(QAbstractNativeEventFilt
void QAbstractEventDispatcher::removeNativeEventFilter(QAbstractNativeEventFilter *filter)
{
Q_D(QAbstractEventDispatcher);
for (int i = 0; i < d->eventFilters.count(); ++i) {
for (int i = 0; i < d->eventFilters.size(); ++i) {
if (d->eventFilters.at(i) == filter) {
d->eventFilters[i] = nullptr;
break;

View File

@ -2153,7 +2153,7 @@ static void replacePercentN(QString *result, int n)
fmt = fmt.arg(n);
++len;
result->replace(percentPos, len, fmt);
len = fmt.length();
len = fmt.size();
}
}
}

View File

@ -41,7 +41,7 @@ static gboolean socketNotifierSourceCheck(GSource *source)
GSocketNotifierSource *src = reinterpret_cast<GSocketNotifierSource *>(source);
bool pending = false;
for (int i = 0; !pending && i < src->pollfds.count(); ++i) {
for (int i = 0; !pending && i < src->pollfds.size(); ++i) {
GPollFDWithQSocketNotifier *p = src->pollfds.at(i);
if (p->pollfd.revents & G_IO_NVAL) {
@ -65,7 +65,7 @@ static gboolean socketNotifierSourceDispatch(GSource *source, GSourceFunc, gpoin
QEvent event(QEvent::SockAct);
GSocketNotifierSource *src = reinterpret_cast<GSocketNotifierSource *>(source);
for (src->activeNotifierPos = 0; src->activeNotifierPos < src->pollfds.count();
for (src->activeNotifierPos = 0; src->activeNotifierPos < src->pollfds.size();
++src->activeNotifierPos) {
GPollFDWithQSocketNotifier *p = src->pollfds.at(src->activeNotifierPos);
@ -348,7 +348,7 @@ QEventDispatcherGlib::~QEventDispatcherGlib()
d->idleTimerSource = nullptr;
// destroy socket notifier source
for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) {
for (int i = 0; i < d->socketNotifierSource->pollfds.size(); ++i) {
GPollFDWithQSocketNotifier *p = d->socketNotifierSource->pollfds[i];
g_source_remove_poll(&d->socketNotifierSource->source, &p->pollfd);
delete p;
@ -458,7 +458,7 @@ void QEventDispatcherGlib::unregisterSocketNotifier(QSocketNotifier *notifier)
Q_D(QEventDispatcherGlib);
for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) {
for (int i = 0; i < d->socketNotifierSource->pollfds.size(); ++i) {
GPollFDWithQSocketNotifier *p = d->socketNotifierSource->pollfds.at(i);
if (p->socketNotifier == notifier) {
// found it

View File

@ -2303,7 +2303,7 @@ void QObject::removeEventFilter(QObject *obj)
{
Q_D(QObject);
if (d->extraData) {
for (int i = 0; i < d->extraData->eventFilters.count(); ++i) {
for (int i = 0; i < d->extraData->eventFilters.size(); ++i) {
if (d->extraData->eventFilters.at(i) == obj)
d->extraData->eventFilters[i] = nullptr;
}

View File

@ -449,7 +449,7 @@ bool QTranslator::load(const QString & filename, const QString & directory,
QString prefix;
if (QFileInfo(filename).isRelative()) {
prefix = directory;
if (prefix.length() && !prefix.endsWith(u'/'))
if (prefix.size() && !prefix.endsWith(u'/'))
prefix += u'/';
}
@ -472,7 +472,7 @@ bool QTranslator::load(const QString & filename, const QString & directory,
break;
int rightmost = 0;
for (int i = 0; i < (int)delims.length(); i++) {
for (int i = 0; i < (int)delims.size(); i++) {
int k = fname.lastIndexOf(delims[i]);
if (k > rightmost)
rightmost = k;
@ -914,7 +914,7 @@ end:
if (!tn)
return QString();
QString str(tn_length / 2, Qt::Uninitialized);
qFromBigEndian<ushort>(tn, str.length(), str.data());
qFromBigEndian<ushort>(tn, str.size(), str.data());
return str;
}

View File

@ -34,9 +34,9 @@ void QMimeGlobMatchResult::addMatch(const QString &mimeType, int weight, const Q
bool replace = weight > m_weight;
if (!replace) {
// Compare the length of the match
if (pattern.length() < m_matchingPatternLength)
if (pattern.size() < m_matchingPatternLength)
return; // too short, ignore
else if (pattern.length() > m_matchingPatternLength) {
else if (pattern.size() > m_matchingPatternLength) {
// longer: clear any previous match (like *.bz2, when pattern is *.tar.bz2)
replace = true;
}
@ -44,7 +44,7 @@ void QMimeGlobMatchResult::addMatch(const QString &mimeType, int weight, const Q
if (replace) {
m_matchingMimeTypes.clear();
// remember the new "longer" length
m_matchingPatternLength = pattern.length();
m_matchingPatternLength = pattern.size();
m_weight = weight;
}
if (!m_matchingMimeTypes.contains(mimeType)) {
@ -59,7 +59,7 @@ void QMimeGlobMatchResult::addMatch(const QString &mimeType, int weight, const Q
QMimeGlobPattern::PatternType QMimeGlobPattern::detectPatternType(const QString &pattern) const
{
const int patternLength = pattern.length();
const int patternLength = pattern.size();
if (!patternLength)
return OtherPattern;
@ -108,10 +108,10 @@ bool QMimeGlobPattern::matchFileName(const QString &inputFileName) const
const QString fileName = m_caseSensitivity == Qt::CaseInsensitive
? inputFileName.toLower() : inputFileName;
const int patternLength = m_pattern.length();
const int patternLength = m_pattern.size();
if (!patternLength)
return false;
const int fileNameLength = fileName.length();
const int fileNameLength = fileName.size();
switch (m_patternType) {
case SuffixPattern: {
@ -166,7 +166,7 @@ static bool isSimplePattern(const QString &pattern)
{
// starts with "*.", has no other '*'
return pattern.lastIndexOf(u'*') == 0
&& pattern.length() > 1
&& pattern.size() > 1
&& pattern.at(1) == u'.' // (other dots are OK, like *.tar.bz2)
// and contains no other special character
&& !pattern.contains(u'?')
@ -229,7 +229,7 @@ void QMimeGlobPatternList::match(QMimeGlobMatchResult &result,
const QMimeGlobPattern &glob = *it;
if (glob.matchFileName(fileName)) {
const QString pattern = glob.pattern();
const int suffixLen = isSimplePattern(pattern) ? pattern.length() - 2 : 0;
const int suffixLen = isSimplePattern(pattern) ? pattern.size() - 2 : 0;
result.addMatch(glob.mimeType(), glob.weight(), pattern, suffixLen);
}
}
@ -244,7 +244,7 @@ void QMimeAllGlobPatterns::matchingGlobs(const QString &fileName, QMimeGlobMatch
// (which is most of them, so this optimization is definitely worth it)
const int lastDot = fileName.lastIndexOf(u'.');
if (lastDot != -1) { // if no '.', skip the extension lookup
const int ext_len = fileName.length() - lastDot - 1;
const int ext_len = fileName.size() - lastDot - 1;
const QString simpleExtension = fileName.right(ext_len).toLower();
// (toLower because fast patterns are always case-insensitive and saved as lowercase)

View File

@ -219,9 +219,9 @@ void QMimeBinaryProvider::addFileNameMatches(const QString &fileName, QMimeGlobM
const int reverseSuffixTreeOffset = m_cacheFile->getUint32(PosReverseSuffixTreeOffset);
const int numRoots = m_cacheFile->getUint32(reverseSuffixTreeOffset);
const int firstRootOffset = m_cacheFile->getUint32(reverseSuffixTreeOffset + 4);
matchSuffixTree(result, m_cacheFile, numRoots, firstRootOffset, lowerFileName, lowerFileName.length() - 1, false);
matchSuffixTree(result, m_cacheFile, numRoots, firstRootOffset, lowerFileName, lowerFileName.size() - 1, false);
if (result.m_matchingMimeTypes.isEmpty())
matchSuffixTree(result, m_cacheFile, numRoots, firstRootOffset, fileName, fileName.length() - 1, true);
matchSuffixTree(result, m_cacheFile, numRoots, firstRootOffset, fileName, fileName.size() - 1, true);
}
// Check complex globs (e.g. "callgrind.out[0-9]*" or "README*")
if (result.m_matchingMimeTypes.isEmpty())
@ -448,7 +448,7 @@ void QMimeBinaryProvider::addAllMimeTypes(QList<QMimeType> &result)
{
loadMimeTypeList();
if (result.isEmpty()) {
result.reserve(m_mimetypeNames.count());
result.reserve(m_mimetypeNames.size());
for (const QString &name : qAsConst(m_mimetypeNames))
result.append(mimeTypeForNameUnchecked(name));
} else {

View File

@ -413,7 +413,7 @@ QStringList QMimeType::suffixes() const
for (const QString &pattern : qAsConst(d->globPatterns)) {
// Not a simple suffix if it looks like: README or *. or *.* or *.JP*G or *.JP?
if (pattern.startsWith("*."_L1) &&
pattern.length() > 2 &&
pattern.size() > 2 &&
pattern.indexOf(u'*', 2) < 0 && pattern.indexOf(u'?', 2) < 0) {
const QString suffix = pattern.mid(2);
result.append(suffix);

View File

@ -1309,7 +1309,7 @@ QCborStreamReader::StringResult<QString> QCborStreamReader::_readString_helper()
if (r.status == Error) {
result.data.clear();
} else {
Q_ASSERT(r.data == result.data.length());
Q_ASSERT(r.data == result.data.size());
if (r.status == EndOfString && lastError() == QCborError::NoError)
preparse();
}
@ -1341,7 +1341,7 @@ QCborStreamReader::StringResult<QByteArray> QCborStreamReader::_readByteArray_he
if (r.status == Error) {
result.data.clear();
} else {
Q_ASSERT(r.data == result.data.length());
Q_ASSERT(r.data == result.data.size());
if (r.status == EndOfString && lastError() == QCborError::NoError)
preparse();
}

View File

@ -330,7 +330,7 @@ void QJsonArray::append(const QJsonValue &value)
*/
void QJsonArray::removeAt(qsizetype i)
{
if (!a || i < 0 || i >= a->elements.length())
if (!a || i < 0 || i >= a->elements.size())
return;
detach();
a->removeAt(i);
@ -366,7 +366,7 @@ void QJsonArray::removeAt(qsizetype i)
*/
QJsonValue QJsonArray::takeAt(qsizetype i)
{
if (!a || i < 0 || i >= a->elements.length())
if (!a || i < 0 || i >= a->elements.size())
return QJsonValue(QJsonValue::Undefined);
detach();
@ -385,11 +385,11 @@ QJsonValue QJsonArray::takeAt(qsizetype i)
void QJsonArray::insert(qsizetype i, const QJsonValue &value)
{
if (a)
detach(a->elements.length() + 1);
detach(a->elements.size() + 1);
else
a = new QCborContainerPrivate;
Q_ASSERT (i >= 0 && i <= a->elements.length());
Q_ASSERT (i >= 0 && i <= a->elements.size());
a->insertAt(i, value.type() == QJsonValue::Undefined ? QCborValue(nullptr)
: QCborValue::fromJsonValue(value));
}
@ -420,7 +420,7 @@ void QJsonArray::insert(qsizetype i, const QJsonValue &value)
*/
void QJsonArray::replace(qsizetype i, const QJsonValue &value)
{
Q_ASSERT (a && i >= 0 && i < a->elements.length());
Q_ASSERT (a && i >= 0 && i < a->elements.size());
detach();
a->replaceAt(i, QCborValue::fromJsonValue(value));
}
@ -454,7 +454,7 @@ bool QJsonArray::contains(const QJsonValue &value) const
*/
QJsonValueRef QJsonArray::operator [](qsizetype i)
{
Q_ASSERT(a && i >= 0 && i < a->elements.length());
Q_ASSERT(a && i >= 0 && i < a->elements.size());
return QJsonValueRef(this, i);
}
@ -477,13 +477,13 @@ bool QJsonArray::operator==(const QJsonArray &other) const
return true;
if (!a)
return !other.a->elements.length();
return !other.a->elements.size();
if (!other.a)
return !a->elements.length();
if (a->elements.length() != other.a->elements.length())
return !a->elements.size();
if (a->elements.size() != other.a->elements.size())
return false;
for (qsizetype i = 0; i < a->elements.length(); ++i) {
for (qsizetype i = 0; i < a->elements.size(); ++i) {
if (a->valueAt(i) != other.a->valueAt(i))
return false;
}

View File

@ -280,7 +280,7 @@ QByteArray QJsonDocument::toJson(JsonFormat format) const
*/
QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error)
{
QJsonPrivate::Parser parser(json.constData(), json.length());
QJsonPrivate::Parser parser(json.constData(), json.size());
QJsonDocument result;
const QCborValue val = parser.parse(error);
if (val.isArray() || val.isMap()) {

View File

@ -228,8 +228,8 @@ QStringList QJsonObject::keys() const
{
QStringList keys;
if (o) {
keys.reserve(o->elements.length() / 2);
for (qsizetype i = 0, end = o->elements.length(); i < end; i += 2)
keys.reserve(o->elements.size() / 2);
for (qsizetype i = 0, end = o->elements.size(); i < end; i += 2)
keys.append(o->stringAt(i));
}
return keys;
@ -240,7 +240,7 @@ QStringList QJsonObject::keys() const
*/
qsizetype QJsonObject::size() const
{
return o ? o->elements.length() / 2 : 0;
return o ? o->elements.size() / 2 : 0;
}
/*!
@ -392,7 +392,7 @@ QJsonValueRef QJsonObject::atImpl(T key)
bool keyExists = false;
auto index = indexOf(o, key, &keyExists);
if (!keyExists) {
detach(o->elements.length() / 2 + 1);
detach(o->elements.size() / 2 + 1);
o->insertAt(index, key);
o->insertAt(index + 1, QCborValue::fromJsonValue(QJsonValue()));
}
@ -458,7 +458,7 @@ template <typename T>
QJsonObject::iterator QJsonObject::insertAt(qsizetype pos, T key, const QJsonValue &value, bool keyExists)
{
if (o)
detach(o->elements.length() / 2 + (keyExists ? 0 : 1));
detach(o->elements.size() / 2 + (keyExists ? 0 : 1));
else
o = new QCborContainerPrivate;
@ -619,13 +619,13 @@ bool QJsonObject::operator==(const QJsonObject &other) const
return true;
if (!o)
return !other.o->elements.length();
return !other.o->elements.size();
if (!other.o)
return !o->elements.length();
if (o->elements.length() != other.o->elements.length())
return !o->elements.size();
if (o->elements.size() != other.o->elements.size())
return false;
for (qsizetype i = 0, end = o->elements.length(); i < end; ++i) {
for (qsizetype i = 0, end = o->elements.size(); i < end; ++i) {
if (o->valueAt(i) != other.o->valueAt(i))
return false;
}
@ -1352,7 +1352,7 @@ bool QJsonObject::detach(qsizetype reserve)
{
if (!o)
return true;
o = QCborContainerPrivate::detach(o.data(), reserve ? reserve * 2 : o->elements.length());
o = QCborContainerPrivate::detach(o.data(), reserve ? reserve * 2 : o->elements.size());
return o;
}
@ -1362,7 +1362,7 @@ bool QJsonObject::detach(qsizetype reserve)
*/
QString QJsonObject::keyAt(qsizetype i) const
{
Q_ASSERT(o && i >= 0 && i * 2 < o->elements.length());
Q_ASSERT(o && i >= 0 && i * 2 < o->elements.size());
return o->stringAt(i * 2);
}
@ -1371,7 +1371,7 @@ QString QJsonObject::keyAt(qsizetype i) const
*/
QJsonValue QJsonObject::valueAt(qsizetype i) const
{
if (!o || i < 0 || 2 * i + 1 >= o->elements.length())
if (!o || i < 0 || 2 * i + 1 >= o->elements.size())
return QJsonValue(QJsonValue::Undefined);
return QJsonPrivate::Value::fromTrustedCbor(o->valueAt(2 * i + 1));
}
@ -1381,7 +1381,7 @@ QJsonValue QJsonObject::valueAt(qsizetype i) const
*/
void QJsonObject::setValueAt(qsizetype i, const QJsonValue &val)
{
Q_ASSERT(o && i >= 0 && 2 * i + 1 < o->elements.length());
Q_ASSERT(o && i >= 0 && 2 * i + 1 < o->elements.size());
detach();
if (val.isUndefined()) {
o->removeAt(2 * i + 1);

View File

@ -552,7 +552,7 @@ bool Parser::parseArray()
}
}
DEBUG << "size =" << (container ? container->elements.length() : 0);
DEBUG << "size =" << (container ? container->elements.size() : 0);
END;
--nestingLevel;

View File

@ -25,10 +25,10 @@ static inline uchar hexdig(uint u)
static QByteArray escapedString(const QString &s)
{
// give it a minimum size to ensure the resize() below always adds enough space
QByteArray ba(qMax(s.length(), 16), Qt::Uninitialized);
QByteArray ba(qMax(s.size(), 16), Qt::Uninitialized);
uchar *cursor = reinterpret_cast<uchar *>(const_cast<char *>(ba.constData()));
const uchar *ba_end = cursor + ba.length();
const uchar *ba_end = cursor + ba.size();
const char16_t *src = reinterpret_cast<const char16_t *>(s.constBegin());
const char16_t *const end = reinterpret_cast<const char16_t *>(s.constEnd());
@ -38,7 +38,7 @@ static QByteArray escapedString(const QString &s)
int pos = cursor - (const uchar *)ba.constData();
ba.resize(ba.size()*2);
cursor = (uchar *)ba.data() + pos;
ba_end = (const uchar *)ba.constData() + ba.length();
ba_end = (const uchar *)ba.constData() + ba.size();
}
char16_t u = *src++;

View File

@ -2497,7 +2497,7 @@ QTextStream &QTextStream::operator<<(const QByteArray &array)
{
Q_D(QTextStream);
CHECK_VALID_STREAM(*this);
d->putString(QString::fromUtf8(array.constData(), array.length()));
d->putString(QString::fromUtf8(array.constData(), array.size()));
return *this;
}

View File

@ -3028,7 +3028,7 @@ void QXmlStreamWriterPrivate::indent(int level)
{
write("\n");
for (int i = level; i > 0; --i)
write(autoFormattingIndent.constData(), autoFormattingIndent.length());
write(autoFormattingIndent.constData(), autoFormattingIndent.size());
}

View File

@ -241,7 +241,7 @@ public:
// the number of QByteArrays
qsizetype bufferCount() const
{
return buffers.length();
return buffers.size();
}
inline bool isEmpty() const
@ -267,12 +267,12 @@ public:
inline bool canReadLine() const {
qsizetype i = 0;
if (i < buffers.length()) {
if (i < buffers.size()) {
if (buffers.at(i).indexOf('\n', firstPos) != -1)
return true;
++i;
for (; i < buffers.length(); i++)
for (; i < buffers.size(); i++)
if (buffers.at(i).contains('\n'))
return true;
}

View File

@ -1815,7 +1815,7 @@ static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion
QString &s = *str;
const unsigned short *utf16 = reinterpret_cast<unsigned short *>(s.data());
const unsigned short *uc = utf16 + s.length();
const unsigned short *uc = utf16 + s.size();
while (uc != utf16 + from) {
char32_t ucs4 = *(--uc);
if (QChar(ucs4).isLowSurrogate() && uc != utf16) {
@ -1910,7 +1910,7 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, qsizetype
{
QString &s = *str;
if (from < 0 || s.length() - from < 2)
if (from < 0 || s.size() - from < 2)
return;
char32_t stcode = 0; // starter code point
@ -1919,10 +1919,10 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, qsizetype
int lastCombining = 255; // to prevent combining > lastCombining
qsizetype pos = from;
while (pos < s.length()) {
while (pos < s.size()) {
qsizetype i = pos;
char32_t uc = s.at(pos).unicode();
if (QChar(uc).isHighSurrogate() && pos < s.length()-1) {
if (QChar(uc).isHighSurrogate() && pos < s.size()-1) {
ushort low = s.at(pos+1).unicode();
if (QChar(low).isLowSurrogate()) {
uc = QChar::surrogateToUcs4(uc, low);
@ -1969,7 +1969,7 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, qsizetype
static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, qsizetype from)
{
QString &s = *str;
const qsizetype l = s.length()-1;
const qsizetype l = s.size()-1;
char32_t u1, u2;
char16_t c1, c2;

View File

@ -3745,11 +3745,11 @@ QString QLocaleData::decimalForm(QString &&digits, int decpt, int precision,
digits.append(zero);
break;
case PMChopTrailingZeros:
Q_ASSERT(digits.length() / digitWidth <= qMax(decpt, 1) || !digits.endsWith(zero));
Q_ASSERT(digits.size() / digitWidth <= qMax(decpt, 1) || !digits.endsWith(zero));
break;
}
if (mustMarkDecimal || decpt < digits.length() / digitWidth)
if (mustMarkDecimal || decpt < digits.size() / digitWidth)
digits.insert(decpt * digitWidth, decimalPoint());
if (groupDigits) {
@ -3787,11 +3787,11 @@ QString QLocaleData::exponentForm(QString &&digits, int decpt, int precision,
digits.append(zero);
break;
case PMChopTrailingZeros:
Q_ASSERT(digits.length() / digitWidth <= 1 || !digits.endsWith(zero));
Q_ASSERT(digits.size() / digitWidth <= 1 || !digits.endsWith(zero));
break;
}
if (mustMarkDecimal || digits.length() > digitWidth)
if (mustMarkDecimal || digits.size() > digitWidth)
digits.insert(digitWidth, decimalPoint());
digits.append(exponentSeparator());
@ -3840,7 +3840,7 @@ QString QLocaleData::applyIntegerFormatting(QString &&numStr, bool negative, int
{
const QString zero = base == 10 ? zeroDigit() : QStringLiteral("0");
const auto digitWidth = zero.size();
const auto digitCount = numStr.length() / digitWidth;
const auto digitCount = numStr.size() / digitWidth;
const auto basePrefix = [&] () -> QStringView {
if (flags & ShowBase) {

View File

@ -687,7 +687,7 @@ static T dtoString(double d, QLocaleData::DoubleForm form, int precision, bool u
bool negative = false;
int length = 0;
int decpt = 0;
qt_doubleToAscii(d, form, precision, buffer.data(), buffer.length(), negative, length, decpt);
qt_doubleToAscii(d, form, precision, buffer.data(), buffer.size(), negative, length, decpt);
QLatin1StringView view(buffer.data(), length);
const bool succinct = form == QLocaleData::DFSignificantDigits;
qsizetype total = (negative ? 1 : 0) + length;

View File

@ -894,7 +894,7 @@ void QRegularExpressionPrivate::compilePattern()
PCRE2_SIZE patternErrorOffset;
compiledPattern = pcre2_compile_16(reinterpret_cast<PCRE2_SPTR16>(pattern.constData()),
pattern.length(),
pattern.size(),
options,
&errorCode,
&patternErrorOffset,
@ -1540,10 +1540,10 @@ QString QRegularExpression::errorString() const
QString errorString;
int errorStringLength;
do {
errorString.resize(errorString.length() + 64);
errorString.resize(errorString.size() + 64);
errorStringLength = pcre2_get_error_message_16(d->errorCode,
reinterpret_cast<ushort *>(errorString.data()),
errorString.length());
errorString.size());
} while (errorStringLength < 0);
errorString.resize(errorStringLength);

View File

@ -3444,7 +3444,7 @@ QString &QString::remove(QChar ch, Qt::CaseSensitivity cs)
*/
QString &QString::replace(qsizetype pos, qsizetype len, const QString &after)
{
return replace(pos, len, after.constData(), after.length());
return replace(pos, len, after.constData(), after.size());
}
/*!
@ -4164,7 +4164,7 @@ QString &QString::replace(QChar c, QLatin1StringView after, Qt::CaseSensitivity
*/
qsizetype QString::indexOf(const QString &str, qsizetype from, Qt::CaseSensitivity cs) const
{
return QtPrivate::findString(QStringView(unicode(), length()), from, QStringView(str.unicode(), str.length()), cs);
return QtPrivate::findString(QStringView(unicode(), length()), from, QStringView(str.unicode(), str.size()), cs);
}
/*!
@ -4418,7 +4418,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after)
// 1. build the backreferences list, holding where the backreferences
// are in the replacement string
QList<QStringCapture> backReferences;
const qsizetype al = after.length();
const qsizetype al = after.size();
const QChar *ac = after.unicode();
for (qsizetype i = 0; i < al - 1; i++) {
@ -6422,7 +6422,7 @@ int QLatin1StringView::compare_helper(const QChar *data1, qsizetype length1, QLa
*/
int QString::localeAwareCompare(const QString &other) const
{
return localeAwareCompare_helper(constData(), length(), other.constData(), other.length());
return localeAwareCompare_helper(constData(), length(), other.constData(), other.size());
}
/*!
@ -7078,27 +7078,27 @@ QString QString::vasprintf(const char *cformat, va_list ap)
switch (length_mod) {
case lm_hh: {
signed char *n = va_arg(ap, signed char*);
*n = result.length();
*n = result.size();
break;
}
case lm_h: {
short int *n = va_arg(ap, short int*);
*n = result.length();
*n = result.size();
break;
}
case lm_l: {
long int *n = va_arg(ap, long int*);
*n = result.length();
*n = result.size();
break;
}
case lm_ll: {
qint64 *n = va_arg(ap, qint64*);
*n = result.length();
*n = result.size();
break;
}
default: {
int *n = va_arg(ap, int*);
*n = result.length();
*n = result.size();
break;
}
}
@ -7928,7 +7928,7 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::
char16_t ucs4Low = QChar::lowSurrogate(n.ucs4);
char16_t oldHigh = QChar::highSurrogate(n.old_mapping);
char16_t oldLow = QChar::lowSurrogate(n.old_mapping);
while (pos < s.length() - 1) {
while (pos < s.size() - 1) {
if (s.at(pos).unicode() == ucs4High && s.at(pos + 1).unicode() == ucs4Low) {
if (!d)
d = data->data();
@ -7938,7 +7938,7 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::
++pos;
}
} else {
while (pos < s.length()) {
while (pos < s.size()) {
if (s.at(pos).unicode() == n.ucs4) {
if (!d)
d = data->data();
@ -8381,7 +8381,7 @@ QString QString::arg(qlonglong a, int fieldWidth, int base, QChar fillChar) cons
if (d.occurrences > d.locale_occurrences) {
arg = QLocaleData::c()->longLongToString(a, -1, base, fieldWidth, flags);
Q_ASSERT(fillChar != u'0' || !qIsFinite(a)
|| fieldWidth <= arg.length());
|| fieldWidth <= arg.size());
}
QString localeArg;
@ -8391,7 +8391,7 @@ QString QString::arg(qlonglong a, int fieldWidth, int base, QChar fillChar) cons
flags |= QLocaleData::GroupDigits;
localeArg = locale.d->m_data->longLongToString(a, -1, base, fieldWidth, flags);
Q_ASSERT(fillChar != u'0' || !qIsFinite(a)
|| fieldWidth <= localeArg.length());
|| fieldWidth <= localeArg.size());
}
return replaceArgEscapes(*this, d, fieldWidth, arg, localeArg, fillChar);
@ -8429,7 +8429,7 @@ QString QString::arg(qulonglong a, int fieldWidth, int base, QChar fillChar) con
if (d.occurrences > d.locale_occurrences) {
arg = QLocaleData::c()->unsLongLongToString(a, -1, base, fieldWidth, flags);
Q_ASSERT(fillChar != u'0' || !qIsFinite(a)
|| fieldWidth <= arg.length());
|| fieldWidth <= arg.size());
}
QString localeArg;
@ -8439,7 +8439,7 @@ QString QString::arg(qulonglong a, int fieldWidth, int base, QChar fillChar) con
flags |= QLocaleData::GroupDigits;
localeArg = locale.d->m_data->unsLongLongToString(a, -1, base, fieldWidth, flags);
Q_ASSERT(fillChar != u'0' || !qIsFinite(a)
|| fieldWidth <= localeArg.length());
|| fieldWidth <= localeArg.size());
}
return replaceArgEscapes(*this, d, fieldWidth, arg, localeArg, fillChar);
@ -8551,7 +8551,7 @@ QString QString::arg(double a, int fieldWidth, char format, int precision, QChar
arg = QLocaleData::c()->doubleToString(a, precision, form, fieldWidth,
flags | QLocaleData::ZeroPadExponent);
Q_ASSERT(fillChar != u'0' || !qIsFinite(a)
|| fieldWidth <= arg.length());
|| fieldWidth <= arg.size());
}
QString localeArg;
@ -8567,7 +8567,7 @@ QString QString::arg(double a, int fieldWidth, char format, int precision, QChar
flags |= QLocaleData::AddTrailingZeroes;
localeArg = locale.d->m_data->doubleToString(a, precision, form, fieldWidth, flags);
Q_ASSERT(fillChar != u'0' || !qIsFinite(a)
|| fieldWidth <= localeArg.length());
|| fieldWidth <= localeArg.size());
}
return replaceArgEscapes(*this, d, fieldWidth, arg, localeArg, fillChar);
@ -10320,10 +10320,10 @@ QDataStream &operator<<(QDataStream &out, const QString &str)
if (!str.isNull() || out.version() < 3) {
if ((out.byteOrder() == QDataStream::BigEndian) == (QSysInfo::ByteOrder == QSysInfo::BigEndian)) {
out.writeBytes(reinterpret_cast<const char *>(str.unicode()),
static_cast<uint>(sizeof(QChar) * str.length()));
static_cast<uint>(sizeof(QChar) * str.size()));
} else {
QVarLengthArray<char16_t> buffer(str.length());
qbswap<sizeof(char16_t)>(str.constData(), str.length(), buffer.data());
QVarLengthArray<char16_t> buffer(str.size());
qbswap<sizeof(char16_t)>(str.constData(), str.size(), buffer.data());
out.writeBytes(reinterpret_cast<const char *>(buffer.data()),
static_cast<uint>(sizeof(char16_t) * buffer.size()));
}

View File

@ -678,7 +678,7 @@ public:
QString &insert(qsizetype i, QChar c);
QString &insert(qsizetype i, const QChar *uc, qsizetype len);
inline QString &insert(qsizetype i, const QString &s) { return insert(i, s.constData(), s.length()); }
inline QString &insert(qsizetype i, const QString &s) { return insert(i, s.constData(), s.size()); }
inline QString &insert(qsizetype i, QStringView v) { return insert(i, v.data(), v.length()); }
QString &insert(qsizetype i, QLatin1StringView s);

View File

@ -877,7 +877,7 @@ QByteArray QUtf16::convertFromUnicode(QStringView in, QStringConverter::State *s
QByteArray d(length, Qt::Uninitialized);
char *end = convertFromUnicode(d.data(), in, state, endian);
Q_ASSERT(end - d.constData() == d.length());
Q_ASSERT(end - d.constData() == d.size());
Q_UNUSED(end);
return d;
}
@ -1491,15 +1491,15 @@ static char *toLatin1(char *out, QStringView in, QStringConverter::State *state)
static QChar *fromLocal8Bit(QChar *out, QByteArrayView in, QStringConverter::State *state)
{
QString s = QLocal8Bit::convertToUnicode(in, state);
memcpy(out, s.constData(), s.length()*sizeof(QChar));
return out + s.length();
memcpy(out, s.constData(), s.size()*sizeof(QChar));
return out + s.size();
}
static char *toLocal8Bit(char *out, QStringView in, QStringConverter::State *state)
{
QByteArray s = QLocal8Bit::convertFromUnicode(in, state);
memcpy(out, s.constData(), s.length());
return out + s.length();
memcpy(out, s.constData(), s.size());
return out + s.size();
}

View File

@ -87,7 +87,7 @@ public:
}
inline QString join(const QString &sep) const
{ return QtPrivate::QStringList_join(self(), sep.constData(), sep.length()); }
{ return QtPrivate::QStringList_join(self(), sep.constData(), sep.size()); }
inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
{ return QtPrivate::QStringList_filter(self(), str, cs); }
inline QStringList &replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive)

View File

@ -726,7 +726,7 @@ void QFutureInterfaceBasePrivate::sendCallOut(const QFutureCallOutEvent &callOut
if (outputConnections.isEmpty())
return;
for (int i = 0; i < outputConnections.count(); ++i)
for (int i = 0; i < outputConnections.size(); ++i)
outputConnections.at(i)->postCallOutEvent(callOutEvent);
}
@ -736,7 +736,7 @@ void QFutureInterfaceBasePrivate::sendCallOuts(const QFutureCallOutEvent &callOu
if (outputConnections.isEmpty())
return;
for (int i = 0; i < outputConnections.count(); ++i) {
for (int i = 0; i < outputConnections.size(); ++i) {
QFutureCallOutInterface *interface = outputConnections.at(i);
interface->postCallOutEvent(callOutEvent1);
interface->postCallOutEvent(callOutEvent2);

View File

@ -347,7 +347,7 @@ inline bool QFutureInterface<T>::reportResults(const QList<T> &_results, int beg
if (store.filterMode()) {
this->reportResultsReady(resultCountBefore, store.count());
} else {
this->reportResultsReady(insertIndex, insertIndex + _results.count());
this->reportResultsReady(insertIndex, insertIndex + _results.size());
}
return true;
}

View File

@ -38,12 +38,12 @@ public:
void waitForFinished()
{
if (m_cancelOnWait) {
for (int i = 0; i < m_futures.count(); ++i) {
for (int i = 0; i < m_futures.size(); ++i) {
m_futures[i].cancel();
}
}
for (int i = 0; i < m_futures.count(); ++i) {
for (int i = 0; i < m_futures.size(); ++i) {
m_futures[i].waitForFinished();
}
}

View File

@ -200,9 +200,9 @@ void QThreadPoolPrivate::enqueueTask(QRunnable *runnable, int priority)
int QThreadPoolPrivate::activeThreadCount() const
{
return (allThreads.count()
- expiredThreads.count()
- waitingThreads.count()
return (allThreads.size()
- expiredThreads.size()
- waitingThreads.size()
+ reservedThreads);
}

View File

@ -51,7 +51,7 @@ QThreadStorageData::QThreadStorageData(void (*func)(void *))
no where to store it, and no way to actually call it.
*/
QThreadData *data = QThreadData::current();
id = data->tls.count();
id = data->tls.size();
DEBUG_MSG("QThreadStorageData: Allocated id %d, destructor %p cannot be stored", id, func);
return;
}

View File

@ -4998,7 +4998,7 @@ QDateTime QDateTime::fromString(QStringView string, Qt::DateFormat format)
// Documented as "ddd MMM d HH:mm:ss yyyy" with optional offset-suffix;
// and allow time either before or after year.
if (parts.count() < 5 || it != tokens.end())
if (parts.size() < 5 || it != tokens.end())
return QDateTime();
// Year and time can be in either order.
@ -5027,7 +5027,7 @@ QDateTime QDateTime::fromString(QStringView string, Qt::DateFormat format)
if (!time.isValid())
return QDateTime();
if (parts.count() == 5)
if (parts.size() == 5)
return QDateTime(date, time, Qt::LocalTime);
QStringView tz = parts.at(5);

View File

@ -662,7 +662,7 @@ QByteArray QTimeZonePrivate::windowsIdToDefaultIanaId(const QByteArray &windowsI
QLocale::Territory territory)
{
const QList<QByteArray> list = windowsIdToIanaIds(windowsId, territory);
return list.count() > 0 ? list.first() : QByteArray();
return list.size() > 0 ? list.first() : QByteArray();
}
QList<QByteArray> QTimeZonePrivate::windowsIdToIanaIds(const QByteArray &windowsId)

View File

@ -357,7 +357,7 @@ static QDate calculatePosixDate(const QByteArray &dateRule, int year)
if (dateRule.at(0) == 'M') {
// nth week in month format "Mmonth.week.dow"
QList<QByteArray> dateParts = dateRule.split('.');
if (dateParts.count() > 2) {
if (dateParts.size() > 2) {
int month = dateParts.at(0).mid(1).toInt(&ok);
int week = ok ? dateParts.at(1).toInt(&ok) : 0;
int dow = ok ? dateParts.at(2).toInt(&ok) : 0;
@ -526,7 +526,7 @@ static auto validatePosixRule(const QByteArray &posixRule)
// http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
// See also calculatePosixTransition()'s reference.
const auto parts = posixRule.split(',');
const struct { bool isValid, hasDst; } fail{false, false}, good{true, parts.count() > 1};
const struct { bool isValid, hasDst; } fail{false, false}, good{true, parts.size() > 1};
const QByteArray &zoneinfo = parts.at(0);
if (zoneinfo.isEmpty())
return fail;
@ -548,13 +548,13 @@ static auto validatePosixRule(const QByteArray &posixRule)
return fail;
if (good.hasDst) {
if (parts.count() != 3 || parts.at(1).isEmpty() || parts.at(2).isEmpty())
if (parts.size() != 3 || parts.at(1).isEmpty() || parts.at(2).isEmpty())
return fail;
for (int i = 1; i < 3; ++i) {
const auto tran = parts.at(i).split('/');
if (!calculatePosixDate(tran.at(0), 1972).isValid())
return fail;
if (tran.count() > 1) {
if (tran.size() > 1) {
const auto time = tran.at(1);
if (parsePosixTime(time.begin(), time.end()) == INT_MIN)
return fail;
@ -595,7 +595,7 @@ static QList<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArray
}
// If only the name part, or no DST specified, then no transitions
if (parts.count() == 1 || !dstZone.hasValidOffset()) {
if (parts.size() == 1 || !dstZone.hasValidOffset()) {
QTimeZonePrivate::Data data;
data.atMSecsSinceEpoch = lastTranMSecs;
data.offsetFromUtc = stdZone.offset;
@ -605,19 +605,19 @@ static QList<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArray
result << data;
return result;
}
if (parts.count() < 3 || parts.at(1).isEmpty() || parts.at(2).isEmpty())
if (parts.size() < 3 || parts.at(1).isEmpty() || parts.at(2).isEmpty())
return result; // Malformed.
// Get the std to dst transition details
const int twoOClock = 7200; // Default transition time, when none specified
const auto dstParts = parts.at(1).split('/');
const QByteArray dstDateRule = dstParts.at(0);
const int dstTime = dstParts.count() < 2 ? twoOClock : parsePosixTransitionTime(dstParts.at(1));
const int dstTime = dstParts.size() < 2 ? twoOClock : parsePosixTransitionTime(dstParts.at(1));
// Get the dst to std transition details
const auto stdParts = parts.at(2).split('/');
const QByteArray stdDateRule = stdParts.at(0);
const int stdTime = stdParts.count() < 2 ? twoOClock : parsePosixTransitionTime(stdParts.at(1));
const int stdTime = stdParts.size() < 2 ? twoOClock : parsePosixTransitionTime(stdParts.at(1));
if (dstDateRule.isEmpty() || stdDateRule.isEmpty() || dstTime == INT_MIN || stdTime == INT_MIN)
return result; // Malformed.
@ -834,7 +834,7 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::findEntry(const QByteArray &ianaId)
}
// Now for each transition time calculate and store our rule:
const int tranCount = tranList.count();;
const int tranCount = tranList.size();;
ret.m_tranTimes.reserve(tranCount);
// The DST offset when in effect: usually stable, usually an hour:
int lastDstOff = 3600;

View File

@ -691,7 +691,7 @@ bool QCommandLineParserPrivate::parse(const QStringList &args)
if (forcePositional) {
positionalArgumentList.append(argument);
} else if (argument.startsWith(doubleDashString)) {
if (argument.length() > 2) {
if (argument.size() > 2) {
QString optionName = argument.mid(2).section(assignChar, 0, 0);
if (registerFoundOption(optionName)) {
if (!parseOptionValue(optionName, argument, &argumentIterator, args.end()))
@ -1042,7 +1042,7 @@ static QString wrapText(const QString &names, int optionNameMaxWidth, const QStr
int lastBreakable = -1;
const int max = 79 - (indentation.size() + optionNameMaxWidth + 1);
int x = 0;
const int len = description.length();
const int len = description.size();
for (int i = 0; i < len; ++i) {
++x;
@ -1116,7 +1116,7 @@ QString QCommandLineParserPrivate::helpText(bool includeQtOptions) const
const QStringList optionNames = option.names();
QString optionNamesString;
for (const QString &optionName : optionNames) {
const int numDashes = optionName.length() == 1 ? 1 : 2;
const int numDashes = optionName.size() == 1 ? 1 : 2;
optionNamesString += QLatin1StringView("--", numDashes) + optionName + ", "_L1;
}
if (!optionNames.isEmpty())
@ -1125,7 +1125,7 @@ QString QCommandLineParserPrivate::helpText(bool includeQtOptions) const
if (!valueName.isEmpty())
optionNamesString += " <"_L1 + valueName + u'>';
optionNameList.append(optionNamesString);
longestOptionNameString = qMax(longestOptionNameString, optionNamesString.length());
longestOptionNameString = qMax(longestOptionNameString, optionNamesString.size());
}
++longestOptionNameString;
const int optionNameMaxWidth = qMin(50, longestOptionNameString);

View File

@ -447,7 +447,7 @@ struct BezierEase : public QEasingCurveFunction
{
if (_bezierCurves.constLast() == QPointF(1.0, 1.0)) {
_init = true;
_curveCount = _bezierCurves.count() / 3;
_curveCount = _bezierCurves.size() / 3;
for (int i=0; i < _curveCount; i++) {
_intervals[i] = _bezierCurves.at(i * 3 + 2).x();
@ -466,17 +466,17 @@ struct BezierEase : public QEasingCurveFunction
_curves[0].p3y = _bezierCurves.at(2).y();
} else if (i == (_curveCount - 1)) {
_curves[i].p0x = _bezierCurves.at(_bezierCurves.count() - 4).x();
_curves[i].p0y = _bezierCurves.at(_bezierCurves.count() - 4).y();
_curves[i].p0x = _bezierCurves.at(_bezierCurves.size() - 4).x();
_curves[i].p0y = _bezierCurves.at(_bezierCurves.size() - 4).y();
_curves[i].p1x = _bezierCurves.at(_bezierCurves.count() - 3).x();
_curves[i].p1y = _bezierCurves.at(_bezierCurves.count() - 3).y();
_curves[i].p1x = _bezierCurves.at(_bezierCurves.size() - 3).x();
_curves[i].p1y = _bezierCurves.at(_bezierCurves.size() - 3).y();
_curves[i].p2x = _bezierCurves.at(_bezierCurves.count() - 2).x();
_curves[i].p2y = _bezierCurves.at(_bezierCurves.count() - 2).y();
_curves[i].p2x = _bezierCurves.at(_bezierCurves.size() - 2).x();
_curves[i].p2y = _bezierCurves.at(_bezierCurves.size() - 2).y();
_curves[i].p3x = _bezierCurves.at(_bezierCurves.count() - 1).x();
_curves[i].p3y = _bezierCurves.at(_bezierCurves.count() - 1).y();
_curves[i].p3x = _bezierCurves.at(_bezierCurves.size() - 1).x();
_curves[i].p3y = _bezierCurves.at(_bezierCurves.size() - 1).y();
} else {
_curves[i].p0x = _bezierCurves.at(i * 3 - 1).x();
_curves[i].p0y = _bezierCurves.at(i * 3 - 1).y();
@ -535,7 +535,7 @@ struct BezierEase : public QEasingCurveFunction
qreal value(qreal x) override
{
Q_ASSERT(_bezierCurves.count() % 3 == 0);
Q_ASSERT(_bezierCurves.size() % 3 == 0);
if (_bezierCurves.isEmpty()) {
return x;
@ -869,7 +869,7 @@ struct TCBEase : public BezierEase
qreal value(qreal x) override
{
Q_ASSERT(_bezierCurves.count() % 3 == 0);
Q_ASSERT(_bezierCurves.size() % 3 == 0);
if (_bezierCurves.isEmpty()) {
qWarning("QEasingCurve: Invalid tcb curve");

View File

@ -279,7 +279,7 @@ void QDBusAdaptorConnector::relay(QObject *senderObj, int lastSignalIdx, void **
qPrintable(errorMsg));
return;
}
if (inputCount + 1 != types.count() ||
if (inputCount + 1 != types.size() ||
types.at(inputCount) == QDBusMetaTypeId::message()) {
// invalid signal signature
qWarning("QDBusAbstractAdaptor: Cannot relay signal %s::%s",
@ -288,7 +288,7 @@ void QDBusAdaptorConnector::relay(QObject *senderObj, int lastSignalIdx, void **
}
QVariantList args;
const int numTypes = types.count();
const int numTypes = types.size();
args.reserve(numTypes - 1);
for (int i = 1; i < numTypes; ++i)
args << QVariant(QMetaType(types.at(i)), argv[i]);

View File

@ -862,7 +862,7 @@ bool QDBusConnection::registerObject(const QString &path, const QString &interfa
QDBusConnectionPrivate::ObjectTreeNode *node = &d->rootNode;
int i = 1;
while (node) {
if (pathComponents.count() == i) {
if (pathComponents.size() == i) {
// this node exists
// consider it free if there's no object here and the user is not trying to
// replace the object sub-tree
@ -972,7 +972,7 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
int i = 1;
while (node) {
if (pathComponents.count() == i)
if (pathComponents.size() == i)
return node->obj;
if ((node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath))
return node->obj;

View File

@ -349,7 +349,7 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root,
return root;
}
int start = 0;
int length = fullpath.length();
int length = fullpath.size();
if (fullpath.at(0) == u'/')
start = 1;
@ -391,7 +391,7 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root,
static QObject *findChildObject(const QDBusConnectionPrivate::ObjectTreeNode *root,
const QString &fullpath, int start)
{
int length = fullpath.length();
int length = fullpath.size();
// any object in the tree can tell us to switch to its own object tree:
const QDBusConnectionPrivate::ObjectTreeNode *node = root;
@ -575,7 +575,7 @@ static void huntAndUnregister(const QList<QStringView> &pathComponents, int i,
QDBusConnection::UnregisterMode mode,
QDBusConnectionPrivate::ObjectTreeNode *node)
{
if (pathComponents.count() == i) {
if (pathComponents.size() == i) {
// found it
node->obj = nullptr;
node->flags = 0;
@ -699,14 +699,14 @@ static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags,
continue;
bool ok = true;
for (int j = i; ok && j < metaTypes.count(); ++j)
for (int j = i; ok && j < metaTypes.size(); ++j)
if (QDBusMetaType::typeToSignature(metaTypes.at(i)) == nullptr)
ok = false;
if (!ok)
continue;
// consistency check:
if (isAsync && metaTypes.count() > i + 1)
if (isAsync && metaTypes.size() > i + 1)
continue;
if (mm.methodType() == QMetaMethod::Slot) {
@ -753,11 +753,11 @@ QDBusCallDeliveryEvent *QDBusConnectionPrivate::prepareReply(QDBusConnectionPriv
Q_ASSERT(object);
Q_UNUSED(object);
int n = metaTypes.count() - 1;
int n = metaTypes.size() - 1;
if (metaTypes[n] == QDBusMetaTypeId::message())
--n;
if (msg.arguments().count() < n)
if (msg.arguments().size() < n)
return nullptr; // too few arguments
// check that types match
@ -829,7 +829,7 @@ bool QDBusConnectionPrivate::activateCall(QObject* object, int flags, const QDBu
qvariant_cast<QDBusSlotCache>(object->property(cachePropertyName));
QString cacheKey = msg.member(), signature = msg.signature();
if (!signature.isEmpty()) {
cacheKey.reserve(cacheKey.length() + 1 + signature.length());
cacheKey.reserve(cacheKey.size() + 1 + signature.size());
cacheKey += u'.';
cacheKey += signature;
}
@ -852,7 +852,7 @@ bool QDBusConnectionPrivate::activateCall(QObject* object, int flags, const QDBu
// ### this is where we want to add the connection as an arg too
// try with no parameters, but with a QDBusMessage
slotData.slotIdx = ::findSlot(mo, memberName, flags, QString(), slotData.metaTypes);
if (slotData.metaTypes.count() != 2 ||
if (slotData.metaTypes.size() != 2 ||
slotData.metaTypes.at(1) != QDBusMetaTypeId::message()) {
// not found
// save the negative lookup
@ -890,10 +890,10 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q
"function called for an object that is in another thread!!");
QVarLengthArray<void *, 10> params;
params.reserve(metaTypes.count());
params.reserve(metaTypes.size());
QVarLengthArray<QVariant, 10> auxParameters; // we cannot allow reallocation here, since we
auxParameters.reserve(metaTypes.count()); // keep references to the entries
auxParameters.reserve(metaTypes.size()); // keep references to the entries
// let's create the parameter list
@ -902,7 +902,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q
// add the input parameters
int i;
int pCount = qMin(msg.arguments().count(), metaTypes.count() - 1);
int pCount = qMin(msg.arguments().size(), metaTypes.size() - 1);
for (i = 1; i <= pCount; ++i) {
auto id = metaTypes[i];
if (id == QDBusMetaTypeId::message())
@ -918,7 +918,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q
const QDBusArgument &in =
*reinterpret_cast<const QDBusArgument *>(arg.constData());
QVariant &out = auxParameters[auxParameters.count() - 1];
QVariant &out = auxParameters[auxParameters.size() - 1];
if (Q_UNLIKELY(!QDBusMetaType::demarshall(in, out.metaType(), out.data())))
qFatal("Internal error: demarshalling function for type '%s' (%d) failed!",
@ -933,13 +933,13 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q
}
}
if (metaTypes.count() > i && metaTypes[i] == QDBusMetaTypeId::message()) {
if (metaTypes.size() > i && metaTypes[i] == QDBusMetaTypeId::message()) {
params.append(const_cast<void*>(static_cast<const void*>(&msg)));
++i;
}
// output arguments
const int numMetaTypes = metaTypes.count();
const int numMetaTypes = metaTypes.size();
QVariantList outputArgs;
if (metaTypes[0].id() != QMetaType::Void && metaTypes[0].isValid()) {
outputArgs.reserve(numMetaTypes - i + 1);
@ -1296,7 +1296,7 @@ int QDBusConnectionPrivate::findSlot(QObject *obj, const QByteArray &normalizedN
QString errorMsg;
int inputCount = qDBusParametersForMethod(obj->metaObject()->method(midx), params, errorMsg);
if ( inputCount == -1 || inputCount + 1 != params.count() )
if ( inputCount == -1 || inputCount + 1 != params.size() )
return -1; // failed to parse or invalid arguments or output arguments
return midx;
@ -1333,13 +1333,13 @@ bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hoo
mname = QString::fromUtf8(normalizedName);
}
key = mname;
key.reserve(interface.length() + 1 + mname.length());
key.reserve(interface.size() + 1 + mname.size());
key += u':';
key += interface;
if (buildSignature) {
hook.signature.clear();
for (int i = 1; i < hook.params.count(); ++i)
for (int i = 1; i < hook.params.size(); ++i)
if (hook.params.at(i) != QDBusMetaTypeId::message())
hook.signature += QLatin1StringView(QDBusMetaType::typeToSignature(hook.params.at(i)));
}
@ -1435,7 +1435,7 @@ void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMes
}
}
if (pathStartPos != msg.path().length()) {
if (pathStartPos != msg.path().size()) {
node.flags &= ~QDBusConnection::ExportAllSignals;
node.obj = findChildObject(&node, msg.path(), pathStartPos);
if (!node.obj) {
@ -1653,14 +1653,14 @@ void QDBusConnectionPrivate::handleSignal(const QDBusMessage& msg)
// (but not both)
QString key = msg.member();
key.reserve(key.length() + 1 + msg.interface().length());
key.reserve(key.size() + 1 + msg.interface().size());
key += u':';
key += msg.interface();
QDBusReadLocker locker(HandleSignalAction, this);
handleSignal(key, msg); // one try
key.truncate(msg.member().length() + 1); // keep the ':'
key.truncate(msg.member().size() + 1); // keep the ':'
handleSignal(key, msg); // second try
key = u':';

View File

@ -187,7 +187,7 @@ propertyNotFoundError(const QDBusMessage &msg, const QString &interface_name, co
QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg)
{
Q_ASSERT(msg.arguments().count() == 2);
Q_ASSERT(msg.arguments().size() == 2);
Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(),
"QDBusConnection: internal threading error",
"function called for an object that is in another thread!!");
@ -345,7 +345,7 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant
QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg)
{
Q_ASSERT(msg.arguments().count() == 3);
Q_ASSERT(msg.arguments().size() == 3);
Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(),
"QDBusConnection: internal threading error",
"function called for an object that is in another thread!!");
@ -445,7 +445,7 @@ static QVariantMap readAllProperties(QObject *object, int flags)
QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg)
{
Q_ASSERT(msg.arguments().count() == 1);
Q_ASSERT(msg.arguments().size() == 1);
Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(),
"QDBusConnection: internal threading error",
"function called for an object that is in another thread!!");

View File

@ -152,7 +152,7 @@ inline void QDBusMarshaller::append(const QByteArray &arg)
DBusMessageIter subiterator;
q_dbus_message_iter_open_container(&iterator, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE_AS_STRING,
&subiterator);
q_dbus_message_iter_append_fixed_array(&subiterator, DBUS_TYPE_BYTE, &cdata, arg.length());
q_dbus_message_iter_append_fixed_array(&subiterator, DBUS_TYPE_BYTE, &cdata, arg.size());
q_dbus_message_iter_close_container(&iterator, &subiterator);
}

View File

@ -266,7 +266,7 @@ void QDBusMetaObjectGenerator::parseMethods()
// convert the last commas:
if (!mm.parameterNames.isEmpty())
prototype[prototype.length() - 1] = ')';
prototype[prototype.size() - 1] = ')';
else
prototype.append(')');
@ -317,7 +317,7 @@ void QDBusMetaObjectGenerator::parseSignals()
// convert the last commas:
if (!mm.parameterNames.isEmpty())
prototype[prototype.length() - 1] = ')';
prototype[prototype.size() - 1] = ')';
else
prototype.append(')');
@ -387,8 +387,8 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
qsizetype methodParametersDataSize =
((aggregateParameterCount(signals_)
+ aggregateParameterCount(methods)) * 2) // types and parameter names
- signals_.count() // return "parameters" don't have names
- methods.count(); // ditto
- signals_.size() // return "parameters" don't have names
- methods.size(); // ditto
QDBusMetaObjectPrivate *header = reinterpret_cast<QDBusMetaObjectPrivate *>(idata.data());
static_assert(QMetaObjectPrivate::OutputRevision == 11, "QtDBus meta-object generator should generate the same version as moc");
@ -396,9 +396,9 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
header->className = 0;
header->classInfoCount = 0;
header->classInfoData = 0;
header->methodCount = int(signals_.count() + methods.count());
header->methodCount = int(signals_.size() + methods.size());
header->methodData = int(idata.size());
header->propertyCount = int(properties.count());
header->propertyCount = int(properties.size());
header->propertyData = int(header->methodData + header->methodCount *
QMetaObjectPrivate::IntsPerMethod + methodParametersDataSize);
header->enumeratorCount = 0;
@ -406,7 +406,7 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
header->constructorCount = 0;
header->constructorData = 0;
header->flags = RequiresVariantMetaObject;
header->signalCount = signals_.count();
header->signalCount = signals_.size();
// These are specific to QDBusMetaObject:
header->propertyDBusData = int(header->propertyData + header->propertyCount
* QMetaObjectPrivate::IntsPerProperty);
@ -416,9 +416,9 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
(header->methodCount * (QMetaObjectPrivate::IntsPerMethod+intsPerMethod)) + methodParametersDataSize +
(header->propertyCount * (QMetaObjectPrivate::IntsPerProperty+intsPerProperty));
for (const Method &mm : qAsConst(signals_))
data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
data_size += 2 + mm.inputTypes.size() + mm.outputTypes.size();
for (const Method &mm : qAsConst(methods))
data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
data_size += 2 + mm.inputTypes.size() + mm.outputTypes.size();
idata.resize(data_size + 1);
QMetaStringTable strings(className.toLatin1());
@ -429,7 +429,7 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
qsizetype typeidOffset = header->methodDBusData + header->methodCount * intsPerMethod;
idata[typeidOffset++] = 0; // eod
qsizetype totalMetaTypeCount = properties.count();
qsizetype totalMetaTypeCount = properties.size();
++totalMetaTypeCount; // + 1 for metatype of dynamic metaobject
for (const auto& methodContainer: {signals_, methods}) {
for (const auto& method: methodContainer) {
@ -441,7 +441,7 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
int propertyId = 0;
// add each method:
qsizetype currentMethodMetaTypeOffset = properties.count() + 1;
qsizetype currentMethodMetaTypeOffset = properties.size() + 1;
for (int x = 0; x < 2; ++x) {
// Signals must be added before other methods, to match moc.
QMap<QByteArray, Method> &map = (x == 0) ? signals_ : methods;
@ -494,14 +494,14 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
idata[parametersOffset++] = strings.enter(mm.parameterNames.at(i));
idata[signatureOffset++] = typeidOffset;
idata[typeidOffset++] = mm.inputTypes.count();
memcpy(idata.data() + typeidOffset, mm.inputTypes.data(), mm.inputTypes.count() * sizeof(uint));
typeidOffset += mm.inputTypes.count();
idata[typeidOffset++] = mm.inputTypes.size();
memcpy(idata.data() + typeidOffset, mm.inputTypes.data(), mm.inputTypes.size() * sizeof(uint));
typeidOffset += mm.inputTypes.size();
idata[signatureOffset++] = typeidOffset;
idata[typeidOffset++] = mm.outputTypes.count();
memcpy(idata.data() + typeidOffset, mm.outputTypes.data(), mm.outputTypes.count() * sizeof(uint));
typeidOffset += mm.outputTypes.count();
idata[typeidOffset++] = mm.outputTypes.size();
memcpy(idata.data() + typeidOffset, mm.outputTypes.data(), mm.outputTypes.size() * sizeof(uint));
typeidOffset += mm.outputTypes.size();
}
}

View File

@ -52,7 +52,7 @@ QString qDBusInterfaceFromMetaObject(const QMetaObject *mo)
if (interface.startsWith("QDBus"_L1)) {
interface.prepend("org.qtproject.QtDBus."_L1);
} else if (interface.startsWith(u'Q') &&
interface.length() >= 2 && interface.at(1).isUpper()) {
interface.size() >= 2 && interface.at(1).isUpper()) {
// assume it's Qt
interface.prepend("org.qtproject.Qt."_L1);
} else if (!QCoreApplication::instance()||
@ -128,7 +128,7 @@ int qDBusParametersForMethod(const QList<QByteArray> &parameterTypes, QList<QMet
if (type.endsWith('&')) {
QByteArray basictype = type;
basictype.truncate(type.length() - 1);
basictype.truncate(type.size() - 1);
QMetaType id = QMetaType::fromName(basictype);
if (!id.isValid()) {

View File

@ -138,7 +138,7 @@ bool QDBusPendingCallPrivate::setReplyCallback(QObject *target, const char *memb
// success
// construct the expected signature
int count = metaTypes.count() - 1;
int count = metaTypes.size() - 1;
if (count == 1 && metaTypes.at(1) == QDBusMetaTypeId::message()) {
// wildcard slot, can receive anything, so don't set the signature
return true;

View File

@ -169,7 +169,7 @@ void qDBusReplyFill(const QDBusMessage &reply, QDBusError &error, QVariant &data
return;
}
if (reply.arguments().count() >= 1 && reply.arguments().at(0).metaType() == data.metaType()) {
if (reply.arguments().size() >= 1 && reply.arguments().at(0).metaType() == data.metaType()) {
data = reply.arguments().at(0);
return;
}
@ -178,7 +178,7 @@ void qDBusReplyFill(const QDBusMessage &reply, QDBusError &error, QVariant &data
const char *receivedType = nullptr;
QByteArray receivedSignature;
if (reply.arguments().count() >= 1) {
if (reply.arguments().size() >= 1) {
if (reply.arguments().at(0).metaType() == QDBusMetaTypeId::argument()) {
// compare signatures instead
QDBusArgument arg = qvariant_cast<QDBusArgument>(reply.arguments().at(0));

View File

@ -59,7 +59,7 @@ static bool variantToString(const QVariant &arg, QString &out)
} else if (argType == QMetaType::QByteArray) {
out += u'{';
QByteArray list = arg.toByteArray();
for (int i = 0; i < list.length(); ++i) {
for (int i = 0; i < list.size(); ++i) {
out += QString::number(list.at(i));
out += ", "_L1;
}
@ -335,11 +335,11 @@ namespace QDBusUtil
*/
bool isValidInterfaceName(const QString& ifaceName)
{
if (ifaceName.isEmpty() || ifaceName.length() > DBUS_MAXIMUM_NAME_LENGTH)
if (ifaceName.isEmpty() || ifaceName.size() > DBUS_MAXIMUM_NAME_LENGTH)
return false;
const auto parts = QStringView{ifaceName}.split(u'.');
if (parts.count() < 2)
if (parts.size() < 2)
return false; // at least two parts
for (auto part : parts)
@ -363,7 +363,7 @@ namespace QDBusUtil
return false;
const auto parts = connName.mid(1).split(u'.');
if (parts.count() < 1)
if (parts.size() < 1)
return false;
for (QStringView part : parts) {
@ -402,14 +402,14 @@ namespace QDBusUtil
*/
bool isValidBusName(const QString &busName)
{
if (busName.isEmpty() || busName.length() > DBUS_MAXIMUM_NAME_LENGTH)
if (busName.isEmpty() || busName.size() > DBUS_MAXIMUM_NAME_LENGTH)
return false;
if (busName.startsWith(u':'))
return isValidUniqueConnectionName(busName);
const auto parts = QStringView{busName}.split(u'.');
if (parts.count() < 1)
if (parts.size() < 1)
return false;
for (QStringView part : parts) {

View File

@ -151,7 +151,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
qWarning() << "Skipped method" << mm.name() << ":" << qPrintable(errorMsg);
continue; // invalid form
}
if (isSignal && inputCount + 1 != types.count())
if (isSignal && inputCount + 1 != types.size())
continue; // signal with output arguments?
if (isSignal && types.at(inputCount) == QDBusMetaTypeId::message())
continue; // signal with QDBusMessage argument?
@ -159,7 +159,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
continue; // cloned signal?
int j;
for (j = 1; j < types.count(); ++j) {
for (j = 1; j < types.size(); ++j) {
// input parameter for a slot or output for a signal
if (types.at(j) == QDBusMetaTypeId::message()) {
isScriptable = true;

View File

@ -976,14 +976,14 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
if (!textRemoved.isEmpty()) {
data.setVariant(QVariant::fromValue(textRemoved));
QVariantList args = packDBusSignalArguments("delete"_L1, changePosition, textRemoved.length(), QVariant::fromValue(data));
QVariantList args = packDBusSignalArguments("delete"_L1, changePosition, textRemoved.size(), QVariant::fromValue(data));
sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
"TextChanged"_L1, args);
}
if (!textInserted.isEmpty()) {
data.setVariant(QVariant::fromValue(textInserted));
QVariantList args = packDBusSignalArguments("insert"_L1, changePosition, textInserted.length(), QVariant::fromValue(data));
QVariantList args = packDBusSignalArguments("insert"_L1, changePosition, textInserted.size(), QVariant::fromValue(data));
sendDBusSignal(path, ATSPI_DBUS_INTERFACE_EVENT_OBJECT ""_L1,
"TextChanged"_L1, args);
}
@ -2063,13 +2063,13 @@ namespace
QString atspiColor(const QString &ia2Color)
{
// "rgb(%u,%u,%u)" -> "%u,%u,%u"
return ia2Color.mid(4, ia2Color.length() - (4+1));
return ia2Color.mid(4, ia2Color.size() - (4+1));
}
QString atspiSize(const QString &ia2Size)
{
// "%fpt" -> "%f"
return ia2Size.left(ia2Size.length() - 2);
return ia2Size.left(ia2Size.size() - 2);
}
AtSpiAttribute atspiTextAttribute(const QString &ia2Name, const QString &ia2Value)
@ -2282,7 +2282,7 @@ static QString textForRange(QAccessibleInterface *accessible, int startOffset, i
}
QString txt = accessible->text(QAccessible::Value);
if (endOffset == -1)
endOffset = txt.length();
endOffset = txt.size();
return txt.mid(startOffset, endOffset - startOffset);
}
@ -2290,7 +2290,7 @@ static void replaceTextFallback(QAccessibleInterface *accessible, long startOffs
{
QString t = textForRange(accessible, 0, -1);
if (endOffset == -1)
endOffset = t.length();
endOffset = t.size();
if (endOffset - startOffset == 0)
t.insert(startOffset, txt);
else

View File

@ -173,11 +173,11 @@ QKeyEvent* QSpiApplicationAdaptor::copyKeyEvent(QKeyEvent* old)
void QSpiApplicationAdaptor::notifyKeyboardListenerCallback(const QDBusMessage& message)
{
if (!keyEvents.length()) {
if (!keyEvents.size()) {
qWarning("QSpiApplication::notifyKeyboardListenerCallback with no queued key called");
return;
}
Q_ASSERT(message.arguments().length() == 1);
Q_ASSERT(message.arguments().size() == 1);
if (message.arguments().at(0).toBool() == true) {
QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
delete event.second;

View File

@ -2008,7 +2008,7 @@ static QString textLineBoundary(int beforeAtAfter, const QString &text, int offs
{
Q_ASSERT(beforeAtAfter >= -1 && beforeAtAfter <= 1);
Q_ASSERT(*startOffset == -1 && *endOffset == -1);
int length = text.length();
int length = text.size();
Q_ASSERT(offset >= 0 && offset <= length);
// move offset into the right range (if asking for line before or after
@ -2057,10 +2057,10 @@ QString QAccessibleTextInterface::textBeforeOffset(int offset, QAccessible::Text
const QString txt = text(0, characterCount());
if (offset == -1)
offset = txt.length();
offset = txt.size();
*startOffset = *endOffset = -1;
if (txt.isEmpty() || offset <= 0 || offset > txt.length())
if (txt.isEmpty() || offset <= 0 || offset > txt.size())
return QString();
// type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
@ -2131,10 +2131,10 @@ QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible::TextB
const QString txt = text(0, characterCount());
if (offset == -1)
offset = txt.length();
offset = txt.size();
*startOffset = *endOffset = -1;
if (txt.isEmpty() || offset < 0 || offset >= txt.length())
if (txt.isEmpty() || offset < 0 || offset >= txt.size())
return QString();
// type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
@ -2169,20 +2169,20 @@ QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible::TextB
int toNext = boundary.toNextBoundary();
if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
break;
if (toNext < 0 || toNext >= txt.length())
if (toNext < 0 || toNext >= txt.size())
break; // not found, the boundary might not exist
}
Q_ASSERT(boundary.position() <= txt.length());
Q_ASSERT(boundary.position() <= txt.size());
*startOffset = boundary.position();
while (true) {
int toNext = boundary.toNextBoundary();
if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
break;
if (toNext < 0 || toNext >= txt.length())
if (toNext < 0 || toNext >= txt.size())
break; // not found, the boundary might not exist
}
Q_ASSERT(boundary.position() <= txt.length());
Q_ASSERT(boundary.position() <= txt.size());
*endOffset = boundary.position();
if ((*startOffset == -1) || (*endOffset == -1) || (*startOffset == *endOffset)) {
@ -2216,13 +2216,13 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
const QString txt = text(0, characterCount());
if (offset == -1)
offset = txt.length();
offset = txt.size();
*startOffset = *endOffset = -1;
if (txt.isEmpty() || offset < 0 || offset > txt.length())
if (txt.isEmpty() || offset < 0 || offset > txt.size())
return QString();
if (offset == txt.length() && boundaryType == QAccessible::CharBoundary)
if (offset == txt.size() && boundaryType == QAccessible::CharBoundary)
return QString();
// type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
@ -2243,7 +2243,7 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
return textLineBoundary(0, txt, offset, startOffset, endOffset);
case QAccessible::NoBoundary:
*startOffset = 0;
*endOffset = txt.length();
*endOffset = txt.size();
return txt;
default:
Q_UNREACHABLE();
@ -2261,11 +2261,11 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
Q_ASSERT(boundary.position() >= 0);
*startOffset = boundary.position();
while (boundary.toNextBoundary() < txt.length()) {
while (boundary.toNextBoundary() < txt.size()) {
if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)))
break;
}
Q_ASSERT(boundary.position() <= txt.length());
Q_ASSERT(boundary.position() <= txt.size());
*endOffset = boundary.position();
return txt.mid(*startOffset, *endOffset - *startOffset);

View File

@ -409,13 +409,13 @@ class Q_GUI_EXPORT QAccessibleTextInsertEvent : public QAccessibleTextCursorEven
{
public:
inline QAccessibleTextInsertEvent(QObject *obj, int position, const QString &text)
: QAccessibleTextCursorEvent(obj, position + int(text.length()))
: QAccessibleTextCursorEvent(obj, position + int(text.size()))
, m_position(position), m_text(text)
{
m_type = QAccessible::TextInserted;
}
inline QAccessibleTextInsertEvent(QAccessibleInterface *iface, int position, const QString &text)
: QAccessibleTextCursorEvent(iface, position + int(text.length()))
: QAccessibleTextCursorEvent(iface, position + int(text.size()))
, m_position(position), m_text(text)
{
m_type = QAccessible::TextInserted;
@ -469,13 +469,13 @@ class Q_GUI_EXPORT QAccessibleTextUpdateEvent : public QAccessibleTextCursorEven
{
public:
inline QAccessibleTextUpdateEvent(QObject *obj, int position, const QString &oldText, const QString &text)
: QAccessibleTextCursorEvent(obj, position + int(text.length()))
: QAccessibleTextCursorEvent(obj, position + int(text.size()))
, m_position(position), m_oldText(oldText), m_text(text)
{
m_type = QAccessible::TextUpdated;
}
inline QAccessibleTextUpdateEvent(QAccessibleInterface *iface, int position, const QString &oldText, const QString &text)
: QAccessibleTextCursorEvent(iface, position + int(text.length()))
: QAccessibleTextCursorEvent(iface, position + int(text.size()))
, m_position(position), m_oldText(oldText), m_text(text)
{
m_type = QAccessible::TextUpdated;

View File

@ -61,7 +61,7 @@ QSize QAbstractFileIconEngine::actualSize(const QSize &size, QIcon::Mode mode,
QIcon::State state)
{
const QList<QSize> &sizes = availableSizes(mode, state);
const int numberSizes = sizes.length();
const int numberSizes = sizes.size();
if (numberSizes == 0)
return QSize();

View File

@ -192,7 +192,7 @@ static QPixmapIconEngineEntry *bestSizeScaleMatch(const QSize &size, qreal scale
QPixmapIconEngineEntry *QPixmapIconEngine::tryMatch(const QSize &size, qreal scale, QIcon::Mode mode, QIcon::State state)
{
QPixmapIconEngineEntry *pe = nullptr;
for (int i = 0; i < pixmaps.count(); ++i)
for (int i = 0; i < pixmaps.size(); ++i)
if (pixmaps.at(i).mode == mode && pixmaps.at(i).state == state) {
if (pe)
pe = bestSizeScaleMatch(size, scale, &pixmaps[i], pe);
@ -269,7 +269,7 @@ QPixmap QPixmapIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIc
pm = pe->pixmap;
if (pm.isNull()) {
int idx = pixmaps.count();
int idx = pixmaps.size();
while (--idx >= 0) {
if (pe == &pixmaps.at(idx)) {
pixmaps.remove(idx);

Some files were not shown because too many files have changed in this diff Show More