qmimeprovider: use view types more
Change-Id: Idd6552313d3ef6ba692432858699521c392c70c3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
8703829d41
commit
8037d4f4eb
@ -453,13 +453,14 @@ void QMimeBinaryProvider::loadMimeTypeList()
|
||||
m_mimetypeNames.clear();
|
||||
// Unfortunately mime.cache doesn't have a full list of all mimetypes.
|
||||
// So we have to parse the plain-text files called "types".
|
||||
QFile file(m_directory + QStringLiteral("/types"));
|
||||
QFile file(m_directory + QStringView(u"/types"));
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
while (!file.atEnd()) {
|
||||
QByteArray line = file.readLine();
|
||||
if (line.endsWith('\n'))
|
||||
line.chop(1);
|
||||
m_mimetypeNames.insert(QString::fromLatin1(line));
|
||||
const QByteArray line = file.readLine();
|
||||
auto lineView = QByteArrayView(line);
|
||||
if (lineView.endsWith('\n'))
|
||||
lineView.chop(1);
|
||||
m_mimetypeNames.insert(QString::fromLatin1(lineView));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -717,7 +718,7 @@ void QMimeXMLProvider::findByMagic(const QByteArray &data, int *accuracyPtr, QMi
|
||||
void QMimeXMLProvider::ensureLoaded()
|
||||
{
|
||||
QStringList allFiles;
|
||||
const QString packageDir = m_directory + QStringLiteral("/packages");
|
||||
const QString packageDir = m_directory + QStringView(u"/packages");
|
||||
QDir dir(packageDir);
|
||||
const QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
|
||||
allFiles.reserve(files.size());
|
||||
|
Loading…
Reference in New Issue
Block a user