diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-15 09:39:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-15 13:54:53 +0200 |
commit | 46ce0d28b4c765076c7871358375c4e85e44534b (patch) | |
tree | b17378d5258a51185001eac455a764897e6dda11 /scripting | |
parent | 00f7309fb786efcc0bbca04fb29de80f275a16ba (diff) |
loplugin:stringliteralvar look for assignments
to O[U]String from char array literals, we can convert the char literals
to O[U]StringLiteral and avoid a runtime allocation
Change-Id: I15d8dddb2cd428b90740e39f20daf98e0941aa6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114125
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/source/provider/URIHelper.cxx | 8 | ||||
-rw-r--r-- | scripting/source/stringresource/stringresource.cxx | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx index 09fedf5762fd..94d0e1fd041c 100644 --- a/scripting/source/provider/URIHelper.cxx +++ b/scripting/source/provider/URIHelper.cxx @@ -35,12 +35,12 @@ namespace ucb = ::com::sun::star::ucb; namespace lang = ::com::sun::star::lang; namespace uri = ::com::sun::star::uri; -const char SHARE[] = "share"; +constexpr OUStringLiteral SHARE = u"share"; -const char SHARE_UNO_PACKAGES_URI[] = - "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE"; +constexpr OUStringLiteral SHARE_UNO_PACKAGES_URI = + u"vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE"; -const char USER[] = "user"; +constexpr OUStringLiteral USER = u"user"; constexpr OUStringLiteral USER_URI = u"vnd.sun.star.expand:${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}"; diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index bcbb02bb8bbd..f2b9dcd37757 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -684,7 +684,7 @@ Sequence< OUString > StringResourcePersistenceImpl::getSupportedServiceNames( ) // XInitialization base functionality for derived classes -const char aNameBaseDefaultStr[] = "strings"; +constexpr OUStringLiteral aNameBaseDefaultStr = u"strings"; void StringResourcePersistenceImpl::implInitializeCommonParameters ( const Sequence< Any >& aArguments ) |