diff options
| author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-03-09 21:26:01 +0100 |
|---|---|---|
| committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-03-26 01:44:05 +0100 |
| commit | b6251958932be5966258f362dc9bb7c7475d2d0a (patch) | |
| tree | 2b2dc46c0d097fca15bcc9e2701682919921c339 /src/corelib/plugin/qcoffpeparser.cpp | |
| parent | 73a03a0c298461aa15d7c2757bc0b6444e5dc3dc (diff) | |
QtCore: Replace remaining uses of QLatin1String with QLatin1StringView
Task-number: QTBUG-98434
Change-Id: Ib7c5fc0aaca6ef33b93c7486e99502c555bf20bc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/plugin/qcoffpeparser.cpp')
| -rw-r--r-- | src/corelib/plugin/qcoffpeparser.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/plugin/qcoffpeparser.cpp b/src/corelib/plugin/qcoffpeparser.cpp index 1ebca08c322..d9dd98a2f48 100644 --- a/src/corelib/plugin/qcoffpeparser.cpp +++ b/src/corelib/plugin/qcoffpeparser.cpp @@ -56,7 +56,7 @@ using namespace Qt::StringLiterals; static constexpr bool IncludeValidityChecks = true; static constexpr inline auto metadataSectionName() noexcept { return ".qtmetadata"_L1; } -static constexpr QLatin1String truncatedSectionName = +static constexpr QLatin1StringView truncatedSectionName = metadataSectionName().left(sizeof(IMAGE_SECTION_HEADER::Name)); #ifdef QT_BUILD_INTERNAL @@ -328,7 +328,7 @@ findStringTable(QByteArrayView data, const IMAGE_NT_HEADERS *ntHeader, const Err return data.sliced(off, size); } -static QLatin1String findSectionName(const IMAGE_SECTION_HEADER *section, QByteArrayView stringTable) +static QLatin1StringView findSectionName(const IMAGE_SECTION_HEADER *section, QByteArrayView stringTable) { auto ptr = reinterpret_cast<const char *>(section->Name); qsizetype n = qstrnlen(ptr, sizeof(section->Name)); @@ -344,13 +344,13 @@ static QLatin1String findSectionName(const IMAGE_SECTION_HEADER *section, QByteA bool ok; qsizetype offset = QByteArrayView(ptr + 1, n - 1).toUInt(&ok); if (!ok || offset >= stringTable.size()) - return QLatin1String(); + return {}; ptr = stringTable.data() + offset; n = qstrnlen(ptr, stringTable.size() - offset); } - return QLatin1String(ptr, n); + return QLatin1StringView(ptr, n); } QLibraryScanResult QCoffPeParser::parse(QByteArrayView data, QString *errMsg) @@ -373,7 +373,7 @@ QLibraryScanResult QCoffPeParser::parse(QByteArrayView data, QString *errMsg) // scan the sections now const auto sectionTableEnd = section + ntHeaders->FileHeader.NumberOfSections; for ( ; section < sectionTableEnd; ++section) { - QLatin1String sectionName = findSectionName(section, stringTable); + QLatin1StringView sectionName = findSectionName(section, stringTable); peDebug << "section" << sectionName << SectionDebug{section}; if (IncludeValidityChecks && sectionName.isEmpty()) return error(QLibrary::tr("a section name is empty or extends past the end of the file")); |
