diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-04-29 16:20:46 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-04-29 22:50:49 +0200 |
commit | 132138eeb0d518218d9051744e2092d3340156af (patch) | |
tree | 28a70ad39cfb393202e66c2c5eac9b8043d7a92e /dbaccess | |
parent | 5fd03b2693f699c6254128b74b2b8f719c2ba5b0 (diff) |
Avoid getTokenCount()
Change-Id: I7c58295c8d0eda927dd670ca9cc5537437ed94e6
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/misc/TokenWriter.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index e38be526a494..b1a60f2e6646 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -26,7 +26,6 @@ #include <HtmlReader.hxx> #include <stringconstants.hxx> #include <strings.hxx> -#include <comphelper/string.hxx> #include <comphelper/types.hxx> #include <connectivity/dbtools.hxx> #include <com/sun/star/sdb/DatabaseContext.hpp> @@ -357,14 +356,17 @@ bool ORTFImportExport::Write() } m_pStream->WriteCharPtr( "{\\fonttbl" ); - sal_Int32 nTokenCount = comphelper::string::getTokenCount(aFonts, ';'); - for(sal_Int32 j=0; j<nTokenCount; ++j) + if (!aFonts.isEmpty()) { - m_pStream->WriteCharPtr( "\\f" ); - m_pStream->WriteInt32AsString(j); - m_pStream->WriteCharPtr( "\\fcharset0\\fnil " ); - m_pStream->WriteCharPtr( aFonts.getToken(j, ';').getStr() ); - m_pStream->WriteChar( ';' ); + sal_Int32 nIdx{0}; + sal_Int32 nTok{-1}; // to compensate pre-increment + do { + m_pStream->WriteCharPtr( "\\f" ); + m_pStream->WriteInt32AsString(++nTok); + m_pStream->WriteCharPtr( "\\fcharset0\\fnil " ); + m_pStream->WriteCharPtr( aFonts.getToken(0, ';', nIdx).getStr() ); + m_pStream->WriteChar( ';' ); + } while (nIdx>=0); } m_pStream->WriteChar( '}' ) ; m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ); |