diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-04 11:14:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-05 12:57:00 +0200 |
commit | 9f1701d01d9f664828356976d8592492f85b30f5 (patch) | |
tree | a91eaef0674591af87b06096fdd186283559a8de /idlc | |
parent | b8bb44161aeb6e00526a38343b63e678ce7d4a1a (diff) |
use more o3tl::getToken
found by inspecting call sites of OUString::getToken
Change-Id: I4269c7476c7aa46fac39528227e350568f0eb34a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132644
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'idlc')
-rw-r--r-- | idlc/source/astdeclaration.cxx | 1 | ||||
-rw-r--r-- | idlc/source/idlccompile.cxx | 12 | ||||
-rw-r--r-- | idlc/source/idlcproduce.cxx | 8 | ||||
-rw-r--r-- | idlc/source/options.cxx | 3 | ||||
-rw-r--r-- | idlc/source/scanner.l | 7 |
5 files changed, 17 insertions, 14 deletions
diff --git a/idlc/source/astdeclaration.cxx b/idlc/source/astdeclaration.cxx index 013e0995a941..69e19185e67c 100644 --- a/idlc/source/astdeclaration.cxx +++ b/idlc/source/astdeclaration.cxx @@ -20,6 +20,7 @@ #include <astdeclaration.hxx> #include <astscope.hxx> #include <rtl/strbuf.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <o3tl/string_view.hxx> diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index 0d06ea59cdbe..5aec2091234f 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -263,24 +263,24 @@ sal_Int32 compileFile(const OString * pathname) if ( pOptions->isValid("-D") ) { - OString token, dOpt = pOptions->getOption("-D"); + OString dOpt = pOptions->getOption("-D"); sal_Int32 nIndex = 0; do { - token = dOpt.getToken( 0, ' ', nIndex ); - if (token.getLength()) + std::string_view token = o3tl::getToken(dOpt, 0, ' ', nIndex ); + if (token.size()) lCppArgs.push_back("-D" + OStringToOUString(token, RTL_TEXTENCODING_UTF8)); } while( nIndex != -1 ); } if ( pOptions->isValid("-I") ) { - OString token, incOpt = pOptions->getOption("-I"); + OString incOpt = pOptions->getOption("-I"); sal_Int32 nIndex = 0; do { - token = incOpt.getToken( 0, ' ', nIndex ); - if (token.getLength()) + std::string_view token = o3tl::getToken(incOpt, 0, ' ', nIndex ); + if (token.size()) lCppArgs.push_back("-I" + OStringToOUString(token, RTL_TEXTENCODING_UTF8)); } while( nIndex != -1 ); } diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx index 732647c9e715..2592fe0dee27 100644 --- a/idlc/source/idlcproduce.cxx +++ b/idlc/source/idlcproduce.cxx @@ -51,10 +51,10 @@ static bool checkOutputPath(const OString& completeName) return true; sal_Int32 nIndex = 0; - OString token(sysPathName.getToken(0, SEPARATOR, nIndex)); - if (token.startsWith("..") - || (token.getLength() >= 2 && token[1] == ':') - || token.startsWith(".")) + std::string_view token(o3tl::getToken(sysPathName, 0, SEPARATOR, nIndex)); + if (o3tl::starts_with(token, "..") + || (token.size() >= 2 && token[1] == ':') + || o3tl::starts_with(token, ".")) { buffer.append(token); buffer.append(SEPARATOR); diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx index 9f020777d54d..0fd06cc9fb3c 100644 --- a/idlc/source/options.cxx +++ b/idlc/source/options.cxx @@ -30,6 +30,7 @@ #include <rtl/ustring.hxx> #include <osl/file.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <o3tl/string_view.hxx> #ifdef _WIN32 # if !defined WIN32_LEAN_AND_MEAN @@ -266,7 +267,7 @@ bool Options::initOptions(std::vector< std::string > & rArgs) #ifdef _WIN32 OString incpath = convertIncPathtoShortWindowsPath(param.getToken(0, ';', k)); #else - OString incpath = param.getToken(0, ';', k); + std::string_view incpath = o3tl::getToken(param, 0, ';', k); #endif buffer.append(incpath); // buffer.append("\""); diff --git a/idlc/source/scanner.l b/idlc/source/scanner.l index e7fff5ee31e6..aaf74a564677 100644 --- a/idlc/source/scanner.l +++ b/idlc/source/scanner.l @@ -30,6 +30,7 @@ #include <string.h> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <rtl/character.hxx> #if defined _MSC_VER @@ -411,7 +412,7 @@ published return IDL_PUBLISHED; docu = docu.trim(); sal_Int32 nIndex = 0; int count = 0; - do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 ); + do { o3tl::getToken(docu, 0, '\n', nIndex ); count++; } while( nIndex != -1 ); idlc()->setLineNumber( beginLine + count - 1); BEGIN( INITIAL ); } @@ -444,7 +445,7 @@ published return IDL_PUBLISHED; docu = docu.trim(); sal_Int32 nIndex = 0; int count = 0; - do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 ); + do { o3tl::getToken(docu, 0, '\n', nIndex ); count++; } while( nIndex != -1 ); idlc()->setLineNumber( beginLine + count - 1); if ( (nIndex = docu.indexOf("/*")) >= 0 || (nIndex = docu.indexOf("///")) >= 0 ) { @@ -461,7 +462,7 @@ published return IDL_PUBLISHED; docu = docu.trim(); sal_Int32 nIndex = 0; int count = 0; - do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 ); + do { o3tl::getToken(docu, 0, '\n', nIndex ); count++; } while( nIndex != -1 ); idlc()->setLineNumber( beginLine + count - 1); if ( docu.indexOf("/*") >= 0 || docu.indexOf("//") >= 0 ) { |