diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-13 16:59:29 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-14 22:40:32 +0200 |
commit | 895f24ffca080516b877e86ad0ce7b076e14418d (patch) | |
tree | b6d39fc2ce02316c95d3c10456937d948bd3d05e /sd | |
parent | f7b305015043c4f9e0a669afc7222d873c548ad5 (diff) |
Avoid getTokenCount in ImplSdPPTImport::Import
Change-Id: I7ed99aa72bc775b98f5ca738c35706629a58dc96
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 76f331d191dd..f35bb59e8c39 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -426,17 +426,19 @@ bool ImplSdPPTImport::Import() sal_uInt32 nPageNumber = 0; OUString aString( pHyperlink->aSubAdress ); OString aStringAry[ 3 ]; - sal_uInt16 nTokenCount = comphelper::string::getTokenCount(aString, ','); - if ( nTokenCount > 3 ) - nTokenCount = 3; - sal_uInt16 nToken; - for( nToken = 0; nToken < nTokenCount; nToken++ ) - aStringAry[nToken] = OUStringToOString(aString.getToken( nToken, (sal_Unicode)',' ), RTL_TEXTENCODING_UTF8); + size_t nTokenCount = 0; + sal_Int32 nPos = 0; + do + { + aStringAry[nTokenCount] = + OUStringToOString(aString.getToken( 0, (sal_Unicode)',', nPos ), RTL_TEXTENCODING_UTF8); + } + while ( ++nTokenCount < SAL_N_ELMENTS(aStringAry) && nPos >= 0 ); bool bDocInternalSubAddress = false; // first pass, searching for a SlideId - for( nToken = 0; nToken < nTokenCount; nToken++ ) + for( size_t nToken = 0; nToken < nTokenCount; ++nToken ) { if (comphelper::string::isdigitAsciiString(aStringAry[nToken])) { @@ -459,7 +461,7 @@ bool ImplSdPPTImport::Import() } if ( !bDocInternalSubAddress ) { // second pass, searching for a SlideName - for ( nToken = 0; nToken < nTokenCount; nToken++ ) + for ( size_t nToken = 0; nToken < nTokenCount; ++nToken ) { OUString aToken(OStringToOUString(aStringAry[nToken], RTL_TEXTENCODING_UTF8)); std::vector<OUString>::const_iterator pIter = @@ -474,7 +476,7 @@ bool ImplSdPPTImport::Import() } if ( !bDocInternalSubAddress ) { // third pass, searching for a slide number - for ( nToken = 0; nToken < nTokenCount; nToken++ ) + for ( size_t nToken = 0; nToken < nTokenCount; ++nToken ) { if (comphelper::string::isdigitAsciiString(aStringAry[nToken])) { |