[Libreoffice-commits] core.git: vcl/source
Matteo Casalin
matteo.casalin at yahoo.com
Mon Apr 30 07:36:32 UTC 2018
vcl/source/filter/graphicfilter.cxx | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
New commits:
commit b3c43f257404f1b9037898825e86806b5b0b0fc7
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Mon Apr 30 09:33:10 2018 +0200
Avoid getTokenCount (fix 1a2ee0ecd5b0cff52922c1d261f7d03a57a52ca0)
Change-Id: I2def3a427585fd281fb0b25e90060b2a2037212b
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
More information about the Libreoffice-commits
mailing list