Port from container::count() and length() to size() - V5

This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:

    const std::string o = "object";

    auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };

    auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
        auto exprOfDeclaredType = [&](auto decl) {
            return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
        };
        return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
    };

    auto renameMethod = [&] (ArrayRef<StringRef> classes,
                            StringRef from, StringRef to) {
        return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
                            callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
                        changeTo(cat(access(o, cat(to)), "()")),
                        cat("use '", to, "' instead of '", from, "'"));
    };

    renameMethod(<classes>, "count", "size");
    renameMethod(<classes>, "length", "size");

except that the on() matcher has been replaced by one that doesn't
ignoreParens().

a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.

Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().

Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-09-30 14:09:04 +02:00
parent 43cda7807b
commit 1c6bf3e09e
315 changed files with 3464 additions and 3461 deletions

View File

@ -87,7 +87,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
for(int pb_subdir = 0; pb_subdir < pb_subdirs.size(); ++pb_subdir) {
ProjectBuilderSubDirs *pb = pb_subdirs[pb_subdir];
const ProStringList &subdirs = pb->project->values("SUBDIRS");
for(int subdir = 0; subdir < subdirs.count(); subdir++) {
for(int subdir = 0; subdir < subdirs.size(); subdir++) {
ProString tmpk = subdirs[subdir];
const ProKey fkey(tmpk + ".file");
if (!pb->project->isEmpty(fkey)) {
@ -329,7 +329,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
t << "\t\t\tprojectReferences = (\n";
{
const ProStringList &qmake_subdirs = project->values("QMAKE_PBX_SUBDIRS");
for(int i = 0; i < qmake_subdirs.count(); i++) {
for(int i = 0; i < qmake_subdirs.size(); i++) {
const ProString &subdir = qmake_subdirs[i];
t << "\t\t\t\t{\n"
<< "\t\t\t\t\t" << writeSettings("ProductGroup", keyFor(subdir + "_PRODUCTGROUP")) << ";\n"
@ -658,7 +658,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
const QStringList &files = fileFixify(sources.at(source).files(project),
FileFixifyFromOutdir | FileFixifyAbsolute);
for(int f = 0; f < files.count(); ++f) {
for(int f = 0; f < files.size(); ++f) {
QString file = files[f];
if(!sources.at(source).compilerName().isNull() &&
!verifyExtraCompiler(sources.at(source).compilerName(), file))
@ -873,7 +873,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
"QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
for (int i = 0; libs[i]; i++) {
tmp = project->values(libs[i]);
for(int x = 0; x < tmp.count();) {
for(int x = 0; x < tmp.size();) {
bool libSuffixReplaced = false;
bool remove = false;
QString library, name;
@ -912,7 +912,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
if(opt.size() > 2) {
r = opt.mid(2).toQString();
} else {
if(x == tmp.count()-1)
if(x == tmp.size()-1)
break;
r = tmp[++x].toQString();
}
@ -921,12 +921,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
frameworkdirs.append(r);
}
} else if(opt == "-framework") {
if(x == tmp.count()-1)
if(x == tmp.size()-1)
break;
const ProString &framework = tmp[x+1];
ProStringList fdirs = frameworkdirs;
fdirs << "/System/Library/Frameworks/" << "/Library/Frameworks/";
for(int fdir = 0; fdir < fdirs.count(); fdir++) {
for(int fdir = 0; fdir < fdirs.size(); fdir++) {
if(exists(fdirs[fdir] + QDir::separator() + framework + ".framework")) {
remove = true;
library = fdirs[fdir] + Option::dir_sep + framework + ".framework";
@ -1008,12 +1008,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
mkt << "SUBLIBS= ";
// ### This is missing the parametrization found in unixmake2.cpp
tmp = project->values("SUBLIBS");
for(int i = 0; i < tmp.count(); i++)
for(int i = 0; i < tmp.size(); i++)
t << escapeFilePath("tmp/lib" + tmp[i] + ".a") << ' ';
t << Qt::endl << Qt::endl;
mkt << "sublibs: $(SUBLIBS)\n\n";
tmp = project->values("SUBLIBS");
for(int i = 0; i < tmp.count(); i++)
for(int i = 0; i < tmp.size(); i++)
t << escapeFilePath("tmp/lib" + tmp[i] + ".a") + ":\n\t"
<< var(ProKey("MAKELIB" + tmp[i])) << Qt::endl << Qt::endl;
mkt.flush();
@ -1148,7 +1148,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
//all bundle data
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
for(int i = 0; i < bundle_data.count(); i++) {
for(int i = 0; i < bundle_data.size(); i++) {
ProStringList bundle_files;
ProString path = project->first(ProKey(bundle_data[i] + ".path"));
const bool isEmbeddedFramework = ((!osx && path == QLatin1String("Frameworks"))
@ -1158,7 +1158,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
//all files
const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files"));
for(int file = 0; file < files.count(); file++) {
for(int file = 0; file < files.size(); file++) {
QString fn = fileFixify(files[file].toQString(), FileFixifyAbsolute);
QString name = fn.split(Option::dir_sep).back();
QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_DATA_FILE_REF." + bundle_data[i] + "-" + fn);
@ -1684,7 +1684,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";\n";
tmp = project->values("QMAKE_PBX_VARS");
for (int i = 0; i < tmp.count(); i++) {
for (int i = 0; i < tmp.size(); i++) {
QString var = tmp[i].toQString(), val = QString::fromLocal8Bit(qgetenv(var.toLatin1().constData()));
if (val.isEmpty() && var == "TB")
val = "/usr/bin/";
@ -1888,7 +1888,7 @@ ProStringList
ProjectBuilderMakefileGenerator::fixListForOutput(const ProStringList &l)
{
ProStringList ret;
for(int i = 0; i < l.count(); i++)
for(int i = 0; i < l.size(); i++)
ret += fixForOutput(l[i].toQString());
return ret;
}

View File

@ -39,7 +39,7 @@ using namespace QMakeInternal;
bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const
{
int argv0 = -1;
for(int i = 0; i < cmdline.count(); ++i) {
for(int i = 0; i < cmdline.size(); ++i) {
if(!cmdline.at(i).contains('=')) {
argv0 = i;
break;
@ -238,7 +238,7 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString
{
ProStringList vpath;
const ProValueMap &v = project->variables();
for(int val_it = 0; val_it < l.count(); ) {
for(int val_it = 0; val_it < l.size(); ) {
bool remove_file = false;
ProString &val = l[val_it];
if(!val.isEmpty()) {
@ -304,7 +304,7 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString
} else {
l.removeAt(val_it);
QString a;
for(int i = (int)files.count()-1; i >= 0; i--) {
for(int i = (int)files.size()-1; i >= 0; i--) {
a = real_dir + files[i];
if(!(flags & VPATH_NoFixify))
a = fileFixify(a);
@ -468,12 +468,12 @@ MakefileGenerator::init()
continue;
}
const ProStringList &tinn = v[innkey], &toutn = v[outnkey];
if (tinn.length() != 1) {
if (tinn.size() != 1) {
warn_msg(WarnLogic, "Substitute '%s.input' does not have exactly one value",
sub.toLatin1().constData());
continue;
}
if (toutn.length() != 1) {
if (toutn.size() != 1) {
warn_msg(WarnLogic, "Substitute '%s.output' does not have exactly one value",
sub.toLatin1().constData());
continue;
@ -639,7 +639,7 @@ MakefileGenerator::init()
paths << compilers.at(x).variable_in;
}
paths << "INCLUDEPATH" << "QMAKE_INTERNAL_INCLUDED_FILES" << "PRECOMPILED_HEADER";
for(int y = 0; y < paths.count(); y++) {
for(int y = 0; y < paths.size(); y++) {
ProStringList &l = v[paths[y].toKey()];
for (ProStringList::Iterator it = l.begin(); it != l.end(); ++it) {
if((*it).isEmpty())
@ -827,7 +827,7 @@ MakefileGenerator::init()
warn_msg(WarnLogic, "Dependency for [%s]: Not found %s", (*file_it).toLatin1().constData(),
dep.toLatin1().constData());
} else {
for(int i = 0; i < files.count(); i++)
for(int i = 0; i < files.size(); i++)
out_deps.append(dir + files[i]);
}
}
@ -1316,7 +1316,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
inst << cmd;
uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + filestr, FileFixifyAbsolute, false))));
}
for(int x = 0; x < files.count(); x++) {
for(int x = 0; x < files.size(); x++) {
QString file = files[x];
uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + file, FileFixifyAbsolute, false))));
QFileInfo fi(fileInfo(dirstr + file));
@ -1883,7 +1883,7 @@ void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCom
return;
QDir outDir(Option::output_dir);
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
for (int i = 0; i < dep_cmd_deps.count(); ++i) {
for (int i = 0; i < dep_cmd_deps.size(); ++i) {
QString &file = dep_cmd_deps[i];
const QString absFile = outDir.absoluteFilePath(file);
if (absFile == file) {
@ -2850,7 +2850,7 @@ MakefileGenerator::fixLibFlags(const ProKey &var)
const ProStringList &in = project->values(var);
ProStringList ret;
ret.reserve(in.length());
ret.reserve(in.size());
for (const ProString &v : in)
ret << fixLibFlag(v);
return ret;
@ -3538,7 +3538,7 @@ MakefileGenerator::LinkerResponseFileInfo MakefileGenerator::maybeCreateLinkerRe
// When using QMAKE_LINK_OBJECT_MAX, the number of object files (regardless of their path
// length) decides whether to use a response file. This is far from being a useful
// heuristic but let's keep this behavior for backwards compatibility.
if (linkerInputs.count() < threshold)
if (linkerInputs.size() < threshold)
return {};
} else {
// When using QMAKE_REPONSEFILE_THRESHOLD, try to determine the command line length of the

View File

@ -73,12 +73,12 @@ BuildsMetaMakefileGenerator::init()
const ProStringList &builds = project->values("BUILDS");
bool use_single_build = builds.isEmpty();
if(builds.count() > 1 && Option::output.fileName() == "-") {
if(builds.size() > 1 && Option::output.fileName() == "-") {
use_single_build = true;
warn_msg(WarnLogic, "Cannot direct to stdout when using multiple BUILDS.");
}
if(!use_single_build) {
for(int i = 0; i < builds.count(); i++) {
for(int i = 0; i < builds.size(); i++) {
ProString build = builds[i];
MakefileGenerator *makefile = processBuild(build);
if(!makefile)
@ -91,7 +91,7 @@ BuildsMetaMakefileGenerator::init()
} else {
Build *b = new Build;
b->name = name;
if(builds.count() != 1)
if(builds.size() != 1)
b->build = build.toQString();
b->makefile = makefile;
makefiles += b;

View File

@ -54,7 +54,7 @@ ProjectGenerator::init()
dirs.prepend(qmake_getpwd());
}
for(int i = 0; i < dirs.count(); ++i) {
for(int i = 0; i < dirs.size(); ++i) {
QString dir, regex, pd = dirs.at(i);
bool add_depend = false;
if(exists(pd)) {
@ -66,7 +66,7 @@ ProjectGenerator::init()
dir += Option::dir_sep;
if (Option::recursive) {
QStringList files = QDir(dir).entryList(QDir::Files);
for (int i = 0; i < files.count(); i++)
for (int i = 0; i < files.size(); i++)
dirs.append(dir + files[i] + QDir::separator() + builtin_regex);
}
regex = builtin_regex;
@ -92,11 +92,11 @@ ProjectGenerator::init()
const QDir d(dir);
if (Option::recursive) {
QStringList entries = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for (int i = 0; i < entries.count(); i++)
for (int i = 0; i < entries.size(); i++)
dirs.append(dir + entries[i] + QDir::separator() + regex);
}
QStringList files = d.entryList(QDir::nameFiltersFromString(regex));
for(int i = 0; i < (int)files.count(); i++) {
for(int i = 0; i < (int)files.size(); i++) {
QString file = d.absoluteFilePath(files[i]);
if (addFile(file)) {
add_depend = true;
@ -116,7 +116,7 @@ ProjectGenerator::init()
if(Option::projfile::do_pwd)
knownDirs.prepend(".");
const QString out_file = fileFixify(Option::output.fileName());
for(int i = 0; i < knownDirs.count(); ++i) {
for(int i = 0; i < knownDirs.size(); ++i) {
QString pd = knownDirs.at(i);
if(exists(pd)) {
QString newdir = pd;
@ -129,7 +129,7 @@ ProjectGenerator::init()
subdirs.append(newdir);
} else {
QStringList profiles = QDir(newdir).entryList(QStringList("*" + Option::pro_ext), QDir::Files);
for(int i = 0; i < (int)profiles.count(); i++) {
for(int i = 0; i < (int)profiles.size(); i++) {
QString nd = newdir;
if(nd == ".")
nd = "";
@ -143,7 +143,7 @@ ProjectGenerator::init()
}
if (Option::recursive) {
QStringList dirs = QDir(newdir).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for(int i = 0; i < (int)dirs.count(); i++) {
for(int i = 0; i < (int)dirs.size(); i++) {
QString nd = fileFixify(newdir + QDir::separator() + dirs[i]);
if (!knownDirs.contains(nd, Qt::CaseInsensitive))
knownDirs.append(nd);
@ -160,7 +160,7 @@ ProjectGenerator::init()
QStringList files = QDir(dir).entryList(QDir::nameFiltersFromString(regx),
QDir::Dirs | QDir::NoDotAndDotDot);
ProStringList &subdirs = v["SUBDIRS"];
for(int i = 0; i < (int)files.count(); i++) {
for(int i = 0; i < (int)files.size(); i++) {
QString newdir(dir + files[i]);
QFileInfo fi(fileInfo(newdir));
{
@ -170,7 +170,7 @@ ProjectGenerator::init()
subdirs.append(newdir);
} else {
QStringList profiles = QDir(newdir).entryList(QStringList("*" + Option::pro_ext), QDir::Files);
for(int i = 0; i < (int)profiles.count(); i++) {
for(int i = 0; i < (int)profiles.size(); i++) {
QString nd = newdir + QDir::separator() + files[i];
fileFixify(nd);
if(files[i] != "." && files[i] != ".." && !subdirs.contains(nd, Qt::CaseInsensitive)) {

View File

@ -852,7 +852,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
//copy other data
if(!project->isEmpty("QMAKE_BUNDLE_DATA")) {
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
for(int i = 0; i < bundle_data.count(); i++) {
for(int i = 0; i < bundle_data.size(); i++) {
const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files"));
QString path = bundle_dir;
const ProKey pkey(bundle_data[i] + ".path");
@ -872,7 +872,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
path += project->first(pkey).toQString();
path = Option::fixPathToTargetOS(path);
for(int file = 0; file < files.count(); file++) {
for(int file = 0; file < files.size(); file++) {
QString fn = files.at(file).toQString();
QString src = fileFixify(fn, FileFixifyAbsolute);
if (!QFile::exists(src))
@ -1560,9 +1560,9 @@ bool UnixMakefileGenerator::writeObjectsPart(QTextStream &t, bool do_incremental
if (!increment)
t << "\\\n\t\t" << (*objit);
}
if (incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done!
if (incrs_out.size() == objs.size()) { //we just switched places, no real incrementals to be done!
t << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << Qt::endl;
} else if (!incrs_out.count()) {
} else if (!incrs_out.size()) {
t << Qt::endl;
} else {
src_incremental = true;

View File

@ -250,7 +250,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" << var("QMAKE_SHELL_NULL_DEVICE");
const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX");
if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) {
if (objmax.isEmpty() || project->values("OBJECTS").size() < objmax.toInt()) {
t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ;
} else {
t << "\n\t" << objectsLinkLine << " " ;
@ -273,7 +273,7 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t)
ProStringList rcIncPaths = project->values("RC_INCLUDEPATH");
rcIncPaths.prepend(fileInfo(rc_file).path());
QString incPathStr;
for (int i = 0; i < rcIncPaths.count(); ++i) {
for (int i = 0; i < rcIncPaths.size(); ++i) {
const ProString &path = rcIncPaths.at(i);
if (path.isEmpty())
continue;

View File

@ -283,7 +283,7 @@ static QString commandLinesForOutput(QStringList commands)
// As we want every sub-command to be error-checked (as is done by makefile-based
// backends), we insert the checks ourselves, using the undocumented jump target.
static QString errchk = QStringLiteral("if errorlevel 1 goto VCEnd");
for (int i = commands.count() - 2; i >= 0; --i) {
for (int i = commands.size() - 2; i >= 0; --i) {
if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive))
commands.insert(i + 1, errchk);
}
@ -301,7 +301,7 @@ static QStringList unquote(const QStringList &values)
{
QStringList result;
result.reserve(values.size());
for (int i = 0; i < values.count(); ++i)
for (int i = 0; i < values.size(); ++i)
result << unquote(values.at(i));
return result;
}
@ -544,7 +544,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
[] (const VCFilter &filter) { return filter.Name; });
tempProj.ExtraCompilers.removeDuplicates();
for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x)
for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x)
addFilters(tempProj, xmlFilter, tempProj.ExtraCompilers.at(x));
xmlFilter << closetag();
@ -559,7 +559,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
outputFilter(tempProj, xml, xmlFilter, "Deployment Files");
outputFilter(tempProj, xml, xmlFilter, "Distribution Files");
for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) {
for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) {
outputFilter(tempProj, xml, xmlFilter, tempProj.ExtraCompilers.at(x));
}
@ -774,7 +774,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
addFilters(tool, xmlFilter, "Deployment Files");
addFilters(tool, xmlFilter, "Distribution Files");
for (int x = 0; x < tool.ExtraCompilers.count(); ++x)
for (int x = 0; x < tool.ExtraCompilers.size(); ++x)
addFilters(tool, xmlFilter, tool.ExtraCompilers.at(x));
xmlFilter << closetag();
@ -788,7 +788,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
outputFilter(tool, xml, xmlFilter, "Resource Files");
outputFilter(tool, xml, xmlFilter, "Deployment Files");
outputFilter(tool, xml, xmlFilter, "Distribution Files");
for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
for (int x = 0; x < tool.ExtraCompilers.size(); ++x) {
outputFilter(tool, xml, xmlFilter, tool.ExtraCompilers.at(x));
}
outputFilter(tool, xml, xmlFilter, "Root Files");

View File

@ -1539,7 +1539,7 @@ bool VCLinkerTool::parseOption(const char* option)
{
QStringList both = QString(option+6).split(",");
HeapReserveSize = both[0].toLongLong();
if(both.count() == 2)
if(both.size() == 2)
HeapCommitSize = both[1].toLongLong();
}
break;
@ -1728,7 +1728,7 @@ bool VCLinkerTool::parseOption(const char* option)
{
QStringList both = QString(option+7).split(",");
StackReserveSize = both[0].toLongLong();
if(both.count() == 2)
if(both.size() == 2)
StackCommitSize = both[1].toLongLong();
}
break;
@ -2231,13 +2231,13 @@ void VCFilter::addFile(const VCFilterFile& fileInfo)
void VCFilter::addFiles(const QStringList& fileList)
{
for (int i = 0; i < fileList.count(); ++i)
for (int i = 0; i < fileList.size(); ++i)
addFile(fileList.at(i));
}
void VCFilter::addFiles(const ProStringList& fileList)
{
for (int i = 0; i < fileList.count(); ++i)
for (int i = 0; i < fileList.size(); ++i)
addFile(fileList.at(i).toQString());
}
@ -2342,7 +2342,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
CustomBuildTool.ToolPath.clear();
CustomBuildTool.ToolName = QLatin1String(_VCCustomBuildTool);
for (int x = 0; x < extraCompilers.count(); ++x) {
for (int x = 0; x < extraCompilers.size(); ++x) {
const QString &extraCompilerName = extraCompilers.at(x);
if (!Project->verifyExtraCompiler(extraCompilerName, inFile) && !hasBuiltIn)
@ -2387,7 +2387,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
configs.contains("dep_existing_only"),
true /* checkCommandAvailability */);
}
for (int i = 0; i < deps.count(); ++i)
for (int i = 0; i < deps.size(); ++i)
deps[i] = Option::fixPathToTargetOS(
Project->replaceExtraCompilerVariables(
deps.at(i), inFile, out, MakefileGenerator::NoShell),
@ -2396,9 +2396,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
if (combined) {
// Add dependencies for each file
const ProStringList &tmp_in = Project->project->values(ProKey(extraCompilerName + ".input"));
for (int a = 0; a < tmp_in.count(); ++a) {
for (int a = 0; a < tmp_in.size(); ++a) {
const ProStringList &files = Project->project->values(tmp_in.at(a).toKey());
for (int b = 0; b < files.count(); ++b) {
for (int b = 0; b < files.size(); ++b) {
QString file = files.at(b).toQString();
deps += Project->findDependencies(file);
inputs += Option::fixPathToTargetOS(file, false);
@ -2432,7 +2432,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
}
// Fixify paths
for (int i = 0; i < deps.count(); ++i)
for (int i = 0; i < deps.size(); ++i)
deps[i] = Option::fixPathToTargetOS(deps[i], false);
@ -2450,7 +2450,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
deps += CustomBuildTool.AdditionalDependencies;
// Make sure that all deps are only once
QStringList uniqDeps;
for (int c = 0; c < deps.count(); ++c) {
for (int c = 0; c < deps.size(); ++c) {
QString aDep = deps.at(c);
if (!aDep.isEmpty())
uniqDeps << aDep;
@ -2496,7 +2496,7 @@ const VCFilter &VCProjectSingleConfig::filterByName(const QString &name) const
const VCFilter &VCProjectSingleConfig::filterForExtraCompiler(const QString &compilerName) const
{
for (int i = 0; i < ExtraCompilersFiles.count(); ++i)
for (int i = 0; i < ExtraCompilersFiles.size(); ++i)
if (ExtraCompilersFiles.at(i).Name == compilerName)
return ExtraCompilersFiles.at(i);
@ -2576,7 +2576,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
outputFilter(tempProj, xml, "Distribution Files");
QSet<QString> extraCompilersInProject;
for (int i = 0; i < tool.ExtraCompilersFiles.count(); ++i) {
for (int i = 0; i < tool.ExtraCompilersFiles.size(); ++i) {
const QString &compilerName = tool.ExtraCompilersFiles.at(i).Name;
if (!extraCompilersInProject.contains(compilerName)) {
extraCompilersInProject += compilerName;
@ -2584,7 +2584,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
}
}
for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) {
for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) {
outputFilter(tempProj, xml, tempProj.ExtraCompilers.at(x));
}
outputFilter(tempProj, xml, "Root Files");
@ -2628,7 +2628,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool)
outputFilter(tool, xml, "Resource Files");
outputFilter(tool, xml, "Deployment Files");
outputFilter(tool, xml, "Distribution Files");
for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
for (int x = 0; x < tool.ExtraCompilers.size(); ++x) {
outputFilter(tool, xml, tool.ExtraCompilers.at(x));
}
outputFilter(tool, xml, "Root Files");

View File

@ -152,7 +152,7 @@ bool VcprojGenerator::writeProjectMakefile()
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) {
for (int j = 0; j < singleProject->ExtraCompilersFiles.size(); ++j) {
const QString &compilerName = singleProject->ExtraCompilersFiles.at(j).Name;
if (!mergedProject.ExtraCompilers.contains(compilerName))
mergedProject.ExtraCompilers += compilerName;
@ -634,10 +634,10 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
bool VcprojGenerator::hasBuiltinCompiler(const QString &file)
{
// Source files
for (int i = 0; i < Option::cpp_ext.count(); ++i)
for (int i = 0; i < Option::cpp_ext.size(); ++i)
if (file.endsWith(Option::cpp_ext.at(i)))
return true;
for (int i = 0; i < Option::c_ext.count(); ++i)
for (int i = 0; i < Option::c_ext.size(); ++i)
if (file.endsWith(Option::c_ext.at(i)))
return true;
if (file.endsWith(".rc")
@ -767,8 +767,8 @@ void VcprojGenerator::init()
if (autogenPrecompSource) {
precompSource = precompH
+ (pchIsCFile
? (Option::c_ext.count() ? Option::c_ext.at(0) : QLatin1String(".c"))
: (Option::cpp_ext.count() ? Option::cpp_ext.at(0) : QLatin1String(".cpp")));
? (Option::c_ext.size() ? Option::c_ext.at(0) : QLatin1String(".c"))
: (Option::cpp_ext.size() ? Option::cpp_ext.at(0) : QLatin1String(".cpp")));
project->values("GENERATED_SOURCES") += precompSource;
} else if (!precompSource.isEmpty()) {
project->values("SOURCES") += precompSource;
@ -1553,7 +1553,7 @@ void VcprojGenerator::initExtraCompilerOutputs()
} else if (!inputVars.isEmpty()) {
// One output file per input
const ProStringList &tmp_in = project->values(inputVars.first().toKey());
for (int i = 0; i < tmp_in.count(); ++i) {
for (int i = 0; i < tmp_in.size(); ++i) {
const QString &filename = tmp_in.at(i).toQString();
if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename))
extraCompile.addFile(Option::fixPathToTargetOS(
@ -1568,7 +1568,7 @@ void VcprojGenerator::initExtraCompilerOutputs()
for (const ProString &inputVar : inputVars) {
if (!otherFilters.contains(inputVar)) {
const ProStringList &tmp_in = project->values(inputVar.toKey());
for (int i = 0; i < tmp_in.count(); ++i) {
for (int i = 0; i < tmp_in.size(); ++i) {
const QString &filename = tmp_in.at(i).toQString();
if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename))
extraCompile.addFile(Option::fixPathToTargetOS(

View File

@ -174,9 +174,9 @@ bool Win32MakefileGenerator::processPrlFileBase(QString &origFile, QStringView o
{
if (MakefileGenerator::processPrlFileBase(origFile, origName, fixedBase, slashOff))
return true;
for (int off = fixedBase.length(); off > slashOff; off--) {
for (int off = fixedBase.size(); off > slashOff; off--) {
if (!fixedBase.at(off - 1).isDigit()) {
if (off != fixedBase.length()) {
if (off != fixedBase.size()) {
return MakefileGenerator::processPrlFileBase(
origFile, origName, fixedBase.left(off), slashOff);
}
@ -686,7 +686,7 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t)
const ProStringList rcIncPaths = project->values("RC_INCLUDEPATH");
QString incPathStr;
for (int i = 0; i < rcIncPaths.count(); ++i) {
for (int i = 0; i < rcIncPaths.size(); ++i) {
const ProString &path = rcIncPaths.at(i);
if (path.isEmpty())
continue;

View File

@ -225,12 +225,12 @@ QMakeEvaluator::getMemberArgs(const ProKey &func, int srclen, const ProStringLis
int *start, int *end)
{
*start = 0, *end = 0;
if (args.count() >= 2) {
if (args.size() >= 2) {
bool ok = true;
const ProString &start_str = args.at(1);
*start = start_str.toInt(&ok);
if (!ok) {
if (args.count() == 2) {
if (args.size() == 2) {
int dotdot = start_str.indexOf(statics.strDotDot);
if (dotdot != -1) {
*start = start_str.left(dotdot).toInt(&ok);
@ -246,7 +246,7 @@ QMakeEvaluator::getMemberArgs(const ProKey &func, int srclen, const ProStringLis
}
} else {
*end = *start;
if (args.count() == 3)
if (args.size() == 3)
*end = args.at(2).toInt(&ok);
if (!ok) {
ProStringRoUser u1(func, m_tmp1);
@ -595,7 +595,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
var = args[0];
sep = args.at(1).toQString();
beg = args.at(2).toInt();
if (args.count() == 4)
if (args.size() == 4)
end = args.at(3).toInt();
} else {
var = args[0];
@ -630,7 +630,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
case E_SPRINTF: {
ProStringRwUser u1(args.at(0), m_tmp1);
QString tmp = u1.str();
for (int i = 1; i < args.count(); ++i)
for (int i = 1; i < args.size(); ++i)
tmp = tmp.arg(args.at(i).toQStringView());
ret << u1.extract(tmp);
break;
@ -642,7 +642,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
bool zeropad = false;
bool leftalign = false;
enum { DefaultSign, PadSign, AlwaysSign } sign = DefaultSign;
if (args.count() >= 2) {
if (args.size() >= 2) {
const auto opts = split_value_list(args.at(1).toQStringView());
for (const ProString &opt : opts) {
if (opt.startsWith(QLatin1String("ibase="))) {
@ -722,11 +722,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
}
case E_JOIN: {
ProString glue, before, after;
if (args.count() >= 2)
if (args.size() >= 2)
glue = args.at(1);
if (args.count() >= 3)
if (args.size() >= 3)
before = args[2];
if (args.count() == 4)
if (args.size() == 4)
after = args[3];
const ProStringList &var = values(map(args.at(0)));
if (!var.isEmpty()) {
@ -742,7 +742,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
}
case E_SPLIT: {
ProStringRoUser u1(m_tmp1);
const QString &sep = (args.count() == 2) ? u1.set(args.at(1)) : statics.field_sep;
const QString &sep = (args.size() == 2) ? u1.set(args.at(1)) : statics.field_sep;
const auto vars = values(map(args.at(0)));
for (const ProString &var : vars) {
// FIXME: this is inconsistent with the "there are no empty strings" dogma.
@ -816,7 +816,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
bool blob = false;
bool lines = false;
bool singleLine = true;
if (args.count() > 1) {
if (args.size() > 1) {
if (!args.at(1).compare(QLatin1String("false"), Qt::CaseInsensitive))
singleLine = false;
else if (!args.at(1).compare(QLatin1String("blob"), Qt::CaseInsensitive))
@ -883,7 +883,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
bool blob = false;
bool lines = false;
bool singleLine = true;
if (args.count() > 1) {
if (args.size() > 1) {
if (!args.at(1).compare(QLatin1String("false"), Qt::CaseInsensitive))
singleLine = false;
else if (!args.at(1).compare(QLatin1String("blob"), Qt::CaseInsensitive))
@ -893,7 +893,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
}
int exitCode;
QByteArray bytes = getCommandOutput(args.at(0).toQString(), &exitCode);
if (args.count() > 2 && !args.at(2).isEmpty()) {
if (args.size() > 2 && !args.at(2).isEmpty()) {
m_valuemapStack.top()[args.at(2).toKey()] =
ProStringList(ProString(QString::number(exitCode)));
}
@ -981,7 +981,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
case E_UPPER:
case E_LOWER:
case E_TITLE:
for (int i = 0; i < args.count(); ++i) {
for (int i = 0; i < args.size(); ++i) {
ProStringRwUser u1(args.at(i), m_tmp1);
QString rstr = u1.str();
if (func_t == E_UPPER) {
@ -996,7 +996,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
break;
case E_FILES: {
bool recursive = false;
if (args.count() == 2)
if (args.size() == 2)
recursive = isTrue(args.at(1));
QStringList dirs;
ProStringRoUser u1(args.at(0), m_tmp1);
@ -1022,7 +1022,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
evalError(fL1S("section(): Encountered invalid wildcard expression '%1'.").arg(pattern));
goto allfail;
}
for (int d = 0; d < dirs.count(); d++) {
for (int d = 0; d < dirs.size(); d++) {
QString dir = dirs[d];
QDir qdir(pfx + dir);
for (int i = 0, count = int(qdir.count()); i < count; ++i) {
@ -1044,7 +1044,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
ProStringRoUser u1(args.at(0), m_tmp1);
QString msg = m_option->expandEnvVars(u1.str());
bool decorate = true;
if (args.count() == 2)
if (args.size() == 2)
decorate = isTrue(args.at(1));
if (decorate) {
if (!msg.endsWith(QLatin1Char('?')))
@ -1091,10 +1091,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
ProValueMap dependees;
QMultiMap<int, ProString> rootSet;
ProStringList orgList = values(args.at(0).toKey());
ProString prefix = args.count() < 2 ? ProString() : args.at(1);
ProString priosfx = args.count() < 4 ? ProString(".priority") : args.at(3);
ProString prefix = args.size() < 2 ? ProString() : args.at(1);
ProString priosfx = args.size() < 4 ? ProString(".priority") : args.at(3);
populateDeps(orgList, prefix,
args.count() < 3 ? ProStringList(ProString(".depends"))
args.size() < 3 ? ProStringList(ProString(".depends"))
: split_value_list(args.at(2).toQStringView()),
priosfx, dependencies, dependees, rootSet);
while (!rootSet.isEmpty()) {
@ -1131,7 +1131,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
case E_ABSOLUTE_PATH: {
ProStringRwUser u1(args.at(0), m_tmp1);
ProStringRwUser u2(m_tmp2);
QString baseDir = args.count() > 1
QString baseDir = args.size() > 1
? IoUtils::resolvePath(currentDirectory(), u2.set(args.at(1)))
: currentDirectory();
QString rstr = u1.str().isEmpty() ? baseDir : IoUtils::resolvePath(baseDir, u1.str());
@ -1141,7 +1141,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
case E_RELATIVE_PATH: {
ProStringRwUser u1(args.at(0), m_tmp1);
ProStringRoUser u2(m_tmp2);
QString baseDir = args.count() > 1
QString baseDir = args.size() > 1
? IoUtils::resolvePath(currentDirectory(), u2.set(args.at(1)))
: currentDirectory();
QString absArg = u1.str().isEmpty() ? baseDir : IoUtils::resolvePath(baseDir, u1.str());
@ -1252,7 +1252,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList &
enum { TargetStash, TargetCache, TargetSuper } target = TargetCache;
enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet;
ProKey srcvar;
if (args.count() >= 2) {
if (args.size() >= 2) {
const auto opts = split_value_list(args.at(1).toQStringView());
for (const ProString &opt : opts) {
if (opt == QLatin1String("transient")) {
@ -1272,7 +1272,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList &
return ReturnFalse;
}
}
if (args.count() >= 3) {
if (args.size() >= 3) {
srcvar = args.at(2).toKey();
} else if (mode != CacheSet) {
evalError(fL1S("cache(): modes other than 'set' require a source variable."));
@ -1367,7 +1367,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList &
varstr += QLatin1String(" -=");
else
varstr += QLatin1String(" =");
if (diffval.count() == 1) {
if (diffval.size() == 1) {
varstr += QLatin1Char(' ');
varstr += quoteValue(diffval.at(0));
} else if (!diffval.isEmpty()) {
@ -1425,7 +1425,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
switch (func_t) {
case T_DEFINED: {
const ProKey &var = args.at(0).toKey();
if (args.count() > 1) {
if (args.size() > 1) {
if (args[1] == QLatin1String("test")) {
return returnBool(m_functionDefs.testFunctions.contains(var));
} else if (args[1] == QLatin1String("replace")) {
@ -1512,7 +1512,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
VisitReturn ok = evaluateFileInto(fn, &vars, LoadProOnly);
if (ok != ReturnTrue)
return ok;
if (args.count() == 2)
if (args.size() == 2)
return returnBool(vars.contains(map(args.at(1))));
QRegularExpression regx;
regx.setPatternOptions(QRegularExpression::DotMatchesEverythingOption);
@ -1562,7 +1562,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
m_current.pro->fileName(), m_current.line);
}
case T_CONFIG: {
if (args.count() == 1)
if (args.size() == 1)
return returnBool(isActiveConfig(args.at(0).toQStringView()));
const auto mutuals = args.at(1).toQStringView().split(QLatin1Char('|'),
Qt::SkipEmptyParts);
@ -1589,7 +1589,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
}
const ProStringList &l = values(map(args.at(0)));
if (args.count() == 2) {
if (args.size() == 2) {
for (int i = 0; i < l.size(); ++i) {
const ProString &val = l[i];
if (val == qry)
@ -1622,9 +1622,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnFalse;
}
case T_COUNT: {
int cnt = values(map(args.at(0))).count();
int cnt = values(map(args.at(0))).size();
int val = args.at(1).toInt();
if (args.count() == 3) {
if (args.size() == 3) {
const ProString &comp = args.at(2);
if (comp == QLatin1String(">") || comp == QLatin1String("greaterThan")) {
return returnBool(cnt > val);
@ -1710,10 +1710,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
LoadFlags flags;
if (m_cumulative)
flags = LoadSilent;
if (args.count() >= 2) {
if (args.size() >= 2) {
if (!args.at(1).isEmpty())
parseInto = args.at(1) + QLatin1Char('.');
if (args.count() >= 3 && isTrue(args.at(2)))
if (args.size() >= 3 && isTrue(args.at(2)))
flags = LoadSilent;
}
QString fn = filePathEnvArg0(args);
@ -1745,7 +1745,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ok;
}
case T_LOAD: {
bool ignore_error = (args.count() == 2 && isTrue(args.at(1)));
bool ignore_error = (args.size() == 2 && isTrue(args.at(1)));
VisitReturn ok = evaluateFeatureFile(m_option->expandEnvVars(args.at(0).toQString()),
ignore_error);
if (ok == ReturnFalse && ignore_error)
@ -1844,11 +1844,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
QIODevice::OpenMode mode = QIODevice::Truncate;
QMakeVfs::VfsFlags flags = (m_cumulative ? QMakeVfs::VfsCumulative : QMakeVfs::VfsExact);
QString contents;
if (args.count() >= 2) {
if (args.size() >= 2) {
const ProStringList &vals = values(args.at(1).toKey());
if (!vals.isEmpty())
contents = vals.join(QLatin1Char('\n')) + QLatin1Char('\n');
if (args.count() >= 3) {
if (args.size() >= 3) {
const auto opts = split_value_list(args.at(2).toQStringView());
for (const ProString &opt : opts) {
if (opt == QLatin1String("append")) {

View File

@ -256,7 +256,7 @@ ProStringList QMakeEvaluator::split_value_list(QStringView vals, int source)
source = currentFileId();
const QChar *vals_data = vals.data();
const int vals_len = vals.length();
const int vals_len = vals.size();
char16_t quote = 0;
bool hadWord = false;
for (int x = 0; x < vals_len; x++) {
@ -801,7 +801,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
} else {
ProString val;
do {
if (index >= list.count())
if (index >= list.size())
goto do_break;
val = list.at(index++);
} while (val.isEmpty()); // stupid, but qmake is like that
@ -853,7 +853,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
if (expandVariableReferences(tokPtr, sizeHint, &varVal, true) == ReturnError)
return ReturnError;
QStringView val = varVal.at(0).toQStringView();
if (val.length() < 4 || val.at(0) != QLatin1Char('s')) {
if (val.size() < 4 || val.at(0) != QLatin1Char('s')) {
evalError(fL1S("The ~= operator can handle only the s/// function."));
return ReturnTrue;
}
@ -1545,7 +1545,7 @@ void QMakeEvaluator::updateFeaturePaths()
feature_roots << (fb + features_concat);
}
for (int i = 0; i < feature_roots.count(); ++i)
for (int i = 0; i < feature_roots.size(); ++i)
if (!feature_roots.at(i).endsWith(QLatin1Char('/')))
feature_roots[i].append(QLatin1Char('/'));

View File

@ -89,7 +89,7 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
QMakeCmdLineParserState &state, QStringList &args, int *pos)
{
enum { ArgNone, ArgConfig, ArgSpec, ArgXSpec, ArgTmpl, ArgTmplPfx, ArgCache, ArgQtConf } argState = ArgNone;
for (; *pos < args.count(); (*pos)++) {
for (; *pos < args.size(); (*pos)++) {
QString arg = args.at(*pos);
switch (argState) {
case ArgConfig:
@ -243,7 +243,7 @@ QStringList QMakeGlobals::splitPathList(const QString &val) const
if (!val.isEmpty()) {
QString cwd(QDir::currentPath());
const QStringList vals = val.split(dirlist_sep, Qt::SkipEmptyParts);
ret.reserve(vals.length());
ret.reserve(vals.size());
for (const QString &it : vals)
ret << IoUtils::resolvePath(cwd, it);
}

View File

@ -334,7 +334,7 @@ void QMakeParser::read(ProFile *pro, QStringView in, int line, SubGrammar gramma
xprStack.reserve(10);
const ushort *cur = (const ushort *)in.data();
const ushort *inend = cur + in.length();
const ushort *inend = cur + in.size();
m_canElse = false;
freshLine:
m_state = StNew;
@ -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.size();
int need = (in.size() - (cur - (const ushort *)in.constData()) + 2) * 5 + out.size();
int tused = *tokPtr - (ushort *)tokBuff->constData();
int xused;
int total;

View File

@ -96,7 +96,7 @@ static QString detectProjectFile(const QString &path, QString *singleProFileCand
ret = candidate;
} else { //last try..
QStringList profiles = dir.entryList(QStringList("*" + Option::pro_ext));
if(profiles.count() == 1)
if(profiles.size() == 1)
ret = dir.filePath(profiles.at(0));
}
return ret;
@ -174,7 +174,7 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
{
enum { ArgNone, ArgOutput } argState = ArgNone;
int x = 0;
while (x < args.count()) {
while (x < args.size()) {
switch (argState) {
case ArgOutput:
Option::output.setFileName(args.at(x--));
@ -390,7 +390,7 @@ Option::init(int argc, char **argv)
} else if (opt == "-qtconf") {
// Skip "-qtconf <file>" and proceed.
++idx;
if (idx + 1 < args.length())
if (idx + 1 < args.size())
++idx;
continue;
} else {

View File

@ -156,7 +156,7 @@ void QVariantAnimationPrivate::convertValues(int t)
{
auto type = QMetaType(t);
//this ensures that all the keyValues are of type t
for (int i = 0; i < keyValues.count(); ++i) {
for (int i = 0; i < keyValues.size(); ++i) {
QVariantAnimation::KeyValue &pair = keyValues[i];
pair.second.convert(type);
}
@ -190,7 +190,7 @@ void QVariantAnimationPrivate::updateInterpolator()
void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/)
{
// can't interpolate if we don't have at least 2 values
if ((keyValues.count() + (defaultStartEndValue.isValid() ? 1 : 0)) < 2)
if ((keyValues.size() + (defaultStartEndValue.isValid() ? 1 : 0)) < 2)
return;
const qreal endProgress = (direction == QAbstractAnimation::Forward) ? qreal(1) : qreal(0);
@ -207,7 +207,7 @@ void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/)
animationValueLessThan);
if (it == keyValues.constBegin()) {
//the item pointed to by it is the start element in the range
if (it->first == 0 && keyValues.count() > 1) {
if (it->first == 0 && keyValues.size() > 1) {
currentInterval.start = *it;
currentInterval.end = *(it+1);
} else {
@ -216,7 +216,7 @@ void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/)
}
} else if (it == keyValues.constEnd()) {
--it; //position the iterator on the last item
if (it->first == 1 && keyValues.count() > 1) {
if (it->first == 1 && keyValues.size() > 1) {
//we have an end value (item with progress = 1)
currentInterval.start = *(it-1);
currentInterval.end = *it;
@ -405,7 +405,7 @@ void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator fun
// to continue causes the app to crash on exit with a SEGV
if (interpolators) {
const auto locker = qt_scoped_lock(registeredInterpolatorsMutex);
if (interpolationType >= interpolators->count())
if (interpolationType >= interpolators->size())
interpolators->resize(interpolationType + 1);
interpolators->replace(interpolationType, func);
}
@ -423,7 +423,7 @@ QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int in
QInterpolatorVector *interpolators = registeredInterpolators();
const auto locker = qt_scoped_lock(registeredInterpolatorsMutex);
QVariantAnimation::Interpolator ret = nullptr;
if (interpolationType < interpolators->count()) {
if (interpolationType < interpolators->size()) {
ret = interpolators->at(interpolationType);
if (ret) return ret;
}

View File

@ -1271,7 +1271,7 @@ qsizetype QDir::count(QT6_IMPL_NEW_OVERLOAD) const
{
Q_D(const QDir);
d->initFileLists(*this);
return d->files.count();
return d->files.size();
}
/*!

View File

@ -295,7 +295,7 @@ void QFileSelectorPrivate::updateSelectors()
QLatin1Char pathSep(',');
QStringList envSelectors = QString::fromLatin1(qgetenv("QT_FILE_SELECTORS"))
.split(pathSep, Qt::SkipEmptyParts);
if (envSelectors.count())
if (envSelectors.size())
sharedData->staticSelectors << envSelectors;
if (!qEnvironmentVariableIsEmpty(env_override))

View File

@ -119,7 +119,7 @@ static bool _q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry &ent
break;
const QStringList &paths = QDir::searchPaths(filePath.left(prefixSeparator));
for (qsizetype i = 0; i < paths.count(); i++) {
for (int i = 0; i < paths.size(); i++) {
entry = QFileSystemEntry(QDir::cleanPath(
paths.at(i) % u'/' % QStringView{filePath}.mid(prefixSeparator + 1)));
// Recurse!

View File

@ -343,7 +343,7 @@ void QSettingsPrivate::requestUpdate()
QStringList QSettingsPrivate::variantListToStringList(const QVariantList &l)
{
QStringList result;
result.reserve(l.count());
result.reserve(l.size());
for (auto v : l)
result.append(variantToString(v));
return result;
@ -358,7 +358,7 @@ QVariant QSettingsPrivate::stringListToVariantList(const QStringList &l)
if (str.startsWith(u'@')) {
if (str.size() < 2 || str.at(1) != u'@') {
QVariantList variantList;
variantList.reserve(l.count());
variantList.reserve(l.size());
for (const auto &s : l)
variantList.append(stringToVariant(s));
return variantList;
@ -1511,7 +1511,7 @@ bool QConfFileSettingsPrivate::readIniLine(QByteArrayView data, qsizetype &dataP
qsizetype &lineStart, qsizetype &lineLen,
qsizetype &equalsPos)
{
qsizetype dataLen = data.length();
qsizetype dataLen = data.size();
bool inQuotes = false;
equalsPos = -1;
@ -1638,7 +1638,7 @@ bool QConfFileSettingsPrivate::readIniFile(QByteArrayView data,
++position;
}
Q_ASSERT(lineStart == data.length());
Q_ASSERT(lineStart == data.size());
FLUSH_CURRENT_SECTION();
return ok;

View File

@ -260,10 +260,10 @@ QString QStandardPaths::writableLocation(StandardLocation type)
QRegularExpressionMatch match = exp.match(line);
if (match.hasMatch() && match.capturedView(1) == key) {
QStringView value = match.capturedView(2);
if (value.length() > 2
if (value.size() > 2
&& value.startsWith(u'\"')
&& value.endsWith(u'\"'))
value = value.mid(1, value.length() - 2);
value = value.mid(1, value.size() - 2);
// value can start with $HOME
if (value.startsWith("$HOME"_L1))
result = QDir::homePath() + value.mid(5);
@ -371,7 +371,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
break;
case AppConfigLocation:
dirs = xdgConfigDirs();
for (int i = 0; i < dirs.count(); ++i)
for (int i = 0; i < dirs.size(); ++i)
appendOrganizationAndApp(dirs[i]);
break;
case GenericDataLocation:
@ -379,19 +379,19 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
break;
case ApplicationsLocation:
dirs = xdgDataDirs();
for (int i = 0; i < dirs.count(); ++i)
for (int i = 0; i < dirs.size(); ++i)
dirs[i].append("/applications"_L1);
break;
case AppDataLocation:
case AppLocalDataLocation:
dirs = xdgDataDirs();
for (int i = 0; i < dirs.count(); ++i)
for (int i = 0; i < dirs.size(); ++i)
appendOrganizationAndApp(dirs[i]);
break;
case FontsLocation:
dirs += QDir::homePath() + "/.fonts"_L1;
dirs += xdgDataDirs();
for (int i = 1; i < dirs.count(); ++i)
for (int i = 1; i < dirs.size(); ++i)
dirs[i].append("/fonts"_L1);
break;
default:

View File

@ -75,7 +75,7 @@ QTemporaryFileName::QTemporaryFileName(const QString &templateName)
.nativeFilePath();
// Find mask in native path
phPos = filename.length();
phPos = filename.size();
phLength = 0;
while (phPos != 0) {
--phPos;
@ -109,8 +109,8 @@ QTemporaryFileName::QTemporaryFileName(const QString &templateName)
QFileSystemEntry::NativePath QTemporaryFileName::generateNext()
{
Q_ASSERT(length != 0);
Q_ASSERT(pos < path.length());
Q_ASSERT(length <= path.length() - pos);
Q_ASSERT(pos < path.size());
Q_ASSERT(length <= path.size() - pos);
Char *const placeholderStart = (Char *)path.data() + pos;
Char *const placeholderEnd = placeholderStart + length;

View File

@ -918,7 +918,7 @@ inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions o
}
// check if we need to remove trailing slashes
if (options & QUrl::StripTrailingSlash) {
while (thePathView.length() > 1 && thePathView.endsWith(u'/'))
while (thePathView.size() > 1 && thePathView.endsWith(u'/'))
thePathView.chop(1);
}

View File

@ -73,11 +73,11 @@ Q_AUTOTEST_EXPORT void qt_punycodeEncoder(QStringView in, QString *output)
// Do not try to encode strings that certainly will result in output
// that is longer than allowable domain name label length. Note that
// non-BMP codepoints are encoded as two QChars.
if (in.length() > MaxDomainLabelLength * 2)
if (in.size() > MaxDomainLabelLength * 2)
return;
int outLen = output->length();
output->resize(outLen + in.length());
int outLen = output->size();
output->resize(outLen + in.size());
QChar *d = output->data() + outLen;
bool skipped = false;
@ -468,7 +468,7 @@ static QString mapDomainName(const QString &in, QUrl::AceProcessingOptions optio
*/
static bool validateAsciiLabel(QStringView label)
{
if (label.length() > MaxDomainLabelLength)
if (label.size() > MaxDomainLabelLength)
return false;
if (label.first() == u'-' || label.last() == u'-')

View File

@ -630,7 +630,7 @@ QList<QPair<QString, QString> > QUrlQuery::queryItems(QUrl::ComponentFormattingO
QList<QPair<QString, QString> > result;
Map::const_iterator it = d->itemList.constBegin();
Map::const_iterator end = d->itemList.constEnd();
result.reserve(d->itemList.count());
result.reserve(d->itemList.size());
for ( ; it != end; ++it)
result << qMakePair(d->recodeToUser(it->first, encoding),
d->recodeToUser(it->second, encoding));

View File

@ -2120,7 +2120,7 @@ QStringList QAbstractItemModel::mimeTypes() const
*/
QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const
{
if (indexes.count() <= 0)
if (indexes.size() <= 0)
return nullptr;
QStringList types = mimeTypes();
if (types.isEmpty())
@ -2159,7 +2159,7 @@ bool QAbstractItemModel::canDropMimeData(const QMimeData *data, Qt::DropAction a
return false;
const QStringList modelTypes = mimeTypes();
for (int i = 0; i < modelTypes.count(); ++i) {
for (int i = 0; i < modelTypes.size(); ++i) {
if (data->hasFormat(modelTypes.at(i)))
return true;
}
@ -2516,7 +2516,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
// iterates twice if wrapping
for (int i = 0; (wrap && i < 2) || (!wrap && i < 1); ++i) {
for (int r = from; (r < to) && (allHits || result.count() < hits); ++r) {
for (int r = from; (r < to) && (allHits || result.size() < hits); ++r) {
QModelIndex idx = index(r, column, p);
if (!idx.isValid())
continue;
@ -2582,7 +2582,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
if (hasChildren(parent)) { // search the hierarchy
result += match(index(0, column, parent), role,
(text.isEmpty() ? value : text),
(allHits ? -1 : hits - result.count()), flags);
(allHits ? -1 : hits - result.size()), flags);
}
}
}
@ -3446,8 +3446,8 @@ void QAbstractItemModel::changePersistentIndexList(const QModelIndexList &from,
if (d->persistent.indexes.isEmpty())
return;
QList<QPersistentModelIndexData *> toBeReinserted;
toBeReinserted.reserve(to.count());
for (int i = 0; i < from.count(); ++i) {
toBeReinserted.reserve(to.size());
for (int i = 0; i < from.size(); ++i) {
if (from.at(i) == to.at(i))
continue;
const auto it = d->persistent.indexes.constFind(from.at(i));

View File

@ -443,7 +443,7 @@ QMimeData* QAbstractProxyModel::mimeData(const QModelIndexList &indexes) const
{
Q_D(const QAbstractProxyModel);
QModelIndexList list;
list.reserve(indexes.count());
list.reserve(indexes.size());
for (const QModelIndex &index : indexes)
list << mapToSource(index);
return d->model->mimeData(list);

View File

@ -315,7 +315,7 @@ QMimeData *QConcatenateTablesProxyModel::mimeData(const QModelIndexList &indexes
Q_ASSERT(checkIndex(firstIndex, CheckIndexOption::IndexIsValid));
const auto result = d->sourceModelForRow(firstIndex.row());
QModelIndexList sourceIndexes;
sourceIndexes.reserve(indexes.count());
sourceIndexes.reserve(indexes.size());
for (const QModelIndex &index : indexes) {
const QModelIndex sourceIndex = mapToSource(index);
Q_ASSERT(sourceIndex.model() == result.sourceModel); // see documentation above

View File

@ -144,7 +144,7 @@ QItemSelection QIdentityProxyModel::mapSelectionFromSource(const QItemSelection&
QItemSelection::const_iterator it = selection.constBegin();
const QItemSelection::const_iterator end = selection.constEnd();
proxySelection.reserve(selection.count());
proxySelection.reserve(selection.size());
for ( ; it != end; ++it) {
Q_ASSERT(it->model() == d->model);
const QItemSelectionRange range(mapFromSource(it->topLeft()), mapFromSource(it->bottomRight()));
@ -167,7 +167,7 @@ QItemSelection QIdentityProxyModel::mapSelectionToSource(const QItemSelection& s
QItemSelection::const_iterator it = selection.constBegin();
const QItemSelection::const_iterator end = selection.constEnd();
sourceSelection.reserve(selection.count());
sourceSelection.reserve(selection.size());
for ( ; it != end; ++it) {
Q_ASSERT(it->model() == this);
const QItemSelectionRange range(mapToSource(it->topLeft()), mapToSource(it->bottomRight()));
@ -203,7 +203,7 @@ QModelIndexList QIdentityProxyModel::match(const QModelIndex& start, int role, c
QModelIndexList::const_iterator it = sourceList.constBegin();
const QModelIndexList::const_iterator end = sourceList.constEnd();
QModelIndexList proxyList;
proxyList.reserve(sourceList.count());
proxyList.reserve(sourceList.size());
for ( ; it != end; ++it)
proxyList.append(mapFromSource(*it));
return proxyList;

View File

@ -466,15 +466,15 @@ void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::Sel
if (!range.isValid())
continue;
newSelection.push_back(range);
for (int t = 0; t < count(); ++t) {
for (int t = 0; t < size(); ++t) {
if (range.intersects(at(t)))
intersections.append(at(t).intersected(range));
}
}
// Split the old (and new) ranges using the intersections
for (int i = 0; i < intersections.count(); ++i) { // for each intersection
for (int t = 0; t < count();) { // splitt each old range
for (int i = 0; i < intersections.size(); ++i) { // for each intersection
for (int t = 0; t < size();) { // splitt each old range
if (at(t).intersects(intersections.at(i))) {
split(at(t), intersections.at(i), this);
removeAt(t);
@ -483,7 +483,7 @@ void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::Sel
}
}
// only split newSelection if Toggle is specified
for (int n = 0; (command & QItemSelectionModel::Toggle) && n < newSelection.count();) {
for (int n = 0; (command & QItemSelectionModel::Toggle) && n < newSelection.size();) {
if (newSelection.at(n).intersects(intersections.at(i))) {
split(newSelection.at(n), intersections.at(i), &newSelection);
newSelection.removeAt(n);
@ -613,7 +613,7 @@ QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection
QItemSelection expanded;
if (command & QItemSelectionModel::Rows) {
for (int i = 0; i < selection.count(); ++i) {
for (int i = 0; i < selection.size(); ++i) {
QModelIndex parent = selection.at(i).parent();
int colCount = model->columnCount(parent);
QModelIndex tl = model->index(selection.at(i).top(), 0, parent);
@ -623,7 +623,7 @@ QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection
}
}
if (command & QItemSelectionModel::Columns) {
for (int i = 0; i < selection.count(); ++i) {
for (int i = 0; i < selection.size(); ++i) {
QModelIndex parent = selection.at(i).parent();
int rowCount = model->rowCount(parent);
QModelIndex tl = model->index(0, selection.at(i).left(), parent);
@ -838,7 +838,7 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged(const QList<QPersiste
// optimization for when all indexes are selected
// (only if there is lots of items (1000) because this is not entirely correct)
if (ranges.isEmpty() && currentSelection.count() == 1) {
if (ranges.isEmpty() && currentSelection.size() == 1) {
QItemSelectionRange range = currentSelection.constFirst();
QModelIndex parent = range.parent();
tableRowCount = model->rowCount(parent);
@ -949,11 +949,11 @@ static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes)
// merge rows
QItemSelection rowSpans;
i = 0;
while (i < colSpans.count()) {
while (i < colSpans.size()) {
QModelIndex tl = colSpans.at(i).topLeft();
QModelIndex br = colSpans.at(i).bottomRight();
QModelIndex prevTl = tl;
while (++i < colSpans.count()) {
while (++i < colSpans.size()) {
QModelIndex nextTl = colSpans.at(i).topLeft();
QModelIndex nextBr = colSpans.at(i).bottomRight();
@ -1362,7 +1362,7 @@ void QItemSelectionModel::reset()
void QItemSelectionModel::clearSelection()
{
Q_D(QItemSelectionModel);
if (d->ranges.count() == 0 && d->currentSelection.count() == 0)
if (d->ranges.size() == 0 && d->currentSelection.size() == 0)
return;
select(QItemSelection(), Clear);
@ -1433,7 +1433,7 @@ bool QItemSelectionModel::isSelected(const QModelIndex &index) const
}
// check currentSelection
if (d->currentSelection.count()) {
if (d->currentSelection.size()) {
if ((d->currentCommand & Deselect) && selected)
selected = !d->currentSelection.contains(index);
else if (d->currentCommand & Toggle)
@ -1468,8 +1468,8 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons
return false;
// return false if row exist in currentSelection (Deselect)
if (d->currentCommand & Deselect && d->currentSelection.count()) {
for (int i=0; i<d->currentSelection.count(); ++i) {
if (d->currentCommand & Deselect && d->currentSelection.size()) {
for (int i=0; i<d->currentSelection.size(); ++i) {
if (d->currentSelection.at(i).parent() == parent &&
row >= d->currentSelection.at(i).top() &&
row <= d->currentSelection.at(i).bottom())
@ -1478,11 +1478,11 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons
}
// return false if ranges in both currentSelection and ranges
// intersect and have the same row contained
if (d->currentCommand & Toggle && d->currentSelection.count()) {
for (int i=0; i<d->currentSelection.count(); ++i)
if (d->currentCommand & Toggle && d->currentSelection.size()) {
for (int i=0; i<d->currentSelection.size(); ++i)
if (d->currentSelection.at(i).top() <= row &&
d->currentSelection.at(i).bottom() >= row)
for (int j=0; j<d->ranges.count(); ++j)
for (int j=0; j<d->ranges.size(); ++j)
if (d->ranges.at(j).top() <= row && d->ranges.at(j).bottom() >= row
&& d->currentSelection.at(i).intersected(d->ranges.at(j)).isValid())
return false;
@ -1497,7 +1497,7 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons
// add ranges and currentSelection and check through them all
QList<QItemSelectionRange>::const_iterator it;
QList<QItemSelectionRange> joined = d->ranges;
if (d->currentSelection.count())
if (d->currentSelection.size())
joined += d->currentSelection;
for (int column = 0; column < colCount; ++column) {
if (!isSelectable(row, column)) {
@ -1542,8 +1542,8 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent
return false;
// return false if column exist in currentSelection (Deselect)
if (d->currentCommand & Deselect && d->currentSelection.count()) {
for (int i = 0; i < d->currentSelection.count(); ++i) {
if (d->currentCommand & Deselect && d->currentSelection.size()) {
for (int i = 0; i < d->currentSelection.size(); ++i) {
if (d->currentSelection.at(i).parent() == parent &&
column >= d->currentSelection.at(i).left() &&
column <= d->currentSelection.at(i).right())
@ -1552,11 +1552,11 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent
}
// return false if ranges in both currentSelection and the selection model
// intersect and have the same column contained
if (d->currentCommand & Toggle && d->currentSelection.count()) {
for (int i = 0; i < d->currentSelection.count(); ++i) {
if (d->currentCommand & Toggle && d->currentSelection.size()) {
for (int i = 0; i < d->currentSelection.size(); ++i) {
if (d->currentSelection.at(i).left() <= column &&
d->currentSelection.at(i).right() >= column) {
for (int j = 0; j < d->ranges.count(); ++j) {
for (int j = 0; j < d->ranges.size(); ++j) {
if (d->ranges.at(j).left() <= column && d->ranges.at(j).right() >= column
&& d->currentSelection.at(i).intersected(d->ranges.at(j)).isValid()) {
return false;
@ -1575,7 +1575,7 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent
// add ranges and currentSelection and check through them all
QList<QItemSelectionRange>::const_iterator it;
QList<QItemSelectionRange> joined = d->ranges;
if (d->currentSelection.count())
if (d->currentSelection.size())
joined += d->currentSelection;
for (int row = 0; row < rowCount; ++row) {
if (!isSelectable(row, column)) {
@ -1759,7 +1759,7 @@ QModelIndexList QItemSelectionModel::selectedRows(int column) const
QDuplicateTracker<RowOrColumnDefinition> rowsSeen;
const QItemSelection ranges = selection();
for (int i = 0; i < ranges.count(); ++i) {
for (int i = 0; i < ranges.size(); ++i) {
const QItemSelectionRange &range = ranges.at(i);
QModelIndex parent = range.parent();
for (int row = range.top(); row <= range.bottom(); row++) {
@ -1788,7 +1788,7 @@ QModelIndexList QItemSelectionModel::selectedColumns(int row) const
QDuplicateTracker<RowOrColumnDefinition> columnsSeen;
const QItemSelection ranges = selection();
for (int i = 0; i < ranges.count(); ++i) {
for (int i = 0; i < ranges.size(); ++i) {
const QItemSelectionRange &range = ranges.at(i);
QModelIndex parent = range.parent();
for (int column = range.left(); column <= range.right(); column++) {
@ -1911,9 +1911,9 @@ void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelectio
// remove equal ranges
bool advance;
for (int o = 0; o < deselected.count(); ++o) {
for (int o = 0; o < deselected.size(); ++o) {
advance = true;
for (int s = 0; s < selected.count() && o < deselected.count();) {
for (int s = 0; s < selected.size() && o < deselected.size();) {
if (deselected.at(o) == selected.at(s)) {
deselected.removeAt(o);
selected.removeAt(s);
@ -1928,17 +1928,17 @@ void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelectio
// find intersections
QItemSelection intersections;
for (int o = 0; o < deselected.count(); ++o) {
for (int s = 0; s < selected.count(); ++s) {
for (int o = 0; o < deselected.size(); ++o) {
for (int s = 0; s < selected.size(); ++s) {
if (deselected.at(o).intersects(selected.at(s)))
intersections.append(deselected.at(o).intersected(selected.at(s)));
}
}
// compare remaining ranges with intersections and split them to find deselected and selected
for (int i = 0; i < intersections.count(); ++i) {
for (int i = 0; i < intersections.size(); ++i) {
// split deselected
for (int o = 0; o < deselected.count();) {
for (int o = 0; o < deselected.size();) {
if (deselected.at(o).intersects(intersections.at(i))) {
QItemSelection::split(deselected.at(o), intersections.at(i), &deselected);
deselected.removeAt(o);
@ -1947,7 +1947,7 @@ void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelectio
}
}
// split selected
for (int s = 0; s < selected.count();) {
for (int s = 0; s < selected.size();) {
if (selected.at(s).intersects(intersections.at(i))) {
QItemSelection::split(selected.at(s), intersections.at(i), &selected);
selected.removeAt(s);

View File

@ -1243,7 +1243,7 @@ void QSortFilterProxyModelPrivate::update_persistent_indexes(
{
Q_Q(QSortFilterProxyModel);
QModelIndexList from, to;
const int numSourceIndexes = source_indexes.count();
const int numSourceIndexes = source_indexes.size();
from.reserve(numSourceIndexes);
to.reserve(numSourceIndexes);
for (const auto &indexPair : source_indexes) {
@ -2313,7 +2313,7 @@ QMimeData *QSortFilterProxyModel::mimeData(const QModelIndexList &indexes) const
{
Q_D(const QSortFilterProxyModel);
QModelIndexList source_indexes;
source_indexes.reserve(indexes.count());
source_indexes.reserve(indexes.size());
for (const QModelIndex &idx : indexes)
source_indexes << mapToSource(idx);
return d->model->mimeData(source_indexes);

View File

@ -86,7 +86,7 @@ int QStringListModel::rowCount(const QModelIndex &parent) const
if (parent.isValid())
return 0;
return lst.count();
return lst.size();
}
/*!
@ -94,7 +94,7 @@ int QStringListModel::rowCount(const QModelIndex &parent) const
*/
QModelIndex QStringListModel::sibling(int row, int column, const QModelIndex &idx) const
{
if (!idx.isValid() || column != 0 || row >= lst.count() || row < 0)
if (!idx.isValid() || column != 0 || row >= lst.size() || row < 0)
return QModelIndex();
return createIndex(row, 0);
@ -310,7 +310,7 @@ void QStringListModel::sort(int, Qt::SortOrder order)
emit layoutAboutToBeChanged(QList<QPersistentModelIndex>(), VerticalSortHint);
QList<QPair<QString, int>> list;
const int lstCount = lst.count();
const int lstCount = lst.size();
list.reserve(lstCount);
for (int i = 0; i < lstCount; ++i)
list.append(QPair<QString, int>(lst.at(i), i));
@ -329,7 +329,7 @@ void QStringListModel::sort(int, Qt::SortOrder order)
QModelIndexList oldList = persistentIndexList();
QModelIndexList newList;
const int numOldIndexes = oldList.count();
const int numOldIndexes = oldList.size();
newList.reserve(numOldIndexes);
for (int i = 0; i < numOldIndexes; ++i)
newList.append(index(forwarding.at(oldList.at(i).row()), 0));

View File

@ -787,7 +787,7 @@ void QCoreApplicationPrivate::init()
// have been removed. Once the original list is exhausted we know all the remaining
// items have been added.
QStringList newPaths(q->libraryPaths());
for (qsizetype i = manualPaths->length(), j = appPaths->length(); i > 0 || j > 0; qt_noop()) {
for (qsizetype i = manualPaths->size(), j = appPaths->size(); i > 0 || j > 0; qt_noop()) {
if (--j < 0) {
newPaths.prepend((*manualPaths)[--i]);
} else if (--i < 0) {
@ -2144,12 +2144,12 @@ static void replacePercentN(QString *result, int n)
qsizetype len = 0;
while ((percentPos = result->indexOf(u'%', percentPos + len)) != -1) {
len = 1;
if (percentPos + len == result->length())
if (percentPos + len == result->size())
break;
QString fmt;
if (result->at(percentPos + len) == u'L') {
++len;
if (percentPos + len == result->length())
if (percentPos + len == result->size())
break;
fmt = "%L1"_L1;
} else {

View File

@ -1180,7 +1180,7 @@ static const struct : QMetaTypeModuleHelper
#endif
QMETATYPE_CONVERTER(QString, QByteArray, result = QString::fromUtf8(source); return true;);
QMETATYPE_CONVERTER(QString, QStringList,
return (source.count() == 1) ? (result = source.at(0), true) : false;
return (source.size() == 1) ? (result = source.at(0), true) : false;
);
#ifndef QT_BOOTSTRAPPED
QMETATYPE_CONVERTER(QString, QUrl, result = source.toString(); return true;);

View File

@ -2155,7 +2155,7 @@ void QObjectPrivate::deleteChildren()
// delete children objects
// don't use qDeleteAll as the destructor of the child might
// delete siblings
for (int i = 0; i < children.count(); ++i) {
for (int i = 0; i < children.size(); ++i) {
currentChildBeingDeleted = children.at(i);
children[i] = nullptr;
delete currentChildBeingDeleted;
@ -3684,7 +3684,7 @@ void QMetaObject::connectSlotsByName(QObject *o)
// ...we check each object in our list, ...
bool foundIt = false;
for (int j = 0; j < list.count(); ++j) {
for (int j = 0; j < list.size(); ++j) {
const QObject *co = list.at(j);
const QByteArray coName = co->objectName().toLatin1();

View File

@ -474,7 +474,7 @@ void QTimerInfoList::registerTimer(int timerId, qint64 interval, Qt::TimerType t
bool QTimerInfoList::unregisterTimer(int timerId)
{
// set timer inactive
for (int i = 0; i < count(); ++i) {
for (int i = 0; i < size(); ++i) {
QTimerInfo *t = at(i);
if (t->id == timerId) {
// found it
@ -495,7 +495,7 @@ bool QTimerInfoList::unregisterTimers(QObject *object)
{
if (isEmpty())
return false;
for (int i = 0; i < count(); ++i) {
for (int i = 0; i < size(); ++i) {
QTimerInfo *t = at(i);
if (t->obj == object) {
// object found
@ -515,7 +515,7 @@ bool QTimerInfoList::unregisterTimers(QObject *object)
QList<QAbstractEventDispatcher::TimerInfo> QTimerInfoList::registeredTimers(QObject *object) const
{
QList<QAbstractEventDispatcher::TimerInfo> list;
for (int i = 0; i < count(); ++i) {
for (int i = 0; i < size(); ++i) {
const QTimerInfo * const t = at(i);
if (t->obj == object) {
list << QAbstractEventDispatcher::TimerInfo(t->id,

View File

@ -357,7 +357,7 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa
// Pass 1) Try to match on the file name
QMimeGlobMatchResult candidatesByName = findByFileName(fileName);
if (candidatesByName.m_allMatchingMimeTypes.count() == 1) {
if (candidatesByName.m_allMatchingMimeTypes.size() == 1) {
const QMimeType mime = mimeTypeForName(candidatesByName.m_matchingMimeTypes.at(0));
if (mime.isValid())
return mime;
@ -399,7 +399,7 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa
}
}
if (candidatesByName.m_allMatchingMimeTypes.count() > 1) {
if (candidatesByName.m_allMatchingMimeTypes.size() > 1) {
candidatesByName.m_matchingMimeTypes.sort(); // make it deterministic
const QMimeType mime = mimeTypeForName(candidatesByName.m_matchingMimeTypes.at(0));
if (mime.isValid())
@ -652,7 +652,7 @@ QList<QMimeType> QMimeDatabase::mimeTypesForFileName(const QString &fileName) co
const QStringList matches = d->mimeTypeForFileName(fileName);
QList<QMimeType> mimes;
mimes.reserve(matches.count());
mimes.reserve(matches.size());
for (const QString &mime : matches)
mimes.append(d->mimeTypeForName(mime));
return mimes;

View File

@ -700,7 +700,7 @@ void QMimeXMLProvider::ensureLoaded()
const QString packageDir = m_directory + QStringLiteral("/packages");
QDir dir(packageDir);
const QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
allFiles.reserve(files.count());
allFiles.reserve(files.size());
for (const QString &xmlFile : files)
allFiles.append(packageDir + u'/' + xmlFile);

View File

@ -139,14 +139,14 @@ public:
NumberParsingStatus getNumber(qulonglong *l);
bool getReal(double *f);
inline void write(QStringView data) { write(data.begin(), data.length()); }
inline void write(QStringView data) { write(data.begin(), data.size()); }
inline void write(QChar ch);
void write(const QChar *data, qsizetype len);
void write(QLatin1StringView data);
void writePadding(qsizetype len);
inline void putString(QStringView string, bool number = false)
{
putString(string.constData(), string.length(), number);
putString(string.constData(), string.size(), number);
}
void putString(const QChar *data, qsizetype len, bool number = false);
void putString(QLatin1StringView data, bool number = false);

View File

@ -42,7 +42,7 @@ public:
{
}
XmlStringRef(const QString *string)
: XmlStringRef(string, 0, string->length())
: XmlStringRef(string, 0, string->size())
{
}

View File

@ -2061,7 +2061,7 @@ static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationFo
enum { NFQC_YES = 0, NFQC_NO = 1, NFQC_MAYBE = 3 };
const ushort *string = reinterpret_cast<const ushort *>(str->constData());
qsizetype length = str->length();
qsizetype length = str->size();
// this avoids one out of bounds check in the loop
while (length > from && QChar::isHighSurrogate(string[length - 1]))
@ -2104,8 +2104,8 @@ static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationFo
*lastStable = pos;
}
if (length != str->length()) // low surrogate parts at the end of text
*lastStable = str->length() - 1;
if (length != str->size()) // low surrogate parts at the end of text
*lastStable = str->size() - 1;
return true;
}

View File

@ -555,7 +555,7 @@ static bool isScript(QStringView tag)
static const QString allScripts =
QString::fromLatin1(reinterpret_cast<const char *>(script_code_list),
sizeof(script_code_list) - 1);
return tag.length() == 4 && allScripts.indexOf(tag) % 4 == 0;
return tag.size() == 4 && allScripts.indexOf(tag) % 4 == 0;
}
bool qt_splitLocaleName(QStringView name, QStringView *lang, QStringView *script, QStringView *land)
@ -4014,7 +4014,7 @@ bool QLocaleData::validateChars(QStringView str, NumberMode numMode, QByteArray
int decDigits, QLocale::NumberOptions number_options) const
{
buff->clear();
buff->reserve(str.length());
buff->reserve(str.size());
enum { Whole, Fractional, Exponent } state = Whole;
const bool scientific = numMode == DoubleScientificMode;
@ -4110,7 +4110,7 @@ double QLocaleData::stringToDouble(QStringView str, bool *ok,
}
int processed = 0;
bool nonNullOk = false;
double d = qt_asciiToDouble(buff.constData(), buff.length() - 1, nonNullOk, processed);
double d = qt_asciiToDouble(buff.constData(), buff.size() - 1, nonNullOk, processed);
if (ok != nullptr)
*ok = nonNullOk;
return d;

View File

@ -2718,9 +2718,9 @@ void QString::resize(qsizetype size)
void QString::resize(qsizetype newSize, QChar fillChar)
{
const qsizetype oldSize = length();
const qsizetype oldSize = size();
resize(newSize);
const qsizetype difference = length() - oldSize;
const qsizetype difference = size() - oldSize;
if (difference > 0)
std::fill_n(d.data() + oldSize, difference, fillChar.unicode());
}
@ -4188,7 +4188,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.size()), cs);
return QtPrivate::findString(QStringView(unicode(), size()), from, QStringView(str.unicode(), str.size()), cs);
}
/*!
@ -4242,7 +4242,7 @@ qsizetype QString::indexOf(QLatin1StringView str, qsizetype from, Qt::CaseSensit
*/
qsizetype QString::indexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) const
{
return qFindChar(QStringView(unicode(), length()), ch, from, cs);
return qFindChar(QStringView(unicode(), size()), ch, from, cs);
}
/*!
@ -4506,7 +4506,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after)
}
// add the last part of the after string
len = afterView.length() - lastEnd;
len = afterView.size() - lastEnd;
if (len > 0) {
chunks << afterView.mid(lastEnd, len);
newLength += len;
@ -4516,9 +4516,9 @@ QString &QString::replace(const QRegularExpression &re, const QString &after)
}
// 3. trailing string after the last match
if (copyView.length() > lastEnd) {
if (copyView.size() > lastEnd) {
chunks << copyView.mid(lastEnd);
newLength += copyView.length() - lastEnd;
newLength += copyView.size() - lastEnd;
}
// 4. assemble the chunks together
@ -4526,7 +4526,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after)
qsizetype i = 0;
QChar *uc = data();
for (const QStringView &chunk : std::as_const(chunks)) {
qsizetype len = chunk.length();
qsizetype len = chunk.size();
memcpy(uc + i, chunk.constData(), len * sizeof(QChar));
i += len;
}
@ -4889,7 +4889,7 @@ static QString extractSections(const QList<qt_section_chunk> &sections, qsizetyp
qsizetype skip = 0;
for (qsizetype k = 0; k < sectionsSize; ++k) {
const qt_section_chunk &section = sections.at(k);
if (section.length == section.string.length())
if (section.length == section.string.size())
skip++;
}
if (start < 0)
@ -4905,7 +4905,7 @@ static QString extractSections(const QList<qt_section_chunk> &sections, qsizetyp
qsizetype first_i = start, last_i = end;
for (qsizetype i = 0; x <= end && i < sectionsSize; ++i) {
const qt_section_chunk &section = sections.at(i);
const bool empty = (section.length == section.string.length());
const bool empty = (section.length == section.string.size());
if (x >= start) {
if (x == start)
first_i = i;
@ -4964,7 +4964,7 @@ QString QString::section(const QRegularExpression &re, qsizetype start, qsizetyp
sep.setPatternOptions(sep.patternOptions() | QRegularExpression::CaseInsensitiveOption);
QList<qt_section_chunk> sections;
qsizetype n = length(), m = 0, last_m = 0, last_len = 0;
qsizetype n = size(), m = 0, last_m = 0, last_len = 0;
QRegularExpressionMatchIterator iterator = sep.globalMatch(*this);
while (iterator.hasNext()) {
QRegularExpressionMatch match = iterator.next();
@ -5321,7 +5321,7 @@ static QByteArray qt_convert_to_latin1(QStringView string)
if (Q_UNLIKELY(string.isNull()))
return QByteArray();
QByteArray ba(string.length(), Qt::Uninitialized);
QByteArray ba(string.size(), Qt::Uninitialized);
// since we own the only copy, we're going to const_cast the constData;
// that avoids an unnecessary call to detach() and expansion code that will never get used
@ -5490,7 +5490,7 @@ QList<uint> QString::toUcs4() const
static QList<uint> qt_convert_to_ucs4(QStringView string)
{
QList<uint> v(string.length());
QList<uint> v(string.size());
uint *a = const_cast<uint*>(v.constData());
QStringIterator it(string);
while (it.hasNext())
@ -6445,7 +6445,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.size());
return localeAwareCompare_helper(constData(), size(), other.constData(), other.size());
}
/*!
@ -6561,7 +6561,7 @@ const ushort *QString::utf16() const
QString QString::leftJustified(qsizetype width, QChar fill, bool truncate) const
{
QString result;
qsizetype len = length();
qsizetype len = size();
qsizetype padlen = width - len;
if (padlen > 0) {
result.resize(len+padlen);
@ -6600,7 +6600,7 @@ QString QString::leftJustified(qsizetype width, QChar fill, bool truncate) const
QString QString::rightJustified(qsizetype width, QChar fill, bool truncate) const
{
QString result;
qsizetype len = length();
qsizetype len = size();
qsizetype padlen = width - len;
if (padlen > 0) {
result.resize(len+padlen);
@ -7933,7 +7933,7 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::
// check if it's fully ASCII first, because then we have no work
auto start = reinterpret_cast<const char16_t *>(data->constData());
const char16_t *p = start + from;
if (isAscii_helper(p, p + data->length() - from))
if (isAscii_helper(p, p + data->size() - from))
return;
if (p > start + from)
from = p - start - 1; // need one before the non-ASCII to perform NFC
@ -8119,9 +8119,9 @@ static QString replaceArgEscapes(QStringView s, const ArgEscapeData &d, qsizetyp
// Negative field-width for right-padding, positive for left-padding:
const qsizetype abs_field_width = qAbs(field_width);
const qsizetype result_len =
s.length() - d.escape_len
+ (d.occurrences - d.locale_occurrences) * qMax(abs_field_width, arg.length())
+ d.locale_occurrences * qMax(abs_field_width, larg.length());
s.size() - d.escape_len
+ (d.occurrences - d.locale_occurrences) * qMax(abs_field_width, arg.size())
+ d.locale_occurrences * qMax(abs_field_width, larg.size());
QString result(result_len, Qt::Uninitialized);
QChar *rc = const_cast<QChar *>(result.unicode());
@ -8164,15 +8164,15 @@ static QString replaceArgEscapes(QStringView s, const ArgEscapeData &d, qsizetyp
rc += escape_start - text_start;
const QStringView use = localize ? larg : arg;
const qsizetype pad_chars = abs_field_width - use.length();
const qsizetype pad_chars = abs_field_width - use.size();
// (If negative, relevant loops are no-ops: no need to check.)
if (field_width > 0) { // left padded
rc = std::fill_n(rc, pad_chars, fillChar);
}
memcpy(rc, use.data(), use.length() * sizeof(QChar));
rc += use.length();
memcpy(rc, use.data(), use.size() * sizeof(QChar));
rc += use.size();
if (field_width < 0) { // right padded
rc = std::fill_n(rc, pad_chars, fillChar);
@ -10956,7 +10956,7 @@ qsizetype QtPrivate::count(QStringView haystack, const QRegularExpression &re)
}
qsizetype count = 0;
qsizetype index = -1;
qsizetype len = haystack.length();
qsizetype len = haystack.size();
while (index <= len - 1) {
QRegularExpressionMatch match = re.matchView(haystack, index + 1);
if (!match.hasMatch())
@ -10983,7 +10983,7 @@ qsizetype QtPrivate::count(QStringView haystack, const QRegularExpression &re)
QString QString::toHtmlEscaped() const
{
QString rich;
const qsizetype len = length();
const qsizetype len = size();
rich.reserve(qsizetype(len * 1.1));
for (QChar ch : *this) {
if (ch == u'<')

View File

@ -679,19 +679,19 @@ 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.size()); }
inline QString &insert(qsizetype i, QStringView v) { return insert(i, v.data(), v.length()); }
inline QString &insert(qsizetype i, QStringView v) { return insert(i, v.data(), v.size()); }
QString &insert(qsizetype i, QLatin1StringView s);
QString &append(QChar c);
QString &append(const QChar *uc, qsizetype len);
QString &append(const QString &s);
inline QString &append(QStringView v) { return append(v.data(), v.length()); }
inline QString &append(QStringView v) { return append(v.data(), v.size()); }
QString &append(QLatin1StringView s);
inline QString &prepend(QChar c) { return insert(0, c); }
inline QString &prepend(const QChar *uc, qsizetype len) { return insert(0, uc, len); }
inline QString &prepend(const QString &s) { return insert(0, s); }
inline QString &prepend(QStringView v) { return prepend(v.data(), v.length()); }
inline QString &prepend(QStringView v) { return prepend(v.data(), v.size()); }
inline QString &prepend(QLatin1StringView s) { return insert(0, s); }
inline QString &operator+=(QChar c) { return append(c); }
@ -1193,7 +1193,7 @@ QString QLatin1StringView::toString() const { return *this; }
//
QString QStringView::toString() const
{ return Q_ASSERT(size() == length()), QString(data(), length()); }
{ return Q_ASSERT(size() == size()), QString(data(), size()); }
qint64 QStringView::toLongLong(bool *ok, int base) const
{ return QString::toIntegral_helper<qint64>(*this, ok, base); }
@ -1483,7 +1483,7 @@ inline QString QString::fromStdString(const std::string &s)
inline std::wstring QString::toStdWString() const
{
std::wstring str;
str.resize(length());
str.resize(size());
str.resize(toWCharArray(str.data()));
return str;
}
@ -1495,16 +1495,16 @@ inline QString QString::fromStdU16String(const std::u16string &s)
{ return fromUtf16(s.data(), qsizetype(s.size())); }
inline std::u16string QString::toStdU16String() const
{ return std::u16string(reinterpret_cast<const char16_t*>(data()), length()); }
{ return std::u16string(reinterpret_cast<const char16_t*>(data()), size()); }
inline QString QString::fromStdU32String(const std::u32string &s)
{ return fromUcs4(s.data(), qsizetype(s.size())); }
inline std::u32string QString::toStdU32String() const
{
std::u32string u32str(length(), char32_t(0));
std::u32string u32str(size(), char32_t(0));
qsizetype len = toUcs4_helper(reinterpret_cast<const ushort *>(constData()),
length(), reinterpret_cast<uint*>(&u32str[0]));
size(), reinterpret_cast<uint*>(&u32str[0]));
u32str.resize(len);
return u32str;
}
@ -1521,9 +1521,9 @@ inline int QString::compare(QStringView s, Qt::CaseSensitivity cs) const noexcep
{ return -s.compare(*this, cs); }
inline int QString::localeAwareCompare(QStringView s) const
{ return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
{ return localeAwareCompare_helper(constData(), size(), s.constData(), s.size()); }
inline int QString::localeAwareCompare(QStringView s1, QStringView s2)
{ return localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
{ return localeAwareCompare_helper(s1.constData(), s1.size(), s2.constData(), s2.size()); }
inline int QStringView::localeAwareCompare(QStringView other) const
{ return QString::localeAwareCompare(*this, other); }

View File

@ -504,7 +504,7 @@ char *QUtf8::convertFromUnicode(char *out, QStringView in, QStringConverter::Sta
{
Q_ASSERT(state);
const QChar *uc = in.data();
qsizetype len = in.length();
qsizetype len = in.size();
if (!len)
return out;
@ -915,13 +915,13 @@ char *QUtf16::convertFromUnicode(char *out, QStringView in, QStringConverter::St
out += 2;
}
if (endian == BigEndianness)
qToBigEndian<char16_t>(in.data(), in.length(), out);
qToBigEndian<char16_t>(in.data(), in.size(), out);
else
qToLittleEndian<char16_t>(in.data(), in.length(), out);
qToLittleEndian<char16_t>(in.data(), in.size(), out);
state->remainingChars = 0;
state->internalState |= HeaderDone;
return out + 2*in.length();
return out + 2*in.size();
}
QString QUtf16::convertToUnicode(QByteArrayView in, QStringConverter::State *state, DataEndianness endian)
@ -1051,7 +1051,7 @@ char *QUtf32::convertFromUnicode(char *out, QStringView in, QStringConverter::St
}
const QChar *uc = in.data();
const QChar *end = in.data() + in.length();
const QChar *end = in.data() + in.size();
QChar ch;
char32_t ucs4;
if (state->remainingChars == 1) {
@ -1489,7 +1489,7 @@ static char *toLatin1(char *out, QStringView in, QStringConverter::State *state)
const char replacement = (state && state->flags & QStringConverter::Flag::ConvertInvalidToNull) ? 0 : '?';
qsizetype invalid = 0;
for (qsizetype i = 0; i < in.length(); ++i) {
for (qsizetype i = 0; i < in.size(); ++i) {
if (in[i] > QChar(0xff)) {
*out = replacement;
++invalid;
@ -1765,7 +1765,7 @@ struct QStringConverterICU : QStringConverter
auto source = reinterpret_cast<const UChar *>(in.data());
auto sourceLimit = reinterpret_cast<const UChar *>(in.data() + in.size());
qsizetype length = UCNV_GET_MAX_BYTES_FOR_STRING(in.length(), ucnv_getMaxCharSize(icu_conv));
qsizetype length = UCNV_GET_MAX_BYTES_FOR_STRING(in.size(), ucnv_getMaxCharSize(icu_conv));
char *target = out;
char *targetLimit = out + length;

View File

@ -387,7 +387,7 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, QStringView befo
QStringView after, Qt::CaseSensitivity cs)
{
for (qsizetype i = 0; i < that->size(); ++i)
(*that)[i].replace(before.data(), before.length(), after.data(), after.length(), cs);
(*that)[i].replace(before.data(), before.size(), after.data(), after.size(), cs);
}
#if QT_CONFIG(regularexpression)
@ -492,7 +492,7 @@ QString QtPrivate::QStringList_join(const QStringList &list, QLatin1StringView s
*/
QString QtPrivate::QStringList_join(const QStringList *that, QStringView sep)
{
return QStringList_join(that, sep.data(), sep.length());
return QStringList_join(that, sep.data(), sep.size());
}
/*!

View File

@ -20,7 +20,7 @@ static void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharA
case QTextBoundaryFinder::Line: options |= QUnicodeTools::LineBreaks; break;
default: break;
}
QUnicodeTools::initCharAttributes(str, scriptItems.data(), scriptItems.count(), attributes, options);
QUnicodeTools::initCharAttributes(str, scriptItems.data(), scriptItems.size(), attributes, options);
}
/*!

View File

@ -164,23 +164,23 @@ public:
if (containsValidResultItem(index)) // reject if already present
return -1;
return addResults(index, new QList<T>(*results), results->count(), results->count());
return addResults(index, new QList<T>(*results), results->size(), results->size());
}
template<typename T>
int addResults(int index, const QList<T> *results, int totalCount)
{
// reject if results are empty, and nothing is filtered away
if ((m_filterMode == false || results->count() == totalCount) && results->empty())
if ((m_filterMode == false || results->size() == totalCount) && results->empty())
return -1;
if (containsValidResultItem(index)) // reject if already present
return -1;
if (m_filterMode == true && results->count() != totalCount && 0 == results->count())
if (m_filterMode == true && results->size() != totalCount && 0 == results->size())
return addResults(index, nullptr, 0, totalCount);
return addResults(index, new QList<T>(*results), results->count(), totalCount);
return addResults(index, new QList<T>(*results), results->size(), totalCount);
}
int addCanceledResult(int index)

View File

@ -55,11 +55,11 @@ QThreadStorageData::QThreadStorageData(void (*func)(void *))
DEBUG_MSG("QThreadStorageData: Allocated id %d, destructor %p cannot be stored", id, func);
return;
}
for (id = 0; id < destr->count(); id++) {
for (id = 0; id < destr->size(); id++) {
if (destr->at(id) == nullptr)
break;
}
if (id == destr->count()) {
if (id == destr->size()) {
destr->append(func);
} else {
(*destr)[id] = func;

View File

@ -123,7 +123,7 @@ static ParsedRfcDateTime rfcDateImpl(QStringView s)
QDate date;
const auto isShortName = [](QStringView name) {
return (name.length() == 3 && name[0].isUpper()
return (name.size() == 3 && name[0].isUpper()
&& name[1].isLower() && name[2].isLower());
};

View File

@ -751,7 +751,7 @@ QTimeZone::OffsetDataList QTimeZone::transitions(const QDateTime &fromDateTime,
if (hasTransitions()) {
const QTimeZonePrivate::DataList plist = d->transitions(fromDateTime.toMSecsSinceEpoch(),
toDateTime.toMSecsSinceEpoch());
list.reserve(plist.count());
list.reserve(plist.size());
for (const QTimeZonePrivate::Data &pdata : plist)
list.append(QTimeZonePrivate::toOffsetData(pdata));
}

View File

@ -500,9 +500,9 @@ QString QCommandLineParser::errorText() const
{
if (!d->errorText.isEmpty())
return d->errorText;
if (d->unknownOptionNames.count() == 1)
if (d->unknownOptionNames.size() == 1)
return tr("Unknown option '%1'.").arg(d->unknownOptionNames.first());
if (d->unknownOptionNames.count() > 1)
if (d->unknownOptionNames.size() > 1)
return tr("Unknown options: %1.").arg(d->unknownOptionNames.join(QStringLiteral(", ")));
return QString();
}

View File

@ -1274,7 +1274,7 @@ void QEasingCurve::addCubicBezierSegment(const QPointF & c1, const QPointF & c2,
QList<QPointF> static inline tcbToBezier(const TCBPoints &tcbPoints)
{
const int count = tcbPoints.count();
const int count = tcbPoints.size();
QList<QPointF> bezierPoints;
bezierPoints.reserve(3 * (count - 1));

View File

@ -151,7 +151,7 @@ public:
// more Qt
typedef iterator Iterator;
typedef const_iterator ConstIterator;
inline qsizetype count() const { return q_hash.count(); }
inline qsizetype count() const { return q_hash.size(); }
inline iterator insert(const T &value)
{ return q_hash.insert(value, QHashDummyValue()); }
inline iterator insert(T &&value)

View File

@ -327,7 +327,7 @@ static QByteArray buildMatchRule(const QString &service,
// add the argument string-matching now
if (!argMatch.args.isEmpty()) {
const QString keyValue = "arg%1='%2',"_L1;
for (int i = 0; i < argMatch.args.count(); ++i)
for (int i = 0; i < argMatch.args.size(); ++i)
if (!argMatch.args.at(i).isNull())
result += keyValue.arg(i).arg(argMatch.args.at(i));
}
@ -945,7 +945,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q
outputArgs.reserve(numMetaTypes - i + 1);
QVariant arg{QMetaType(metaTypes[0])};
outputArgs.append( arg );
params[0] = const_cast<void*>(outputArgs.at( outputArgs.count() - 1 ).constData());
params[0] = const_cast<void*>(outputArgs.at( outputArgs.size() - 1 ).constData());
} else {
outputArgs.reserve(numMetaTypes - i);
}
@ -953,7 +953,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q
for ( ; i < numMetaTypes; ++i) {
QVariant arg{QMetaType(metaTypes[i])};
outputArgs.append( arg );
params.append(const_cast<void*>(outputArgs.at( outputArgs.count() - 1 ).constData()));
params.append(const_cast<void*>(outputArgs.at( outputArgs.size() - 1 ).constData()));
}
// make call:

View File

@ -221,7 +221,7 @@ void QDBusMetaObjectGenerator::parseMethods()
bool ok = true;
// build the input argument list
for (qsizetype i = 0; i < m.inputArgs.count(); ++i) {
for (qsizetype i = 0; i < m.inputArgs.size(); ++i) {
const QDBusIntrospection::Argument &arg = m.inputArgs.at(i);
Type type = findType(arg.type.toLatin1(), m.annotations, "In", i);
@ -240,7 +240,7 @@ void QDBusMetaObjectGenerator::parseMethods()
if (!ok) continue;
// build the output argument list:
for (qsizetype i = 0; i < m.outputArgs.count(); ++i) {
for (qsizetype i = 0; i < m.outputArgs.size(); ++i) {
const QDBusIntrospection::Argument &arg = m.outputArgs.at(i);
Type type = findType(arg.type.toLatin1(), m.annotations, "Out", i);
@ -297,7 +297,7 @@ void QDBusMetaObjectGenerator::parseSignals()
bool ok = true;
// build the output argument list
for (qsizetype i = 0; i < s.outputArgs.count(); ++i) {
for (qsizetype i = 0; i < s.outputArgs.size(); ++i) {
const QDBusIntrospection::Argument &arg = s.outputArgs.at(i);
Type type = findType(arg.type.toLatin1(), s.annotations, "Out", i);

View File

@ -306,7 +306,7 @@ namespace QDBusUtil
return false; // can't be valid if it's empty
const QChar *c = part.data();
for (int i = 0; i < part.length(); ++i)
for (int i = 0; i < part.size(); ++i)
if (!isValidCharacterNoDash(c[i]))
return false;
@ -358,7 +358,7 @@ namespace QDBusUtil
*/
bool isValidUniqueConnectionName(QStringView connName)
{
if (connName.isEmpty() || connName.length() > DBUS_MAXIMUM_NAME_LENGTH ||
if (connName.isEmpty() || connName.size() > DBUS_MAXIMUM_NAME_LENGTH ||
!connName.startsWith(u':'))
return false;
@ -371,7 +371,7 @@ namespace QDBusUtil
return false;
const QChar* c = part.data();
for (int j = 0; j < part.length(); ++j)
for (int j = 0; j < part.size(); ++j)
if (!isValidCharacter(c[j]))
return false;
}
@ -419,7 +419,7 @@ namespace QDBusUtil
const QChar *c = part.data();
if (isValidNumber(c[0]))
return false;
for (int j = 0; j < part.length(); ++j)
for (int j = 0; j < part.size(); ++j)
if (!isValidCharacter(c[j]))
return false;
}
@ -435,13 +435,13 @@ namespace QDBusUtil
*/
bool isValidMemberName(QStringView memberName)
{
if (memberName.isEmpty() || memberName.length() > DBUS_MAXIMUM_NAME_LENGTH)
if (memberName.isEmpty() || memberName.size() > DBUS_MAXIMUM_NAME_LENGTH)
return false;
const QChar* c = memberName.data();
if (isValidNumber(c[0]))
return false;
for (int j = 0; j < memberName.length(); ++j)
for (int j = 0; j < memberName.size(); ++j)
if (!isValidCharacterNoDash(c[j]))
return false;
return true;

View File

@ -1811,12 +1811,12 @@ QRect AtSpiAdaptor::getExtents(QAccessibleInterface *interface, uint coordType)
bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
{
if (function == "GetNActions"_L1) {
int count = QAccessibleBridgeUtils::effectiveActionNames(interface).count();
int count = QAccessibleBridgeUtils::effectiveActionNames(interface).size();
sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(count))));
} else if (function == "DoAction"_L1) {
int index = message.arguments().at(0).toInt();
const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
if (index < 0 || index >= actionNames.count())
if (index < 0 || index >= actionNames.size())
return false;
const QString actionName = actionNames.at(index);
bool success = QAccessibleBridgeUtils::performEffectiveAction(interface, actionName);
@ -1826,13 +1826,13 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin
} else if (function == "GetName"_L1) {
int index = message.arguments().at(0).toInt();
const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
if (index < 0 || index >= actionNames.count())
if (index < 0 || index >= actionNames.size())
return false;
sendReply(connection, message, actionNames.at(index));
} else if (function == "GetDescription"_L1) {
int index = message.arguments().at(0).toInt();
const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
if (index < 0 || index >= actionNames.count())
if (index < 0 || index >= actionNames.size())
return false;
QString description;
if (QAccessibleActionInterface *actionIface = interface->actionInterface())
@ -1843,7 +1843,7 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin
} else if (function == "GetKeyBinding"_L1) {
int index = message.arguments().at(0).toInt();
const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
if (index < 0 || index >= actionNames.count())
if (index < 0 || index >= actionNames.size())
return false;
QStringList keyBindings;
if (QAccessibleActionInterface *actionIface = interface->actionInterface())
@ -1853,7 +1853,7 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin
if (!acc.isEmpty())
keyBindings.append(acc);
}
if (keyBindings.length() > 0)
if (keyBindings.size() > 0)
sendReply(connection, message, keyBindings.join(u';'));
else
sendReply(connection, message, QString());

View File

@ -670,7 +670,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
const QString cn = QLatin1StringView(mo->className());
// Check if the class has a InterfaceFactory installed.
for (int i = qAccessibleFactories()->count(); i > 0; --i) {
for (int i = qAccessibleFactories()->size(); i > 0; --i) {
InterfaceFactory factory = qAccessibleFactories()->at(i - 1);
if (QAccessibleInterface *iface = factory(cn, object)) {
QAccessibleCache::instance()->insert(object, iface);
@ -787,7 +787,7 @@ bool QAccessible::isActive()
*/
void QAccessible::setActive(bool active)
{
for (int i = 0; i < qAccessibleActivationObservers()->count() ;++i)
for (int i = 0; i < qAccessibleActivationObservers()->size() ;++i)
qAccessibleActivationObservers()->at(i)->accessibilityActiveChanged(active);
}

View File

@ -124,7 +124,7 @@ static QObjectList topLevelObjects()
{
QObjectList list;
const QWindowList tlw(QGuiApplication::topLevelWindows());
for (int i = 0; i < tlw.count(); ++i) {
for (int i = 0; i < tlw.size(); ++i) {
QWindow *w = tlw.at(i);
if (w->type() != Qt::Popup && w->type() != Qt::Desktop) {
if (QAccessibleInterface *root = w->accessibleRoot()) {
@ -140,7 +140,7 @@ static QObjectList topLevelObjects()
/*! \reimp */
int QAccessibleApplication::childCount() const
{
return topLevelObjects().count();
return topLevelObjects().size();
}
/*! \reimp */
@ -160,7 +160,7 @@ QAccessibleInterface *QAccessibleApplication::parent() const
QAccessibleInterface *QAccessibleApplication::child(int index) const
{
const QObjectList tlo(topLevelObjects());
if (index >= 0 && index < tlo.count())
if (index >= 0 && index < tlo.size())
return QAccessible::queryAccessibleInterface(tlo.at(index));
return nullptr;
}

View File

@ -50,7 +50,7 @@ void QPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
if (!bridges() || bridges()->isEmpty())
return;
for (int i = 0; i < bridges()->count(); ++i)
for (int i = 0; i < bridges()->size(); ++i)
bridges()->at(i)->notifyAccessibilityUpdate(event);
}
@ -63,7 +63,7 @@ void QPlatformAccessibility::setRootObject(QObject *o)
if (!o)
return;
for (int i = 0; i < bridges()->count(); ++i) {
for (int i = 0; i < bridges()->size(); ++i) {
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o);
bridges()->at(i)->setRootObject(iface);
}

View File

@ -344,13 +344,13 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
if (files.isEmpty()) {
infoList = QDir::drives();
} else {
infoList.reserve(files.count());
infoList.reserve(files.size());
for (const auto &file : files)
infoList << QFileInfo(file);
}
QList<QPair<QString, QFileInfo>> updatedFiles;
updatedFiles.reserve(infoList.count());
for (int i = infoList.count() - 1; i >= 0; --i) {
updatedFiles.reserve(infoList.size());
for (int i = infoList.size() - 1; i >= 0; --i) {
QFileInfo driveInfo = infoList.at(i);
driveInfo.stat();
QString driveName = translateDriveName(driveInfo);

View File

@ -394,12 +394,12 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
QFileSystemModelPrivate::QFileSystemNode *parent = node(index);
for (int i = 0; i < pathElements.count(); ++i) {
for (int i = 0; i < pathElements.size(); ++i) {
QString element = pathElements.at(i);
if (i != 0)
elementPath.append(separator);
elementPath.append(element);
if (i == pathElements.count() - 1)
if (i == pathElements.size() - 1)
elementPath.append(trailingSeparator);
#ifdef Q_OS_WIN
// On Windows, "filename " and "filename" are equivalent and
@ -1106,7 +1106,7 @@ void QFileSystemModel::sort(int column, Qt::SortOrder order)
emit layoutAboutToBeChanged();
QModelIndexList oldList = persistentIndexList();
QList<QPair<QFileSystemModelPrivate::QFileSystemNode *, int>> oldNodes;
const int nodeCount = oldList.count();
const int nodeCount = oldList.size();
oldNodes.reserve(nodeCount);
for (int i = 0; i < nodeCount; ++i) {
const QModelIndex &oldNode = oldList.at(i);
@ -1752,7 +1752,7 @@ void QFileSystemModelPrivate::_q_directoryChanged(const QString &directory, cons
if ((iterator == newFiles.end()) || (i.value()->fileName < *iterator))
toRemove.append(i.value()->fileName);
}
for (int i = 0 ; i < toRemove.count() ; ++i )
for (int i = 0 ; i < toRemove.size() ; ++i )
removeNode(parentNode, toRemove[i]);
}
@ -1844,7 +1844,7 @@ void QFileSystemModelPrivate::addVisibleFiles(QFileSystemNode *parentNode, const
QModelIndex parent = index(parentNode);
bool indexHidden = isHiddenByFilter(parentNode, parent);
if (!indexHidden) {
q->beginInsertRows(parent, parentNode->visibleChildren.size() , parentNode->visibleChildren.size() + newFiles.count() - 1);
q->beginInsertRows(parent, parentNode->visibleChildren.size() , parentNode->visibleChildren.size() + newFiles.size() - 1);
}
if (parentNode->dirtyChildrenIndex == -1)
@ -1974,11 +1974,11 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path,
max = QString();*/
}
if (newFiles.count() > 0) {
if (newFiles.size() > 0) {
addVisibleFiles(parentNode, newFiles);
}
if (newFiles.count() > 0 || (sortColumn != 0 && rowsToUpdate.size() > 0)) {
if (newFiles.size() > 0 || (sortColumn != 0 && rowsToUpdate.size() > 0)) {
forceSort = true;
delayedSort();
}

View File

@ -2529,9 +2529,9 @@ QStandardItem *QStandardItemModel::verticalHeaderItem(int row) const
void QStandardItemModel::setHorizontalHeaderLabels(const QStringList &labels)
{
Q_D(QStandardItemModel);
if (columnCount() < labels.count())
setColumnCount(labels.count());
for (int i = 0; i < labels.count(); ++i) {
if (columnCount() < labels.size())
setColumnCount(labels.size());
for (int i = 0; i < labels.size(); ++i) {
QStandardItem *item = horizontalHeaderItem(i);
if (!item) {
item = d->createItem();
@ -2552,9 +2552,9 @@ void QStandardItemModel::setHorizontalHeaderLabels(const QStringList &labels)
void QStandardItemModel::setVerticalHeaderLabels(const QStringList &labels)
{
Q_D(QStandardItemModel);
if (rowCount() < labels.count())
setRowCount(labels.count());
for (int i = 0; i < labels.count(); ++i) {
if (rowCount() < labels.size())
setRowCount(labels.size());
for (int i = 0; i < labels.size(); ++i) {
QStandardItem *item = verticalHeaderItem(i);
if (!item) {
item = d->createItem();
@ -3112,9 +3112,9 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
QSet<QStandardItem*> itemsSet;
QStack<QStandardItem*> stack;
itemsSet.reserve(indexes.count());
stack.reserve(indexes.count());
for (int i = 0; i < indexes.count(); ++i) {
itemsSet.reserve(indexes.size());
stack.reserve(indexes.size());
for (int i = 0; i < indexes.size(); ++i) {
if (QStandardItem *item = itemFromIndex(indexes.at(i))) {
itemsSet << item;
stack.push(item);

View File

@ -883,7 +883,7 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking
if (modalWindowList.isEmpty() || windowNeverBlocked(window))
return false;
for (int i = 0; i < modalWindowList.count(); ++i) {
for (int i = 0; i < modalWindowList.size(); ++i) {
QWindow *modalWindow = modalWindowList.at(i);
// A window is not blocked by another modal window if the two are

View File

@ -1129,7 +1129,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
// except for a single '+' at the end of the string.
// Only '+' can have length 1.
if (sub.length() == 1) {
if (sub.size() == 1) {
// Make sure we only encounter a single '+' at the end of the accel
if (accel.lastIndexOf(u'+') != accel.size()-1)
return Qt::Key_unknown;
@ -1157,7 +1157,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
accelRef = accelRef.mid(p + 1);
int fnum = 0;
if (accelRef.length() == 1) {
if (accelRef.size() == 1) {
#if defined(Q_OS_MACOS)
int qtKey = qtkeyForMacSymbol(accelRef.at(0));
if (qtKey != -1) {
@ -1554,7 +1554,7 @@ QList<QKeySequence> QKeySequence::listFromString(const QString &str, SequenceFor
QList<QKeySequence> result;
const QStringList strings = str.split("; "_L1);
result.reserve(strings.count());
result.reserve(strings.size());
for (const QString &string : strings) {
result << fromString(string, format);
}

View File

@ -35,7 +35,7 @@ Q_LOGGING_CATEGORY(lcDnd, "qt.gui.dnd")
static QWindow* topLevelAt(const QPoint &pos)
{
QWindowList list = QGuiApplication::topLevelWindows();
for (int i = list.count()-1; i >= 0; --i) {
for (int i = list.size()-1; i >= 0; --i) {
QWindow *w = list.at(i);
if (w->isVisible() && w->handle() && w->geometry().contains(pos) && !qobject_cast<QShapedPixmapWindow*>(w))
return w;

View File

@ -162,7 +162,7 @@ QPageRanges QPageRanges::fromString(const QString &ranges)
if (item.contains(u'-')) {
const QStringList rangeItems = item.split(u'-');
if (rangeItems.count() != 2)
if (rangeItems.size() != 2)
return QPageRanges();
bool ok;

View File

@ -4278,7 +4278,7 @@ protected:
void QGradientCache::generateGradientColorTable(const QGradient& gradient, QRgba64 *colorTable, int size, int opacity) const
{
const QGradientStops stops = gradient.stops();
int stopCount = stops.count();
int stopCount = stops.size();
Q_ASSERT(stopCount > 0);
bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation);

View File

@ -421,7 +421,7 @@ QDebug operator<<(QDebug dbg, const QPolygon &a)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QPolygon(";
for (int i = 0; i < a.count(); ++i)
for (int i = 0; i < a.size(); ++i)
dbg.nospace() << a.at(i);
dbg.nospace() << ')';
return dbg;
@ -742,7 +742,7 @@ QDebug operator<<(QDebug dbg, const QPolygonF &a)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QPolygonF(";
for (int i = 0; i < a.count(); ++i)
for (int i = 0; i < a.size(); ++i)
dbg.nospace() << a.at(i);
dbg.nospace() << ')';
return dbg;

View File

@ -3818,7 +3818,7 @@ QRegion::QRegion(const QRect &r, RegionType t)
QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule)
{
if (a.count() > 2) {
if (a.size() > 2) {
QRegionPrivate *qt_rgn = PolygonRegion(a.constData(), a.size(),
fillRule == Qt::WindingFill ? WindingRule : EvenOddRule);
if (qt_rgn) {

View File

@ -1760,7 +1760,7 @@ QPolygon QTransform::mapToPolygon(const QRect &rect) const
*/
bool QTransform::squareToQuad(const QPolygonF &quad, QTransform &trans)
{
if (quad.count() != 4)
if (quad.size() != 4)
return false;
qreal dx0 = quad[0].x();

View File

@ -478,7 +478,7 @@ bool QRhiVulkan::create(QRhi::Flags flags)
for (const VkExtensionProperties &p : std::as_const(extProps))
devExts.append({ p.extensionName, p.specVersion });
}
qCDebug(QRHI_LOG_INFO, "%d device extensions available", int(devExts.count()));
qCDebug(QRHI_LOG_INFO, "%d device extensions available", int(devExts.size()));
QList<const char *> requestedDevExts;
requestedDevExts.append("VK_KHR_swapchain");
@ -1759,7 +1759,7 @@ QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::Begin
// when profiling is enabled, pick a free query (pair) from the pool
int timestampQueryIdx = -1;
if (hasGpuFrameTimeCallback() && swapChainD->bufferCount > 1) { // no timestamps if not having at least 2 frames in flight
for (int i = 0; i < timestampQueryPoolMap.count(); ++i) {
for (int i = 0; i < timestampQueryPoolMap.size(); ++i) {
if (!timestampQueryPoolMap.testBit(i)) {
timestampQueryPoolMap.setBit(i);
timestampQueryIdx = i * 2;
@ -3245,9 +3245,9 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat
cmd.args.copyBufferToImage.src = utexD->stagingBuffers[currentFrameSlot];
cmd.args.copyBufferToImage.dst = utexD->image;
cmd.args.copyBufferToImage.dstLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
cmd.args.copyBufferToImage.count = copyInfos.count();
cmd.args.copyBufferToImage.count = copyInfos.size();
cmd.args.copyBufferToImage.bufferImageCopyIndex = cbD->pools.bufferImageCopy.size();
cbD->pools.bufferImageCopy.append(copyInfos.constData(), copyInfos.count());
cbD->pools.bufferImageCopy.append(copyInfos.constData(), copyInfos.size());
// no reuse of staging, this is intentional
QRhiVulkan::DeferredReleaseEntry e;

View File

@ -388,7 +388,7 @@ QByteArray QShader::serialized() const
const QShaderKey &k(it.key());
writeShaderKey(&ds, k);
const NativeResourceBindingMap &map(it.value());
ds << int(map.count());
ds << int(map.size());
for (auto mapIt = map.cbegin(), mapItEnd = map.cend(); mapIt != mapItEnd; ++mapIt) {
ds << mapIt.key();
ds << mapIt.value().first;
@ -400,7 +400,7 @@ QByteArray QShader::serialized() const
const QShaderKey &k(it.key());
writeShaderKey(&ds, k);
const SeparateToCombinedImageSamplerMappingList &list(it.value());
ds << int(list.count());
ds << int(list.size());
for (auto listIt = list.cbegin(), listItEnd = list.cend(); listIt != listItEnd; ++listIt) {
ds << listIt->combinedSamplerName;
ds << listIt->textureBinding;

View File

@ -697,7 +697,7 @@ static ColorData parseColorValue(QCss::Value v)
return ColorData();
QStringList lst = v.variant.toStringList();
if (lst.count() != 2)
if (lst.size() != 2)
return ColorData();
const QString &identifier = lst.at(0);
@ -794,7 +794,7 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal)
return BrushData();
QStringList lst = v.variant.toStringList();
if (lst.count() != 2)
if (lst.size() != 2)
return BrushData();
QStringList gradFuncs;
@ -1617,7 +1617,7 @@ QRect Declaration::rectValue() const
if (v.type != Value::Function)
return QRect();
const QStringList func = v.variant.toStringList();
if (func.count() != 2 || func.at(0).compare("rect"_L1) != 0)
if (func.size() != 2 || func.at(0).compare("rect"_L1) != 0)
return QRect();
const auto args = QStringView{func[1]}.split(u' ', Qt::SkipEmptyParts);
if (args.size() != 4)
@ -1863,7 +1863,7 @@ int Selector::specificity() const
val += 1;
val += (sel.pseudos.size() + sel.attributeSelectors.size()) * 0x10;
val += sel.ids.count() * 0x100;
val += sel.ids.size() * 0x100;
}
return val;
}
@ -2128,7 +2128,7 @@ QList<StyleRule> StyleSelector::styleRulesForNode(NodePtr node)
if (!styleSheet.idIndex.isEmpty()) {
QStringList ids = nodeIds(node);
for (int i = 0; i < ids.count(); i++) {
for (int i = 0; i < ids.size(); i++) {
const QString &key = ids.at(i);
QMultiHash<QString, StyleRule>::const_iterator it = styleSheet.idIndex.constFind(key);
while (it != styleSheet.idIndex.constEnd() && it.key() == key) {
@ -2139,7 +2139,7 @@ QList<StyleRule> StyleSelector::styleRulesForNode(NodePtr node)
}
if (!styleSheet.nameIndex.isEmpty()) {
QStringList names = nodeNames(node);
for (int i = 0; i < names.count(); i++) {
for (int i = 0; i < names.size(); i++) {
QString name = names.at(i);
if (nameCaseSensitivity == Qt::CaseInsensitive)
name = std::move(name).toLower();

View File

@ -179,7 +179,7 @@ static QStringList splitIntoFamilies(const QString &family)
auto str = list.at(i).trimmed();
if ((str.startsWith(u'"') && str.endsWith(u'"'))
|| (str.startsWith(u'\'') && str.endsWith(u'\''))) {
str = str.mid(1, str.length() - 2);
str = str.mid(1, str.size() - 2);
}
familyList << str.toString();
}

View File

@ -1904,9 +1904,9 @@ void QTextEngine::itemize() const
{
QUnicodeTools::ScriptItemArray scriptItems;
QUnicodeTools::initScripts(layoutData->string, &scriptItems);
for (int i = 0; i < scriptItems.length(); ++i) {
for (int i = 0; i < scriptItems.size(); ++i) {
const auto &item = scriptItems.at(i);
int end = i < scriptItems.length() - 1 ? scriptItems.at(i + 1).position : length;
int end = i < scriptItems.size() - 1 ? scriptItems.at(i + 1).position : length;
for (int j = item.position; j < end; ++j)
analysis[j].script = item.script;
}
@ -3171,7 +3171,7 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
if (tabSpec.type == QTextOption::RightTab || tabSpec.type == QTextOption::CenterTab) {
// find next tab to calculate the width required.
tab = QFixed::fromReal(tabSpec.position);
for (int i=item + 1; i < layoutData->items.count(); i++) {
for (int i=item + 1; i < layoutData->items.size(); i++) {
const QScriptItem &item = layoutData->items[i];
if (item.analysis.flags == QScriptAnalysis::TabOrObject) { // found it.
tabSectionEnd = item.position;
@ -3186,7 +3186,7 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
if (tabSectionEnd > si.position) {
QFixed length;
// Calculate the length of text between this tab and the tabSectionEnd
for (int i=item; i < layoutData->items.count(); i++) {
for (int i=item; i < layoutData->items.size(); i++) {
const QScriptItem &item = layoutData->items.at(i);
if (item.position > tabSectionEnd || item.position <= si.position)
continue;
@ -3258,7 +3258,7 @@ void QTextEngine::resolveFormats() const
QTextFormatCollection *collection = formatCollection();
QList<QTextCharFormat> resolvedFormats(layoutData->items.count());
QList<QTextCharFormat> resolvedFormats(layoutData->items.size());
QVarLengthArray<int, 64> formatsSortedByStart;
formatsSortedByStart.reserve(specialData->formats.size());
@ -3276,7 +3276,7 @@ void QTextEngine::resolveFormats() const
const int *startIt = formatsSortedByStart.constBegin();
const int *endIt = formatsSortedByEnd.constBegin();
for (int i = 0; i < layoutData->items.count(); ++i) {
for (int i = 0; i < layoutData->items.size(); ++i) {
const QScriptItem *si = &layoutData->items.at(i);
int end = si->position + length(si);

View File

@ -3988,7 +3988,7 @@ int QTextFormatCollection::createObjectIndex(const QTextFormat &f)
QTextFormat QTextFormatCollection::format(int idx) const
{
if (idx < 0 || idx >= formats.count())
if (idx < 0 || idx >= formats.size())
return QTextFormat();
return formats.at(idx);
@ -3997,7 +3997,7 @@ QTextFormat QTextFormatCollection::format(int idx) const
void QTextFormatCollection::setDefaultFont(const QFont &f)
{
defaultFnt = f;
for (int i = 0; i < formats.count(); ++i)
for (int i = 0; i < formats.size(); ++i)
if (formats.at(i).d)
formats[i].d->resolveFont(defaultFnt);
}

View File

@ -55,7 +55,7 @@ public:
inline QTextImageFormat imageFormat(int index) const
{ return format(index).toImageFormat(); }
inline int numFormats() const { return formats.count(); }
inline int numFormats() const { return formats.size(); }
typedef QList<QTextFormat> FormatVector;

View File

@ -771,7 +771,7 @@ QString QTextHtmlParser::parseEntity(QStringView entity)
if (!resolved.isNull())
return QString(resolved);
if (entity.length() > 1 && entity.at(0) == u'#') {
if (entity.size() > 1 && entity.at(0) == u'#') {
entity = entity.mid(1); // removing leading #
int base = 10;
@ -1029,7 +1029,7 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent
// set element specific attributes
switch (id) {
case Html_a:
for (int i = 0; i < attributes.count(); i += 2) {
for (int i = 0; i < attributes.size(); i += 2) {
const QString key = attributes.at(i);
if (key.compare("href"_L1, Qt::CaseInsensitive) == 0
&& !attributes.at(i + 1).isEmpty()) {
@ -1575,12 +1575,12 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
QString linkHref;
QString linkType;
if (attributes.count() % 2 == 1)
if (attributes.size() % 2 == 1)
return;
QTextHtmlParserNode *node = nodes.last();
for (int i = 0; i < attributes.count(); i += 2) {
for (int i = 0; i < attributes.size(); i += 2) {
QString key = attributes.at(i);
QString value = attributes.at(i + 1);
@ -1942,7 +1942,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n
case Html_u: {
bool needsUnderline = (node.id == Html_u) ? true : false;
if (node.id == Html_a) {
for (int i = 0; i < node.attributes.count(); i += 2) {
for (int i = 0; i < node.attributes.size(); i += 2) {
const QString key = node.attributes.at(i);
if (key.compare("href"_L1, Qt::CaseInsensitive) == 0
&& !node.attributes.at(i + 1).isEmpty()) {

View File

@ -1323,7 +1323,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
int neighborItem = itm;
if (neighborItem > 0 && si->position == realCursorPosition)
--neighborItem;
else if (neighborItem < d->layoutData->items.count() - 1 && si->position + si->num_glyphs == realCursorPosition)
else if (neighborItem < d->layoutData->items.size() - 1 && si->position + si->num_glyphs == realCursorPosition)
++neighborItem;
const bool onBoundary = neighborItem != itm
&& si->analysis.bidiLevel != d->layoutData->items[neighborItem].analysis.bidiLevel;
@ -2215,7 +2215,7 @@ int QTextLine::textStart() const
int QTextLine::textLength() const
{
if (eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators
&& eng->block.isValid() && index == eng->lines.count()-1) {
&& eng->block.isValid() && index == eng->lines.size()-1) {
return eng->lines.at(index).length - 1;
}
return eng->lines.at(index).length + eng->lines.at(index).trailingSpaces;
@ -2900,7 +2900,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
int neighborItem = itm;
if (neighborItem > 0 && scriptItem->position == pos)
--neighborItem;
else if (neighborItem < eng->layoutData->items.count() - 1 && scriptItem->position + scriptItem->num_glyphs == pos)
else if (neighborItem < eng->layoutData->items.size() - 1 && scriptItem->position + scriptItem->num_glyphs == pos)
++neighborItem;
const bool onBoundary = neighborItem != itm && scriptItem->analysis.bidiLevel != eng->layoutData->items[neighborItem].analysis.bidiLevel;
// If we are, prioritise the neighbor item that has the same direction as the engine
@ -3217,7 +3217,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
// character between lines is a space and we want
// to position the cursor to the left of that
// character.
if (index < eng->lines.count() - 1)
if (index < eng->lines.size() - 1)
pos = qMin(eng->previousLogicalPosition(pos), pos);
return pos;

View File

@ -86,7 +86,7 @@ QTextList::~QTextList()
int QTextList::count() const
{
Q_D(const QTextList);
return d->blocks.count();
return d->blocks.size();
}
/*!

View File

@ -165,7 +165,7 @@ QTextDocument *QTextObject::document() const
void QTextBlockGroupPrivate::markBlocksDirty()
{
for (int i = 0; i < blocks.count(); ++i) {
for (int i = 0; i < blocks.size(); ++i) {
const QTextBlock &block = blocks.at(i);
pieceTable->documentChange(block.position(), block.length());
}

View File

@ -243,13 +243,13 @@ void QBasicPlatformVulkanInstance::initInstance(QVulkanInstance *instance, const
// No clever stuff with QSet and friends: the order for layers matters
// and the user-provided order must be kept.
for (int i = 0; i < m_enabledLayers.count(); ++i) {
for (int i = 0; i < m_enabledLayers.size(); ++i) {
const QByteArray &layerName(m_enabledLayers[i]);
if (!m_supportedLayers.contains(layerName))
m_enabledLayers.removeAt(i--);
}
qDebug(lcPlatVk) << "Enabling Vulkan instance layers:" << m_enabledLayers;
for (int i = 0; i < m_enabledExtensions.count(); ++i) {
for (int i = 0; i < m_enabledExtensions.size(); ++i) {
const QByteArray &extName(m_enabledExtensions[i]);
if (!m_supportedExtensions.contains(extName))
m_enabledExtensions.removeAt(i--);

View File

@ -102,7 +102,7 @@ bool QHttpHeaderParser::parseStatus(QByteArrayView status)
static const int spacePos = 8;
static const char httpMagic[] = "HTTP/";
if (status.length() < minLength
if (status.size() < minLength
|| !status.startsWith(httpMagic)
|| status.at(dotPos) != '.'
|| status.at(spacePos) != ' ') {

View File

@ -657,7 +657,7 @@ QAuthenticatorPrivate::parseDigestAuthenticationChallenge(QByteArrayView challen
QHash<QByteArray, QByteArray> options;
// parse the challenge
const char *d = challenge.data();
const char *end = d + challenge.length();
const char *end = d + challenge.size();
while (d < end) {
while (d < end && (*d == ' ' || *d == '\n' || *d == '\r'))
++d;
@ -1759,7 +1759,7 @@ static QByteArray qGssapiContinue(QAuthenticatorPrivate *ctx, QByteArrayView cha
if (!challenge.isEmpty()) {
inBuf.value = const_cast<char*>(challenge.data());
inBuf.length = challenge.length();
inBuf.length = challenge.size();
}
majStat = gss_init_sec_context(&minStat,

View File

@ -181,7 +181,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
int rotationAngle = 0;
bool invertx = false;
bool inverty = false;
for (int i = 0; i < args.count(); ++i) {
for (int i = 0; i < args.size(); ++i) {
if (args.at(i).startsWith("rotate"_L1)) {
QString rotateArg = args.at(i).section(u'=', 1, 1);
bool ok;

View File

@ -200,7 +200,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) {
const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray();
const QByteArrayList vposComp = vpos.split(',');
if (vposComp.count() == 2)
if (vposComp.size() == 2)
vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt());
}
if (userConnectorConfig.value(QStringLiteral("primary")).toBool())
@ -478,7 +478,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
const QStringList crtcPlanePairs = val.split(u':');
for (const QString &crtcPlanePair : crtcPlanePairs) {
const QStringList values = crtcPlanePair.split(u',');
if (values.count() == 2 && uint(values[0].toInt()) == output.crtc_id) {
if (values.size() == 2 && uint(values[0].toInt()) == output.crtc_id) {
uint planeId = values[1].toInt();
for (QKmsPlane &kmsplane : m_planes) {
if (kmsplane.id == planeId) {

View File

@ -39,7 +39,7 @@ QTuioHandler::QTuioHandler(const QString &specification)
bool invertx = false;
bool inverty = false;
for (int i = 0; i < args.count(); ++i) {
for (int i = 0; i < args.size(); ++i) {
if (args.at(i).startsWith("udp=")) {
QString portString = args.at(i).section('=', 1, 1);
portNumber = portString.toInt();
@ -326,7 +326,7 @@ void QTuioHandler::process2DCurFseq(const QOscMessage &message)
Q_UNUSED(message); // TODO: do we need to do anything with the frame id?
QWindow *win = QGuiApplication::focusWindow();
if (!win && QGuiApplication::topLevelWindows().length() > 0 && forceDelivery)
if (!win && QGuiApplication::topLevelWindows().size() > 0 && forceDelivery)
win = QGuiApplication::topLevelWindows().at(0);
if (!win)
@ -499,7 +499,7 @@ void QTuioHandler::process2DObjFseq(const QOscMessage &message)
Q_UNUSED(message); // TODO: do we need to do anything with the frame id?
QWindow *win = QGuiApplication::focusWindow();
if (!win && QGuiApplication::topLevelWindows().length() > 0 && forceDelivery)
if (!win && QGuiApplication::topLevelWindows().size() > 0 && forceDelivery)
win = QGuiApplication::topLevelWindows().at(0);
if (!win)

View File

@ -56,7 +56,7 @@ protected:
if (isEmpty())
return QStringList();
if (!formatList.count()) {
if (!formatList.size()) {
QXcbClipboardMime *that = const_cast<QXcbClipboardMime *>(this);
// get the list of targets from the current clipboard owner - we do this
// once so that multiple calls to this function don't require multiple

View File

@ -108,7 +108,7 @@ static void sm_setProperty(const QString &name, const QString &value)
static void sm_setProperty(const QString &name, const QStringList &value)
{
SmPropValue *prop = new SmPropValue[value.count()];
SmPropValue *prop = new SmPropValue[value.size()];
int count = 0;
QList<QByteArray> vl;
vl.reserve(value.size());

View File

@ -57,7 +57,7 @@ static const char *getPasswordCB(const char */*prompt*/, http_t *http, const cha
QString resourceString = QString::fromLocal8Bit(resource);
if (resourceString.startsWith(QStringLiteral("/printers/")))
resourceString = resourceString.mid(QStringLiteral("/printers/").length());
resourceString = resourceString.mid(QStringLiteral("/printers/").size());
QLabel *label = new QLabel();
if (hostname == QStringLiteral("localhost")) {

View File

@ -428,7 +428,7 @@ bool QPpdPrintDevice::setProperty(QPrintDevice::PrintDevicePropertyKey key, cons
{
if (key == PDPK_PpdOption) {
const QStringList values = value.toStringList();
if (values.count() == 2) {
if (values.size() == 2) {
ppdMarkOption(m_ppd, values[0].toLatin1(), values[1].toLatin1());
return true;
}
@ -441,7 +441,7 @@ bool QPpdPrintDevice::isFeatureAvailable(QPrintDevice::PrintDevicePropertyKey ke
{
if (key == PDPK_PpdChoiceIsInstallableConflict) {
const QStringList values = params.toStringList();
if (values.count() == 2)
if (values.size() == 2)
return ppdInstallableConflict(m_ppd, values[0].toLatin1(), values[1].toLatin1());
}

View File

@ -779,7 +779,7 @@ void QSQLiteDriver::close()
for (QSQLiteResult *result : std::as_const(d->results))
result->d_func()->finalize();
if (d->access && (d->notificationid.count() > 0)) {
if (d->access && (d->notificationid.size() > 0)) {
d->notificationid.clear();
sqlite3_update_hook(d->access, nullptr, nullptr);
}
@ -990,7 +990,7 @@ bool QSQLiteDriver::subscribeToNotification(const QString &name)
//sqlite supports only one notification callback, so only the first is registered
d->notificationid << name;
if (d->notificationid.count() == 1)
if (d->notificationid.size() == 1)
sqlite3_update_hook(d->access, &handle_sqlite_callback, reinterpret_cast<void *> (this));
return true;

View File

@ -196,7 +196,7 @@ QCUPSSupport::JobSheets QCUPSSupport::parseJobSheets(const QString &jobSheets)
JobSheets result;
const QStringList parts = jobSheets.split(u',');
if (parts.count() == 2) {
if (parts.size() == 2) {
result.startBannerPage = stringToBannerPage(parts[0]);
result.endBannerPage = stringToBannerPage(parts[1]);
}

View File

@ -630,7 +630,7 @@ bool QSqlResult::exec()
int i;
QVariant val;
QString holder;
for (i = d->holders.count() - 1; i >= 0; --i) {
for (i = d->holders.size() - 1; i >= 0; --i) {
holder = d->holders.at(i).holderName;
val = d->values.value(d->indexes.value(holder).value(0,-1));
QSqlField f(""_L1, val.metaType());

View File

@ -129,7 +129,7 @@ void testReadWritePropertyBasics(
testedObj.property(propertyName).template value<PropertyType>(), initial, comparator,
represent);
if (spy)
QCOMPARE(spy->count(), 1);
QCOMPARE(spy->size(), 1);
QUntypedBindable bindable = metaProperty.bindable(&instance);
@ -148,7 +148,7 @@ void testReadWritePropertyBasics(
QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent);
QPROPERTY_TEST_COMPARISON_HELPER(propObserverLambda.value(), changed, comparator, represent);
if (spy)
QCOMPARE(spy->count(), 2);
QCOMPARE(spy->size(), 2);
// Bind object's property to other property
QProperty<PropertyType> propSetter(initial);
@ -162,7 +162,7 @@ void testReadWritePropertyBasics(
QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), initial, comparator, represent);
QPROPERTY_TEST_COMPARISON_HELPER(propObserverLambda.value(), initial, comparator, represent);
if (spy)
QCOMPARE(spy->count(), 3);
QCOMPARE(spy->size(), 3);
// Count notifications triggered; should only happen on actual change.
int updateCount = 0;
@ -177,7 +177,7 @@ void testReadWritePropertyBasics(
QPROPERTY_TEST_COMPARISON_HELPER(propObserverLambda.value(), changed, comparator, represent);
QCOMPARE(updateCount, 1);
if (spy)
QCOMPARE(spy->count(), 4);
QCOMPARE(spy->size(), 4);
// Test that manually setting the value (even the same one) breaks the
// binding.
@ -188,7 +188,7 @@ void testReadWritePropertyBasics(
// value didn't change -> the signal should not be emitted
if (spy)
QCOMPARE(spy->count(), 4);
QCOMPARE(spy->size(), 4);
}
/*!
@ -287,7 +287,7 @@ void testWriteOncePropertyBasics(
represent);
QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent);
if (spy)
QCOMPARE(spy->count(), 1);
QCOMPARE(spy->size(), 1);
// Attempt to set back the 'prior' value and verify that it has no effect
testedObj.setProperty(propertyName, QVariant::fromValue(prior));
@ -296,7 +296,7 @@ void testWriteOncePropertyBasics(
represent);
QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent);
if (spy)
QCOMPARE(spy->count(), 1);
QCOMPARE(spy->size(), 1);
if (bindingPreservedOnWrite)
QVERIFY(bindable.hasBinding());
else
@ -386,7 +386,7 @@ void testReadOnlyPropertyBasics(
testedObj.property(propertyName).template value<PropertyType>(), initial, comparator,
represent);
if (spy)
QCOMPARE(spy->count(), 0);
QCOMPARE(spy->size(), 0);
QProperty<PropertyType> propObserver;
propObserver.setBinding(bindable.makeBinding());
@ -402,7 +402,7 @@ void testReadOnlyPropertyBasics(
QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent);
if (spy)
QCOMPARE(spy->count(), 1);
QCOMPARE(spy->size(), 1);
}
} // namespace QTestPrivate

View File

@ -97,11 +97,11 @@ public:
bool wait(int timeout = 5000)
{
Q_ASSERT(!m_waiting);
const qsizetype origCount = count();
const qsizetype origCount = size();
m_waiting = true;
m_loop.enterLoopMSecs(timeout);
m_waiting = false;
return count() > origCount;
return size() > origCount;
}
int qt_metacall(QMetaObject::Call call, int methodId, void **a) override

View File

@ -655,7 +655,7 @@ static void qPrintDataTags(FILE *stream)
// Print all tag combinations:
if (gTable->dataCount() == 0) {
if (localTags.count() == 0) {
if (localTags.size() == 0) {
// No tags at all, so just print the test function:
fprintf(stream, "%s %s\n", currTestMetaObj->className(), slot);
} else {
@ -667,7 +667,7 @@ static void qPrintDataTags(FILE *stream)
}
} else {
for (int j = 0; j < gTable->dataCount(); ++j) {
if (localTags.count() == 0) {
if (localTags.size() == 0) {
// Only global tags, so print the current one:
fprintf(
stream, "%s %s __global__ %s\n",
@ -2431,7 +2431,7 @@ QTest::TestEntryFunction QTest::qGetTestCaseEntryFunction(const QString& name)
*/
int QTest::qExec(QObject *testObject, const QStringList &arguments)
{
const int argc = arguments.count();
const int argc = arguments.size();
QVarLengthArray<char *> argv(argc);
QList<QByteArray> args;

View File

@ -132,7 +132,7 @@ class QTestEventList: public QList<QTestEvent *>
public:
inline QTestEventList() {}
inline QTestEventList(const QTestEventList &other): QList<QTestEvent *>()
{ for (int i = 0; i < other.count(); ++i) append(other.at(i)->clone()); }
{ for (int i = 0; i < other.size(); ++i) append(other.at(i)->clone()); }
inline ~QTestEventList()
{ clear(); }
inline void clear()
@ -182,7 +182,7 @@ public:
#ifdef QT_WIDGETS_LIB
inline void simulate(QWidget *w)
{
for (int i = 0; i < count(); ++i)
for (int i = 0; i < size(); ++i)
at(i)->simulate(w);
}
#endif

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