From 57c0ca2e575813626d0c2c994e0a4b52253f42b1 Mon Sep 17 00:00:00 2001 From: Matteo Casalin Date: Sun, 13 Sep 2015 13:09:42 +0200 Subject: Avoid getTokenCount in StandardHdl_Impl link (2) Change-Id: I0164f81e6308c5a5c1b4d93e8df55aa911ea8b4c --- cui/source/options/optpath.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'cui') diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 835418596853..0a97795aab8e 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -419,12 +419,11 @@ IMPL_LINK_NOARG_TYPED(SvxPathTabPage, StandardHdl_Impl, Button*, void) bool bReadOnly = false; GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly ); - sal_uInt16 i; - sal_uInt16 nOldCount = comphelper::string::getTokenCount(aOldPath, MULTIPATH_DELIMITER); - for ( i = 0; i < nOldCount; ++i ) + sal_Int32 nOldPos = 0; + do { bool bFound = false; - OUString sOnePath = aOldPath.getToken( i, MULTIPATH_DELIMITER ); + const OUString sOnePath = aOldPath.getToken( 0, MULTIPATH_DELIMITER, nOldPos ); if ( !sInternal.isEmpty() ) { sal_Int32 nInternalPos = 0; @@ -442,9 +441,11 @@ IMPL_LINK_NOARG_TYPED(SvxPathTabPage, StandardHdl_Impl, Button*, void) sTemp += sOnePath; } } + while ( nOldPos >= 0 ); OUString sUserPath, sWritablePath; - nOldCount = comphelper::string::getTokenCount(sTemp, MULTIPATH_DELIMITER); + sal_uInt16 nOldCount = comphelper::string::getTokenCount(sTemp, MULTIPATH_DELIMITER); + sal_uInt16 i; for ( i = 0; nOldCount > 0 && i < nOldCount - 1; ++i ) { if ( !sUserPath.isEmpty() ) -- cgit