diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-04-13 07:49:32 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-04-13 10:34:07 +0200 |
commit | b210c45d19e8791402d1f3aa9b3bb5bcd6c95f79 (patch) | |
tree | b6919fa93f80272f142163090c80adea19feda91 /sfx2/source/bastyp | |
parent | 55c7691fadfb9b3a4869cc14432ec57c858f693f (diff) |
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>
Diffstat (limited to 'sfx2/source/bastyp')
-rw-r--r-- | sfx2/source/bastyp/fltfnc.cxx | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index d554d8e9652d..942109db2699 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -652,23 +652,22 @@ std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4Extension( const OU { 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 ( (nFlags & nMust) == nMust && !(nFlags & nDont ) ) - { - OUString sWildCard = ToUpper_Impl( pFilter->GetWildcard().getGlob() ); - OUString sExt = ToUpper_Impl( rExt ); - - if (sExt.isEmpty()) - continue; + if (sExt[0] != '.') + sExt = "." + sExt; - if (sExt[0] != '.') - sExt = "." + sExt; + for (const std::shared_ptr<const SfxFilter>& pFilter : *m_rImpl.pList) + { + SfxFilterFlags nFlags = pFilter->GetFilterFlags(); + if ((nFlags & nMust) == nMust && !(nFlags & nDont)) + { + OUString sWildCard = ToUpper_Impl(pFilter->GetWildcard().getGlob()); - WildCard aCheck(sWildCard, ';'); - if (aCheck.Matches(sExt)) - return pFilter; + WildCard aCheck(sWildCard, ';'); + if (aCheck.Matches(sExt)) + return pFilter; + } } } |