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 --- sd/source/ui/unoidl/unoobj.cxx | 15 +++++++-------- sd/source/ui/unoidl/unopage.cxx | 11 ++--------- 2 files changed, 9 insertions(+), 17 deletions(-) (limited to 'sd/source/ui/unoidl') diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 872c3a71458e..6c728052b2cb 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -1465,14 +1465,13 @@ uno::Any SAL_CALL SdUnoEventsAccess::getByName( const OUString& aName ) const OUString aModulName = aMacro.getToken(0, '.', nIdx); const OUString aLibName = aMacro.getToken(0, '.', nIdx); - OUStringBuffer sBuffer; - sBuffer.append( aLibName ); - sBuffer.append( '.' ); - sBuffer.append( aModulName ); - sBuffer.append( '.' ); - sBuffer.append( aMacroName ); - - aAny <<= sBuffer.makeStringAndClear(); + OUString sBuffer = aLibName + + "." + + aModulName + + "." + + aMacroName; + + aAny <<= sBuffer; pProperties->Name = gaStrMacroName; pProperties->Handle = -1; pProperties->Value = aAny; diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 0d6bc61f2dab..ca082fe01c11 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -2103,11 +2103,8 @@ OUString getPageApiName( SdPage const * pPage ) if( aPageName.isEmpty() ) { - OUStringBuffer sBuffer; - sBuffer.append( sEmptyPageName ); const sal_Int32 nPageNum = ( ( pPage->GetPageNum() - 1 ) >> 1 ) + 1; - sBuffer.append( nPageNum ); - aPageName = sBuffer.makeStringAndClear(); + aPageName = sEmptyPageName + OUString::number( nPageNum ); } } @@ -2165,11 +2162,7 @@ OUString getUiNameFromPageApiNameImpl( const OUString& rApiName ) if( nPageNumber != -1) { - OUStringBuffer sBuffer; - sBuffer.append( SdResId(STR_PAGE) ); - sBuffer.append( ' ' ); - sBuffer.append( aNumber ); - return sBuffer.makeStringAndClear(); + return SdResId(STR_PAGE) + " " + aNumber; } } -- cgit