diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-06-24 12:09:11 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-06-30 23:00:13 +0200 |
commit | 5fa9aa1c8f5b9a3245a0cb23f689fecb563dd31f (patch) | |
tree | 70720362491bc413bcf608179f5989701578fe6b /sw/source/ui | |
parent | 5b07f513cb758ec831e80f3e4dc1819445cdfb51 (diff) |
Avoid getTokenCount()
Change-Id: Ia56f125151aa96d014e348b6d022b45138f732c9
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/dbui/createaddresslistdialog.cxx | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index b0dcf5962536..a43be61db108 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -25,7 +25,6 @@ #include "createaddresslistdialog.hxx" #include "customizeaddresslistdialog.hxx" #include <mmconfigitem.hxx> -#include <comphelper/string.hxx> #include <vcl/scrbar.hxx> #include <vcl/builderfactory.hxx> #include <svtools/controldims.hxx> @@ -438,12 +437,10 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( OUString sLine; bool bRead = pStream->ReadByteStringLine( sLine, RTL_TEXTENCODING_UTF8 ); - if(bRead) + if(bRead && !sLine.isEmpty()) { - //header line - sal_Int32 nHeaders = comphelper::string::getTokenCount(sLine, '\t'); sal_Int32 nIndex = 0; - for( sal_Int32 nToken = 0; nToken < nHeaders; ++nToken) + do { const OUString sHeader = sLine.getToken( 0, '\t', nIndex ); OSL_ENSURE(sHeader.getLength() > 2 && @@ -454,14 +451,14 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( m_pCSVData->aDBColumnHeaders.push_back( sHeader.copy(1, sHeader.getLength() -2)); } } + while (nIndex > 0); } while(pStream->ReadByteStringLine( sLine, RTL_TEXTENCODING_UTF8 )) { std::vector<OUString> aNewData; //analyze data line - sal_Int32 nDataCount = comphelper::string::getTokenCount(sLine, '\t'); - sal_Int32 nIndex = 0; - for( sal_Int32 nToken = 0; nToken < nDataCount; ++nToken) + sal_Int32 nIndex = { sLine.isEmpty() ? -1 : 0 }; + while (nIndex >= 0) { const OUString sData = sLine.getToken( 0, '\t', nIndex ); OSL_ENSURE( sData.startsWith("\"") && sData.endsWith("\""), |