forms/source/component/ListBox.cxx |   14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

New commits:
commit cca2e42926a14ec27c663cd0f495dccb7607d6f9
Author:     Matteo Casalin <[email protected]>
AuthorDate: Mon Mar 4 16:20:50 2019 +0100
Commit:     Matteo Casalin <[email protected]>
CommitDate: Sat Apr 6 23:41:12 2019 +0200

    Use getTokenCount and indexed getToken
    
    Change-Id: Id57a1771c897c69b05d02a359f22e5fb2b1f5a31
    Reviewed-on: https://gerrit.libreoffice.org/69239
    Tested-by: Jenkins
    Reviewed-by: Matteo Casalin <[email protected]>

diff --git a/forms/source/component/ListBox.cxx 
b/forms/source/component/ListBox.cxx
index d6857dcfdcf8..fcf16abe66b4 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -42,6 +42,7 @@
 #include <comphelper/basicio.hxx>
 #include <comphelper/property.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/string.hxx>
 #include <comphelper/types.hxx>
 #include <connectivity/dbtools.hxx>
 #include <connectivity/formattedcolumnvalue.hxx>
@@ -637,19 +638,12 @@ namespace frm
             OUString sListSource;
             _rxInStream >> sListSource;
 
-            sal_Int32 nTokens = 1;
-            const sal_Unicode* pStr = sListSource.getStr();
-            while ( *pStr )
-            {
-                if ( *pStr == ';' )
-                    nTokens++;
-                pStr++;
-            }
+            const sal_Int32 nTokens{ 
comphelper::string::getTokenCount(sListSource, ';') };
             aListSourceSeq.realloc( nTokens );
+            sal_Int32 nIdx{ 0 };
             for (sal_Int32 i=0; i<nTokens; ++i)
             {
-                sal_Int32 nTmp = 0;
-                aListSourceSeq.getArray()[i] = 
sListSource.getToken(i,';',nTmp);
+                aListSourceSeq.getArray()[i] = sListSource.getToken(0, ';', 
nIdx);
             }
         }
         else
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to