diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-08-31 17:40:19 +0300 |
---|---|---|
committer | Arkadiy Illarionov <qarkai@gmail.com> | 2019-09-01 02:04:50 +0200 |
commit | 01837a85004a6f891a09c0a63ed7eff75d634827 (patch) | |
tree | 91dc39c58bde987760ac55aae876e9ec578cda43 /io/source/TextInputStream | |
parent | 376cc3ea0fc2e0f209763a2a27c5852136332c86 (diff) |
Simplify Sequence iterations in io
Use comphelper::findValue and initializer lists.
Change-Id: I4ebaf556a21b263e48b82a7290093eb8a832d9da
Reviewed-on: https://gerrit.libreoffice.org/78351
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'io/source/TextInputStream')
-rw-r--r-- | io/source/TextInputStream/TextInputStream.cxx | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx index c1ae805571f6..d90f30976ec8 100644 --- a/io/source/TextInputStream/TextInputStream.cxx +++ b/io/source/TextInputStream/TextInputStream.cxx @@ -19,6 +19,7 @@ #include <string.h> +#include <comphelper/sequence.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> @@ -167,8 +168,6 @@ OUString OTextInputStream::implReadString( const Sequence< sal_Unicode >& Delimi bool bFound = false; bool bFoundFirstLineEndChar = false; sal_Unicode cFirstLineEndChar = 0; - const sal_Unicode* pDelims = Delimiters.getConstArray(); - const sal_Int32 nDelimCount = Delimiters.getLength(); while( !bFound ) { // Still characters available? @@ -213,18 +212,12 @@ OUString OTextInputStream::implReadString( const Sequence< sal_Unicode >& Delimi cFirstLineEndChar = c; } } - else + else if( comphelper::findValue(Delimiters, c) != -1 ) { - for( sal_Int32 i = 0 ; i < nDelimCount ; i++ ) - { - if( c == pDelims[ i ] ) - { - bFound = true; - nCopyLen = nBufferReadPos; - if( bRemoveDelimiter ) - nCopyLen--; - } - } + bFound = true; + nCopyLen = nBufferReadPos; + if( bRemoveDelimiter ) + nCopyLen--; } } |