diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-23 15:02:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-24 08:43:55 +0200 |
commit | a2fc883173d7053cefe543620982051ae40c4b03 (patch) | |
tree | dac1b760925c8151dfd8a9cbe3a8735b68ab9f79 /sw | |
parent | 010713e65ccade7b682c219707c8db3d864145c1 (diff) |
use more std::container::insert instead of std::copy
which is both more compact code, and more efficient, since the insert
method can do smarter resizing
Change-Id: I17f226660f87cdf002edccc29b4af8fd59a25f91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96948
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/access/textmarkuphelper.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/basflt/shellio.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 3 |
3 files changed, 5 insertions, 9 deletions
diff --git a/sw/source/core/access/textmarkuphelper.cxx b/sw/source/core/access/textmarkuphelper.cxx index 19bd4d576959..887633412248 100644 --- a/sw/source/core/access/textmarkuphelper.cxx +++ b/sw/source/core/access/textmarkuphelper.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <comphelper/sequence.hxx> #include <osl/diagnose.h> #include <ndtxt.hxx> #include <wrong.hxx> @@ -215,11 +216,7 @@ css::uno::Sequence< css::accessibility::TextSegment > } } - uno::Sequence< css::accessibility::TextSegment > aTextMarkups( - aTmpTextMarkups.size() ); - std::copy( aTmpTextMarkups.begin(), aTmpTextMarkups.end(), aTextMarkups.begin() ); - - return aTextMarkups; + return comphelper::containerToSequence(aTmpTextMarkups ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index d467a21d8a1c..5bc7b4db23b0 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -175,8 +175,8 @@ ErrCode SwReader::Read( const Reader& rOptions ) // store for now all Fly's if( mpCursor ) { - std::copy(mxDoc->GetSpzFrameFormats()->begin(), - mxDoc->GetSpzFrameFormats()->end(), std::back_inserter(aFlyFrameArr)); + aFlyFrameArr.insert( aFlyFrameArr.end(), mxDoc->GetSpzFrameFormats()->begin(), + mxDoc->GetSpzFrameFormats()->end() ); } const sal_Int32 nSttContent = pPam->GetPoint()->nContent.GetIndex(); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index e5723fc0b1c4..0dcc81d6cf2e 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1756,9 +1756,8 @@ void SwWW8Writer::InsAsString8(ww::bytes &rO, const OUString& rStr, OString sTmp(OUStringToOString(rStr, eCodeSet)); const char *pStart = sTmp.getStr(); const char *pEnd = pStart + sTmp.getLength(); - rO.reserve(rO.size() + sTmp.getLength()); - std::copy(pStart, pEnd, std::inserter(rO, rO.end())); + rO.insert( rO.end(), pStart, pEnd ); } void SwWW8Writer::WriteString16(SvStream& rStrm, const OUString& rStr, |