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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 16 08:27:24 UTC 2019


 sc/source/filter/html/htmlpars.cxx |   14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

New commits:
commit 649ee85cd0f96d7532220ca244dee7b85fa4065b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jan 15 10:05:26 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jan 16 09:26:59 2019 +0100

    use unique_ptr in ScHTMLLayoutParser::Adjust
    
    Change-Id: Ib411146c79a03a0c447c7ec387e6e57451cc0d2f
    Reviewed-on: https://gerrit.libreoffice.org/66420
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 16b0325e45be..bce592228825 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -470,8 +470,7 @@ void ScHTMLLayoutParser::Adjust()
 {
     xLockedList->RemoveAll();
 
-    std::stack< ScHTMLAdjustStackEntry* > aStack;
-    ScHTMLAdjustStackEntry* pS = nullptr;
+    std::stack< std::unique_ptr<ScHTMLAdjustStackEntry> > aStack;
     sal_uInt16 nTab = 0;
     SCCOL nLastCol = SCCOL_MAX;
     SCROW nNextRow = 0;
@@ -484,15 +483,13 @@ void ScHTMLLayoutParser::Adjust()
         {   // Table finished
             if ( !aStack.empty() )
             {
-                pS = aStack.top();
+                std::unique_ptr<ScHTMLAdjustStackEntry> pS = std::move(aStack.top());
                 aStack.pop();
 
                 nLastCol = pS->nLastCol;
                 nNextRow = pS->nNextRow;
                 nCurRow = pS->nCurRow;
             }
-            delete pS;
-            pS = nullptr;
             nTab = pE->nTab;
             if (pTables)
             {
@@ -526,7 +523,7 @@ void ScHTMLLayoutParser::Adjust()
         nLastCol = pE->nCol; // Read column
         if ( pE->nTab > nTab )
         {   // New table
-            aStack.push( new ScHTMLAdjustStackEntry(
+            aStack.push( std::make_unique<ScHTMLAdjustStackEntry>(
                 nLastCol, nNextRow, nCurRow ) );
             nTab = pE->nTab;
             if ( pTables )
@@ -609,11 +606,6 @@ void ScHTMLLayoutParser::Adjust()
         if ( nRowMax < nRowTmp )
             nRowMax = nRowTmp;
     }
-    while ( !aStack.empty() )
-    {
-        delete aStack.top();
-        aStack.pop();
-    }
 }
 
 sal_uInt16 ScHTMLLayoutParser::GetWidth( const ScEEParseEntry* pE )


More information about the Libreoffice-commits mailing list