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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 26 06:38:12 UTC 2018


 sw/source/filter/ww8/wrtw8num.cxx |    2 +-
 sw/source/filter/ww8/wrtww8.cxx   |   30 +++++++++++++++---------------
 sw/source/filter/ww8/wrtww8.hxx   |   18 +++++++++---------
 sw/source/filter/ww8/ww8atr.cxx   |    4 ++--
 4 files changed, 27 insertions(+), 27 deletions(-)

New commits:
commit 8ceb8e9d9bf352d5a79894ecb04326284b642810
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 25 14:09:40 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 26 08:37:56 2018 +0200

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

diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index af43f75ce436..dbf50faa680b 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3270,7 +3270,7 @@ void WW8Export::ExportDocument_Impl()
 {
     PrepareStorage();
 
-    pFib = new WW8Fib(8, m_bDot);
+    pFib.reset(new WW8Fib(8, m_bDot));
 
     tools::SvRef<SotStorageStream> xWwStrm( GetWriter().GetStorage().OpenSotStream( m_aMainStg ) );
     tools::SvRef<SotStorageStream> xTableStrm( xWwStrm ), xDataStrm( xWwStrm );
@@ -3315,10 +3315,10 @@ void WW8Export::ExportDocument_Impl()
     }
 
     // Default: "Standard"
-    pSepx = new WW8_WrPlcSepx( *this );                         // Sections/headers/footers
+    pSepx.reset(new WW8_WrPlcSepx( *this ));                         // Sections/headers/footers
 
-    pFootnote = new WW8_WrPlcFootnoteEdn( TXT_FTN );                      // Footnotes
-    pEdn = new WW8_WrPlcFootnoteEdn( TXT_EDN );                      // Endnotes
+    pFootnote.reset(new WW8_WrPlcFootnoteEdn( TXT_FTN ));                      // Footnotes
+    pEdn.reset(new WW8_WrPlcFootnoteEdn( TXT_EDN ));                      // Endnotes
     m_pAtn = new WW8_WrPlcAnnotations;                                 // PostIts
     m_pFactoids.reset(new WW8_WrtFactoids); // Smart tags.
     m_pTextBxs = new WW8_WrPlcTextBoxes( TXT_TXTBOX );
@@ -3346,7 +3346,7 @@ void WW8Export::ExportDocument_Impl()
 
     m_pGrf = new SwWW8WrGrf( *this );
     m_pPiece = new WW8_WrPct( pFib->m_fcMin );
-    pDop = new WW8Dop;
+    pDop.reset(new WW8Dop);
 
     pDop->fRevMarking = bool( RedlineFlags::On & m_nOrigRedlineFlags );
     pDop->fRMView = bool( RedlineFlags::ShowDelete & m_nOrigRedlineFlags );
@@ -3417,7 +3417,7 @@ void WW8Export::ExportDocument_Impl()
     DELETEZ( pO );
     DELETEZ( m_pChpPlc );
     DELETEZ( m_pPapPlc );
-    DELETEZ( pSepx );
+    pSepx.reset();
 
     delete m_pRedlAuthors;
     delete m_pSdrObjs;
@@ -3425,12 +3425,12 @@ void WW8Export::ExportDocument_Impl()
     delete m_pTextBxs;
     delete m_pHFTextBxs;
     delete m_pAtn;
-    delete pEdn;
-    delete pFootnote;
+    pEdn.reset();
+    pFootnote.reset();
     delete m_pBkmks;
     delete m_pPiece;
-    delete pDop;
-    delete pFib;
+    pDop.reset();
+    pFib.reset();
     GetWriter().SetStream( nullptr );
 
     xWwStrm->SetBufferSize( 0 );
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 80cb2404aadf..dde8717443c6 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -959,15 +959,15 @@ private:
 class WW8Export : public MSWordExportBase
 {
 public:
-    ww::bytes* pO;                       ///< Buffer
+    ww::bytes* pO;                      ///< Buffer
 
     SvStream *pTableStrm, *pDataStrm;   ///< Streams for WW97 Export
 
-    WW8Fib* pFib;                       ///< File Information Block
-    WW8Dop* pDop;                       ///< DOcument Properties
-    WW8_WrPlcFootnoteEdn *pFootnote;              ///< Footnotes - structure to remember them, and output
-    WW8_WrPlcFootnoteEdn *pEdn;              ///< Endnotes - structure to remember them, and output
-    WW8_WrPlcSepx* pSepx;               ///< Sections/headers/footers
+    std::unique_ptr<WW8Fib> pFib;                       ///< File Information Block
+    std::unique_ptr<WW8Dop> pDop;                       ///< DOcument Properties
+    std::unique_ptr<WW8_WrPlcFootnoteEdn> pFootnote;    ///< Footnotes - structure to remember them, and output
+    std::unique_ptr<WW8_WrPlcFootnoteEdn> pEdn;         ///< Endnotes - structure to remember them, and output
+    std::unique_ptr<WW8_WrPlcSepx> pSepx;               ///< Sections/headers/footers
 
     bool m_bDot; ///< Template or document.
 
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index f404d9ab2498..02d96980146e 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3462,9 +3462,9 @@ void WW8AttributeOutput::TextFootnote_Impl( const SwFormatFootnote& rFootnote )
 {
     WW8_WrPlcFootnoteEdn* pFootnoteEnd;
     if ( rFootnote.IsEndNote() || GetExport().m_pDoc->GetFootnoteInfo().ePos == FTNPOS_CHAPTER )
-        pFootnoteEnd = m_rWW8Export.pEdn;
+        pFootnoteEnd = m_rWW8Export.pEdn.get();
     else
-        pFootnoteEnd = m_rWW8Export.pFootnote;
+        pFootnoteEnd = m_rWW8Export.pFootnote.get();
 
     pFootnoteEnd->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), rFootnote );
     m_rWW8Export.WriteFootnoteBegin( rFootnote, m_rWW8Export.pO );
