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

Stephan Bergmann sbergman at redhat.com
Thu Jan 26 18:05:28 UTC 2017


 fpicker/source/win32/misc/resourceprovider.cxx |   24 +++++++++---------------
 fpicker/source/win32/misc/resourceprovider.hxx |    6 +++++-
 2 files changed, 14 insertions(+), 16 deletions(-)

New commits:
commit 1041bc88ec7fb83aaa228c97dafd6c0ac75dd1e0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jan 26 19:04:40 2017 +0100

    loplugin:useuniqueptr
    
    Change-Id: I66e3e1b3c92304643a783203e4f245e93701ba9a

diff --git a/fpicker/source/win32/misc/resourceprovider.cxx b/fpicker/source/win32/misc/resourceprovider.cxx
index 9360089..35ec2a2 100644
--- a/fpicker/source/win32/misc/resourceprovider.cxx
+++ b/fpicker/source/win32/misc/resourceprovider.cxx
@@ -17,6 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <memory>
+
+#include <o3tl/make_unique.hxx>
 #include <osl/diagnose.h>
 #include <rtl/ustrbuf.hxx>
 #include "resourceprovider.hxx"
@@ -85,25 +90,16 @@ public:
     CResourceProvider_Impl( )
     {
         const SolarMutexGuard aGuard;
-        m_ResMgr = new SimpleResMgr(
+        m_ResMgr = o3tl::make_unique<SimpleResMgr>(
             "fps_office", Application::GetSettings().GetUILanguageTag());
     }
 
-
-    ~CResourceProvider_Impl( )
-    {
-        delete m_ResMgr;
-    }
-
-
     OUString getResString( sal_Int16 aId )
     {
         OUString aResOUString;
 
         try
         {
-            OSL_ASSERT( m_ResMgr );
-
             // translate the control id to a resource id
             sal_Int16 aResId = CtrlIdToResId( aId );
 
@@ -118,18 +114,16 @@ public:
     }
 
 public:
-    SimpleResMgr* m_ResMgr;
+    std::unique_ptr<SimpleResMgr> m_ResMgr;
 };
 
 CResourceProvider::CResourceProvider( ) :
-    m_pImpl( new CResourceProvider_Impl() )
+    m_pImpl( o3tl::make_unique<CResourceProvider_Impl>() )
 {
 }
 
 CResourceProvider::~CResourceProvider( )
-{
-    delete m_pImpl;
-}
+{}
 
 OUString CResourceProvider::getResString( sal_Int16 aId )
 {
diff --git a/fpicker/source/win32/misc/resourceprovider.hxx b/fpicker/source/win32/misc/resourceprovider.hxx
index 32f3b11..8d515cb 100644
--- a/fpicker/source/win32/misc/resourceprovider.hxx
+++ b/fpicker/source/win32/misc/resourceprovider.hxx
@@ -21,6 +21,10 @@
 #ifndef INCLUDED_FPICKER_SOURCE_WIN32_MISC_RESOURCEPROVIDER_HXX
 #define INCLUDED_FPICKER_SOURCE_WIN32_MISC_RESOURCEPROVIDER_HXX
 
+#include <sal/config.h>
+
+#include <memory>
+
 #include <sal/types.h>
 
 #include <rtl/ustring.hxx>
@@ -36,7 +40,7 @@ public:
     OUString getResString( sal_Int16 aId );
 
 private:
-    CResourceProvider_Impl* m_pImpl;
+    std::unique_ptr<CResourceProvider_Impl> m_pImpl;
 };
 
 #endif


More information about the Libreoffice-commits mailing list