diff options
Diffstat (limited to 'src/corelib/mimetypes/qmimeglobpattern.cpp')
-rw-r--r-- | src/corelib/mimetypes/qmimeglobpattern.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/corelib/mimetypes/qmimeglobpattern.cpp b/src/corelib/mimetypes/qmimeglobpattern.cpp index f991d15b6c..381b635b90 100644 --- a/src/corelib/mimetypes/qmimeglobpattern.cpp +++ b/src/corelib/mimetypes/qmimeglobpattern.cpp @@ -34,9 +34,9 @@ void QMimeGlobMatchResult::addMatch(const QString &mimeType, int weight, const Q bool replace = weight > m_weight; if (!replace) { // Compare the length of the match - if (pattern.length() < m_matchingPatternLength) + if (pattern.size() < m_matchingPatternLength) return; // too short, ignore - else if (pattern.length() > m_matchingPatternLength) { + else if (pattern.size() > m_matchingPatternLength) { // longer: clear any previous match (like *.bz2, when pattern is *.tar.bz2) replace = true; } @@ -44,7 +44,7 @@ void QMimeGlobMatchResult::addMatch(const QString &mimeType, int weight, const Q if (replace) { m_matchingMimeTypes.clear(); // remember the new "longer" length - m_matchingPatternLength = pattern.length(); + m_matchingPatternLength = pattern.size(); m_weight = weight; } if (!m_matchingMimeTypes.contains(mimeType)) { @@ -59,7 +59,7 @@ void QMimeGlobMatchResult::addMatch(const QString &mimeType, int weight, const Q QMimeGlobPattern::PatternType QMimeGlobPattern::detectPatternType(const QString &pattern) const { - const int patternLength = pattern.length(); + const int patternLength = pattern.size(); if (!patternLength) return OtherPattern; @@ -108,10 +108,10 @@ bool QMimeGlobPattern::matchFileName(const QString &inputFileName) const const QString fileName = m_caseSensitivity == Qt::CaseInsensitive ? inputFileName.toLower() : inputFileName; - const int patternLength = m_pattern.length(); + const int patternLength = m_pattern.size(); if (!patternLength) return false; - const int fileNameLength = fileName.length(); + const int fileNameLength = fileName.size(); switch (m_patternType) { case SuffixPattern: { @@ -166,7 +166,7 @@ static bool isSimplePattern(const QString &pattern) { // starts with "*.", has no other '*' return pattern.lastIndexOf(u'*') == 0 - && pattern.length() > 1 + && pattern.size() > 1 && pattern.at(1) == u'.' // (other dots are OK, like *.tar.bz2) // and contains no other special character && !pattern.contains(u'?') @@ -229,7 +229,7 @@ void QMimeGlobPatternList::match(QMimeGlobMatchResult &result, const QMimeGlobPattern &glob = *it; if (glob.matchFileName(fileName)) { const QString pattern = glob.pattern(); - const int suffixLen = isSimplePattern(pattern) ? pattern.length() - 2 : 0; + const int suffixLen = isSimplePattern(pattern) ? pattern.size() - 2 : 0; result.addMatch(glob.mimeType(), glob.weight(), pattern, suffixLen); } } @@ -244,7 +244,7 @@ void QMimeAllGlobPatterns::matchingGlobs(const QString &fileName, QMimeGlobMatch // (which is most of them, so this optimization is definitely worth it) const int lastDot = fileName.lastIndexOf(u'.'); if (lastDot != -1) { // if no '.', skip the extension lookup - const int ext_len = fileName.length() - lastDot - 1; + const int ext_len = fileName.size() - lastDot - 1; const QString simpleExtension = fileName.right(ext_len).toLower(); // (toLower because fast patterns are always case-insensitive and saved as lowercase) |