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();
|
m_mimetypeNames.clear();
|
||||||
// Unfortunately mime.cache doesn't have a full list of all mimetypes.
|
// Unfortunately mime.cache doesn't have a full list of all mimetypes.
|
||||||
// So we have to parse the plain-text files called "types".
|
// 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)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
while (!file.atEnd()) {
|
while (!file.atEnd()) {
|
||||||
QByteArray line = file.readLine();
|
const QByteArray line = file.readLine();
|
||||||
if (line.endsWith('\n'))
|
auto lineView = QByteArrayView(line);
|
||||||
line.chop(1);
|
if (lineView.endsWith('\n'))
|
||||||
m_mimetypeNames.insert(QString::fromLatin1(line));
|
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()
|
void QMimeXMLProvider::ensureLoaded()
|
||||||
{
|
{
|
||||||
QStringList allFiles;
|
QStringList allFiles;
|
||||||
const QString packageDir = m_directory + QStringLiteral("/packages");
|
const QString packageDir = m_directory + QStringView(u"/packages");
|
||||||
QDir dir(packageDir);
|
QDir dir(packageDir);
|
||||||
const QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
|
const QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
|
||||||
allFiles.reserve(files.size());
|
allFiles.reserve(files.size());
|
||||||
|
Loading…
Reference in New Issue
Block a user