diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-03-09 16:34:49 +0100 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-03-25 19:16:29 +0100 |
commit | 753a08ae0e1204b148cf3935f87349eefe75d338 (patch) | |
tree | 193ff5b6a131bba519336c31727d708ddab43032 /src/corelib/io/qfilesystemwatcher_win.cpp | |
parent | 1fefff6d1f99dbcf1a453424753ad5562fb675ef (diff) |
QtCore: replace QLatin1String/QLatin1Char with _L1/u'' where applicable
As a drive-by, did also minor refactorings/improvements.
Task-number: QTBUG-98434
Change-Id: I81964176ae2f07ea63674c96f47f9c6aa046854f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Diffstat (limited to 'src/corelib/io/qfilesystemwatcher_win.cpp')
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_win.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index 5d8a5b3682..a836c56473 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -63,6 +63,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + // #define WINQFSW_DEBUG #ifdef WINQFSW_DEBUG # define DEBUG qDebug @@ -75,8 +77,8 @@ static Qt::HANDLE createChangeNotification(const QString &path, uint flags) // Volume and folder paths need a trailing slash for proper notification // (e.g. "c:" -> "c:/"). QString nativePath = QDir::toNativeSeparators(path); - if ((flags & FILE_NOTIFY_CHANGE_ATTRIBUTES) == 0 && !nativePath.endsWith(QLatin1Char('\\'))) - nativePath.append(QLatin1Char('\\')); + if ((flags & FILE_NOTIFY_CHANGE_ATTRIBUTES) == 0 && !nativePath.endsWith(u'\\')) + nativePath.append(u'\\'); const HANDLE result = FindFirstChangeNotification(reinterpret_cast<const wchar_t *>(nativePath.utf16()), FALSE, flags); DEBUG() << __FUNCTION__ << nativePath << Qt::hex << Qt::showbase << flags << "returns" << result; @@ -274,7 +276,7 @@ bool QWindowsRemovableDriveListener::nativeEventFilter(const QByteArray &, void // Set up listening for WM_DEVICECHANGE+DBT_CUSTOMEVENT for a removable drive path, void QWindowsRemovableDriveListener::addPath(const QString &p) { - const wchar_t drive = p.size() >= 2 && p.at(0).isLetter() && p.at(1) == QLatin1Char(':') + const wchar_t drive = p.size() >= 2 && p.at(0).isLetter() && p.at(1) == u':' ? wchar_t(p.at(0).toUpper().unicode()) : L'\0'; if (!drive) return; @@ -367,8 +369,8 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths, for (const QString &path : paths) { auto sg = qScopeGuard([&] { unhandled.push_back(path); }); QString normalPath = path; - if ((normalPath.endsWith(QLatin1Char('/')) && !normalPath.endsWith(QLatin1String(":/"))) - || (normalPath.endsWith(QLatin1Char('\\')) && !normalPath.endsWith(QLatin1String(":\\")))) { + if ((normalPath.endsWith(u'/') && !normalPath.endsWith(":/"_L1)) + || (normalPath.endsWith(u'\\') && !normalPath.endsWith(":\\"_L1))) { normalPath.chop(1); } QFileInfo fileInfo(normalPath); @@ -530,7 +532,7 @@ QStringList QWindowsFileSystemWatcherEngine::removePaths(const QStringList &path for (const QString &path : paths) { auto sg = qScopeGuard([&] { unhandled.push_back(path); }); QString normalPath = path; - if (normalPath.endsWith(QLatin1Char('/')) || normalPath.endsWith(QLatin1Char('\\'))) + if (normalPath.endsWith(u'/') || normalPath.endsWith(u'\\')) normalPath.chop(1); QFileInfo fileInfo(normalPath); DEBUG() << "removing" << normalPath; @@ -631,10 +633,10 @@ Q_DECL_COLD_FUNCTION static QString msgFindNextFailed(const QWindowsFileSystemWatcherEngineThread::PathInfoHash &pathInfos) { QString str; - str += QLatin1String("QFileSystemWatcher: FindNextChangeNotification failed for"); + str += "QFileSystemWatcher: FindNextChangeNotification failed for"_L1; for (const QWindowsFileSystemWatcherEngine::PathInfo &pathInfo : pathInfos) - str += QLatin1String(" \"") + QDir::toNativeSeparators(pathInfo.absolutePath) + QLatin1Char('"'); - str += QLatin1Char(' '); + str += " \""_L1 + QDir::toNativeSeparators(pathInfo.absolutePath) + u'"'; + str += u' '; return str; } |