summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx18
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 );