From e266d448f45348f27f8291ea5d0542747d7c8168 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 26 Jun 2023 16:16:19 +0200 Subject: loplugin:stringstatic look for more strings that can be initialised at compile-time instead of runtime Change-Id: I08d516fdc13a3a79f93c079f89ac44cbc7a1ed71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153620 Tested-by: Jenkins Reviewed-by: Noel Grandin --- l10ntools/source/merge.cxx | 2 +- l10ntools/source/propmerge.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'l10ntools') diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 263e3d588121..8327442b0af2 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -150,7 +150,7 @@ MergeDataFile::MergeDataFile( OString sLang; //Get language id from path { - const OString sTransSource("translations/source/"); + static constexpr OStringLiteral sTransSource("translations/source/"); const sal_Int32 nStart = sPoFileName.indexOf(sTransSource)+sTransSource.getLength(); const sal_Int32 nCount = diff --git a/l10ntools/source/propmerge.cxx b/l10ntools/source/propmerge.cxx index c17519364443..99c2885ce5a3 100644 --- a/l10ntools/source/propmerge.cxx +++ b/l10ntools/source/propmerge.cxx @@ -28,7 +28,7 @@ namespace sal_Int32 lcl_IndexOfUnicode( std::string_view rSource, const sal_Int32 nFrom = 0 ) { - const OString sHexDigits = "0123456789abcdefABCDEF"; + static constexpr std::string_view sHexDigits = "0123456789abcdefABCDEF"; size_t nIndex = rSource.find( "\\u", nFrom ); if( nIndex == std::string_view::npos ) { @@ -37,7 +37,7 @@ namespace bool bIsUnicode = true; for( short nDist = 2; nDist <= 5; ++nDist ) { - if( sHexDigits.indexOf( rSource[nIndex + nDist] ) == -1 ) + if( sHexDigits.find( rSource[nIndex + nDist] ) == std::string_view::npos ) { bIsUnicode = false; } -- cgit