diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-13 14:56:22 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-14 22:40:30 +0200 |
commit | af6d9db3fc1dddd65299eb0bfb5b366700edc742 (patch) | |
tree | 9cee9f88b2af3a56f45760cc416b661be493bd32 /cui | |
parent | a3bbb7e63c1f5e7f5d63678e7d35f8847e4a9370 (diff) |
Avoid getTokenCount in PathHdl_Impl link
Change-Id: Idfc4977283373349d6c636c91e631eb98684ae56
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optpath.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 370f71cd1ba8..16bae497ad90 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -584,19 +584,24 @@ IMPL_LINK_NOARG_TYPED(SvxPathTabPage, PathHdl_Impl, Button*, void) sWritable.clear(); OUString sFullPath; OUString sNewPath = pMultiDlg->GetPath(); - char cDelim = MULTIPATH_DELIMITER; - sal_uInt16 nCount = comphelper::string::getTokenCount(sNewPath, cDelim); - if ( nCount > 0 ) + if ( !sNewPath.isEmpty() ) { - sal_uInt16 i = 0; - for ( ; i < nCount - 1; ++i ) + const sal_Unicode cDelim = MULTIPATH_DELIMITER; + sal_Int32 nNextPos = 0; + for (;;) { + const OUString sToken(sNewPath.getToken( 0, cDelim, nNextPos )); + if ( nNextPos<0 ) + { + // Last token need a different handling + sWritable = sToken; + break; + } if ( !sUser.isEmpty() ) sUser += OUString(cDelim); - sUser += sNewPath.getToken( i, cDelim ); + sUser += sToken; } sFullPath = sUser; - sWritable += sNewPath.getToken( i, cDelim ); if ( !sFullPath.isEmpty() ) sFullPath += OUString(cDelim); sFullPath += sWritable; |