summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qstorageinfo_unix.cpp
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-03-09 16:34:49 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2022-03-25 19:16:29 +0100
commit753a08ae0e1204b148cf3935f87349eefe75d338 (patch)
tree193ff5b6a131bba519336c31727d708ddab43032 /src/corelib/io/qstorageinfo_unix.cpp
parent1fefff6d1f99dbcf1a453424753ad5562fb675ef (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/qstorageinfo_unix.cpp')
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp
index 2b635f63bb..380f3e3f4c 100644
--- a/src/corelib/io/qstorageinfo_unix.cpp
+++ b/src/corelib/io/qstorageinfo_unix.cpp
@@ -119,6 +119,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QStorageIterator
{
public:
@@ -190,7 +192,7 @@ template <typename String>
static bool isParentOf(const String &parent, const QString &dirName)
{
return dirName.startsWith(parent) &&
- (dirName.size() == parent.size() || dirName.at(parent.size()) == QLatin1Char('/') ||
+ (dirName.size() == parent.size() || dirName.at(parent.size()) == u'/' ||
parent.size() == 1);
}
@@ -214,11 +216,11 @@ static bool shouldIncludeFs(const QStorageIterator &it)
*/
QString mountDir = it.rootPath();
- if (isParentOf(QLatin1String("/dev"), mountDir)
- || isParentOf(QLatin1String("/proc"), mountDir)
- || isParentOf(QLatin1String("/sys"), mountDir)
- || isParentOf(QLatin1String("/var/run"), mountDir)
- || isParentOf(QLatin1String("/var/lock"), mountDir)) {
+ if (isParentOf("/dev"_L1, mountDir)
+ || isParentOf("/proc"_L1, mountDir)
+ || isParentOf("/sys"_L1, mountDir)
+ || isParentOf("/var/run"_L1, mountDir)
+ || isParentOf("/var/lock"_L1, mountDir)) {
return false;
}
@@ -767,8 +769,7 @@ static QString decodeFsEncString(const QString &str)
int i = 0;
while (i < str.size()) {
if (i <= str.size() - 4) { // we need at least four characters \xAB
- if (str.at(i) == QLatin1Char('\\') &&
- str.at(i+1) == QLatin1Char('x')) {
+ if (QStringView{str}.sliced(i).startsWith("\\x"_L1)) {
bool bOk;
const int code = QStringView{str}.mid(i+2, 2).toInt(&bOk, 16);
// only decode characters between 0x20 and 0x7f but not