[Libreoffice-commits] core.git: bridges/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 3 08:27:57 UTC 2018


 bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx |    5 --
 bridges/source/cpp_uno/shared/guardedarray.hxx      |   46 --------------------
 bridges/source/cpp_uno/shared/vtablefactory.cxx     |    5 --
 3 files changed, 4 insertions(+), 52 deletions(-)

New commits:
commit 8d5b917d188a1f59d9c0df61424fbe960ddced90
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 2 12:44:39 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 3 10:27:32 2018 +0200

    loplugin:useuniqueptr in bridges
    
    Change-Id: I7248f8b5031e9659b2a58644952e59cc99d6a2d6
    Reviewed-on: https://gerrit.libreoffice.org/58483
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx
index f28148104a5f..39afb083b9bd 100644
--- a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx
+++ b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx
@@ -19,8 +19,6 @@
 
 #include <cppinterfaceproxy.hxx>
 
-#include "guardedarray.hxx"
-
 #include <bridge.hxx>
 #include <vtablefactory.hxx>
 
@@ -31,6 +29,7 @@
 #include <typelib/typedescription.h>
 
 #include <cstddef>
+#include <memory>
 #include <new>
 
 
@@ -103,7 +102,7 @@ com::sun::star::uno::XInterface * CppInterfaceProxy::create(
         reinterpret_cast< typelib_TypeDescription ** >(&pTypeDescr));
     bridges::cpp_uno::shared::VtableFactory::Vtables aVtables(
         getVtableFactory()->getVtables(pTypeDescr));
-    bridges::cpp_uno::shared::GuardedArray< char > pMemory(
+    std::unique_ptr< char[] > pMemory(
         new char[
             sizeof (CppInterfaceProxy)
             + (aVtables.count - 1) * sizeof (void **)]);
diff --git a/bridges/source/cpp_uno/shared/guardedarray.hxx b/bridges/source/cpp_uno/shared/guardedarray.hxx
deleted file mode 100644
index 13e6f162260e..000000000000
--- a/bridges/source/cpp_uno/shared/guardedarray.hxx
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_SHARED_GUARDEDARRAY_HXX
-#define INCLUDED_BRIDGES_SOURCE_CPP_UNO_SHARED_GUARDEDARRAY_HXX
-
-namespace bridges { namespace cpp_uno { namespace shared {
-
-template< typename T > class GuardedArray {
-public:
-    explicit GuardedArray(T * thePointer): pointer(thePointer) {}
-
-    ~GuardedArray() { delete[] pointer; }
-
-    T * get() const { return pointer; }
-
-    T * release() { T * p = pointer; pointer = nullptr; return p; }
-
-private:
-    GuardedArray(GuardedArray &) = delete;
-    void operator =(GuardedArray) = delete;
-
-    T * pointer;
-};
-
-} } }
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index 9e3a91fb0a93..bbeedcaad3c3 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -20,8 +20,6 @@
 
 #include <vtablefactory.hxx>
 
-#include "guardedarray.hxx"
-
 #include <vtables.hxx>
 
 #include <osl/thread.h>
@@ -34,6 +32,7 @@
 #include <sal/types.h>
 #include <typelib/typedescription.hxx>
 
+#include <memory>
 #include <new>
 #include <unordered_map>
 #include <vector>
@@ -204,7 +203,7 @@ VtableFactory::Vtables VtableFactory::getVtables(
         Vtables vtables;
         assert(blocks.size() <= SAL_MAX_INT32);
         vtables.count = static_cast< sal_Int32 >(blocks.size());
-        bridges::cpp_uno::shared::GuardedArray< Block > guardedBlocks(
+        std::unique_ptr< Block[] > guardedBlocks(
             new Block[vtables.count]);
         vtables.blocks = guardedBlocks.get();
         for (sal_Int32 j = 0; j < vtables.count; ++j) {


More information about the Libreoffice-commits mailing list