From 78ad44c5d4b4f8d92e8f6036cf0c79701f3678a3 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 28 Dec 2021 10:30:52 +0100 Subject: Fix pattern type matching Amends 3c747aafa44ac2d0b314a002d2672227bf6513e5 Change-Id: I2753b627c269cbb50009ef5e9c2ffa274e0ccf5c Reviewed-by: David Faure Reviewed-by: Alex Richardson (cherry picked from commit 9453038921f190eb8582e559df889cbc243f9e3c) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/mimetypes/qmimeglobpattern.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib/mimetypes/qmimeglobpattern.cpp') 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")) -- cgit v1.2.1