diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-14 14:27:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-15 14:33:57 +0200 |
commit | f13c6ad5f020a196a0e3aa6f28bda3dc185d465b (patch) | |
tree | f9aaab122974d36c134fb1723ec3c1c8df51eeef /sdext | |
parent | 9270f74466d0eb841babaa24997f608631c70341 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/minimizer/pppoptimizerdialog.cxx | 11 | ||||
-rw-r--r-- | sdext/source/pdfimport/odf/odfemitter.cxx | 17 | ||||
-rw-r--r-- | sdext/source/pdfimport/test/pdfunzip.cxx | 20 |
3 files changed, 23 insertions, 25 deletions
diff --git a/sdext/source/minimizer/pppoptimizerdialog.cxx b/sdext/source/minimizer/pppoptimizerdialog.cxx index 66efb3e29824..1bd04455a258 100644 --- a/sdext/source/minimizer/pppoptimizerdialog.cxx +++ b/sdext/source/minimizer/pppoptimizerdialog.cxx @@ -112,12 +112,11 @@ void SAL_CALL PPPOptimizerDialog::dispatch( const URL& rURL, if ( nFileSizeSource && nFileSizeDest ) { - OUStringBuffer sBuf( "Your Presentation has been minimized from:" ); - sBuf.append( OUString::number( nFileSizeSource >> 10 ) ); - sBuf.append( "KB to " ); - sBuf.append( OUString::number( nFileSizeDest >> 10 ) ); - sBuf.append( "KB." ); - OUString sResult( sBuf.makeStringAndClear() ); + OUString sResult = "Your Presentation has been minimized from:" + + OUString::number( nFileSizeSource >> 10 ) + + "KB to " + + OUString::number( nFileSizeDest >> 10 ) + + "KB."; SAL_INFO("sdext.minimizer", sResult ); } } diff --git a/sdext/source/pdfimport/odf/odfemitter.cxx b/sdext/source/pdfimport/odf/odfemitter.cxx index 78a38e42502f..a46d73ac9346 100644 --- a/sdext/source/pdfimport/odf/odfemitter.cxx +++ b/sdext/source/pdfimport/odf/odfemitter.cxx @@ -56,9 +56,8 @@ OdfEmitter::OdfEmitter( const uno::Reference<io::XOutputStream>& xOutput ) : OSL_PRECOND(m_xOutput.is(), "OdfEmitter(): invalid output stream"); m_aLineFeed[0] = '\n'; - OUStringBuffer aElement; - aElement.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); - write(aElement.makeStringAndClear()); + OUString aElement = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; + write(aElement); } void OdfEmitter::beginTag( const char* pTag, const PropertyMap& rProperties ) @@ -73,12 +72,12 @@ void OdfEmitter::beginTag( const char* pTag, const PropertyMap& rProperties ) std::vector<OUString> aAttributes; for( const auto& rCurr : rProperties ) { - OUStringBuffer aAttribute; - aAttribute.append(rCurr.first); - aAttribute.append("=\""); - aAttribute.append(rCurr.second); - aAttribute.append("\" "); - aAttributes.push_back(aAttribute.makeStringAndClear()); + OUString aAttribute = + rCurr.first + + "=\"" + + rCurr.second + + "\" "; + aAttributes.push_back(aAttribute); } // since the hash map's sorting is undefined (and varies across diff --git a/sdext/source/pdfimport/test/pdfunzip.cxx b/sdext/source/pdfimport/test/pdfunzip.cxx index a014fa4ccae0..e2a6602ad74a 100644 --- a/sdext/source/pdfimport/test/pdfunzip.cxx +++ b/sdext/source/pdfimport/test/pdfunzip.cxx @@ -263,11 +263,11 @@ static int write_addStreamArray( const char* pOutFile, PDFArray* pStreams, PDFFi PDFObject* pObject = pPDFFile->findObject( pStreamRef->m_nNumber, pStreamRef->m_nGeneration ); if( pObject ) { - OStringBuffer aOutStream( pOutFile ); - aOutStream.append( "_stream_" ); - aOutStream.append( sal_Int32(pStreamRef->m_nNumber) ); - aOutStream.append( "_" ); - aOutStream.append( sal_Int32(pStreamRef->m_nGeneration) ); + OString aOutStream = pOutFile + + OStringLiteral("_stream_") + + OString::number( sal_Int32(pStreamRef->m_nNumber) ) + + "_" + + OString::number( sal_Int32(pStreamRef->m_nGeneration) ); FileEmitContext aContext( aOutStream.getStr(), pInFile, pPDFFile ); aContext.m_bDecrypt = pPDFFile->isEncrypted(); pObject->writeStream( aContext, pPDFFile ); @@ -406,11 +406,11 @@ static int write_objects( const char* i_pInFile, const char* i_pOutFile, PDFFile continue; } - OStringBuffer aOutStream( i_pOutFile ); - aOutStream.append( "_stream_" ); - aOutStream.append( nObject ); - aOutStream.append( "_" ); - aOutStream.append( nGeneration ); + OString aOutStream = i_pOutFile + + OStringLiteral("_stream_") + + OString::number( nObject ) + + "_" + + OString::number( nGeneration ); FileEmitContext aContext( aOutStream.getStr(), i_pInFile, i_pPDFFile ); aContext.m_bDecrypt = i_pPDFFile->isEncrypted(); pStream->writeStream( aContext, i_pPDFFile ); |