summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/mimetype.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/library/mimetype.cpp b/library/mimetype.cpp
index e2e0dab..92fe5e6 100644
--- a/library/mimetype.cpp
+++ b/library/mimetype.cpp
@@ -234,32 +234,30 @@ void MimeType::loadExtensions(const QString& filename)
QFile file(filename);
if ( file.open(IO_ReadOnly) ) {
QTextStream in(&file);
QRegExp space("[ \t]+");
while (!in.atEnd()) {
QStringList tokens = QStringList::split(space, in.readLine());
QStringList::ConstIterator it = tokens.begin();
if ( it != tokens.end() ) {
QString id = *it; ++it;
// new override old (though left overrides right)
QStringList exts = (*extFor)[id];
QStringList newexts;
- if ( it != tokens.end() ) {
+ while ( it != tokens.end() ) {
exts.remove(*it);
if ( !newexts.contains(*it) )
newexts.append(*it);
- while (it != tokens.end()) {
- (*typeFor)[*it] = id;
- ++it;
- }
+ (*typeFor)[*it] = id;
+ ++it;
}
(*extFor)[id] = newexts + exts;
}
}
}
}
void MimeType::init( const QString& ext_or_id )
{
if ( ext_or_id[0] != '/' && ext_or_id.contains('/') ) {
i = ext_or_id.lower();
} else {