filter/source/config/cache/filtercache.cxx | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
New commits: commit c0643239a536ea2adc1876ef85591bb1b27abcef Author: Noel Grandin <n...@peralex.com> AuthorDate: Mon Jun 21 11:07:55 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jun 22 10:23:49 2021 +0200 no need to make copies of these map entries Change-Id: Ie65cbacd2806a2c030b682f8cfd473676c4f95c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117605 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index c97d39f2319b..ca698f378b59 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -973,8 +973,8 @@ void FilterCache::impl_validateAndOptimize() for (auto const& elem : m_lTypes) { - OUString sType = elem.first; - CacheItem aType = elem.second; + const OUString & sType = elem.first; + const CacheItem & aType = elem.second; // get its registration for file Extensions AND(!) URLPattern ... // It doesn't matter if these items exists or if our @@ -984,15 +984,21 @@ void FilterCache::impl_validateAndOptimize() // from this cache! css::uno::Sequence< OUString > lExtensions; css::uno::Sequence< OUString > lURLPattern; - aType[PROPNAME_EXTENSIONS] >>= lExtensions; - aType[PROPNAME_URLPATTERN] >>= lURLPattern; + auto it = aType.find(PROPNAME_EXTENSIONS); + if (it != aType.end()) + it->second >>= lExtensions; + it = aType.find(PROPNAME_URLPATTERN); + if (it != aType.end()) + it->second >>= lURLPattern; sal_Int32 ce = lExtensions.getLength(); sal_Int32 cu = lURLPattern.getLength(); #if OSL_DEBUG_LEVEL > 0 OUString sInternalTypeNameCheck; - aType[PROPNAME_NAME] >>= sInternalTypeNameCheck; + it = aType.find(PROPNAME_NAME); + if (it != aType.end()) + it->second >>= sInternalTypeNameCheck; if (sInternalTypeNameCheck != sType) { sLog.append("Warning\t:\t" "The type \"" + sType + "\" does support the property \"Name\" correctly.\n"); @@ -1015,7 +1021,9 @@ void FilterCache::impl_validateAndOptimize() // preferred type is usable in the same manner then every // other type! bool bPreferred = false; - aType[PROPNAME_PREFERRED] >>= bPreferred; + it = aType.find(PROPNAME_PREFERRED); + if (it != aType.end()) + it->second >>= bPreferred; const OUString* pExtensions = lExtensions.getConstArray(); for (sal_Int32 e=0; e<ce; ++e) @@ -1057,7 +1065,9 @@ void FilterCache::impl_validateAndOptimize() continue; OUString sPrefFilter; - aType[PROPNAME_PREFERREDFILTER] >>= sPrefFilter; + it = aType.find(PROPNAME_PREFERREDFILTER); + if (it != aType.end()) + it->second >>= sPrefFilter; if (sPrefFilter.isEmpty()) { // OK - there is no filter for this type. But that's not an error. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits