From a3d0091d185f39eddabf4d372ebe0ac3061dbb89 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 23 Dec 2020 13:16:31 +0100 Subject: New loplugin:stringliteralvar See the comment at the top of compilerplugins/clang/stringliteralvar.cxx for details. (Turned some affected variables in included files into inline variables, to avoid GCC warnings about unused variables.) Change-Id: Ie77219e6adfdaaceaa8b4e590b08971f2f04c83a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- toolkit/source/controls/stdtabcontroller.cxx | 2 +- toolkit/source/controls/tabpagemodel.cxx | 2 +- toolkit/source/helper/formpdfexport.cxx | 28 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'toolkit') diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx index c0173e822c75..32c2e6e63c82 100644 --- a/toolkit/source/controls/stdtabcontroller.cxx +++ b/toolkit/source/controls/stdtabcontroller.cxx @@ -111,7 +111,7 @@ bool StdTabController::ImplCreateComponentSequence( if ( pTabs ) { // opt: Constant String for TabStop name - static const char aTabStopName[] = "Tabstop"; + static const OUStringLiteral aTabStopName = u"Tabstop"; Reference< XPropertySet > xPSet( xCtrl->getModel(), UNO_QUERY ); Reference< XPropertySetInfo > xInfo = xPSet->getPropertySetInfo(); diff --git a/toolkit/source/controls/tabpagemodel.cxx b/toolkit/source/controls/tabpagemodel.cxx index 30f45d9258bd..498e8329ffdf 100644 --- a/toolkit/source/controls/tabpagemodel.cxx +++ b/toolkit/source/controls/tabpagemodel.cxx @@ -141,7 +141,7 @@ void SAL_CALL UnoControlTabPageModel::initialize (const Sequence& rArgument Reference xDialogProp(xDialogModel,UNO_QUERY); if ( xDialogProp.is() ) { - static const char s_sResourceResolver[] = "ResourceResolver"; + static const OUStringLiteral s_sResourceResolver = u"ResourceResolver"; Reference xThis(*this,UNO_QUERY); xThis->setPropertyValue(s_sResourceResolver,xDialogProp->getPropertyValue(s_sResourceResolver)); xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_TITLE),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_TITLE))); diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx index a265d18dfdf0..188410af86d4 100644 --- a/toolkit/source/helper/formpdfexport.cxx +++ b/toolkit/source/helper/formpdfexport.cxx @@ -58,7 +58,7 @@ namespace toolkitform using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; - const char FM_PROP_NAME[] = "Name"; + const OUStringLiteral FM_PROP_NAME = u"Name"; namespace { @@ -67,7 +67,7 @@ namespace toolkitform */ sal_Int16 classifyFormControl( const Reference< XPropertySet >& _rxModel ) { - static const char FM_PROP_CLASSID[] = "ClassId"; + static const OUStringLiteral FM_PROP_CLASSID = u"ClassId"; sal_Int16 nControlType = FormComponentType::CONTROL; Reference< XPropertySetInfo > xPSI; @@ -312,8 +312,8 @@ namespace toolkitform SAL_INFO("toolkit.helper", "describePDFControl: unable to get property HelpText"); } Any aText; - static const char FM_PROP_TEXT[] = "Text"; - static const char FM_PROP_LABEL[] = "Label"; + static const OUStringLiteral FM_PROP_TEXT = u"Text"; + static const OUStringLiteral FM_PROP_LABEL = u"Label"; if ( xPSI->hasPropertyByName( FM_PROP_TEXT ) ) aText = xModelProps->getPropertyValue( FM_PROP_TEXT ); else if ( xPSI->hasPropertyByName( FM_PROP_LABEL ) ) @@ -326,7 +326,7 @@ namespace toolkitform // readonly - static const char FM_PROP_READONLY[] = "ReadOnly"; + static const OUStringLiteral FM_PROP_READONLY = u"ReadOnly"; if ( xPSI->hasPropertyByName( FM_PROP_READONLY ) ) if( ! (xModelProps->getPropertyValue( FM_PROP_READONLY ) >>= Descriptor->ReadOnly) ) SAL_WARN("toolkit.helper", "describePDFControl: unable to get property " << FM_PROP_READONLY); @@ -334,7 +334,7 @@ namespace toolkitform // border { - static const char FM_PROP_BORDER[] = "Border"; + static const OUStringLiteral FM_PROP_BORDER = u"Border"; if ( xPSI->hasPropertyByName( FM_PROP_BORDER ) ) { sal_Int16 nBorderType = 0; @@ -356,7 +356,7 @@ namespace toolkitform // background color - static const char FM_PROP_BACKGROUNDCOLOR[] = "BackgroundColor"; + static const OUStringLiteral FM_PROP_BACKGROUNDCOLOR = u"BackgroundColor"; if ( xPSI->hasPropertyByName( FM_PROP_BACKGROUNDCOLOR ) ) { Color nBackColor = COL_TRANSPARENT; @@ -367,7 +367,7 @@ namespace toolkitform // text color - static const char FM_PROP_TEXTCOLOR[] = "TextColor"; + static const OUStringLiteral FM_PROP_TEXTCOLOR = u"TextColor"; if ( xPSI->hasPropertyByName( FM_PROP_TEXTCOLOR ) ) { Color nTextColor = COL_TRANSPARENT; @@ -382,7 +382,7 @@ namespace toolkitform // multi line and word break // The MultiLine property of the control is mapped to both the "MULTILINE" and // "WORDBREAK" style flags - static const char FM_PROP_MULTILINE[] = "MultiLine"; + static const OUStringLiteral FM_PROP_MULTILINE = u"MultiLine"; if ( xPSI->hasPropertyByName( FM_PROP_MULTILINE ) ) { bool bMultiLine = false; @@ -393,7 +393,7 @@ namespace toolkitform } // horizontal alignment - static const char FM_PROP_ALIGN[] = "Align"; + static const OUStringLiteral FM_PROP_ALIGN = u"Align"; if ( xPSI->hasPropertyByName( FM_PROP_ALIGN ) ) { sal_Int16 nAlign = awt::TextAlign::LEFT; @@ -429,7 +429,7 @@ namespace toolkitform } // font - static const char FM_PROP_FONT[] = "FontDescriptor"; + static const OUStringLiteral FM_PROP_FONT = u"FontDescriptor"; if ( xPSI->hasPropertyByName( FM_PROP_FONT ) ) { FontDescriptor aUNOFont; @@ -473,7 +473,7 @@ namespace toolkitform pEditWidget->FileSelect = true; // maximum text length - static const char FM_PROP_MAXTEXTLEN[] = "MaxTextLen"; + static const OUStringLiteral FM_PROP_MAXTEXTLEN = u"MaxTextLen"; if ( xPSI->hasPropertyByName( FM_PROP_MAXTEXTLEN ) ) { sal_Int16 nMaxTextLength = 0; @@ -494,7 +494,7 @@ namespace toolkitform FormButtonType eButtonType = FormButtonType_PUSH; if( ! (xModelProps->getPropertyValue("ButtonType") >>= eButtonType) ) SAL_WARN("toolkit.helper", "describePDFControl: unable to get property ButtonType"); - static const char FM_PROP_TARGET_URL[] = "TargetURL"; + static const OUStringLiteral FM_PROP_TARGET_URL = u"TargetURL"; if ( eButtonType == FormButtonType_SUBMIT ) { // if a button is a submit button, then it uses the URL at its parent form @@ -556,7 +556,7 @@ namespace toolkitform // check boxes - static const char FM_PROP_STATE[] = "State"; + static const OUStringLiteral FM_PROP_STATE = u"State"; if ( Descriptor->getType() == vcl::PDFWriter::CheckBox ) { vcl::PDFWriter::CheckBoxWidget* pCheckBoxWidget = static_cast< vcl::PDFWriter::CheckBoxWidget* >( Descriptor.get() ); -- cgit