commit 337d0a4f602b879e73367586b9090dcc94898eb3
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 25 13:58:41 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 26 08:37:47 2018 +0200

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

diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 3065a98a82a4..011ae61990dd 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -74,7 +74,7 @@ sal_uInt16 MSWordExportBase::GetId( const SwNumRule& rNumRule )
 {
     if ( !m_pUsedNumTable )
     {
-        m_pUsedNumTable = new SwNumRuleTable;
+        m_pUsedNumTable.reset(new SwNumRuleTable);
         m_pUsedNumTable->insert( m_pUsedNumTable->begin(), m_pDoc->GetNumRuleTable().begin(), m_pDoc->GetNumRuleTable().end() );
         // Check, if the outline rule is already inserted into <pUsedNumTable>.
         // If yes, do not insert it again.
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index cb1af3ce4d68..af43f75ce436 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3173,11 +3173,11 @@ void MSWordExportBase::ExportDocument( bool bWriteAll )
         if ( rOpt.IsImpress2PowerPoint() )
             nSvxMSDffOLEConvFlags |= OLE_STARIMPRESS_2_POWERPOINT;
 
-        m_pOLEExp = new SvxMSExportOLEObjects( nSvxMSDffOLEConvFlags );
+        m_pOLEExp.reset(new SvxMSExportOLEObjects( nSvxMSDffOLEConvFlags ));
     }
 
     if ( !m_pOCXExp && m_pDoc->GetDocShell() )
-        m_pOCXExp = new SwMSConvertControls( m_pDoc->GetDocShell(), m_pCurPam );
+        m_pOCXExp.reset(new SwMSConvertControls( m_pDoc->GetDocShell(), m_pCurPam ));
 
     // #i81405# - Collect anchored objects before changing the redline mode.
     m_aFrames = GetFrames( *m_pDoc, bWriteAll? nullptr : m_pOrigPam );
@@ -3631,10 +3631,10 @@ MSWordExportBase::~MSWordExportBase()
         // - it's an auto delete array, so the rest of the array which are
         // duplicated lists that were added during the export will be deleted.
         m_pUsedNumTable->erase(m_pUsedNumTable->begin(), m_pUsedNumTable->begin() + m_pUsedNumTable->size() - m_nUniqueList);
-        delete m_pUsedNumTable;
+        m_pUsedNumTable.reset();
     }
-    delete m_pOLEExp;
-    delete m_pOCXExp;
+    m_pOLEExp.reset();
+    m_pOCXExp.reset();
 }
 
 WW8Export::WW8Export( SwWW8Writer *pWriter,
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index df66ce5f37aa..80cb2404aadf 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -457,15 +457,15 @@ public:
     std::vector<const SwTOXType*> m_aTOXArr;
     const SfxItemSet* m_pISet;    // for double attributes
     WW8_WrPct*  m_pPiece;         // Pointer to Piece-Table
-    SwNumRuleTable* m_pUsedNumTable;  // all used NumRules
+    std::unique_ptr<SwNumRuleTable> m_pUsedNumTable;  // all used NumRules
     const SwTextNode *m_pTopNodeOfHdFtPage; ///< Top node of host page when in hd/ft
     std::map< sal_uInt16, sal_uInt16 > m_aRuleDuplicates; //map to Duplicated numrules
     std::stack< sal_Int32 > m_aCurrentCharPropStarts; ///< To remember the position in a run.
     WW8_WrtBookmarks* m_pBkmks;
     WW8_WrtRedlineAuthor* m_pRedlAuthors;
     std::shared_ptr<NfKeywordTable> m_pKeyMap;
-    SvxMSExportOLEObjects* m_pOLEExp;
-    SwMSConvertControls* m_pOCXExp;
+    std::unique_ptr<SvxMSExportOLEObjects> m_pOLEExp;
+    std::unique_ptr<SwMSConvertControls> m_pOCXExp;
     WW8OleMap m_aOleMap;    // To remember all already exported ole objects
     ww8::WW8TableInfo::Pointer_t m_pTableInfo;
 


More information about the Libreoffice-commits mailing list