diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-23 12:34:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-26 13:12:31 +0200 |
commit | 0193b284e880a659ab73160e42238e1d5fe5cf8f (patch) | |
tree | da09299838a6afb43d7c601803a6bab787489854 /basic | |
parent | 2ef138de767c312188d41a7f206234eafac3108b (diff) |
new loplugin:constexprliteral
OUStringLiteral should be declared constexpr, to enforce
that it is initialised at compile-time and not runtime.
This seems to make a different at least on Visual Studio
Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/classes/sb.cxx | 2 | ||||
-rw-r--r-- | basic/source/sbx/sbxscan.cxx | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 64ba5cd20c86..1070f1986e38 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -1893,7 +1893,7 @@ Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic ) // look for the ThisComponent variable, first in the parent (which // might be the document's Basic), then in the parent's parent (which might be // the application Basic) - static const OUStringLiteral sThisComponent( u"ThisComponent"); + static constexpr OUStringLiteral sThisComponent( u"ThisComponent"); SbxVariable* pThisComponent = nullptr; SbxObject* pLookup = pBasic->GetParent(); diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 317539fbeecd..6003734cc050 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -122,7 +122,7 @@ ErrCode ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType, if( bOnlyIntntl ) aSearchStr.append(cIntntlGrpSep); const OUString pSearchStr = aSearchStr.makeStringAndClear(); - static const OUStringLiteral pDdEe = u"DdEe"; + static constexpr OUStringLiteral pDdEe = u"DdEe"; while( ImpStrChr( pSearchStr, *p ) ) { aBuf.append( *p ); @@ -191,7 +191,7 @@ ErrCode ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType, eScanType = SbxDOUBLE; // type detection? - static const OUStringLiteral pTypes = u"%!&#"; + static constexpr OUStringLiteral pTypes = u"%!&#"; if( ImpStrChr( pTypes, *p ) ) p++; } |