From f13c6ad5f020a196a0e3aa6f28bda3dc185d465b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 14 Oct 2019 14:27:57 +0200 Subject: new loplugin:bufferadd look for OUStringBuffer append sequences that can be turned into creating an OUString with + operations Change-Id: Ica840dc096000307b4a105fb4d9ec7588a15ade6 Reviewed-on: https://gerrit.libreoffice.org/80809 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/filter/html/swhtml.cxx | 5 ++--- sw/source/filter/ww8/docxattributeoutput.cxx | 9 ++++----- sw/source/filter/ww8/docxexport.cxx | 13 ++++++------- sw/source/filter/ww8/wrtw8esh.cxx | 5 ++--- 4 files changed, 14 insertions(+), 18 deletions(-) (limited to 'sw/source/filter') diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index c2dbad75a1d9..d638abac1052 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -2013,9 +2013,8 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken ) } else { - OUStringBuffer aComment; - aComment.append('<').append(aToken).append('>'); - InsertComment( aComment.makeStringAndClear() ); + OUString aComment = "<" + aToken + ">"; + InsertComment( aComment ); } } break; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 196970c2b4da..e7468c1c8d6d 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5422,11 +5422,10 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S m_pSerializer->startElementNS(XML_w, XML_object); } - OStringBuffer sShapeStyle, sShapeId; - sShapeStyle.append( "width:" ).append( double( rSize.Width() ) / 20 ) - .append( "pt;height:" ).append( double( rSize.Height() ) / 20 ) - .append( "pt" ); //from VMLExport::AddRectangleDimensions(), it does: value/20 - sShapeId.append( "ole_" ).append( sId ); + OString sShapeStyle = "width:" + OString::number( double( rSize.Width() ) / 20 ) + + "pt;height:" + OString::number( double( rSize.Height() ) / 20 ) + + "pt"; //from VMLExport::AddRectangleDimensions(), it does: value/20 + OString sShapeId = "ole_" + sId; // shape definition m_pSerializer->startElementNS( XML_v, XML_shape, diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 6651124711dc..1ff5f4bb25e6 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -992,13 +992,12 @@ void DocxExport::WriteSettings() SwDBData aData = m_pDoc->GetDBData(); if ( !aData.sDataSource.isEmpty() && aData.nCommandType == css::sdb::CommandType::TABLE && !aData.sCommand.isEmpty() ) { - OUStringBuffer aDataSource; - aDataSource.append("SELECT * FROM "); - aDataSource.append(aData.sDataSource); // current database - aDataSource.append(".dbo."); // default database owner - aDataSource.append(aData.sCommand); // sheet name - aDataSource.append("$"); // sheet identifier - const OUString sDataSource = aDataSource.makeStringAndClear(); + OUString sDataSource = + "SELECT * FROM " + + aData.sDataSource + // current database + ".dbo." + // default database owner + aData.sCommand + // sheet name + "$"; // sheet identifier pFS->startElementNS( XML_w, XML_mailMerge ); pFS->singleElementNS(XML_w, XML_mainDocumentType, FSNS( XML_w, XML_val ), "formLetters" ); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 7932a848cc4a..f3d1fb00997e 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -3049,10 +3049,9 @@ void SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrUnoObj& rFo tools::SvRef xObjPool = rWW8Wrt.GetWriter().GetStorage().OpenSotStorage(SL::aObjectPool); //Create a destination storage for the microsoft control - OUStringBuffer sStorageName; sal_uInt32 nObjId = ++mnObjectId; - sStorageName.append('_').append( static_cast( nObjId )); - tools::SvRef xOleStg = xObjPool->OpenSotStorage(sStorageName.makeStringAndClear()); + OUString sStorageName = "_" + OUString::number( static_cast( nObjId )); + tools::SvRef xOleStg = xObjPool->OpenSotStorage(sStorageName); if (!xOleStg.is()) return; -- cgit