summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfileselector.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp6
-rw-r--r--src/corelib/io/qloggingregistry.cpp4
-rw-r--r--src/corelib/io/qsettings_winrt.cpp6
-rw-r--r--src/corelib/io/qstandardpaths.cpp8
-rw-r--r--src/corelib/io/qurl.cpp5
-rw-r--r--src/corelib/io/qurlquery.h4
9 files changed, 19 insertions, 20 deletions
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index 32b98e32d8..83bfe47ab1 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -261,7 +261,7 @@ static QString selectionHelper(const QString &path, const QString &fileName, con
*/
Q_ASSERT(path.isEmpty() || path.endsWith(QLatin1Char('/')));
- foreach (const QString &s, selectors) {
+ for (const QString &s : selectors) {
QString prospectiveBase = path + QLatin1Char(selectorIndicator) + s + QLatin1Char('/');
QStringList remainingSelectors = selectors;
remainingSelectors.removeAll(s);
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index 5e9e19aab1..3847e70a1c 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -246,7 +246,7 @@ QInotifyFileSystemWatcherEngine::QInotifyFileSystemWatcherEngine(int fd, QObject
QInotifyFileSystemWatcherEngine::~QInotifyFileSystemWatcherEngine()
{
notifier.setEnabled(false);
- foreach (int id, pathToID)
+ for (int id : qAsConst(pathToID))
inotify_rm_watch(inotifyFd, id < 0 ? -id : id);
::close(inotifyFd);
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
index 80cbcb26cc..43e1719a13 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp
+++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
@@ -82,7 +82,7 @@ QKqueueFileSystemWatcherEngine::~QKqueueFileSystemWatcherEngine()
notifier.setEnabled(false);
close(kqfd);
- foreach (int id, pathToID)
+ for (int id : qAsConst(pathToID))
::close(id < 0 ? -id : id);
}
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp
index 2e01e1a857..6c263b6847 100644
--- a/src/corelib/io/qfilesystemwatcher_win.cpp
+++ b/src/corelib/io/qfilesystemwatcher_win.cpp
@@ -164,7 +164,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
// now look for a thread to insert
bool found = false;
- foreach(QWindowsFileSystemWatcherEngineThread *thread, threads) {
+ for (QWindowsFileSystemWatcherEngineThread *thread : qAsConst(threads)) {
QMutexLocker(&(thread->mutex));
if (thread->handles.count() < MAXIMUM_WAIT_OBJECTS) {
DEBUG() << "Added handle" << handle.handle << "for" << absolutePath << "to watch" << fileInfo.absoluteFilePath()
@@ -311,7 +311,7 @@ QWindowsFileSystemWatcherEngineThread::~QWindowsFileSystemWatcherEngineThread()
CloseHandle(handles.at(0));
handles[0] = INVALID_HANDLE_VALUE;
- foreach (HANDLE h, handles) {
+ for (HANDLE h : qAsConst(handles)) {
if (h == INVALID_HANDLE_VALUE)
continue;
FindCloseChangeNotification(h);
@@ -323,7 +323,7 @@ static inline QString msgFindNextFailed(const QWindowsFileSystemWatcherEngineThr
QString result;
QTextStream str(&result);
str << "QFileSystemWatcher: FindNextChangeNotification failed for";
- foreach (const QWindowsFileSystemWatcherEngine::PathInfo &pathInfo, pathInfos)
+ for (const QWindowsFileSystemWatcherEngine::PathInfo &pathInfo : pathInfos)
str << " \"" << QDir::toNativeSeparators(pathInfo.absolutePath) << '"';
str << ' ';
return result;
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index a12eab5a87..3e6e61b906 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -400,7 +400,7 @@ QLoggingRegistry *QLoggingRegistry::instance()
*/
void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
{
- QLoggingRegistry *reg = QLoggingRegistry::instance();
+ const QLoggingRegistry *reg = QLoggingRegistry::instance();
Q_ASSERT(reg->categories.contains(cat));
QtMsgType enableForLevel = reg->categories.value(cat);
@@ -421,7 +421,7 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
}
QString categoryName = QLatin1String(cat->categoryName());
- foreach (const QLoggingRule &item, reg->rules) {
+ for (const QLoggingRule &item : reg->rules) {
int filterpass = item.pass(categoryName, QtDebugMsg);
if (filterpass != 0)
debug = (filterpass > 0);
diff --git a/src/corelib/io/qsettings_winrt.cpp b/src/corelib/io/qsettings_winrt.cpp
index 02c3c7624e..f380ef345c 100644
--- a/src/corelib/io/qsettings_winrt.cpp
+++ b/src/corelib/io/qsettings_winrt.cpp
@@ -533,10 +533,10 @@ QStringList QWinRTSettingsPrivate::children(const QString &uKey, ChildSpec spec)
const QStringList subContainerList = subContainerNames(container.Get(), spec == AllKeys);
if (spec == AllKeys) {
- foreach (const QString &item, subContainerList) {
+ for (const QString &item : subContainerList) {
const QString subChildren = uKey.isEmpty() ? item : (uKey + QLatin1Char('/') + item);
const QStringList subResult = children(subChildren, ChildKeys);
- foreach (const QString &subItem, subResult)
+ for (const QString &subItem : subResult)
result += item + QLatin1Char('/') + subItem;
}
}
@@ -644,7 +644,7 @@ IApplicationDataContainer *QWinRTSettingsPrivate::getContainer(IApplicationDataC
return current;
const QStringList groupPath = group.split(QLatin1Char('/'), QString::SkipEmptyParts);
- foreach (const QString &subGroup, groupPath) {
+ for (const QString &subGroup : groupPath) {
ComPtr<IApplicationDataContainer> sub = subContainer(current, subGroup);
if (!sub && create)
sub = createSubContainer(current, subGroup);
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 497191fd32..7544f5b177 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -443,7 +443,7 @@ static inline QString searchExecutable(const QStringList &searchPaths,
const QString &executableName)
{
const QDir currentDir = QDir::current();
- foreach (const QString &searchPath, searchPaths) {
+ for (const QString &searchPath : searchPaths) {
const QString candidate = currentDir.absoluteFilePath(searchPath + QLatin1Char('/') + executableName);
const QString absPath = checkExecutable(candidate);
if (!absPath.isEmpty())
@@ -462,9 +462,9 @@ static inline QString
const QStringList &suffixes)
{
const QDir currentDir = QDir::current();
- foreach (const QString &searchPath, searchPaths) {
+ for (const QString &searchPath : searchPaths) {
const QString candidateRoot = currentDir.absoluteFilePath(searchPath + QLatin1Char('/') + executableName);
- foreach (const QString &suffix, suffixes) {
+ for (const QString &suffix : suffixes) {
const QString absPath = checkExecutable(candidateRoot + suffix);
if (!absPath.isEmpty())
return absPath;
@@ -505,7 +505,7 @@ QString QStandardPaths::findExecutable(const QString &executableName, const QStr
// Remove trailing slashes, which occur on Windows.
const QStringList rawPaths = QString::fromLocal8Bit(pEnv.constData()).split(QDir::listSeparator(), QString::SkipEmptyParts);
searchPaths.reserve(rawPaths.size());
- foreach (const QString &rawPath, rawPaths) {
+ for (const QString &rawPath : rawPaths) {
QString cleanPath = QDir::cleanPath(rawPath);
if (cleanPath.size() > 1 && cleanPath.endsWith(QLatin1Char('/')))
cleanPath.truncate(cleanPath.size() - 1);
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 9bf359222a..e5c31763f4 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -4062,7 +4062,7 @@ QStringList QUrl::toStringList(const QList<QUrl> &urls, FormattingOptions option
{
QStringList lst;
lst.reserve(urls.size());
- foreach (const QUrl &url, urls)
+ for (const QUrl &url : urls)
lst.append(url.toString(options));
return lst;
@@ -4078,9 +4078,8 @@ QList<QUrl> QUrl::fromStringList(const QStringList &urls, ParsingMode mode)
{
QList<QUrl> lst;
lst.reserve(urls.size());
- foreach (const QString &str, urls) {
+ for (const QString &str : urls)
lst.append(QUrl(str, mode));
- }
return lst;
}
diff --git a/src/corelib/io/qurlquery.h b/src/corelib/io/qurlquery.h
index ae3a79c119..16e186a79b 100644
--- a/src/corelib/io/qurlquery.h
+++ b/src/corelib/io/qurlquery.h
@@ -154,10 +154,10 @@ inline QList<QPair<QByteArray, QByteArray> > QUrl::encodedQueryItems() const
}
inline QList<QByteArray> QUrl::allEncodedQueryItemValues(const QByteArray &key) const
{
- QStringList items = QUrlQuery(*this).allQueryItemValues(fromEncodedComponent_helper(key), QUrl::FullyEncoded);
+ const QStringList items = QUrlQuery(*this).allQueryItemValues(fromEncodedComponent_helper(key), QUrl::FullyEncoded);
QList<QByteArray> result;
result.reserve(items.size());
- Q_FOREACH (const QString &item, items)
+ for (const QString &item : items)
result << item.toLatin1();
return result;
}