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 /sd/source | |
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 'sd/source')
-rw-r--r-- | sd/source/core/sdpage2.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Communicator.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/ImagePreparer.cxx | 21 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Listener.cxx | 17 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unoobj.cxx | 15 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 11 |
6 files changed, 29 insertions, 44 deletions
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index 12691c5175a8..077023df9dc7 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -79,9 +79,7 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName, |* Name of the layout of the page \********************************************************************/ OUString aOldLayoutName(maLayoutName); // memorize - OUStringBuffer aBuf(rLayoutName); - aBuf.append(SD_LT_SEPARATOR).append(STR_LAYOUT_OUTLINE); - maLayoutName = aBuf.makeStringAndClear(); + maLayoutName = rLayoutName + SD_LT_SEPARATOR STR_LAYOUT_OUTLINE; /********************************************************************* |* search and replace master page if necessary diff --git a/sd/source/ui/remotecontrol/Communicator.cxx b/sd/source/ui/remotecontrol/Communicator.cxx index 81a5cf04c6ef..b93112d9542c 100644 --- a/sd/source/ui/remotecontrol/Communicator.cxx +++ b/sd/source/ui/remotecontrol/Communicator.cxx @@ -58,10 +58,9 @@ void Communicator::execute() pTransmitter->addMessage( "LO_SERVER_SERVER_PAIRED\n\n", Transmitter::PRIORITY_HIGH ); - OStringBuffer aServerInformationBuffer; - aServerInformationBuffer.append( "LO_SERVER_INFO\n" LIBO_VERSION_DOTTED "\n\n" ); + OString aServerInformation = "LO_SERVER_INFO\n" LIBO_VERSION_DOTTED "\n\n"; - pTransmitter->addMessage( aServerInformationBuffer.makeStringAndClear(), Transmitter::PRIORITY_HIGH ); + pTransmitter->addMessage( aServerInformation, Transmitter::PRIORITY_HIGH ); Receiver aReceiver( pTransmitter.get() ); try { diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx b/sd/source/ui/remotecontrol/ImagePreparer.cxx index a3cdc74d4ffa..786effb8b8eb 100644 --- a/sd/source/ui/remotecontrol/ImagePreparer.cxx +++ b/sd/source/ui/remotecontrol/ImagePreparer.cxx @@ -177,18 +177,15 @@ void ImagePreparer::sendNotes( sal_uInt32 aSlideNumber ) return; // Start the writing - OStringBuffer aBuffer; - - aBuffer.append( "slide_notes\n" ); - - aBuffer.append( static_cast<sal_Int32>(aSlideNumber) ); - aBuffer.append( "\n" ); - - aBuffer.append( "<html><body>" ); - aBuffer.append( aNotes ); - aBuffer.append( "</body></html>" ); - aBuffer.append( "\n\n" ); - pTransmitter->addMessage( aBuffer.makeStringAndClear(), + OString aBuffer = + "slide_notes\n" + + OString::number( static_cast<sal_Int32>(aSlideNumber) ) + + "\n" + "<html><body>" + + aNotes + + "</body></html>" + "\n\n"; + pTransmitter->addMessage( aBuffer, Transmitter::PRIORITY_LOW ); } diff --git a/sd/source/ui/remotecontrol/Listener.cxx b/sd/source/ui/remotecontrol/Listener.cxx index 290d35cb897f..3c9527b175f4 100644 --- a/sd/source/ui/remotecontrol/Listener.cxx +++ b/sd/source/ui/remotecontrol/Listener.cxx @@ -43,12 +43,11 @@ void Listener::init( const css::uno::Reference< css::presentation::XSlideShowCon sal_Int32 aSlides = aController->getSlideCount(); sal_Int32 aCurrentSlide = aController->getCurrentSlideIndex(); - OStringBuffer aBuffer; - aBuffer.append( "slideshow_started\n" ) - .append( OString::number( aSlides ) ).append("\n") - .append( OString::number( aCurrentSlide ) ).append( "\n\n" ); + OString aBuffer = "slideshow_started\n" + + OString::number( aSlides ) + "\n" + + OString::number( aCurrentSlide ) + "\n\n"; - pTransmitter->addMessage( aBuffer.makeStringAndClear(), + pTransmitter->addMessage( aBuffer, Transmitter::PRIORITY_HIGH ); { @@ -98,13 +97,13 @@ void SAL_CALL Listener::slideTransitionStarted() { sal_Int32 aSlide = mController->getCurrentSlideIndex(); - OStringBuffer aBuilder( "slide_updated\n" ); - aBuilder.append( OString::number( aSlide ) ); - aBuilder.append( "\n\n" ); + OString aBuilder = "slide_updated\n" + + OString::number( aSlide ) + + "\n\n"; if ( pTransmitter ) { - pTransmitter->addMessage( aBuilder.makeStringAndClear(), + pTransmitter->addMessage( aBuilder, Transmitter::PRIORITY_HIGH ); } } 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; } } |