From 44e7f5bb0dfeaa305210def8ac431b699c9c7c50 Mon Sep 17 00:00:00 2001 From: Jochen Nitschke Date: Mon, 10 Jul 2017 12:28:46 +0200 Subject: simplify strip types from Sequence, related tdf#108782 Change-Id: I504d7d118d30a310bbb0199de8b9fd58f2bcaaa6 Reviewed-on: https://gerrit.libreoffice.org/39751 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/core/dataaccess/databasedocument.cxx | 30 ++++------------------ 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index c49ea30d9d54..958e6b7498fc 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -82,7 +82,6 @@ #include #include -#include #include #include @@ -238,30 +237,11 @@ Sequence< Type > SAL_CALL ODatabaseDocument::getTypes( ) // allowed to contain macros, too. if ( !m_bAllowDocumentScripting ) { - Sequence< Type > aStrippedTypes( aTypes.getLength() ); - Type* pStripTo( aStrippedTypes.getArray() ); - - // strip XEmbeddedScripts, and immediately re-assign to aTypes - aTypes = Sequence< Type >( - pStripTo, - std::remove_copy_if( - aTypes.begin(), - aTypes.end(), - pStripTo, - std::bind2nd( std::equal_to< Type >(), cppu::UnoType::get() ) - ) - pStripTo - ); - - // strip XScriptInvocationContext, and immediately re-assign to aTypes - aTypes = Sequence< Type >( - pStripTo, - std::remove_copy_if( - aTypes.begin(), - aTypes.end(), - pStripTo, - std::bind2nd( std::equal_to< Type >(), cppu::UnoType::get() ) - ) - pStripTo - ); + auto newEnd = std::remove_if( aTypes.begin(), aTypes.end(), + [](const Type& t) + { return t == cppu::UnoType::get() || + t == cppu::UnoType::get();} ); + aTypes.realloc( std::distance(aTypes.begin(), newEnd) ); } return aTypes; -- cgit v1.2.3