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

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 5 08:23:25 UTC 2018


 lotuswordpro/source/filter/explode.cxx |    8 ++++----
 lotuswordpro/source/filter/explode.hxx |    7 +------
 2 files changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 37159a6979c7b82ed98f7b972cc7c86a3ff18df1
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 1 10:29:39 2018 +0200

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

diff --git a/lotuswordpro/source/filter/explode.cxx b/lotuswordpro/source/filter/explode.cxx
index 497252d1d67a..207346c55a26 100644
--- a/lotuswordpro/source/filter/explode.cxx
+++ b/lotuswordpro/source/filter/explode.cxx
@@ -251,7 +251,7 @@ sal_Int32 Decompression::explode()
         }
         // if the bit is 1 we have here a length/distance pair:
         // -decode a number with Hufmman Tree #1; variable bit length, result is 0x00 .. 0x0F -> L1
-        sal_uInt32 L1 = Decode(m_Tree1);
+        sal_uInt32 L1 = Decode(m_Tree1.get());
         sal_uInt32 Length;
         if (L1 <= 7)
         {
@@ -276,7 +276,7 @@ sal_Int32 Decompression::explode()
         }
 
         // - decode another number with Hufmann Tree #2 giving result 0x00..0x3F -> D1
-        sal_uInt32 D1 = Decode(m_Tree2);
+        sal_uInt32 D1 = Decode(m_Tree2.get());
         sal_uInt32 D2;
         if (Length == 2)
         {
@@ -400,7 +400,7 @@ void Decompression::ConstructTree1()
     // d    0000 01
     // e    0000 001
     // f    0000 000
-    m_Tree1 = new HuffmanTreeNode();
+    m_Tree1.reset( new HuffmanTreeNode());
     for (sal_uInt32 i=0; i< 16; i++)
     {
         m_Tree1->InsertNode(i, Tree1String[i]);
@@ -431,7 +431,7 @@ void Decompression::ConstructTree1()
 void Decompression::ConstructTree2()
 {
 
-    m_Tree2 = new HuffmanTreeNode();
+    m_Tree2.reset(new HuffmanTreeNode());
     for (sal_uInt32 i=0; i< 64; i++)
     {
         m_Tree2->InsertNode(i, Tree2String[i]);
diff --git a/lotuswordpro/source/filter/explode.hxx b/lotuswordpro/source/filter/explode.hxx
index 1b8cc587811c..01e5ec97b8de 100644
--- a/lotuswordpro/source/filter/explode.hxx
+++ b/lotuswordpro/source/filter/explode.hxx
@@ -85,11 +85,6 @@ class Decompression
 {
 public:
     Decompression(SvStream * pInStream, SvStream * pOutStream);
-    ~Decompression()
-    {
-        delete m_Tree1;
-        delete m_Tree2;
-    };
     /**
      * @brief
      * decompress from instream to outstream
@@ -117,7 +112,7 @@ public:
 
     sal_uInt32 m_iArrayOfM[16];
 
-    HuffmanTreeNode *m_Tree1, *m_Tree2;
+    std::unique_ptr<HuffmanTreeNode> m_Tree1, m_Tree2;
 
     void ConstructTree1();
     void ConstructTree2();


More information about the Libreoffice-commits mailing list