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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 19 09:57:08 UTC 2018


 sw/source/filter/html/htmlftn.cxx  |    8 +++-----
 sw/source/filter/html/htmlplug.cxx |   18 ++++++------------
 sw/source/filter/html/htmltab.cxx  |    3 +--
 sw/source/filter/html/swhtml.hxx   |    6 +++---
 4 files changed, 13 insertions(+), 22 deletions(-)

New commits:
commit 174d8630d754c429b6a88964edae9c9dda707344
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 18 11:40:10 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 19 11:56:41 2018 +0200

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

diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx
index 096fdcd9059b..c8a50ae1f42d 100644
--- a/sw/source/filter/html/htmlftn.cxx
+++ b/sw/source/filter/html/htmlftn.cxx
@@ -173,7 +173,7 @@ void SwHTMLParser::InsertFootEndNote( const OUString& rName, bool bEndNote,
                                       bool bFixed )
 {
     if( !m_pFootEndNoteImpl )
-        m_pFootEndNoteImpl = new SwHTMLFootEndNote_Impl;
+        m_pFootEndNoteImpl.reset(new SwHTMLFootEndNote_Impl);
 
     m_pFootEndNoteImpl->sName = rName;
     if( m_pFootEndNoteImpl->sName.getLength() > 3 )
@@ -213,8 +213,7 @@ void SwHTMLParser::InsertFootEndNoteText()
 
 void SwHTMLParser::DeleteFootEndNoteImpl()
 {
-    delete m_pFootEndNoteImpl;
-    m_pFootEndNoteImpl = nullptr;
+    m_pFootEndNoteImpl.reset();
 }
 
 SwNodeIndex *SwHTMLParser::GetFootEndNoteSection( const OUString& rName )
@@ -234,8 +233,7 @@ SwNodeIndex *SwHTMLParser::GetFootEndNoteSection( const OUString& rName )
                 m_pFootEndNoteImpl->aTextFootnotes.erase( m_pFootEndNoteImpl->aTextFootnotes.begin() + i );
                 if (m_pFootEndNoteImpl->aTextFootnotes.empty())
                 {
-                    delete m_pFootEndNoteImpl;
-                    m_pFootEndNoteImpl = nullptr;
+                    m_pFootEndNoteImpl.reset();
                 }
 
                 break;
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 22738a13b934..5864bac5a004 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -651,8 +651,7 @@ void SwHTMLParser::NewObject()
     bool bPrcWidth = false, bPrcHeight = false,
              bDeclare = false;
     // create a new Command list
-    delete m_pAppletImpl;
-    m_pAppletImpl = new SwApplet_Impl( m_xDoc->GetAttrPool() );
+    m_pAppletImpl.reset(new SwApplet_Impl( m_xDoc->GetAttrPool() ));
 
     const HTMLOptions& rHTMLOptions = GetOptions();
     for (size_t i = rHTMLOptions.size(); i; )
@@ -749,8 +748,7 @@ void SwHTMLParser::NewObject()
 
     if( !bIsApplet )
     {
-        delete m_pAppletImpl;
-        m_pAppletImpl = nullptr;
+        m_pAppletImpl.reset();
         return;
     }
 
@@ -799,8 +797,7 @@ void SwHTMLParser::EndObject()
         // if applicable create frames and register auto-bound frames
         RegisterFlyFrame( pFlyFormat );
 
-        delete m_pAppletImpl;
-        m_pAppletImpl = nullptr;
+        m_pAppletImpl.reset();
     }
 #else
     (void) this;                // Silence loplugin:staticmethods
@@ -818,8 +815,7 @@ void SwHTMLParser::InsertApplet()
     sal_Int16 eHoriOri = text::HoriOrientation::NONE;
 
     // create a new Command list
-    delete m_pAppletImpl;
-    m_pAppletImpl = new SwApplet_Impl( m_xDoc->GetAttrPool() );
+    m_pAppletImpl.reset(new SwApplet_Impl( m_xDoc->GetAttrPool() ));
 
     const HTMLOptions& rHTMLOptions = GetOptions();
     for (size_t i = rHTMLOptions.size(); i; )
@@ -879,8 +875,7 @@ void SwHTMLParser::InsertApplet()
 
     if( aCode.isEmpty() )
     {
-        delete m_pAppletImpl;
-        m_pAppletImpl = nullptr;
+        m_pAppletImpl.reset();
         return;
     }
 
@@ -931,8 +926,7 @@ void SwHTMLParser::EndApplet()
     // if applicable create frames and register auto-bound frames
     RegisterFlyFrame( pFlyFormat );
 
-    delete m_pAppletImpl;
-    m_pAppletImpl = nullptr;
+    m_pAppletImpl.reset();
 #else
     (void) this;
 #endif
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 3b6f1b33f980..9f4816e5d1ff 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -4908,8 +4908,7 @@ void SwHTMLParser::ClearFootnotesInRange(const SwNodeIndex& rMkNdIdx, const SwNo
             m_pFootEndNoteImpl->aTextFootnotes.end(), IndexInRange(rMkNdIdx, rPtNdIdx)), m_pFootEndNoteImpl->aTextFootnotes.end());
         if (m_pFootEndNoteImpl->aTextFootnotes.empty())
         {
-            delete m_pFootEndNoteImpl;
-            m_pFootEndNoteImpl = nullptr;
+            m_pFootEndNoteImpl.reset();
         }
     }
 
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 0867f3e4d0ed..e6d927c96768 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -368,7 +368,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
     //onto them until parsing is done
     std::vector<std::unique_ptr<SwTableBox>> m_aOrphanedTableBoxes;
 
-    SwApplet_Impl *m_pAppletImpl; // current applet
+    std::unique_ptr<SwApplet_Impl> m_pAppletImpl; // current applet
 
     SwCSS1Parser    *m_pCSS1Parser;   // Style-Sheet-Parser
     SwHTMLNumRuleInfo *m_pNumRuleInfo;
@@ -381,12 +381,12 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
 
     std::vector<HTMLTable*> m_aTables;
     std::shared_ptr<HTMLTable> m_xTable; // current "outermost" table
-    SwHTMLForm_Impl *m_pFormImpl;   // current form
+    SwHTMLForm_Impl* m_pFormImpl;   // current form
     SdrObject       *m_pMarquee;    // current marquee
     std::unique_ptr<SwField> m_xField; // current field
     ImageMap        *m_pImageMap;   // current image map
     ImageMaps       *m_pImageMaps;  ///< all Image-Maps that have been read
-    SwHTMLFootEndNote_Impl *m_pFootEndNoteImpl;
+    std::unique_ptr<SwHTMLFootEndNote_Impl> m_pFootEndNoteImpl;
 
     Size    m_aHTMLPageSize;      // page size of HTML template
 


More information about the Libreoffice-commits mailing list