Commit f6d99b34 authored by Tobias Hunger's avatar Tobias Hunger

MIMEdatabase: Fix coding style issues

Change-Id: I6ae0f8aa965cd5152bc9bc386c10be07212ae267
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@digia.com>
parent 4a911023
......@@ -1495,8 +1495,8 @@ MimeType MimeDatabasePrivate::findByFile(const QFileInfo &f, unsigned *priorityP
// Pass 1) Try to match on suffix
const TypeMimeTypeMap::const_iterator cend = m_typeMimeTypeMap.constEnd();
for (int level = m_maxLevel; level >= 0 && candidate.isNull(); level--)
for (TypeMimeTypeMap::const_iterator it = m_typeMimeTypeMap.constBegin(); it != cend; ++it)
for (int level = m_maxLevel; level >= 0 && candidate.isNull(); level--) {
for (TypeMimeTypeMap::const_iterator it = m_typeMimeTypeMap.constBegin(); it != cend; ++it) {
if (it.value().level == level) {
const unsigned suffixPriority = it.value().type.matchesFileBySuffix(context);
if (suffixPriority && suffixPriority > *priorityPtr) {
......@@ -1506,12 +1506,14 @@ MimeType MimeDatabasePrivate::findByFile(const QFileInfo &f, unsigned *priorityP
return candidate;
}
}
}
}
// Pass 2) Match on content
if (!f.isReadable())
return candidate;
for (int level = m_maxLevel; level >= 0; level--)
for (TypeMimeTypeMap::const_iterator it = m_typeMimeTypeMap.constBegin(); it != cend; ++it)
for (int level = m_maxLevel; level >= 0; level--) {
for (TypeMimeTypeMap::const_iterator it = m_typeMimeTypeMap.constBegin(); it != cend; ++it) {
if (it.value().level == level) {
const unsigned contentPriority = it.value().type.matchesFileByContent(context);
if (contentPriority && contentPriority > *priorityPtr) {
......@@ -1519,6 +1521,8 @@ MimeType MimeDatabasePrivate::findByFile(const QFileInfo &f, unsigned *priorityP
candidate = it.value().type;
}
}
}
}
return candidate;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment