summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-07-10 12:28:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-10 13:59:50 +0200
commit44e7f5bb0dfeaa305210def8ac431b699c9c7c50 (patch)
tree9284d58a5d77c4014e8495c4f99e903ec9bfe7a5 /dbaccess
parent51de3f584661380ce2aa843009ea0854476a6021 (diff)
simplify strip types from Sequence, related tdf#108782
Change-Id: I504d7d118d30a310bbb0199de8b9fd58f2bcaaa6 Reviewed-on: https://gerrit.libreoffice.org/39751 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx30
1 files 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 <osl/diagnose.h>
#include <vcl/errcode.hxx>
-#include <functional>
#include <list>
#include <svtools/grfmgr.hxx>
@@ -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<XEmbeddedScripts>::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<XScriptInvocationContext>::get() )
- ) - pStripTo
- );
+ auto newEnd = std::remove_if( aTypes.begin(), aTypes.end(),
+ [](const Type& t)
+ { return t == cppu::UnoType<XEmbeddedScripts>::get() ||
+ t == cppu::UnoType<XScriptInvocationContext>::get();} );
+ aTypes.realloc( std::distance(aTypes.begin(), newEnd) );
}
return aTypes;