dbaccess/source/core/dataaccess/databasedocument.cxx |   30 +++----------------
 1 file changed, 5 insertions(+), 25 deletions(-)

New commits:
commit 44e7f5bb0dfeaa305210def8ac431b699c9c7c50
Author: Jochen Nitschke <j.nitschke+loger...@ok.de>
Date:   Mon Jul 10 12:28:46 2017 +0200

    simplify strip types from Sequence, related tdf#108782
    
    Change-Id: I504d7d118d30a310bbb0199de8b9fd58f2bcaaa6
    Reviewed-on: https://gerrit.libreoffice.org/39751
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to