summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-09-03 09:33:39 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-09-03 09:34:00 +0200
commit37a6fdf890d49a20a57aeb41021dc0ff663cc628 (patch)
treeddc85350aacd58ced61263b4e34ed585e63c2933
parent411e32244c7bff5fb64a049b1c63cf15ac166cd3 (diff)
loplugin:stringconstant also for cases using char const v[] = "..."
Change-Id: Iba38686620624178a7be39d703389402bbcea4cb
-rw-r--r--basic/source/classes/sbunoobj.cxx8
-rw-r--r--compilerplugins/clang/stringconstant.cxx10
-rw-r--r--cui/source/customize/cfg.cxx6
-rw-r--r--cui/source/dialogs/hldocntp.cxx2
-rw-r--r--cui/source/dialogs/hldoctp.cxx2
-rw-r--r--filter/source/svg/svgexport.cxx2
-rw-r--r--framework/source/fwe/helper/configimporter.cxx2
-rw-r--r--framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx2
-rw-r--r--framework/source/uiconfiguration/uiconfigurationmanager.cxx2
-rw-r--r--sc/source/ui/docshell/impex.cxx8
-rw-r--r--sd/source/ui/unoidl/unopage.cxx2
-rw-r--r--sfx2/source/sidebar/Tools.cxx2
-rw-r--r--sw/source/uibase/utlui/attrdesc.cxx2
-rw-r--r--sw/source/uibase/utlui/unotools.cxx2
-rw-r--r--unotools/source/config/bootstrap.cxx6
-rw-r--r--xmloff/source/text/XMLIndexMarkExport.cxx2
-rw-r--r--xmloff/source/text/txtfldi.cxx12
-rw-r--r--xmloff/source/text/txtvfldi.cxx10
18 files changed, 46 insertions, 36 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index e5b05fc7ae2d..da07e3bdc47a 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -966,7 +966,7 @@ Type getUnoTypeForSbxValue( const SbxValue* pVal )
OUStringBuffer aSeqTypeName;
for( short iDim = 0 ; iDim < nDims ; iDim++ )
{
- aSeqTypeName.appendAscii(aSeqLevelStr);
+ aSeqTypeName.append(aSeqLevelStr);
}
aSeqTypeName.append(aElementType.getTypeName());
aRetType = Type( TypeClass_SEQUENCE, aSeqTypeName.makeStringAndClear() );
@@ -1104,7 +1104,7 @@ static Any implRekMultiDimArrayToSequence( SbxDimArray* pArray,
sal_Int32 i;
for( i = 0 ; i < nSeqLevel ; i++ )
{
- aSeqTypeName.appendAscii(aSeqLevelStr);
+ aSeqTypeName.append(aSeqLevelStr);
}
aSeqTypeName.append(aElemType.getTypeName());
Type aSeqType( TypeClass_SEQUENCE, aSeqTypeName.makeStringAndClear() );
@@ -1769,7 +1769,7 @@ OUString Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj )
OUStringBuffer aRet;
if( eType != TypeClass_INTERFACE )
{
- aRet.appendAscii( ID_DBG_SUPPORTEDINTERFACES );
+ aRet.append( ID_DBG_SUPPORTEDINTERFACES );
aRet.append( " not available.\n(TypeClass is not TypeClass_INTERFACE)\n" );
}
else
@@ -5018,7 +5018,7 @@ void SbUnoStructRefObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
if( nId == -1 ) // Property ID_DBG_SUPPORTEDINTERFACES"
{
OUStringBuffer aRet;
- aRet.appendAscii( ID_DBG_SUPPORTEDINTERFACES );
+ aRet.append( ID_DBG_SUPPORTEDINTERFACES );
aRet.append( " not available.\n(TypeClass is not TypeClass_INTERFACE)\n" );
pVar->PutString( aRet.makeStringAndClear() );
diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx
index 5c675a8ae022..2688542fcda5 100644
--- a/compilerplugins/clang/stringconstant.cxx
+++ b/compilerplugins/clang/stringconstant.cxx
@@ -781,6 +781,16 @@ bool StringConstant::isStringConstant(
{
return false;
}
+ DeclRefExpr const * dre = dyn_cast<DeclRefExpr>(expr);
+ if (dre != nullptr) {
+ VarDecl const * var = dyn_cast<VarDecl>(dre->getDecl());
+ if (var != nullptr) {
+ Expr const * init = var->getAnyInitializer();
+ if (init != nullptr) {
+ expr = init->IgnoreParenImpCasts();
+ }
+ }
+ }
StringLiteral const * lit = dyn_cast<StringLiteral>(expr);
if (lit != nullptr) {
if (!lit->isAscii()) {
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 2664fcc0e604..a0924cecdb2f 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -305,7 +305,7 @@ generateCustomURL(
SvxEntries* entries )
{
OUString url = OUString(ITEM_TOOLBAR_URL );
- url += OUString(CUSTOM_TOOLBAR_STR );
+ url += CUSTOM_TOOLBAR_STR;
// use a random number to minimize possible clash with existing custom toolbars
url += OUString::number( generateRandomValue(), 16 );
@@ -1134,7 +1134,7 @@ bool MenuSaveInData::LoadSubMenus(
if ( !subMenuTitle.isEmpty() )
{
- subMenuTitle += OUString( aMenuSeparatorStr);
+ subMenuTitle += aMenuSeparatorStr;
}
else
{
@@ -1933,7 +1933,7 @@ void SvxConfigPage::AddSubMenusToUI(
if ( pEntryData->IsPopup() )
{
OUString subMenuTitle( rBaseTitle );
- subMenuTitle += OUString(aMenuSeparatorStr);
+ subMenuTitle += aMenuSeparatorStr;
subMenuTitle += stripHotKey( pEntryData->GetName() );
sal_uInt16 nPos = m_pTopLevelListBox->InsertEntry( subMenuTitle );
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 3acb9fec7922..12d98d121290 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -436,7 +436,7 @@ IMPL_LINK_NOARG_TYPED(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, Button*, void)
OUString aStrTmp( xFolderPicker->getDirectory() );
if( aStrTmp[ aStrTmp.getLength() - 1 ] != sSlash[0] )
- aStrTmp += OUString( sSlash );
+ aStrTmp += sSlash;
// append old file name
if( bHandleFileName )
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index 92c15d7e213a..764d5f382602 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -135,7 +135,7 @@ OUString SvxHyperlinkDocTp::GetCurrentURL ()
if( !aStrMark.isEmpty() )
{
- aStrURL += OUString( sHash );
+ aStrURL += sHash;
aStrURL += aStrMark;
}
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 1773740f5754..e39627bb2cdd 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -1352,7 +1352,7 @@ bool SVGFilter::implExportTextEmbeddedBitmaps()
#define SVGFILTER_EXPORT_SVGSCRIPT( z, n, aFragment ) \
- xExtDocHandler->unknown( OUString::createFromAscii( aFragment ## n ) );
+ xExtDocHandler->unknown( aFragment ## n );
bool SVGFilter::implGenerateScript()
{
diff --git a/framework/source/fwe/helper/configimporter.cxx b/framework/source/fwe/helper/configimporter.cxx
index a51b485cad11..e1306991259d 100644
--- a/framework/source/fwe/helper/configimporter.cxx
+++ b/framework/source/fwe/helper/configimporter.cxx
@@ -44,7 +44,7 @@ bool UIConfigurationImporterOOo1x::ImportCustomToolbars(
for ( sal_uInt16 i = 1; i <= 4; i++ )
{
OUStringBuffer aCustomTbxName( 20 );
- aCustomTbxName.appendAscii( USERDEFTOOLBOX );
+ aCustomTbxName.append( USERDEFTOOLBOX );
aCustomTbxName[14] = aCustomTbxName[14] + i;
OUString aTbxStreamName( aCustomTbxName.makeStringAndClear() );
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 844b55726934..1b3ab4ab6f05 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -366,7 +366,7 @@ void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer,
if ( xElementTypeStorage.is() )
{
OUStringBuffer aBuf( RESOURCEURL_PREFIX_SIZE );
- aBuf.appendAscii( RESOURCEURL_PREFIX );
+ aBuf.append( RESOURCEURL_PREFIX );
aBuf.appendAscii( UIELEMENTTYPENAMES[ nElementType ] );
aBuf.append( "/" );
OUString aResURLPrefix( aBuf.makeStringAndClear() );
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index 6f68a3100a73..a4a9675acf64 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -289,7 +289,7 @@ void UIConfigurationManager::impl_preloadUIElementTypeList( sal_Int16 nElementTy
if ( xElementTypeStorage.is() )
{
OUStringBuffer aBuf( RESOURCEURL_PREFIX_SIZE );
- aBuf.appendAscii( RESOURCEURL_PREFIX );
+ aBuf.append( RESOURCEURL_PREFIX );
aBuf.appendAscii( UIELEMENTTYPENAMES[ nElementType ] );
aBuf.append( "/" );
OUString aResURLPrefix( aBuf.makeStringAndClear() );
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index c9f2c706202a..da82e0b5df16 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -695,11 +695,11 @@ static void lcl_UnescapeSylk( OUString & rString, SylkVersion eVersion )
// Older versions quoted the string and doubled embedded quotes, but not
// the semicolons, which was plain wrong.
if (eVersion >= SYLK_OOO32)
- rString = rString.replaceAll(OUString(DOUBLE_SEMICOLON), ";");
+ rString = rString.replaceAll(DOUBLE_SEMICOLON, ";");
else
- rString = rString.replaceAll(OUString(DOUBLE_DOUBLEQUOTE), "\"");
+ rString = rString.replaceAll(DOUBLE_DOUBLEQUOTE, "\"");
- rString = rString.replaceAll(OUString(SYLK_LF), "\n");
+ rString = rString.replaceAll(SYLK_LF, "\n");
}
static const sal_Unicode* lcl_ScanSylkString( const sal_Unicode* p,
@@ -2002,7 +2002,7 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
case CELLTYPE_EDIT:
hasstring:
aCellStr = pDoc->GetString(nCol, nRow, aRange.aStart.Tab());
- aCellStr = aCellStr.replaceAll("\n", OUString(SYLK_LF));
+ aCellStr = aCellStr.replaceAll("\n", SYLK_LF);
aBufStr = "C;X";
aBufStr += OUString::number( c );
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 98e6c33f8b08..6d22bec8281c 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -2154,7 +2154,7 @@ OUString getPageApiName( SdPage* pPage )
if( aPageName.isEmpty() )
{
OUStringBuffer sBuffer;
- sBuffer.appendAscii( sEmptyPageName );
+ sBuffer.append( sEmptyPageName );
const sal_Int32 nPageNum = ( ( pPage->GetPageNum() - 1 ) >> 1 ) + 1;
sBuffer.append( nPageNum );
aPageName = sBuffer.makeStringAndClear();
diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx
index 0e62e6d309f9..901449d4a022 100644
--- a/sfx2/source/sidebar/Tools.cxx
+++ b/sfx2/source/sidebar/Tools.cxx
@@ -67,7 +67,7 @@ Image Tools::GetImage (
else if (rsURL.startsWith(sCommandImagePrefix))
{
::rtl::OUStringBuffer aCommandName;
- aCommandName.appendAscii(sUnoCommandPrefix);
+ aCommandName.append(sUnoCommandPrefix);
aCommandName.append(rsURL.copy(nCommandImagePrefixLength));
const ::rtl::OUString sCommandName (aCommandName.makeStringAndClear());
diff --git a/sw/source/uibase/utlui/attrdesc.cxx b/sw/source/uibase/utlui/attrdesc.cxx
index 513a98a8b8db..7b2db477f0cb 100644
--- a/sw/source/uibase/utlui/attrdesc.cxx
+++ b/sw/source/uibase/utlui/attrdesc.cxx
@@ -83,7 +83,7 @@ void SwAttrSet::GetPresentation(
ePresMetric, aStr,
&rInt );
if( rText.getLength() && aStr.getLength() )
- rText += OUString(sComma);
+ rText += sComma;
rText += aStr;
if( aIter.IsAtEnd() )
break;
diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx
index ffec1024dbf4..d3479b089e6c 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -95,7 +95,7 @@ void SwOneExampleFrame::CreateErrorMessage(vcl::Window* pParent)
if(SwOneExampleFrame::bShowServiceNotAvailableMessage)
{
OUString sInfo(SW_RES(STR_SERVICE_UNAVAILABLE));
- sInfo += OUString(cFrameControl);
+ sInfo += cFrameControl;
ScopedVclPtr<InfoBox>::Create(pParent, sInfo)->Execute();
SwOneExampleFrame::bShowServiceNotAvailableMessage = false;
}
diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index 47bf2610a0c6..0d8f516046eb 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -414,14 +414,14 @@ static void addFileError(OUStringBuffer& _rBuf, OUString const& _aPath, AsciiStr
_rBuf.append("The configuration file");
_rBuf.append(" '").append(sSimpleFileName).append("' ");
- _rBuf.appendAscii(_sWhat).appendAscii(PERIOD);
+ _rBuf.appendAscii(_sWhat).append(PERIOD);
}
static void addMissingDirectoryError(OUStringBuffer& _rBuf, OUString const& _aPath)
{
_rBuf.append("The configuration directory");
_rBuf.append(" '").append(_aPath).append("' ");
- _rBuf.appendAscii(IS_MISSING).appendAscii(PERIOD);
+ _rBuf.append(IS_MISSING).append(PERIOD);
}
static void addUnexpectedError(OUStringBuffer& _rBuf, AsciiString _sExtraInfo = NULL)
@@ -429,7 +429,7 @@ static void addUnexpectedError(OUStringBuffer& _rBuf, AsciiString _sExtraInfo =
if (NULL == _sExtraInfo)
_sExtraInfo = "An internal failure occurred";
- _rBuf.appendAscii(_sExtraInfo).appendAscii(PERIOD);
+ _rBuf.appendAscii(_sExtraInfo).append(PERIOD);
}
static Bootstrap::FailureCode describeError(OUStringBuffer& _rBuf, Bootstrap::Impl const& _rData)
diff --git a/xmloff/source/text/XMLIndexMarkExport.cxx b/xmloff/source/text/XMLIndexMarkExport.cxx
index 9004c7423fb6..d7f2a2d5dd01 100644
--- a/xmloff/source/text/XMLIndexMarkExport.cxx
+++ b/xmloff/source/text/XMLIndexMarkExport.cxx
@@ -248,7 +248,7 @@ void XMLIndexMarkExport::GetID(
// HACK: use address of object to form identifier
sal_Int64 nId = sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(rPropSet.get()));
- sBuf.appendAscii(sPrefix, sizeof(sPrefix)-1);
+ sBuf.append(sPrefix);
sBuf.append(nId);
}
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index d64e177f0b22..98a086c87db3 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -3098,8 +3098,8 @@ void XMLDdeFieldDeclImportContext::StartElement(
{
// make service name
OUStringBuffer sBuf;
- sBuf.appendAscii(sAPI_fieldmaster_prefix);
- sBuf.appendAscii(sAPI_dde);
+ sBuf.append(sAPI_fieldmaster_prefix);
+ sBuf.append(sAPI_dde);
// create DDE TextFieldMaster
Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),
@@ -3192,8 +3192,8 @@ void XMLDdeFieldImportContext::EndElement()
{
// find master
OUStringBuffer sBuf;
- sBuf.appendAscii(sAPI_fieldmaster_prefix);
- sBuf.appendAscii(sAPI_dde);
+ sBuf.append(sAPI_fieldmaster_prefix);
+ sBuf.append(sAPI_dde);
sBuf.append('.');
sBuf.append(sName);
OUString sMasterName = sBuf.makeStringAndClear();
@@ -3212,8 +3212,8 @@ void XMLDdeFieldImportContext::EndElement()
xMaster->setPropertyValue( sPropertyContent, uno::makeAny( GetContent()));
// master exists: create text field and attach
Reference<XPropertySet> xField;
- sBuf.appendAscii(sAPI_textfield_prefix);
- sBuf.appendAscii(sAPI_dde);
+ sBuf.append(sAPI_textfield_prefix);
+ sBuf.append(sAPI_dde);
if (CreateField(xField, sBuf.makeStringAndClear()))
{
Reference<XDependentTextField> xDepTextField(xField,UNO_QUERY);
diff --git a/xmloff/source/text/txtvfldi.cxx b/xmloff/source/text/txtvfldi.cxx
index a9410639f314..691712635c87 100644
--- a/xmloff/source/text/txtvfldi.cxx
+++ b/xmloff/source/text/txtvfldi.cxx
@@ -957,14 +957,14 @@ bool XMLVariableDeclImportContext::FindFieldMaster(
xTextFieldsSupp->getTextFieldMasters(), UNO_QUERY);
OUStringBuffer sBuffer;
- sBuffer.appendAscii(sAPI_fieldmaster_prefix);
- sBuffer.appendAscii(sAPI_set_expression);
+ sBuffer.append(sAPI_fieldmaster_prefix);
+ sBuffer.append(sAPI_set_expression);
sBuffer.append(".");
sBuffer.append(sName);
OUString sVarServiceName = sBuffer.makeStringAndClear();
- sBuffer.appendAscii(sAPI_fieldmaster_prefix);
- sBuffer.appendAscii(sAPI_user);
+ sBuffer.append(sAPI_fieldmaster_prefix);
+ sBuffer.append(sAPI_user);
sBuffer.append(".");
sBuffer.append(sName);
OUString sUserServiceName = sBuffer.makeStringAndClear();
@@ -1040,7 +1040,7 @@ bool XMLVariableDeclImportContext::FindFieldMaster(
if( xFactory.is() ) {
OUStringBuffer sService;
- sService.appendAscii(sAPI_fieldmaster_prefix);
+ sService.append(sAPI_fieldmaster_prefix);
sService.appendAscii((eVarType==VarTypeUserField) ?
sAPI_user : sAPI_set_expression);
Reference<XInterface> xIfc =