Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
e0df247d
Commit
e0df247d
authored
Mar 09, 2009
by
Roberto Raggi
Browse files
Fixed: Possible crash in MimeType::matchesFile().
parent
0ef7f31a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/mimedatabase.cpp
View file @
e0df247d
...
...
@@ -490,19 +490,21 @@ unsigned MimeType::matchesFile(const QFileInfo &file) const
unsigned
MimeType
::
matchesFile
(
Internal
::
FileMatchContext
&
c
)
const
{
// check globs
const
QList
<
QRegExp
>::
const_iterator
cend
=
m_d
->
globPatterns
.
constEnd
();
for
(
QList
<
QRegExp
>::
const_iterator
it
=
m_d
->
globPatterns
.
constBegin
();
it
!=
cend
;
++
it
)
if
(
it
->
exactMatch
(
c
.
fileName
()))
foreach
(
QRegExp
pattern
,
m_d
->
globPatterns
)
{
if
(
pattern
.
exactMatch
(
c
.
fileName
()))
return
GlobMatchPriority
;
}
// Nope, try magic matchers on context data
if
(
m_d
->
magicMatchers
.
e
mpty
())
if
(
m_d
->
magicMatchers
.
isE
mpty
())
return
0
;
const
QByteArray
data
=
c
.
data
();
if
(
!
data
.
isEmpty
())
{
const
MimeTypeData
::
IMagicMatcher
List
::
const_iterator
cend
=
m_d
->
magicMatchers
.
constEnd
();
for
(
MimeTypeData
::
IMagicMatcherList
::
const_iterator
it
=
m_d
->
magicMatchers
.
constBegin
();
it
!=
cend
;
++
it
)
if
((
*
it
)
->
matches
(
data
))
return
(
*
it
)
->
priority
();
foreach
(
MimeTypeData
::
IMagicMatcher
SharedPointer
matcher
,
m_d
->
magicMatchers
)
{
if
(
matcher
->
matches
(
data
)
)
return
matcher
->
priority
();
}
}
return
0
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment