From cd66852f6dd08631a25d15a1527a647e69ab8ce3 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 7 Aug 2018 10:34:54 +0200 Subject: create appendCopy method in OUStringBuffer so we can avoid temporary copies when appending a substring of an OUString to the buffer. I would have preferred to call the method just "append" but that results in ambiguous method errors when the callsite is something like sal_Int32 n; OUStringBuffer s; s.append(n, 10); I'm not sure why Change-Id: I6b5b6641fcb5b26ce2269f89ef06e03c0b6aa76f Reviewed-on: https://gerrit.libreoffice.org/58666 Tested-by: Jenkins Reviewed-by: Noel Grandin --- framework/source/uielement/toolbarsmenucontroller.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'framework') diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 71b6e42b25d2..fc22ed4cc279 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -392,7 +392,7 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co sal_Int32 n = aSortedTbs[i].aCommand.lastIndexOf( '/' ); if (( n > 0 ) && (( n+1 ) < aSortedTbs[i].aCommand.getLength() )) - aStrBuf.append( aSortedTbs[i].aCommand.copy( n+1 )); + aStrBuf.appendCopy( aSortedTbs[i].aCommand, n+1 ); OUString aCmd( aStrBuf.makeStringAndClear() ); @@ -664,7 +664,7 @@ void SAL_CALL ToolbarsMenuController::itemSelected( const css::awt::MenuEvent& r if (( nIndex > 0 ) && (( nIndex+1 ) < aCmd.getLength() )) { OUStringBuffer aBuf( "private:resource/toolbar/" ); - aBuf.append( aCmd.copy( nIndex+1 )); + aBuf.appendCopy( aCmd, nIndex+1 ); bool bShow( !pVCLPopupMenu->IsItemChecked( rEvent.MenuId )); OUString aToolBarResName( aBuf.makeStringAndClear() ); -- cgit v1.2.3