summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2021-12-28 10:30:52 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2021-12-29 12:34:44 +0100
commit78ad44c5d4b4f8d92e8f6036cf0c79701f3678a3 (patch)
tree69ccba740411b032155bb40c7b044c193ebed329
parentcda55eb957734edbec09de108566760fe70bcf75 (diff)
downloadqtbase-78ad44c5d4b4f8d92e8f6036cf0c79701f3678a3.tar.gz
Fix pattern type matching
Amends 3c747aafa44ac2d0b314a002d2672227bf6513e5 Change-Id: I2753b627c269cbb50009ef5e9c2ffa274e0ccf5c Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Alex Richardson <arichardson.kde@gmail.com> (cherry picked from commit 9453038921f190eb8582e559df889cbc243f9e3c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/corelib/mimetypes/qmimeglobpattern.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/mimetypes/qmimeglobpattern.cpp b/src/corelib/mimetypes/qmimeglobpattern.cpp
index 56bf36b758..403eafecb8 100644
--- a/src/corelib/mimetypes/qmimeglobpattern.cpp
+++ b/src/corelib/mimetypes/qmimeglobpattern.cpp
@@ -94,7 +94,7 @@ QMimeGlobPattern::PatternType QMimeGlobPattern::detectPatternType(const QString
if (!patternLength)
return OtherPattern;
- const bool starCount = pattern.count(QLatin1Char('*')) == 1;
+ const int starCount = pattern.count(QLatin1Char('*'));
const bool hasSquareBracket = pattern.indexOf(QLatin1Char('[')) != -1;
const bool hasQuestionMark = pattern.indexOf(QLatin1Char('?')) != -1;
@@ -106,10 +106,10 @@ QMimeGlobPattern::PatternType QMimeGlobPattern::detectPatternType(const QString
// Patterns like "README*" (well this is currently the only one like that...)
if (pattern.at(patternLength - 1) == QLatin1Char('*'))
return PrefixPattern;
- }
- // Names without any wildcards like "README"
- if (starCount == 0)
+ } else if (starCount == 0) {
+ // Names without any wildcards like "README"
return LiteralPattern;
+ }
}
if (pattern == QLatin1String("[0-9][0-9][0-9].vdr"))