diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-12 10:50:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-14 07:54:28 +0200 |
commit | bc2101646bc6e63944c42500af5a15134b9b2d17 (patch) | |
tree | ca1da50da2e3e76eef650a1ae3956c16e0a19f33 /basic | |
parent | ad97694737c99889bc0eb21efccb83768d510361 (diff) |
loplugin:stringviewparam improvements
improve the check by checking for methods that exclude
using string_view, rather than checking for methods that
__can__ use string_view, which leads to exposing
some holes in our o3tl/string_view.hxx coverage.
Change-Id: Ic9dd60441c671f502692f9cd2a1bb67301c4b960
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150277
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 2 | ||||
-rw-r--r-- | basic/source/comp/token.cxx | 5 | ||||
-rw-r--r-- | basic/source/inc/token.hxx | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 2453caa57c8c..cce2caca22b4 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1735,7 +1735,7 @@ void SbModule::GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache) } -OUString SbModule::GetKeywordCase( const OUString& sKeyword ) +OUString SbModule::GetKeywordCase( std::u16string_view sKeyword ) { return SbiParser::GetKeywordCase( sKeyword ); } diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx index a060b3fd9318..814d5488f8ee 100644 --- a/basic/source/comp/token.cxx +++ b/basic/source/comp/token.cxx @@ -22,6 +22,7 @@ #include <basic/sberrors.hxx> #include <sal/macros.h> +#include <o3tl/string_view.hxx> #include <basiccharclass.hxx> #include <token.hxx> @@ -558,11 +559,11 @@ bool SbiTokenizer::MayBeLabel( bool bNeedsColon ) } -OUString SbiTokenizer::GetKeywordCase( const OUString& sKeyword ) +OUString SbiTokenizer::GetKeywordCase( std::u16string_view sKeyword ) { for( auto& rTok : aTokTable_Basic ) { - if( sKeyword.equalsIgnoreAsciiCaseAscii(rTok.s) ) + if( o3tl::equalsIgnoreAsciiCase(sKeyword, rTok.s) ) return OStringToOUString(rTok.s, RTL_TEXTENCODING_ASCII_US); } return OUString(); diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx index 4230ff585b7a..9927e894e3b5 100644 --- a/basic/source/inc/token.hxx +++ b/basic/source/inc/token.hxx @@ -130,7 +130,7 @@ public: { return t >= FIRSTKWD && t <= LASTKWD; } static bool IsExtra( SbiToken t ) { return t >= FIRSTEXTRA; } - static OUString GetKeywordCase( const OUString& sKeyword ); + static OUString GetKeywordCase( std::u16string_view sKeyword ); }; |