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

Noel Grandin noel.grandin at collabora.co.uk
Sun Apr 29 15:24:51 UTC 2018


 svtools/source/misc/templatefoldercache.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 605f6d485f15948da5c0443fea18c296da270e18
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Apr 24 15:10:14 2018 +0200

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

diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx
index 94762f656e3f..f27abc4e2071 100644
--- a/svtools/source/misc/templatefoldercache.cxx
+++ b/svtools/source/misc/templatefoldercache.cxx
@@ -379,7 +379,7 @@ namespace svt
         // will be lazy inited; never access directly; use getOfficeInstDirs().
         uno::Reference< util::XOfficeInstallationDirectories > m_xOfficeInstDirs;
 
-        SvStream*                       m_pCacheStream;
+        std::unique_ptr<SvStream>       m_pCacheStream;
         bool                            m_bNeedsUpdate : 1;
         bool                            m_bKnowState : 1;
         bool                            m_bValidCurrentState : 1;
@@ -518,7 +518,7 @@ namespace svt
 
     void TemplateFolderCacheImpl::closeCacheStream( )
     {
-        DELETEZ( m_pCacheStream );
+        m_pCacheStream.reset();
     }
 
 
@@ -704,12 +704,12 @@ namespace svt
         aStorageURL.Append( ".templdir.cache" );
 
         // open the stream
-        m_pCacheStream = UcbStreamHelper::CreateStream( aStorageURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ),
-            _bForRead ? StreamMode::READ | StreamMode::NOCREATE : StreamMode::WRITE | StreamMode::TRUNC );
+        m_pCacheStream.reset( UcbStreamHelper::CreateStream( aStorageURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ),
+            _bForRead ? StreamMode::READ | StreamMode::NOCREATE : StreamMode::WRITE | StreamMode::TRUNC ) );
         DBG_ASSERT( m_pCacheStream, "TemplateFolderCacheImpl::openCacheStream: could not open/create the cache stream!" );
         if ( m_pCacheStream && m_pCacheStream->GetErrorCode() )
         {
-            DELETEZ( m_pCacheStream );
+            m_pCacheStream.reset();
         }
 
         if ( m_pCacheStream )


More information about the Libreoffice-commits mailing list