summaryrefslogtreecommitdiff
path: root/cui/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-04-15 09:39:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-04-15 13:54:53 +0200
commit46ce0d28b4c765076c7871358375c4e85e44534b (patch)
treeb17378d5258a51185001eac455a764897e6dda11 /cui/source
parent00f7309fb786efcc0bbca04fb29de80f275a16ba (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 'cui/source')
-rw-r--r--cui/source/customize/macropg.cxx6
-rw-r--r--cui/source/inc/cfg.hxx12
2 files changed, 9 insertions, 9 deletions
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index b6e4694dddac..c6bfd2966b6f 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -35,7 +35,7 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-const char aVndSunStarUNO[] = "vnd.sun.star.UNO:";
+constexpr OUStringLiteral aVndSunStarUNO = u"vnd.sun.star.UNO:";
SvxMacroTabPage_Impl::SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet )
: bReadOnly(false)
@@ -277,7 +277,7 @@ namespace
OUString aPureMethod;
if (bUNO)
{
- aPureMethod = rURL.copy(strlen(aVndSunStarUNO));
+ aPureMethod = rURL.copy(aVndSunStarUNO.getLength());
}
else
{
@@ -630,7 +630,7 @@ AssignComponentDialog::AssignComponentDialog(weld::Window* pParent, const OUStri
OUString aMethodName;
if( maURL.startsWith( aVndSunStarUNO ) )
{
- aMethodName = maURL.copy( strlen(aVndSunStarUNO) );
+ aMethodName = maURL.copy( aVndSunStarUNO.getLength() );
}
mxMethodEdit->set_text(aMethodName);
mxMethodEdit->select_region(0, -1);
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index ecefed6578d6..c5b7c4848933 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -42,17 +42,17 @@
#define notebookbarTabScope "notebookbarTabScope"
-const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
+inline constexpr OUStringLiteral ITEM_DESCRIPTOR_COMMANDURL = u"CommandURL";
inline constexpr OUStringLiteral ITEM_DESCRIPTOR_CONTAINER = u"ItemDescriptorContainer";
-const char ITEM_DESCRIPTOR_LABEL[] = "Label";
-const char ITEM_DESCRIPTOR_TYPE[] = "Type";
-const char ITEM_DESCRIPTOR_STYLE[] = "Style";
-const char ITEM_DESCRIPTOR_ISVISIBLE[] = "IsVisible";
+inline constexpr OUStringLiteral ITEM_DESCRIPTOR_LABEL = u"Label";
+inline constexpr OUStringLiteral ITEM_DESCRIPTOR_TYPE = u"Type";
+inline constexpr OUStringLiteral ITEM_DESCRIPTOR_STYLE = u"Style";
+inline constexpr OUStringLiteral ITEM_DESCRIPTOR_ISVISIBLE = u"IsVisible";
const char ITEM_DESCRIPTOR_RESOURCEURL[] = "ResourceURL";
inline constexpr OUStringLiteral ITEM_DESCRIPTOR_UINAME = u"UIName";
inline constexpr OUStringLiteral ITEM_MENUBAR_URL = u"private:resource/menubar/menubar";
-constexpr char16_t ITEM_TOOLBAR_URL[] = u"private:resource/toolbar/";
+inline constexpr OUStringLiteral ITEM_TOOLBAR_URL = u"private:resource/toolbar/";
inline constexpr OUStringLiteral CUSTOM_TOOLBAR_STR = u"custom_toolbar_";