From 413a9f9bde60af2633c858435436891c8511385b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 27 May 2020 12:15:19 +0200 Subject: Port remaining usages of QStringRef in QtCore to QStringView Task-number: QTBUG-84319 Change-Id: If77bc94c18e8d522b4577050091cd7d7aa941311 Reviewed-by: Thiago Macieira --- src/corelib/io/qloggingregistry.cpp | 2 +- src/corelib/io/qresource.cpp | 2 +- src/corelib/io/qstandardpaths_unix.cpp | 4 ++-- src/corelib/io/qstorageinfo_unix.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index cacebfbda6..d40f312fc4 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -190,7 +190,7 @@ void QLoggingRule::parse(QStringView pattern) void QLoggingSettingsParser::setContent(const QString &content) { _rules.clear(); - const auto lines = content.splitRef(QLatin1Char('\n')); + const auto lines = QStringView{content}.split(QLatin1Char('\n')); for (const auto &line : lines) parseNextLine(line); } diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index dfaae20c34..9324261939 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -388,7 +388,7 @@ QResourcePrivate::ensureInitialized() const if(!that->absoluteFilePath.startsWith(QLatin1Char(':'))) that->absoluteFilePath.prepend(QLatin1Char(':')); - QStringRef path(&fileName); + QStringView path(fileName); if(path.startsWith(QLatin1Char(':'))) path = path.mid(1); diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index ec37ce7d76..ca2a2689f1 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -283,10 +283,10 @@ static QStringList xdgDataDirs() dirs.append(QString::fromLatin1("/usr/local/share")); dirs.append(QString::fromLatin1("/usr/share")); } else { - const auto parts = xdgDataDirsEnv.splitRef(QLatin1Char(':'), Qt::SkipEmptyParts); + const auto parts = QStringView{xdgDataDirsEnv}.split(QLatin1Char(':'), Qt::SkipEmptyParts); // Normalize paths, skip relative paths - for (const QStringRef &dir : parts) { + for (const auto &dir : parts) { if (dir.startsWith(QLatin1Char('/'))) dirs.push_back(QDir::cleanPath(dir.toString())); } diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 698c4ddf41..e38f495213 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -766,7 +766,7 @@ static QString decodeFsEncString(const QString &str) if (str.at(i) == QLatin1Char('\\') && str.at(i+1) == QLatin1Char('x')) { bool bOk; - const int code = str.midRef(i+2, 2).toInt(&bOk, 16); + const int code = QStringView{str}.mid(i+2, 2).toInt(&bOk, 16); // only decode characters between 0x20 and 0x7f but not // the backslash to prevent collisions if (bOk && code >= 0x20 && code < 0x80 && code != '\\') { -- cgit v1.2.3