diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-04-29 17:41:51 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-04-29 22:50:52 +0200 |
commit | 1a2ee0ecd5b0cff52922c1d261f7d03a57a52ca0 (patch) | |
tree | 54b6b76efa343123c9306cc49bdde675f6dda977 | |
parent | 2a39163aef4211c9d19cb1faee7f55d3718355b6 (diff) |
Avoid getTokenCount
Change-Id: Id4a6e669fedf803fc96ce83315dccc61cfb25aed
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 43feef35e5e2..91d01a2f46d3 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -75,8 +75,6 @@ #define PMGCHUNG_msOG 0x6d734f47 // Microsoft Office Animated GIF -using comphelper::string::getTokenCount; - typedef ::std::vector< GraphicFilter* > FilterList_impl; static FilterList_impl* pFilterHdlList = nullptr; @@ -1597,11 +1595,16 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream) { 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 @@ -2426,11 +2429,10 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r } else { - sal_Int32 i, nTokenCount = getTokenCount(aFilterPath, ';'); - for ( i = 0; i < nTokenCount; i++ ) - { + sal_Int32 nIdx{0}; + do { #ifndef DISABLE_DYNLOADING - OUString aPhysicalName( ImpCreateFullFilterPath( aFilterPath.getToken(i, ';'), aFilterName ) ); + OUString aPhysicalName( ImpCreateFullFilterPath( aFilterPath.getToken(0, ';', nIdx), aFilterName ) ); osl::Module aLibrary( aPhysicalName ); PFilterCall pFunc = nullptr; @@ -2442,6 +2444,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("etiGraphicExport")); // Execute dialog in DLL #else + --nIdx; // Just one iteration PFilterCall pFunc = NULL; if (aFilterName == "egi") pFunc = egiGraphicExport; @@ -2458,7 +2461,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r } else nStatus = ERRCODE_GRFILTER_FILTERERROR; - } + } while (nIdx>=0); } } if( nStatus != ERRCODE_NONE ) |