Move extension preparation out of the loop
Change-Id: I6e4b5397e3d0ae9b943e261e9fca95735ccc9a73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132866 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -652,23 +652,22 @@ std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4Extension( const OU
|
|||||||
{
|
{
|
||||||
if ( m_rImpl.pList )
|
if ( m_rImpl.pList )
|
||||||
{
|
{
|
||||||
for (const std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
|
if (OUString sExt = ToUpper_Impl(rExt); !sExt.isEmpty())
|
||||||
{
|
{
|
||||||
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
|
if (sExt[0] != '.')
|
||||||
if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) )
|
sExt = "." + sExt;
|
||||||
|
|
||||||
|
for (const std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList)
|
||||||
{
|
{
|
||||||
OUString sWildCard = ToUpper_Impl( pFilter->GetWildcard().getGlob() );
|
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
|
||||||
OUString sExt = ToUpper_Impl( rExt );
|
if ((nFlags & nMust) == nMust && !(nFlags & nDont))
|
||||||
|
{
|
||||||
|
OUString sWildCard = ToUpper_Impl(pFilter->GetWildcard().getGlob());
|
||||||
|
|
||||||
if (sExt.isEmpty())
|
WildCard aCheck(sWildCard, ';');
|
||||||
continue;
|
if (aCheck.Matches(sExt))
|
||||||
|
return pFilter;
|
||||||
if (sExt[0] != '.')
|
}
|
||||||
sExt = "." + sExt;
|
|
||||||
|
|
||||||
WildCard aCheck(sWildCard, ';');
|
|
||||||
if (aCheck.Matches(sExt))
|
|
||||||
return pFilter;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user