prefer OUStringBuffer to concatenating OUString in a loop

Change-Id: Ia617e6e3524264ecc62d50bb8b58d1458b8e3303
Reviewed-on: https://gerrit.libreoffice.org/15582
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
This commit is contained in:
Takeshi Abe
2015-05-01 14:15:42 +09:00
committed by Norbert Thiebaud
parent bcbf45d9f9
commit be88df0e6c

View File

@@ -24,6 +24,7 @@
#include <comphelper/accessibletexthelper.hxx> #include <comphelper/accessibletexthelper.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx> #include <comphelper/storagehelper.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <unotools/eventcfg.hxx> #include <unotools/eventcfg.hxx>
#include <sfx2/event.hxx> #include <sfx2/event.hxx>
@@ -1226,12 +1227,15 @@ void SmDocShell::GetState(SfxItemSet &rSet)
} }
if( nCount ) if( nCount )
{ {
OUString sList; OUStringBuffer aBuf;
for( sal_uInt16 n = 0; n < nCount; ++n ) for( sal_uInt16 n = 0; n < nCount; ++n )
sList += (pTmpUndoMgr->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) + "\n"; {
aBuf.append((pTmpUndoMgr->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ));
aBuf.append('\n');
}
SfxStringListItem aItem( nWh ); SfxStringListItem aItem( nWh );
aItem.SetString( sList ); aItem.SetString( aBuf.makeStringAndClear() );
rSet.Put( aItem ); rSet.Put( aItem );
} }
} }