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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jul 17 10:19:38 UTC 2018


 compilerplugins/clang/useuniqueptr.cxx  |    3 +++
 sw/source/filter/html/htmlnumwriter.cxx |   12 ++++++++----
 sw/source/filter/html/wrthtml.cxx       |   10 +++++++---
 sw/source/filter/html/wrthtml.hxx       |    9 +++++----
 4 files changed, 23 insertions(+), 11 deletions(-)

New commits:
commit 011c6c719f77181f042c68ba92e38847e39c8ca1
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 16 14:40:20 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 17 12:19:14 2018 +0200

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

diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx
index 1cb392f718f8..a9f60c47039f 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -79,6 +79,9 @@ public:
         // SwLineLayout::m_pNext
         if (fn == SRCDIR "/sw/source/core/text/porlay.cxx")
             return;
+        // ODatabaseExport::m_aDestColumns
+        if (fn == SRCDIR "/dbaccess/source/ui/misc/DExport.cxx")
+            return;
 
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
     }
diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx
index dc21f1cbb0f2..bd0d2dadab8b 100644
--- a/sw/source/filter/html/htmlnumwriter.cxx
+++ b/sw/source/filter/html/htmlnumwriter.cxx
@@ -56,7 +56,7 @@ void SwHTMLWriter::FillNextNumInfo()
         const SwNode* pNd = m_pDoc->GetNodes()[nPos];
         if( pNd->IsTextNode() )
         {
-            m_pNextNumRuleInfo = new SwHTMLNumRuleInfo( *pNd->GetTextNode() );
+            m_pNextNumRuleInfo.reset( new SwHTMLNumRuleInfo( *pNd->GetTextNode() ) );
 
             // Before a table we keep the old level if the same numbering is
             // continued after the table and no new numbering is started.
@@ -78,7 +78,7 @@ void SwHTMLWriter::FillNextNumInfo()
         else
         {
             // In all other case the numbering is over.
-            m_pNextNumRuleInfo = new SwHTMLNumRuleInfo;
+            m_pNextNumRuleInfo.reset(new SwHTMLNumRuleInfo);
         }
     }
     while( !m_pNextNumRuleInfo );
@@ -86,8 +86,12 @@ void SwHTMLWriter::FillNextNumInfo()
 
 void SwHTMLWriter::ClearNextNumInfo()
 {
-    delete m_pNextNumRuleInfo;
-    m_pNextNumRuleInfo = nullptr;
+    m_pNextNumRuleInfo.reset();
+}
+
+void SwHTMLWriter::SetNextNumInfo( std::unique_ptr<SwHTMLNumRuleInfo> pNxt )
+{
+    m_pNextNumRuleInfo = std::move(pNxt);
 }
 
 Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt,
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index c0347613752e..b2f90146fa7c 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -171,6 +171,11 @@ SwHTMLWriter::~SwHTMLWriter()
 {
 }
 
+std::unique_ptr<SwHTMLNumRuleInfo> SwHTMLWriter::ReleaseNextNumInfo()
+{
+    return std::move(m_pNextNumRuleInfo);
+}
+
 void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium)
 {
     const SfxItemSet* pSet = rMedium.GetItemSet();
@@ -1519,8 +1524,7 @@ HTMLSaveData::HTMLSaveData(SwHTMLWriter& rWriter, sal_uLong nStt,
     if( bSaveNum )
     {
         pOldNumRuleInfo = new SwHTMLNumRuleInfo( rWrt.GetNumInfo() );
-        pOldNextNumRuleInfo = rWrt.GetNextNumInfo();
-        rWrt.SetNextNumInfo( nullptr );
+        pOldNextNumRuleInfo = rWrt.ReleaseNextNumInfo();
     }
     else
     {
@@ -1555,7 +1559,7 @@ HTMLSaveData::~HTMLSaveData()
     {
         rWrt.GetNumInfo().Set( *pOldNumRuleInfo );
         delete pOldNumRuleInfo;
-        rWrt.SetNextNumInfo( pOldNextNumRuleInfo );
+        rWrt.SetNextNumInfo( std::move(pOldNextNumRuleInfo) );
     }
     else
     {
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index 1aff873f8fc8..27ae06bd7bef 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -259,7 +259,7 @@ class SW_DLLPUBLIC SwHTMLWriter : public Writer
 {
     SwHTMLPosFlyFrames *m_pHTMLPosFlyFrames;
     std::unique_ptr<SwHTMLNumRuleInfo> m_pNumRuleInfo;// current numbering
-    SwHTMLNumRuleInfo *m_pNextNumRuleInfo;
+    std::unique_ptr<SwHTMLNumRuleInfo> m_pNextNumRuleInfo;
     sal_uInt32 m_nHTMLMode;               // description of export configuration
 
     FieldUnit m_eCSS1Unit;
@@ -521,10 +521,11 @@ public:
 
     // Fetch current numbering information of next paragraph. They
     // don't have to exist yet!
-    SwHTMLNumRuleInfo *GetNextNumInfo() { return m_pNextNumRuleInfo; }
+    SwHTMLNumRuleInfo *GetNextNumInfo() { return m_pNextNumRuleInfo.get(); }
+    std::unique_ptr<SwHTMLNumRuleInfo> ReleaseNextNumInfo();
 
     // Set the numbering information of next paragraph.
-    void SetNextNumInfo( SwHTMLNumRuleInfo *pNxt ) { m_pNextNumRuleInfo=pNxt; }
+    void SetNextNumInfo( std::unique_ptr<SwHTMLNumRuleInfo> pNxt );
 
     // Fill the numbering information of next paragraph.
     void FillNextNumInfo();
@@ -621,7 +622,7 @@ struct HTMLSaveData
     SwHTMLWriter& rWrt;
     SwPaM* pOldPam, *pOldEnd;
     SwHTMLNumRuleInfo *pOldNumRuleInfo;     // Owner = this
-    SwHTMLNumRuleInfo *pOldNextNumRuleInfo; // Owner = HTML-Writer
+    std::unique_ptr<SwHTMLNumRuleInfo> pOldNextNumRuleInfo;
     sal_uInt16 nOldDefListLvl;
     SvxFrameDirection nOldDirection;
     bool bOldWriteAll : 1;


More information about the Libreoffice-commits mailing list