[Libreoffice-commits] core.git: 2 commits - cui/source sd/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Jun 21 06:27:53 UTC 2018


 cui/source/inc/optlingu.hxx      |    2 +-
 cui/source/options/optlingu.cxx  |    9 ++++-----
 sd/source/filter/html/htmlex.cxx |   12 +++++-------
 3 files changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 9e005eb3096f01cda638e6817c9614e262afae6c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 20 16:36:42 2018 +0200

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

diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 53677a73c4be..b072437e5325 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -132,7 +132,7 @@ const char * const pButtonNames[] =
 class EasyFile
 {
 private:
-    SvStream*   pOStm;
+    std::unique_ptr<SvStream> pOStm;
     bool        bOpen;
 
 public:
@@ -3140,7 +3140,7 @@ ErrCode EasyFile::createStream(  const OUString& rUrl, SvStream* &rpStr )
     createFileName( rUrl, aFileName );
 
     ErrCode nErr = ERRCODE_NONE;
-    pOStm = ::utl::UcbStreamHelper::CreateStream( aFileName, StreamMode::WRITE | StreamMode::TRUNC );
+    pOStm.reset( ::utl::UcbStreamHelper::CreateStream( aFileName, StreamMode::WRITE | StreamMode::TRUNC ) );
     if( pOStm )
     {
         bOpen = true;
@@ -3154,11 +3154,10 @@ ErrCode EasyFile::createStream(  const OUString& rUrl, SvStream* &rpStr )
     if( nErr != ERRCODE_NONE )
     {
         bOpen = false;
-        delete pOStm;
-        pOStm = nullptr;
+        pOStm.reset();
     }
 
-    rpStr = pOStm;
+    rpStr = pOStm.get();
 
     return nErr;
 }
@@ -3182,8 +3181,7 @@ void EasyFile::createFileName(  const OUString& rURL, OUString& rFileName )
 
 void EasyFile::close()
 {
-    delete pOStm;
-    pOStm = nullptr;
+    pOStm.reset();
     bOpen = false;
 }
 
commit 7042d52b0789c8311f8f007862aa80dba54e72f1
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 20 15:48:46 2018 +0200

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

diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx
index 04ca33441cde..25a8d47646d2 100644
--- a/cui/source/inc/optlingu.hxx
+++ b/cui/source/inc/optlingu.hxx
@@ -129,7 +129,7 @@ private:
 
     std::unique_ptr<SvLBoxButtonData>   m_xCheckButtonData;
 
-    SvxLinguData_Impl*  pLinguData;
+    std::unique_ptr<SvxLinguData_Impl>  pLinguData;
 
     SvxLinguTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet );
     SvTreeListEntry*    CreateEntry(OUString& rTxt, sal_uInt16 nCol);
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 6ee8ea97aa67..fc02af9c258a 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1029,8 +1029,7 @@ SvxLinguTabPage::~SvxLinguTabPage()
 
 void SvxLinguTabPage::dispose()
 {
-    delete pLinguData;
-    pLinguData = nullptr;
+    pLinguData.reset();
     m_pLinguModulesFT.clear();
     m_pLinguModulesCLB.clear();
     m_pLinguModulesEditPB.clear();
@@ -1060,7 +1059,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
     {
         DBG_ASSERT( pLinguData, "pLinguData not yet initialized" );
         if (!pLinguData)
-            pLinguData = new SvxLinguData_Impl;
+            pLinguData.reset( new SvxLinguData_Impl );
 
         // update spellchecker configuration entries
         const LangImplNameTable *pTable = &pLinguData->GetSpellTable();
@@ -1299,7 +1298,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
     if (m_pLinguModulesCLB->IsVisible())
     {
         if (!pLinguData)
-            pLinguData = new SvxLinguData_Impl;
+            pLinguData.reset( new SvxLinguData_Impl );
         UpdateModulesBox_Impl();
     }
 
@@ -1459,7 +1458,7 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void )
     if (m_pLinguModulesEditPB == pBtn)
     {
         if (!pLinguData)
-            pLinguData = new SvxLinguData_Impl;
+            pLinguData.reset( new SvxLinguData_Impl );
 
         SvxLinguData_Impl   aOldLinguData( *pLinguData );
         ScopedVclPtrInstance< SvxEditModulesDlg > aDlg( this, *pLinguData );


More information about the Libreoffice-commits mailing list