diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-04-30 09:33:10 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-04-30 09:36:00 +0200 |
commit | b3c43f257404f1b9037898825e86806b5b0b0fc7 (patch) | |
tree | 48a8088dc38622589f4efc9b664e321327a7c44a /vcl | |
parent | 25762ee54f0def7b5aa14d2bb4f2f3dc85d057af (diff) |
Avoid getTokenCount (fix 1a2ee0ecd5b0cff52922c1d261f7d03a57a52ca0)
Change-Id: I2def3a427585fd281fb0b25e90060b2a2037212b
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 0a95499c84c9..6c10f95e7094 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -22,7 +22,6 @@ #include <o3tl/make_unique.hxx> #include <osl/mutex.hxx> #include <comphelper/processfactory.hxx> -#include <comphelper/string.hxx> #include <comphelper/threadpool.hxx> #include <ucbhelper/content.hxx> #include <cppuhelper/implbase.hxx> @@ -75,8 +74,6 @@ #define PMGCHUNG_msOG 0x6d734f47 // Microsoft Office Animated GIF -using comphelper::string::getTokenCount; - typedef ::std::vector< GraphicFilter* > FilterList_impl; static FilterList_impl* pFilterHdlList = nullptr; @@ -2011,11 +2008,16 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, { ImpFilterLibCacheEntry* pFilter = nullptr; - // find first filter in filter paths - sal_Int32 i, nTokenCount = getTokenCount(aFilterPath, ';'); - ImpFilterLibCache &rCache = Cache::get(); - for( i = 0; ( i < nTokenCount ) && ( pFilter == nullptr ); i++ ) - pFilter = rCache.GetFilter(aFilterPath.getToken(i, ';'), aFilterName, aExternalFilterName); + if (!aFilterPath.isEmpty()) + { + // find first filter in filter paths + ImpFilterLibCache &rCache = Cache::get(); + sal_Int32 nIdx{0}; + do { + pFilter = rCache.GetFilter(aFilterPath.getToken(0, ';', nIdx), aFilterName, aExternalFilterName); + } while (nIdx>=0 && pFilter==nullptr); + } + if( !pFilter ) nStatus = ERRCODE_GRFILTER_FILTERERROR; else |