Port QDir to qsizetype [1/3]: indexed to ranged loops
Indexed for loops are prone to int/qsizetype mismatches, so use ranged for loops where possible. Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-103525 Change-Id: Ia3e97a6b2924f92d3f7fb1a7ae075b59188006e9 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
f06c41e729
commit
35cbf52f0c
@ -285,8 +285,8 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, const QFileInfoList
|
||||
if (infos)
|
||||
*infos = l;
|
||||
if (names) {
|
||||
for (int i = 0; i < n; ++i)
|
||||
names->append(l.at(i).fileName());
|
||||
for (const QFileInfo &fi : l)
|
||||
names->append(fi.fileName());
|
||||
}
|
||||
} else {
|
||||
QScopedArrayPointer<QDirSortItem> si(new QDirSortItem[n]);
|
||||
@ -1057,8 +1057,8 @@ void QDir::setSearchPaths(const QString &prefix, const QStringList &searchPaths)
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < prefix.length(); ++i) {
|
||||
if (!prefix.at(i).isLetterOrNumber()) {
|
||||
for (QChar ch : prefix) {
|
||||
if (!ch.isLetterOrNumber()) {
|
||||
qWarning("QDir::setSearchPaths: Prefix can only contain letters or numbers");
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user