[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - hwpfilter/qa hwpfilter/source

Caolán McNamara caolanm at redhat.com
Wed Apr 12 11:31:34 UTC 2017


 hwpfilter/qa/cppunit/data/fail/cslist-1.hwp |binary
 hwpfilter/source/hpara.cxx                  |   88 +--
 hwpfilter/source/hpara.h                    |    5 
 hwpfilter/source/hwpfile.cxx                |   92 +--
 hwpfilter/source/hwpfile.h                  |   15 
 hwpfilter/source/hwpreader.cxx              |  678 +++++++++++++---------------
 hwpfilter/source/hwpreader.hxx              |    4 
 hwpfilter/source/solver.cxx                 |   53 --
 8 files changed, 435 insertions(+), 500 deletions(-)

New commits:
commit 37e5ac5f54bfb14af435fa1ab30400176133dc6f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 3 11:25:32 2017 +0000

    backport various fixes to aid future backporting
    
    ofz#725 fix hwp leak
    
    Change-Id: I09088981ca63b297781307590092725bc1cbed1b
    (cherry picked from commit 681b6361f23a8f20511ad97989c642b07f25c495)
    
    valgrind: uninitialized reads
    
    Change-Id: Ia1e821d1e323d85c65484c980be09f015af6517b
    (cherry picked from commit afabc7d2f2fcf8fcd39ff5002f09c32e8f03d4bb)
    
    partial loplugin:useuniqueptr extend to catch more localvar cases
    
    hwpfilter part of...
    
    commit aa09b0c27a6d925da428d6267daadc7338829869
    Author: Noel Grandin <noel.grandin at collabora.co.uk>
    Date:   Thu Apr 6 09:46:06 2017 +0200
    
        loplugin:useuniqueptr extend to catch more localvar cases
    
        i.e. where the code looks like
        {
            foo * p = new foo;
            ...
            delete p;
            return ...;
        }
    
    Change-Id: Iad770d1904b2373b1bf8ce609f4c95882388eff8
    
    ofz: epic slow use of std::list
    
    Change-Id: I790a3098272101fd33f83f21bdcef1bb061efd76
    Reviewed-on: https://gerrit.libreoffice.org/34635
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 283e843be91ef4d727c0815d1b8a0420fd16a7fd)
    
    use rtl::Reference in HwpReader
    
    instead of storing both a raw pointer and an uno::Reference
    
    (cherry picked from commit 0bab51d8ad35a31685002118cdac20657b57137a)
    
    Change-Id: I02dd356d9693116f98ad2b96951570b3ba448b14
    Reviewed-on: https://gerrit.libreoffice.org/36301
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/hwpfilter/qa/cppunit/data/fail/cslist-1.hwp b/hwpfilter/qa/cppunit/data/fail/cslist-1.hwp
new file mode 100644
index 000000000000..d491f7b4c04d
Binary files /dev/null and b/hwpfilter/qa/cppunit/data/fail/cslist-1.hwp differ
diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx
index 96b2729c8698..84294c59ed3c 100644
--- a/hwpfilter/source/hpara.cxx
+++ b/hwpfilter/source/hpara.cxx
@@ -77,7 +77,6 @@ HWPPara::HWPPara()
     , pstyno(0)
     , linfo(nullptr)
     , cshapep(nullptr)
-    , hhstr(nullptr)
 {
     memset(&cshape, 0, sizeof(cshape));
     memset(&pshape, 0, sizeof(pshape));
@@ -87,19 +86,8 @@ HWPPara::~HWPPara()
 {
     delete[] linfo;
     delete[] cshapep;
-    if (hhstr)
-    {
-// virtual destructor
-/* C++은 null에 대해서도 동작한다. */
-        for (int ii = 0; ii < nch; ++ii)
-            delete hhstr[ii];
-
-        delete[]hhstr;
-    }
-
 }
 
-
 bool HWPPara::Read(HWPFile & hwpf, unsigned char flag)
 {
     unsigned char same_cshape;
@@ -162,6 +150,7 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag)
             perror("Memory Allocation: cshape\n");
             return false;
         }
+        memset(cshapep, 0, nch * sizeof(CharShape));
 
         for (ii = 0; ii < nch; ii++)
         {
@@ -180,14 +169,12 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag)
         }
     }
 // read string
-    hhstr = ::comphelper::newArray_null<HBox *>(nch);
-    if (!hhstr) { return false; }
-    for (ii = 0; ii < nch; ii++)
-        hhstr[ii] = nullptr;
+    hhstr.resize(nch);
     ii = 0;
     while (ii < nch)
     {
-        if (nullptr == (hhstr[ii] = readHBox(hwpf)))
+        hhstr[ii] = readHBox(hwpf);
+        if (!hhstr[ii])
             return false;
         if (hhstr[ii]->hh == CH_END_PARA)
             break;
@@ -207,93 +194,93 @@ CharShape *HWPPara::GetCharShape(int pos)
 }
 
 
-HBox *HWPPara::readHBox(HWPFile & hwpf)
+std::unique_ptr<HBox> HWPPara::readHBox(HWPFile & hwpf)
 {
+    std::unique_ptr<HBox> hbox;
+
     hchar hh;
     if (!hwpf.Read2b(hh))
-        return nullptr;
-
-    HBox *hbox = nullptr;
+        return hbox;
 
     if (hwpf.State() != HWP_NoError)
-        return nullptr;
+        return hbox;
 
     if (hh > 31 || hh == CH_END_PARA)
-        hbox = new HBox(hh);
+        hbox.reset(new HBox(hh));
     else if (IS_SP_SKIP_BLOCK(hh))
-        hbox = new SkipData(hh);
+        hbox.reset(new SkipData(hh));
     else
     {
         switch (hh)
         {
             case CH_FIELD:                        // 5
-                hbox = new FieldCode;
+                hbox.reset(new FieldCode);
                 break;
             case CH_BOOKMARK:                     // 6
-                hbox = new Bookmark;
+                hbox.reset(new Bookmark);
                 break;
             case CH_DATE_FORM:                    // 7
-                hbox = new DateFormat;
+                hbox.reset(new DateFormat);
                 break;
             case CH_DATE_CODE:                    // 8
-                hbox = new DateCode;
+                hbox.reset(new DateCode);
                 break;
             case CH_TAB:                          // 9
-                hbox = new Tab;
+                hbox.reset(new Tab);
                 break;
             case CH_TEXT_BOX:                     // 10
-                hbox = new TxtBox;
+                hbox.reset(new TxtBox);
                 break;
             case CH_PICTURE:                      // 11
-                hbox = new Picture;
+                hbox.reset(new Picture);
                 break;
             case CH_LINE:                         // 14
-                hbox = new Line;
+                hbox.reset(new Line);
                 break;
             case CH_HIDDEN:                       // 15
-                hbox = new Hidden;
+                hbox.reset(new Hidden);
                 break;
             case CH_HEADER_FOOTER:                // 16
-                hbox = new HeaderFooter;
+                hbox.reset(new HeaderFooter);
                 break;
             case CH_FOOTNOTE:                     // 17
-                hbox = new Footnote;
+                hbox.reset(new Footnote);
                 break;
             case CH_AUTO_NUM:                     // 18
-                hbox = new AutoNum;
+                hbox.reset(new AutoNum);
                 break;
             case CH_NEW_NUM:                      // 19
-                hbox = new NewNum;
+                hbox.reset(new NewNum);
                 break;
             case CH_SHOW_PAGE_NUM:                // 20
-                hbox = new ShowPageNum;
+                hbox.reset(new ShowPageNum);
                 break;
             case CH_PAGE_NUM_CTRL:                // 21
-                hbox = new PageNumCtrl;
+                hbox.reset(new PageNumCtrl);
                 break;
             case CH_MAIL_MERGE:                   // 22
-                hbox = new MailMerge;
+                hbox.reset(new MailMerge);
                 break;
             case CH_COMPOSE:                      // 23
-                hbox = new Compose;
+                hbox.reset(new Compose);
                 break;
             case CH_HYPHEN:                       // 24
-                hbox = new Hyphen;
+                hbox.reset(new Hyphen);
                 break;
             case CH_TOC_MARK:                     // 25
-                hbox = new TocMark;
+                hbox.reset(new TocMark);
                 break;
             case CH_INDEX_MARK:                   // 26
-                hbox = new IndexMark;
+                hbox.reset(new IndexMark);
                 break;
             case CH_OUTLINE:                      // 28
-                hbox = new Outline;
+                hbox.reset(new Outline);
                 break;
             case CH_KEEP_SPACE:                   // 30
-                hbox = new KeepSpace;
+                hbox.reset(new KeepSpace);
                 break;
             case CH_FIXED_SPACE:                  // 31
-                hbox = new FixedSpace;
+                hbox.reset(new FixedSpace);
                 break;
             default:
                 break;
@@ -301,13 +288,12 @@ HBox *HWPPara::readHBox(HWPFile & hwpf)
     }
     if (!hbox || !hbox->Read(hwpf))
     {
-        delete hbox;
-
-        return nullptr;
+        hbox.reset();
+        return hbox;
     }
     if( hh == CH_TEXT_BOX || hh == CH_PICTURE || hh == CH_LINE )
     {
-        FBox *fbox = static_cast<FBox *>(hbox);
+        FBox *fbox = static_cast<FBox *>(hbox.get());
         if( ( fbox->style.anchor_type == 1) && ( fbox->pgy >= begin_ypos) )
         {
             //strange construct to compile without warning
diff --git a/hwpfilter/source/hpara.h b/hwpfilter/source/hpara.h
index 28e67dc456b8..7f9f26efd18d 100644
--- a/hwpfilter/source/hpara.h
+++ b/hwpfilter/source/hpara.h
@@ -23,6 +23,7 @@
 #include <hwplib.h>
 #include <hwpfile.h>
 #include <hinfo.h>
+#include <memory>
 
 struct HBox;
 
@@ -110,7 +111,7 @@ class DLLEXPORT HWPPara
 /**
  * Box object list
  */
-        HBox          **hhstr;
+        std::vector<std::unique_ptr<HBox>> hhstr;
 
         HWPPara(void);
         ~HWPPara(void);
@@ -135,7 +136,7 @@ class DLLEXPORT HWPPara
         HWPPara *Next(void) { return _next;}
 
     private:
-        HBox *readHBox(HWPFile &);
+        std::unique_ptr<HBox> readHBox(HWPFile &);
 };
 
 #endif // INCLUDED_HWPFILTER_SOURCE_HPARA_H
diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx
index 0c8a88c07be6..9b3b54f1af76 100644
--- a/hwpfilter/source/hwpfile.cxx
+++ b/hwpfilter/source/hwpfile.cxx
@@ -70,7 +70,7 @@ HWPFile::~HWPFile()
     for (; it != plist.end(); ++it)
         delete *it;
 
-    std::list < Table* >::iterator tbl = tables.begin();
+    std::vector< Table* >::iterator tbl = tables.begin();
     for (; tbl != tables.end(); ++tbl)
         delete *tbl;
 
@@ -246,7 +246,7 @@ void HWPFile::ParaListRead()
 
 bool HWPFile::ReadParaList(std::list < HWPPara* > &aplist, unsigned char flag)
 {
-    HWPPara *spNode = new HWPPara;
+    std::unique_ptr<HWPPara> spNode( new HWPPara );
      unsigned char tmp_etcflag;
      unsigned char prev_etcflag = 0;
     while (spNode->Read(*this, flag))
@@ -271,11 +271,10 @@ bool HWPFile::ReadParaList(std::list < HWPPara* > &aplist, unsigned char flag)
                 AddParaShape( &spNode->pshape );
 
         if (!aplist.empty())
-            aplist.back()->SetNext(spNode);
-        aplist.push_back(spNode);
-        spNode = new HWPPara;
+            aplist.back()->SetNext(spNode.get());
+        aplist.push_back(spNode.release());
+        spNode.reset( new HWPPara );
     }
-    delete spNode;
 
     return true;
 }
@@ -462,92 +461,53 @@ void HWPFile::AddBox(FBox * box)
     blist.push_back(box);
 }
 
-
 ParaShape *HWPFile::getParaShape(int index)
 {
-    std::list<ParaShape*>::iterator it = pslist.begin();
-
-    for( int i = 0; it != pslist.end(); ++it, i++ ){
-    if( i == index )
-      break;
-    }
-
-    return it != pslist.end() ? *it : nullptr;
+    if (index < 0 || static_cast<unsigned int>(index) >= pslist.size())
+        return nullptr;
+    return pslist[index];
 }
 
-
 CharShape *HWPFile::getCharShape(int index)
 {
-    std::list<CharShape*>::iterator it = cslist.begin();
-
-    for( int i = 0; it != cslist.end(); ++it, i++ ){
-        if( i == index )
-          break;
-    }
-
-    return it != cslist.end() ? *it : nullptr;
+    if (index < 0 || static_cast<unsigned int>(index) >= cslist.size())
+        return nullptr;
+    return cslist[index];
 }
 
-
 FBoxStyle *HWPFile::getFBoxStyle(int index)
 {
-    std::list<FBoxStyle*>::iterator it = fbslist.begin();
-
-    for( int i = 0; it != fbslist.end(); ++it, i++ ){
-        if( i == index )
-          break;
-    }
-
-    return it != fbslist.end() ? *it : nullptr;
+    if (index < 0 || static_cast<unsigned int>(index) >= fbslist.size())
+        return nullptr;
+    return fbslist[index];
 }
 
 DateCode *HWPFile::getDateCode(int index)
 {
-    std::list<DateCode*>::iterator it = datecodes.begin();
-
-    for( int i = 0; it != datecodes.end(); ++it, i++ ){
-        if( i == index )
-          break;
-    }
-
-    return it != datecodes.end() ? *it : nullptr;
+    if (index < 0 || static_cast<unsigned int>(index) >= datecodes.size())
+        return nullptr;
+    return datecodes[index];
 }
 
 HeaderFooter *HWPFile::getHeaderFooter(int index)
 {
-    std::list<HeaderFooter*>::iterator it = headerfooters.begin();
-
-    for( int i = 0; it != headerfooters.end(); ++it, i++ ){
-        if( i == index )
-          break;
-    }
-
-    return it != headerfooters.end() ? *it : nullptr;
+    if (index < 0 || static_cast<unsigned int>(index) >= headerfooters.size())
+        return nullptr;
+    return headerfooters[index];
 }
 
 ShowPageNum *HWPFile::getPageNumber(int index)
 {
-    std::list<ShowPageNum*>::iterator it = pagenumbers.begin();
-
-    for( int i = 0; it != pagenumbers.end(); ++it, i++ ){
-        if( i == index )
-          break;
-    }
-
-    return it != pagenumbers.end() ? *it : nullptr;
-
+    if (index < 0 || static_cast<unsigned int>(index) >= pagenumbers.size())
+        return nullptr;
+    return pagenumbers[index];
 }
 
 Table *HWPFile::getTable(int index)
 {
-    std::list<Table*>::iterator it = tables.begin();
-
-    for( int i = 0; it != tables.end(); ++it, i++ ){
-        if( i == index )
-          break;
-    }
-
-    return it != tables.end() ? *it : nullptr;
+    if (index < 0 || static_cast<unsigned int>(index) >= tables.size())
+        return nullptr;
+    return tables[index];
 }
 
 void HWPFile::AddParaShape(ParaShape * pshape)
diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h
index 497593f5fb80..4cf2910e22d4 100644
--- a/hwpfilter/source/hwpfile.h
+++ b/hwpfilter/source/hwpfile.h
@@ -26,6 +26,7 @@
 #define INCLUDED_HWPFILTER_SOURCE_HWPFILE_H
 
 #include <list>
+#include <vector>
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
@@ -283,13 +284,13 @@ class DLLEXPORT HWPFile
         std::list<EmPicture*> emblist;
         std::list<HyperText*> hyperlist;
         int currenthyper;
-        std::list<ParaShape*> pslist;             /* 스타오피스의 구조상 필요 */
-        std::list<CharShape*> cslist;
-        std::list<FBoxStyle*> fbslist;
-        std::list<DateCode*> datecodes;
-        std::list<HeaderFooter*> headerfooters;
-        std::list<ShowPageNum*> pagenumbers;
-        std::list<Table*> tables;
+        std::vector<ParaShape*> pslist;             /* 스타오피스의 구조상 필요 */
+        std::vector<CharShape*> cslist;
+        std::vector<FBoxStyle*> fbslist;
+        std::vector<DateCode*> datecodes;
+        std::vector<HeaderFooter*> headerfooters;
+        std::vector<ShowPageNum*> pagenumbers;
+        std::vector<Table*> tables;
 
 // for global document handling
         static HWPFile *cur_doc;
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index 1588a7eba3cc..c91654a5fb00 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -41,7 +41,7 @@
 #define rstartEl(x,y)   do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->startElement(x,y); } while(false)
 #define rendEl(x)       do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->endElement(x); } while(false)
 #define rchars(x)       do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(x); } while(false)
-#define padd(x,y,z)     pList->addAttribute(x,y,z)
+#define padd(x,y,z)     mxList->addAttribute(x,y,z)
 #define Double2Str(x)   OUString::number((double)(x))
 #define WTI(x)          ((double)(x) / 1800.)     // unit => inch
 #define WTMM(x)     ((double)(x) / 1800. * 25.4)  // unit => mm
@@ -53,14 +53,14 @@
 #define sXML_CDATA "CDATA"
 
 #define STARTP  padd( "text:style-name", "CDATA", ascii(getPStyleName(((ParaShape &)para->GetParaShape()).index,buf))); \
-    rstartEl( "text:p",rList ); \
-    pList->clear(); \
+    rstartEl( "text:p",mxList.get() ); \
+    mxList->clear(); \
     pstart = true
 #define STARTT \
     curr = para->GetCharShape(n > 0 ? n-1 : 0)->index; \
     padd( "text:style-name", "CDATA" , ascii( getTStyleName(curr, buf) ) ); \
-    rstartEl( "text:span",rList ); \
-    pList->clear(); \
+    rstartEl( "text:span",mxList.get() ); \
+    mxList->clear(); \
     tstart = true
 #define ENDP \
     rendEl("text:p"); \
@@ -106,15 +106,13 @@ struct HwpReaderPrivate
 
 HwpReader::HwpReader()
 {
-    pList = new AttributeListImpl;
-    rList = static_cast<XAttributeList *>(pList);
+    mxList = new AttributeListImpl;
     d = new HwpReaderPrivate;
 }
 
 
 HwpReader::~HwpReader()
 {
-    rList = nullptr;
     delete d;
 }
 
@@ -187,8 +185,8 @@ sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor) throw(R
     padd("xmlns:form", "CDATA", "http://openoffice.org/2000/form");
     padd("xmlns:script", "CDATA", "http://openoffice.org/2000/script");
 
-    rstartEl("office:document", rList);
-    pList->clear();
+    rstartEl("office:document", mxList.get());
+    mxList->clear();
 
     makeMeta();
     makeStyles();
@@ -209,7 +207,7 @@ sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor) throw(R
  */
 void HwpReader::makeBody()
 {
-    rstartEl("office:body", rList);
+    rstartEl("office:body", mxList.get());
     makeTextDecls();
     HWPPara *hwppara = hwpfile.GetFirstPara();
     d->bInBody = true;
@@ -224,26 +222,26 @@ void HwpReader::makeBody()
  */
 void HwpReader::makeTextDecls()
 {
-    rstartEl("text:sequence-decls", rList);
+    rstartEl("text:sequence-decls", mxList.get());
     padd("text:display-outline-level", sXML_CDATA, "0");
     padd("text:name", sXML_CDATA, "Illustration");
-    rstartEl("text:sequence-decl", rList);
-    pList->clear();
+    rstartEl("text:sequence-decl", mxList.get());
+    mxList->clear();
     rendEl("text:sequence-decl");
     padd("text:display-outline-level", sXML_CDATA, "0");
     padd("text:name", sXML_CDATA, "Table");
-    rstartEl("text:sequence-decl", rList);
-    pList->clear();
+    rstartEl("text:sequence-decl", mxList.get());
+    mxList->clear();
     rendEl("text:sequence-decl");
     padd("text:display-outline-level", sXML_CDATA, "0");
     padd("text:name", sXML_CDATA, "Text");
-    rstartEl("text:sequence-decl", rList);
-    pList->clear();
+    rstartEl("text:sequence-decl", mxList.get());
+    mxList->clear();
     rendEl("text:sequence-decl");
     padd("text:display-outline-level", sXML_CDATA, "0");
     padd("text:name", sXML_CDATA, "Drawing");
-    rstartEl("text:sequence-decl", rList);
-    pList->clear();
+    rstartEl("text:sequence-decl", mxList.get());
+    mxList->clear();
     rendEl("text:sequence-decl");
     rendEl("text:sequence-decls");
 }
@@ -258,25 +256,25 @@ void HwpReader::makeMeta()
 {
     HWPInfo& hwpinfo = hwpfile.GetHWPInfo();
 
-    rstartEl("office:meta", rList);
+    rstartEl("office:meta", mxList.get());
 
     if (hwpinfo.summary.title[0])
     {
-        rstartEl("dc:title", rList);
+        rstartEl("dc:title", mxList.get());
         rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.title)));
         rendEl("dc:title");
     }
 
     if (hwpinfo.summary.subject[0])
     {
-        rstartEl("dc:subject", rList);
+        rstartEl("dc:subject", mxList.get());
         rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.subject)));
         rendEl("dc:subject");
     }
 
     if (hwpinfo.summary.author[0])
     {
-        rstartEl("meta:initial-creator", rList);
+        rstartEl("meta:initial-creator", mxList.get());
         rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.author)));
         rendEl("meta:initial-creator");
     }
@@ -340,41 +338,41 @@ void HwpReader::makeMeta()
         }
         sprintf(buf,"%d-%02d-%02dT%02d:%02d:00",year,month,day,hour,minute);
 
-        rstartEl( "meta:creation-date", rList );
+        rstartEl( "meta:creation-date", mxList.get() );
         rchars( ascii(buf));
         rendEl( "meta:creation-date" );
     }
 
     if (hwpinfo.summary.keyword[0][0] || hwpinfo.summary.etc[0][0])
     {
-        rstartEl("meta:keywords", rList);
+        rstartEl("meta:keywords", mxList.get());
         if (hwpinfo.summary.keyword[0][0])
         {
-            rstartEl("meta:keyword", rList);
+            rstartEl("meta:keyword", mxList.get());
             rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.keyword[0])));
             rendEl("meta:keyword");
         }
         if (hwpinfo.summary.keyword[1][0])
         {
-            rstartEl("meta:keyword", rList);
+            rstartEl("meta:keyword", mxList.get());
             rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.keyword[1])));
             rendEl("meta:keyword");
         }
         if (hwpinfo.summary.etc[0][0])
         {
-            rstartEl("meta:keyword", rList);
+            rstartEl("meta:keyword", mxList.get());
             rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.etc[0])));
             rendEl("meta:keyword");
         }
         if (hwpinfo.summary.etc[1][0])
         {
-            rstartEl("meta:keyword", rList);
+            rstartEl("meta:keyword", mxList.get());
             rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.etc[1])));
             rendEl("meta:keyword");
         }
         if (hwpinfo.summary.etc[2][0])
         {
-            rstartEl("meta:keyword", rList);
+            rstartEl("meta:keyword", mxList.get());
             rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.etc[2])));
             rendEl("meta:keyword");
         }
@@ -449,8 +447,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo )
                 padd( "draw:dots2-length", sXML_CDATA, Double2Str( LineStyle[prop->line_pstyle].dots2 * WTMM(prop->line_width)) + "cm");
             }
             padd( "draw:distance", sXML_CDATA, Double2Str( LineStyle[prop->line_pstyle].distance * WTMM(prop->line_width)) + "cm");
-            rstartEl( "draw:stroke-dash", rList);
-            pList->clear();
+            rstartEl( "draw:stroke-dash", mxList.get());
+            mxList->clear();
             rendEl( "draw:stroke-dash" );
         }
 
@@ -477,8 +475,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo )
                     padd("svg:viewBox", sXML_CDATA, "0 0 30 30");
                     padd("svg:d", sXML_CDATA, "m0 0h30v30h-30z");
                 }
-                rstartEl("draw:marker", rList);
-                pList->clear();
+                rstartEl("draw:marker", mxList.get());
+                mxList->clear();
                 rendEl("draw:marker");
             }
             if( prop->line_hstyle && !ArrowShape[prop->line_hstyle].bMade)
@@ -501,8 +499,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo )
                     padd("svg:viewBox", sXML_CDATA, "0 0 20 20");
                     padd("svg:d", sXML_CDATA, "m0 0h20v20h-20z");
                 }
-                rstartEl("draw:marker", rList);
-                pList->clear();
+                rstartEl("draw:marker", mxList.get());
+                mxList->clear();
                 rendEl("draw:marker");
             }
         }
@@ -566,8 +564,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo )
                 padd( "xlink:show", sXML_CDATA, "embed");
                 padd( "xlink:actuate", sXML_CDATA, "onLoad");
 
-                rstartEl( "draw:fill-image", rList);
-                pList->clear();
+                rstartEl( "draw:fill-image", mxList.get());
+                mxList->clear();
                 rendEl( "draw:fill-image");
             }
 /*  If there is a gradient, when a bitmap file is present, this is the first. */
@@ -648,8 +646,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo )
                     padd( "draw:angle", sXML_CDATA,
                         ascii(Int2Str( angle, "%d", buf)));
                 }
-                rstartEl( "draw:gradient", rList );
-                pList->clear();
+                rstartEl( "draw:gradient", mxList.get() );
+                mxList->clear();
                 rendEl( "draw:gradient");
             }
                                                   /* hatch */
@@ -685,8 +683,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo )
                         padd( "draw:rotation", sXML_CDATA, "450");
                         break;
                 }
-                rstartEl( "draw:hatch", rList);
-                pList->clear();
+                rstartEl( "draw:hatch", mxList.get());
+                mxList->clear();
                 rendEl( "draw:hatch");
             }
         }
@@ -699,7 +697,7 @@ void HwpReader::makeStyles()
 {
     HWPStyle& hwpstyle = hwpfile.GetHWPStyle();
 
-    rstartEl("office:styles", rList);
+    rstartEl("office:styles", mxList.get());
 
     int i;
     for (i = 0; i < hwpfile.getFBoxStyleCount(); i++)
@@ -713,21 +711,21 @@ void HwpReader::makeStyles()
     padd("style:name", sXML_CDATA, "Standard");
     padd("style:family", sXML_CDATA, "paragraph");
     padd("style:class", sXML_CDATA, "text");
-    rstartEl("style:style", rList);
-    pList->clear();
+    rstartEl("style:style", mxList.get());
+    mxList->clear();
 
     padd("fo:line-height", sXML_CDATA, "160%");
     padd("fo:text-align", sXML_CDATA, "justify");
-    rstartEl("style:properties", rList);
-    pList->clear();
-    rstartEl("style:tab-stops", rList);
+    rstartEl("style:properties", mxList.get());
+    mxList->clear();
+    rstartEl("style:tab-stops", mxList.get());
 
     for( i = 1 ; i < 40 ; i++)
     {
         padd("style:position", sXML_CDATA,
             Double2Str( WTI(1000 * i)) + "inch");
-        rstartEl("style:tab-stop", rList);
-        pList->clear();
+        rstartEl("style:tab-stop", mxList.get());
+        mxList->clear();
         rendEl("style:tab-stop");
     }
     rendEl("style:tab-stops");
@@ -742,15 +740,15 @@ void HwpReader::makeStyles()
         padd("style:family", sXML_CDATA, "paragraph");
         padd("style:parent-style-name", sXML_CDATA, "Standard");
 
-        rstartEl("style:style", rList);
+        rstartEl("style:style", mxList.get());
 
-        pList->clear();
+        mxList->clear();
 
         parseCharShape(hwpstyle.GetCharShape(ii));
         parseParaShape(hwpstyle.GetParaShape(ii));
 
-        rstartEl("style:properties", rList);
-        pList->clear();
+        rstartEl("style:properties", mxList.get());
+        mxList->clear();
         rendEl("style:properties");
 
         rendEl("style:style");
@@ -761,8 +759,8 @@ void HwpReader::makeStyles()
         padd( "style:family", sXML_CDATA, "paragraph");
         padd( "style:parent-style-name", sXML_CDATA, "Standard");
         padd( "style:class", sXML_CDATA, "extra");
-        rstartEl("style:style", rList);
-        pList->clear();
+        rstartEl("style:style", mxList.get());
+        mxList->clear();
         rendEl("style:style");
     }
 
@@ -771,8 +769,8 @@ void HwpReader::makeStyles()
         padd( "style:family", sXML_CDATA, "paragraph");
         padd( "style:parent-style-name", sXML_CDATA, "Standard");
         padd( "style:class", sXML_CDATA, "extra");
-        rstartEl("style:style", rList);
-        pList->clear();
+        rstartEl("style:style", mxList.get());
+        mxList->clear();
 
         rendEl("style:style");
     }
@@ -783,8 +781,8 @@ void HwpReader::makeStyles()
         padd( "style:family", sXML_CDATA, "paragraph");
         padd( "style:parent-style-name", sXML_CDATA, "Standard");
         padd( "style:class", sXML_CDATA, "html");
-        rstartEl( "style:style", rList);
-        pList->clear();
+        rstartEl( "style:style", mxList.get());
+        mxList->clear();
         padd( "fo:font-size", sXML_CDATA, "6pt");
         padd( "fo:margin-top", sXML_CDATA, "0cm");
         padd( "fo:margin-bottom", sXML_CDATA, "0cm");
@@ -794,8 +792,8 @@ void HwpReader::makeStyles()
         padd( "text:number-lines", sXML_CDATA, "false");
         padd( "text:line-number", sXML_CDATA, "0");
         padd("fo:line-height", sXML_CDATA, "100%");
-        rstartEl( "style:properties", rList);
-        pList->clear();
+        rstartEl( "style:properties", mxList.get());
+        mxList->clear();
         rendEl( "style:properties");
         rendEl( "style:style");
     }
@@ -806,8 +804,8 @@ void HwpReader::makeStyles()
     padd("text:num-format", sXML_CDATA, "1");
     if( hwpinfo.beginfnnum != 1)
         padd("text:offset", sXML_CDATA, ascii(Int2Str(hwpinfo.beginfnnum -1, "%d", buf)));
-    rstartEl("text:footnotes-configuration", rList);
-    pList->clear();
+    rstartEl("text:footnotes-configuration", mxList.get());
+    mxList->clear();
     rendEl("text:footnotes-configuration");
 
     rendEl("office:styles");
@@ -823,7 +821,7 @@ void HwpReader::makeAutoStyles()
 {
     int i;
 
-    rstartEl("office:automatic-styles", rList);
+    rstartEl("office:automatic-styles", mxList.get());
 
     for (i = 0; i < hwpfile.getParaShapeCount(); i++)
         makePStyle(hwpfile.getParaShape(i));
@@ -877,23 +875,23 @@ void HwpReader::makeAutoStyles()
             ascii(Int2Str(i,"PNPara%d", buf)));
         padd("style:family", sXML_CDATA, "paragraph");
         padd("style:parent-style-name", sXML_CDATA, "Standard");
-        rstartEl("style:style", rList);
-        pList->clear();
+        rstartEl("style:style", mxList.get());
+        mxList->clear();
         if( i == 1 )
             padd("fo:text-align", sXML_CDATA, "start");
         else if ( i == 2 )
             padd("fo:text-align", sXML_CDATA, "center");
         else if ( i == 3 )
             padd("fo:text-align", sXML_CDATA, "end");
-        rstartEl("style:properties", rList);
-        pList->clear();
+        rstartEl("style:properties", mxList.get());
+        mxList->clear();
         rendEl( "style:properties");
         rendEl( "style:style");
 
         padd("style:name", sXML_CDATA, ascii(Int2Str(i,"PNBox%d",buf)));
         padd("style:family", sXML_CDATA, "graphics");
-        rstartEl("style:style", rList);
-        pList->clear();
+        rstartEl("style:style", mxList.get());
+        mxList->clear();
 
         padd("fo:margin-top", sXML_CDATA, "0cm");
         padd("fo:margin-bottom", sXML_CDATA, "0cm");
@@ -910,8 +908,8 @@ void HwpReader::makeAutoStyles()
         padd("style:horizontal-rel", sXML_CDATA, "paragraph");
         padd("fo:padding", sXML_CDATA, "0cm");
         padd("stylefamily", sXML_CDATA, "graphics");
-        rstartEl("style:properties", rList);
-        pList->clear();
+        rstartEl("style:properties", mxList.get());
+        mxList->clear();
         rendEl("style:properties");
         rendEl("style:style");
     }
@@ -950,7 +948,7 @@ struct PageSetting
 
 void HwpReader::makeMasterStyles()
 {
-    rstartEl("office:master-styles", rList);
+    rstartEl("office:master-styles", mxList.get());
 
     int i;
     int nMax = hwpfile.getMaxSettedPage();
@@ -1043,8 +1041,8 @@ void HwpReader::makeMasterStyles()
                 ascii(Int2Str(i+1, "p%d", buf)));
         padd("draw:style-name", sXML_CDATA,
             ascii(Int2Str(i, "master%d", buf)));
-        rstartEl("style:master-page", rList);
-        pList->clear();
+        rstartEl("style:master-page", mxList.get());
+        mxList->clear();
 
         if( aSet[i].bIsSet )                      /* If you've changed the current setting */
         {
@@ -1094,17 +1092,17 @@ void HwpReader::makeMasterStyles()
         }
         else                                      /* If the previous settings doesn't exist, set to the default settings */
         {
-            rstartEl("style:header", rList);
+            rstartEl("style:header", mxList.get());
             padd("text:style-name", sXML_CDATA, "Standard");
-            rstartEl("text:p", rList);
-            pList->clear();
+            rstartEl("text:p", mxList.get());
+            mxList->clear();
             rendEl("text:p");
             rendEl("style:header");
 
-            rstartEl("style:footer", rList);
+            rstartEl("style:footer", mxList.get());
             padd("text:style-name", sXML_CDATA, "Standard");
-            rstartEl("text:p", rList);
-            pList->clear();
+            rstartEl("text:p", mxList.get());
+            mxList->clear();
             rendEl("text:p");
             rendEl("style:footer");
 
@@ -1115,7 +1113,7 @@ void HwpReader::makeMasterStyles()
 // header
         if( pPage->header )
         {
-            rstartEl("style:header", rList);
+            rstartEl("style:header", mxList.get());
             if( pPage->pagenumber && pPage->pagenumber->where < 4 )
             {
                 d->bInHeader = true;
@@ -1128,7 +1126,7 @@ void HwpReader::makeMasterStyles()
         }
         if( pPage->header_even )
         {
-            rstartEl("style:header", rList);
+            rstartEl("style:header", mxList.get());
             if( pPage->pagenumber && ( pPage->pagenumber->where < 4
                 || pPage->pagenumber->where == 7 ) )
             {
@@ -1145,10 +1143,10 @@ void HwpReader::makeMasterStyles()
                                                   /* Will be the default. */
         else if( pPage->header_odd && !pPage->header_even )
         {
-            rstartEl("style:header", rList);
+            rstartEl("style:header", mxList.get());
             padd("text:style-name", sXML_CDATA, "Standard");
-            rstartEl("text:p", rList);
-            pList->clear();
+            rstartEl("text:p", mxList.get());
+            mxList->clear();
             if( pPage->pagenumber && ( pPage->pagenumber->where < 4 ||
                 pPage->pagenumber->where == 7 ) )
             {
@@ -1163,7 +1161,7 @@ void HwpReader::makeMasterStyles()
         }
         if( pPage->header_odd )
         {
-            rstartEl("style:header-left", rList);
+            rstartEl("style:header-left", mxList.get());
             if( pPage->pagenumber && ( pPage->pagenumber->where < 4
                 || pPage->pagenumber->where == 7 ) )
             {
@@ -1180,10 +1178,10 @@ void HwpReader::makeMasterStyles()
                                                   /* Will be the default.  */
         else if( pPage->header_even && !pPage->header_odd )
         {
-            rstartEl("style:header-left", rList);
+            rstartEl("style:header-left", mxList.get());
             padd("text:style-name", sXML_CDATA, "Standard");
-            rstartEl("text:p", rList);
-            pList->clear();
+            rstartEl("text:p", mxList.get());
+            mxList->clear();
             if( pPage->pagenumber && ( pPage->pagenumber->where < 4 ||
                 pPage->pagenumber->where == 7 ) )
             {
@@ -1198,10 +1196,10 @@ void HwpReader::makeMasterStyles()
         }
         if( !pPage->header && !pPage->header_even && !pPage->header_odd )
         {
-            rstartEl("style:header", rList);
+            rstartEl("style:header", mxList.get());
             padd("text:style-name", sXML_CDATA, "Standard");
-            rstartEl("text:p", rList);
-            pList->clear();
+            rstartEl("text:p", mxList.get());
+            mxList->clear();
             if( pPage->pagenumber && (pPage->pagenumber->where < 4 ||
                 pPage->pagenumber->where == 7 ) )
             {
@@ -1215,7 +1213,7 @@ void HwpReader::makeMasterStyles()
 // footer
         if( pPage->footer )
         {
-            rstartEl("style:footer", rList);
+            rstartEl("style:footer", mxList.get());
             if( pPage->pagenumber && pPage->pagenumber->where >= 4
                 && pPage->pagenumber->where != 7 )
             {
@@ -1229,7 +1227,7 @@ void HwpReader::makeMasterStyles()
         }
         if( pPage->footer_even )
         {
-            rstartEl("style:footer", rList);
+            rstartEl("style:footer", mxList.get());
             if( pPage->pagenumber && pPage->pagenumber->where >= 4
                 && pPage->pagenumber->where != 7 )
             {
@@ -1246,10 +1244,10 @@ void HwpReader::makeMasterStyles()
                                                   /* Will be the default. */
         else if( pPage->footer_odd && !pPage->footer_even )
         {
-            rstartEl("style:footer", rList);
+            rstartEl("style:footer", mxList.get());
             padd("text:style-name", sXML_CDATA, "Standard");
-            rstartEl("text:p", rList);
-            pList->clear();
+            rstartEl("text:p", mxList.get());
+            mxList->clear();
             if( pPage->pagenumber && pPage->pagenumber->where >= 4
                 && pPage->pagenumber->where != 7 )
             {
@@ -1264,7 +1262,7 @@ void HwpReader::makeMasterStyles()
         }
         if( pPage->footer_odd )
         {
-            rstartEl("style:footer-left", rList);
+            rstartEl("style:footer-left", mxList.get());
             if( pPage->pagenumber && pPage->pagenumber->where >= 4
                 && pPage->pagenumber->where != 7 )
             {
@@ -1281,10 +1279,10 @@ void HwpReader::makeMasterStyles()
                                                   /* Will be the default. */
         else if( pPage->footer_even && !pPage->footer_odd )
         {
-            rstartEl("style:footer-left", rList);
+            rstartEl("style:footer-left", mxList.get());
             padd("text:style-name", sXML_CDATA, "Standard");
-            rstartEl("text:p", rList);
-            pList->clear();
+            rstartEl("text:p", mxList.get());
+            mxList->clear();
             if( pPage->pagenumber && pPage->pagenumber->where >= 4
                 && pPage->pagenumber->where != 7 )
             {
@@ -1299,10 +1297,10 @@ void HwpReader::makeMasterStyles()
         }
         if( !pPage->footer && !pPage->footer_even && !pPage->footer_odd )
         {
-            rstartEl("style:footer", rList);
+            rstartEl("style:footer", mxList.get());
             padd("text:style-name", sXML_CDATA, "Standard");
-            rstartEl("text:p", rList);
-            pList->clear();
+            rstartEl("text:p", mxList.get());
+            mxList->clear();
             if( pPage->pagenumber && pPage->pagenumber->where >= 4
                 && pPage->pagenumber->where != 7 )
             {
@@ -1475,17 +1473,17 @@ void HwpReader::makePStyle(ParaShape * pshape)
     padd("style:name", sXML_CDATA,
         ascii(Int2Str(pshape->index, "P%d", buf)));
     padd("style:family", sXML_CDATA, "paragraph");
-    rstartEl("style:style", rList);
-    pList->clear();
+    rstartEl("style:style", mxList.get());
+    mxList->clear();
     parseParaShape(pshape);
     parseCharShape(pshape->cshape);
-    rstartEl("style:properties", rList);
-    pList->clear();
+    rstartEl("style:properties", mxList.get());
+    mxList->clear();
 
     if( nscount )
     {
         unsigned char tf = 0;
-        rstartEl("style:tab-stops",rList);
+        rstartEl("style:tab-stops",mxList.get());
 
           int tab_margin = pshape->left_margin + pshape->indent;
           if( tab_margin < 0 )
@@ -1520,8 +1518,8 @@ void HwpReader::makePStyle(ParaShape * pshape)
                 tf = 1;
                 padd("style:leader-char", sXML_CDATA, ".");
             }
-            rstartEl( "style:tab-stop", rList);
-            pList->clear();
+            rstartEl( "style:tab-stop", mxList.get());
+            mxList->clear();
             rendEl( "style:tab-stop" );
 
             if( (pshape->tabs[i].position != 1000 * i ) || tf )
@@ -1547,8 +1545,8 @@ void HwpReader::makePageStyle()
 
      for( int i = 0 ; i < pmCount ; i++ ){
          padd("style:name", sXML_CDATA, ascii(Int2Str(i + 1, "pm%d", buf)));
-         rstartEl("style:page-master",rList);
-         pList->clear();
+         rstartEl("style:page-master",mxList.get());
+         mxList->clear();
 
 
          switch( hwpinfo.paper.paper_kind )
@@ -1711,8 +1709,8 @@ void HwpReader::makePageStyle()
              }
          }
 
-         rstartEl("style:properties",rList);
-         pList->clear();
+         rstartEl("style:properties",mxList.get());
+         mxList->clear();
 
      /* background image */
          if( hwpinfo.back_info.isset && hwpinfo.back_info.type > 0 )
@@ -1734,11 +1732,11 @@ void HwpReader::makePageStyle()
                  padd("style:repeat", sXML_CDATA, "no-repeat");
                  padd("style:position", sXML_CDATA, "center");
              }
-             rstartEl("style:background-image",rList);
+             rstartEl("style:background-image",mxList.get());
 
              if( hwpinfo.back_info.type == 2 ){
-                 rstartEl("office:binary-data", rList);
-                 pList->clear();
+                 rstartEl("office:binary-data", mxList.get());
+                 mxList->clear();
                  std::shared_ptr<char> pStr(base64_encode_string(reinterpret_cast<unsigned char *>(hwpinfo.back_info.data), hwpinfo.back_info.size ), Free<char>());
                  rchars(ascii(pStr.get()));
                  rendEl("office:binary-data");
@@ -1751,35 +1749,35 @@ void HwpReader::makePageStyle()
          rendEl("style:properties");
 
     /* header style */
-         rstartEl("style:header-style", rList);
+         rstartEl("style:header-style", mxList.get());
          padd("svg:height", sXML_CDATA,
               Double2Str(WTI(hwpinfo.paper.header_length)) + "inch");
          padd("fo:margin-bottom", sXML_CDATA, "0mm");
 
-         rstartEl("style:properties",rList);
-         pList->clear();
+         rstartEl("style:properties",mxList.get());
+         mxList->clear();
          rendEl("style:properties");
          rendEl("style:header-style");
 
     /* footer style */
-         rstartEl("style:footer-style", rList);
+         rstartEl("style:footer-style", mxList.get());
          padd("svg:height", sXML_CDATA,
               Double2Str(WTI(hwpinfo.paper.footer_length)) + "inch");
          padd("fo:margin-top", sXML_CDATA, "0mm");
-         rstartEl("style:properties",rList);
-         pList->clear();
+         rstartEl("style:properties",mxList.get());
+         mxList->clear();
          rendEl("style:properties");
          rendEl("style:footer-style");
 
     /* Footnote style, but it fell in the dtd, the specification has been defined. REALKING */
-         rstartEl("style:footnote-layout", rList);
+         rstartEl("style:footnote-layout", mxList.get());
 
          padd("style:distance-before-sep", sXML_CDATA,
               Double2Str(WTI(hwpinfo.splinetext)) + "inch");
          padd("style:distance-after-sep", sXML_CDATA,
               Double2Str(WTI(hwpinfo.splinefn)) + "inch");
-         rstartEl("style:properties",rList);
-         pList->clear();
+         rstartEl("style:properties",mxList.get());
+         mxList->clear();
          rendEl("style:properties");
          if ( hwpinfo.fnlinetype == 2 )
               padd("style:width", sXML_CDATA, "15cm");
@@ -1790,8 +1788,8 @@ void HwpReader::makePageStyle()
          else
               padd("style:width", sXML_CDATA, "5cm");
 
-         rstartEl("style:footnote-sep",rList);
-         pList->clear();
+         rstartEl("style:footnote-sep",mxList.get());
+         mxList->clear();
          rendEl("style:footnote-sep");
 
          rendEl("style:footnote-layout");
@@ -1804,8 +1802,8 @@ void HwpReader::makeColumns(ColumnDef *coldef)
 {
     if( !coldef ) return;
   padd("fo:column-count", sXML_CDATA, ascii(Int2Str(coldef->ncols, "%d", buf)));
-  rstartEl("style:columns",rList);
-  pList->clear();
+  rstartEl("style:columns",mxList.get());
+  mxList->clear();
   if( coldef->separator != 0 )
   {
         switch( coldef->separator )
@@ -1826,8 +1824,8 @@ void HwpReader::makeColumns(ColumnDef *coldef)
                   padd("style:style", sXML_CDATA, "none");
                   break;
         }
-        rstartEl("style:column-sep",rList);
-        pList->clear();
+        rstartEl("style:column-sep",mxList.get());
+        mxList->clear();
         rendEl("style:column-sep");
   }
   double spacing = WTI(coldef->spacing)/ 2. ;
@@ -1843,8 +1841,8 @@ void HwpReader::makeColumns(ColumnDef *coldef)
         else
              padd("fo:margin-right", sXML_CDATA,
                   Double2Str( spacing) + "inch");
-        rstartEl("style:column",rList);
-        pList->clear();
+        rstartEl("style:column",mxList.get());
+        mxList->clear();
         rendEl("style:column");
   }
   rendEl("style:columns");
@@ -1855,11 +1853,11 @@ void HwpReader::makeTStyle(CharShape * cshape)
     padd("style:name", sXML_CDATA,
         ascii(Int2Str(cshape->index, "T%d", buf)));
     padd("style:family", sXML_CDATA, "text");
-    rstartEl("style:style", rList);
-    pList->clear();
+    rstartEl("style:style", mxList.get());
+    mxList->clear();
     parseCharShape(cshape);
-    rstartEl("style:properties", rList);
-    pList->clear();
+    rstartEl("style:properties", mxList.get());
+    mxList->clear();
     rendEl("style:properties");
     rendEl("style:style");
 }
@@ -1873,14 +1871,14 @@ void HwpReader::makeTableStyle(Table *tbl)
     padd("style:name", sXML_CDATA,
         ascii(Int2Str(hbox->style.boxnum, "Table%d", buf)));
     padd("style:family", sXML_CDATA,"table");
-    rstartEl("style:style", rList);
-    pList->clear();
+    rstartEl("style:style", mxList.get());
+    mxList->clear();
     padd("style:width", sXML_CDATA,
         Double2Str(WTMM(hbox->box_xs)) + "mm");
     padd("table:align", sXML_CDATA,"left");
     padd("fo:keep-with-next", sXML_CDATA,"false");
-    rstartEl("style:properties", rList);
-    pList->clear();
+    rstartEl("style:properties", mxList.get());
+    mxList->clear();
     rendEl("style:properties");
     rendEl("style:style");
 
@@ -1890,12 +1888,12 @@ void HwpReader::makeTableStyle(Table *tbl)
         sprintf(buf,"Table%d.%c",hbox->style.boxnum, static_cast<char>('A'+i));
         padd("style:name", sXML_CDATA, ascii( buf ));
         padd("style:family", sXML_CDATA,"table-column");
-        rstartEl("style:style", rList);
-        pList->clear();
+        rstartEl("style:style", mxList.get());
+        mxList->clear();
         padd("style:column-width", sXML_CDATA,
             Double2Str(WTMM(tbl->columns.data[i+1] - tbl->columns.data[i])) + "mm");
-        rstartEl("style:properties", rList);
-        pList->clear();
+        rstartEl("style:properties", mxList.get());
+        mxList->clear();
         rendEl("style:properties");
         rendEl("style:style");
     }
@@ -1906,12 +1904,12 @@ void HwpReader::makeTableStyle(Table *tbl)
         sprintf(buf,"Table%d.row%" SAL_PRI_SIZET "u",hbox->style.boxnum, i + 1);
         padd("style:name", sXML_CDATA, ascii( buf ));
         padd("style:family", sXML_CDATA,"table-row");
-        rstartEl("style:style", rList);
-        pList->clear();
+        rstartEl("style:style", mxList.get());
+        mxList->clear();
         padd("style:row-height", sXML_CDATA,
             Double2Str(WTMM(tbl->rows.data[i+1] - tbl->rows.data[i])) + "mm");
-        rstartEl("style:properties", rList);
-        pList->clear();
+        rstartEl("style:properties", mxList.get());
+        mxList->clear();
         rendEl("style:properties");
         rendEl("style:style");
     }
@@ -1923,8 +1921,8 @@ void HwpReader::makeTableStyle(Table *tbl)
         sprintf(buf,"Table%d.%c%d",hbox->style.boxnum, 'A'+ tcell->nColumnIndex, tcell->nRowIndex +1);
         padd("style:name", sXML_CDATA, ascii( buf ));
         padd("style:family", sXML_CDATA,"table-cell");
-        rstartEl("style:style", rList);
-        pList->clear();
+        rstartEl("style:style", mxList.get());
+        mxList->clear();
         Cell *cl = tcell->pCell;
         if( cl->ver_align == 1 )
             padd("fo:vertical-align", sXML_CDATA,"middle");
@@ -2011,8 +2009,8 @@ void HwpReader::makeTableStyle(Table *tbl)
                 ascii(hcolor2str(sal::static_int_cast<uchar>(cl->color),
                                 sal::static_int_cast<uchar>(cl->shade), buf)));
 
-        rstartEl("style:properties", rList);
-        pList->clear();
+        rstartEl("style:properties", mxList.get());
+        mxList->clear();
         rendEl("style:properties");
 
         rendEl("style:style");
@@ -2028,8 +2026,8 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle)
             ascii(Int2Str(hdo->index, "Draw%d", buf)));
         padd("style:family", sXML_CDATA, "graphics");
 
-        rstartEl("style:style", rList);
-        pList->clear();
+        rstartEl("style:style", mxList.get());
+        mxList->clear();
 
         switch (fstyle->txtflow)
         {
@@ -2195,8 +2193,8 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle)
             padd("style:vertical-rel", sXML_CDATA, "baseline");
         }
 
-        rstartEl("style:properties", rList);
-        pList->clear();
+        rstartEl("style:properties", mxList.get());
+        mxList->clear();
         rendEl("style:properties");
         rendEl("style:style");
 
@@ -2214,8 +2212,8 @@ void HwpReader::makeCaptionStyle(FBoxStyle * fstyle)
     padd("style:name", sXML_CDATA,
         ascii(Int2Str(fstyle->boxnum, "CapBox%d", buf)));
     padd("style:family", sXML_CDATA, "graphics");
-    rstartEl("style:style", rList);
-    pList->clear();
+    rstartEl("style:style", mxList.get());
+    mxList->clear();
     padd("fo:margin-left", sXML_CDATA, "0cm");
     padd("fo:margin-right", sXML_CDATA, "0cm");
     padd("fo:margin-top", sXML_CDATA, "0cm");
@@ -2282,8 +2280,8 @@ void HwpReader::makeCaptionStyle(FBoxStyle * fstyle)
             padd("style:horizontal-rel", sXML_CDATA, "page-content");
         }
     }
-    rstartEl("style:properties", rList);
-    pList->clear();
+    rstartEl("style:properties", mxList.get());
+    mxList->clear();
     rendEl("style:properties");
     rendEl("style:style");
     if( fstyle->boxtype == 'G' )
@@ -2298,8 +2296,8 @@ void HwpReader::makeCaptionStyle(FBoxStyle * fstyle)
     }
 
     padd("style:family", sXML_CDATA, "graphics");
-    rstartEl("style:style", rList);
-    pList->clear();
+    rstartEl("style:style", mxList.get());
+    mxList->clear();
 
     padd("fo:margin-left", sXML_CDATA, "0cm");
     padd("fo:margin-right", sXML_CDATA, "0cm");
@@ -2414,8 +2412,8 @@ void HwpReader::makeCaptionStyle(FBoxStyle * fstyle)
             sal::static_int_cast<uchar>(cell->color),
             sal::static_int_cast<uchar>(cell->shade), buf)));
     }
-    rstartEl("style:properties", rList);
-    pList->clear();
+    rstartEl("style:properties", mxList.get());
+    mxList->clear();
     rendEl("style:properties");
     rendEl("style:style");
 }
@@ -2455,8 +2453,8 @@ void HwpReader::makeFStyle(FBoxStyle * fstyle)
             break;
     }
 
-    rstartEl("style:style", rList);
-    pList->clear();
+    rstartEl("style:style", mxList.get());
+    mxList->clear();
 
     if ( fstyle->boxtype == 'T')
     {
@@ -2675,8 +2673,8 @@ void HwpReader::makeFStyle(FBoxStyle * fstyle)
             padd("draw:color-mode", sXML_CDATA, "mono");
 
     }
-    rstartEl("style:properties", rList);
-    pList->clear();
+    rstartEl("style:properties", mxList.get());
+    mxList->clear();
     rendEl("style:properties");
     rendEl("style:style");
 }
@@ -2715,8 +2713,8 @@ void HwpReader::make_text_p0(HWPPara * para, bool bParaStart)
     {
         padd("text:style-name", sXML_CDATA,
             ascii(getPStyleName(para->GetParaShape().index, buf)));
-        rstartEl("text:p", rList);
-        pList->clear();
+        rstartEl("text:p", mxList.get());
+        mxList->clear();
     }
     if( d->bFirstPara && d->bInBody )
     {
@@ -2727,8 +2725,8 @@ void HwpReader::make_text_p0(HWPPara * para, bool bParaStart)
             // U+C758 HANGUL SYLLABLE YI, U+CC98 HANGUL SYLLABLE CEO,
             // U+C74C HANGUL SYLLABLE EUM: "Begin of Document"
         padd("text:name", sXML_CDATA, OUString(buf, strlen(buf), RTL_TEXTENCODING_UTF8));
-        rstartEl("text:bookmark", rList);
-        pList->clear();
+        rstartEl("text:bookmark", mxList.get());
+        mxList->clear();
         rendEl("text:bookmark");
         d->bFirstPara = false;
     }
@@ -2739,8 +2737,8 @@ void HwpReader::make_text_p0(HWPPara * para, bool bParaStart)
     }
     padd("text:style-name", sXML_CDATA,
         ascii(getTStyleName(para->cshape.index, buf)));
-    rstartEl("text:span", rList);
-    pList->clear();
+    rstartEl("text:span", mxList.get());
+    mxList->clear();
 
     for (n = 0; n < para->nch && para->hhstr[n]->hh;
         n += para->hhstr[n]->WSize())
@@ -2748,7 +2746,7 @@ void HwpReader::make_text_p0(HWPPara * para, bool bParaStart)
         if (para->hhstr[n]->hh == CH_SPACE && !firstspace)
         {
             makeChars(str);
-            rstartEl("text:s", rList);
+            rstartEl("text:s", mxList.get());
             rendEl("text:s");
         }
         else if (para->hhstr[n]->hh == CH_END_PARA)
@@ -2790,8 +2788,8 @@ void HwpReader::make_text_p1(HWPPara * para,bool bParaStart)
     {
         padd("text:style-name", sXML_CDATA,
             ascii(getPStyleName(para->GetParaShape().index, buf)));
-        rstartEl("text:p", rList);
-        pList->clear();
+        rstartEl("text:p", mxList.get());
+        mxList->clear();
     }
     if( d->bFirstPara && d->bInBody )
     {
@@ -2803,8 +2801,8 @@ void HwpReader::make_text_p1(HWPPara * para,bool bParaStart)
             // U+C758 HANGUL SYLLABLE YI, U+CC98 HANGUL SYLLABLE CEO,
             // U+C74C HANGUL SYLLABLE EUM: "Begin of Document"
         padd("text:name", sXML_CDATA, OUString(buf, strlen(buf), RTL_TEXTENCODING_UTF8));
-        rstartEl("text:bookmark", rList);
-        pList->clear();
+        rstartEl("text:bookmark", mxList.get());
+        mxList->clear();
         rendEl("text:bookmark");
         d->bFirstPara = false;
     }
@@ -2815,8 +2813,8 @@ void HwpReader::make_text_p1(HWPPara * para,bool bParaStart)
     }
     padd("text:style-name", sXML_CDATA,
         ascii(getTStyleName(curr, buf)));
-    rstartEl("text:span", rList);
-    pList->clear();
+    rstartEl("text:span", mxList.get());
+    mxList->clear();
 
     for (n = 0; n < para->nch && para->hhstr[n]->hh;
         n += para->hhstr[n]->WSize())
@@ -2828,13 +2826,13 @@ void HwpReader::make_text_p1(HWPPara * para,bool bParaStart)
             curr = para->GetCharShape(n)->index;
             padd("text:style-name", sXML_CDATA,
                 ascii(getTStyleName(curr, buf)));
-            rstartEl("text:span", rList);
-            pList->clear();
+            rstartEl("text:span", mxList.get());
+            mxList->clear();
         }
         if (para->hhstr[n]->hh == CH_SPACE && !firstspace)
         {
             makeChars(str);
-            rstartEl("text:s", rList);
+            rstartEl("text:s", mxList.get());
             rendEl("text:s");
         }
         else if (para->hhstr[n]->hh == CH_END_PARA)
@@ -2887,8 +2885,8 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart)
             // U+C758 HANGUL SYLLABLE YI, U+CC98 HANGUL SYLLABLE CEO,
             // U+C74C HANGUL SYLLABLE EUM: "Begin of Document"
         padd("text:name", sXML_CDATA, OUString(buf, strlen(buf), RTL_TEXTENCODING_UTF8));
-        rstartEl("text:bookmark", rList);
-        pList->clear();
+        rstartEl("text:bookmark", mxList.get());
+        mxList->clear();
         rendEl("text:bookmark");
         d->bFirstPara = false;
     }
@@ -2922,8 +2920,8 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart)
             if( !pstart ) {STARTP;}
             if( !tstart ) {STARTT;}
             makeChars(str);
-            rstartEl("text:s", rList);
-            pList->clear();
+            rstartEl("text:s", mxList.get());
+            mxList->clear();
             rendEl("text:s");
         }
         else if ( para->hhstr[n]->hh >= CH_SPACE )
@@ -2948,7 +2946,7 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart)
         }
         else if (para->hhstr[n]->hh == CH_FIELD)
         {
-            FieldCode *hbox = static_cast<FieldCode *>(para->hhstr[n]);
+            FieldCode *hbox = static_cast<FieldCode*>(para->hhstr[n].get());
             if( hbox->location_info == 1)
             {
                 if( !pstart ) {STARTP;}
@@ -2984,7 +2982,7 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart)
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
                     makeChars(str);
-                    makeBookmark(static_cast<Bookmark *>(para->hhstr[n]));
+                    makeBookmark(static_cast<Bookmark*>(para->hhstr[n].get()));
                     break;
                 case CH_DATE_FORM:                // 7
                     break;
@@ -2992,7 +2990,7 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart)
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
                     makeChars(str);
-                    makeDateCode(static_cast<DateCode *>(para->hhstr[n]));
+                    makeDateCode(static_cast<DateCode*>(para->hhstr[n].get()));
                     break;
                 case CH_TAB:                      // 9
                     if( !pstart ) {STARTP;}
@@ -3001,12 +2999,12 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart)
                         if( !tstart ) {STARTT;}
                         makeChars(str);
                     }
-                    makeTab(static_cast<Tab *>(para->hhstr[n]));
+                    makeTab(static_cast<Tab*>(para->hhstr[n].get()));
                     break;
                 case CH_TEXT_BOX:                 /* 10 - ordered by Table/text box/formula/button/hypertext */
                 {
-/* produce tables first, and treat formula as being in text:p. */
-                    TxtBox *hbox = static_cast<TxtBox *>(para->hhstr[n]);
+                    /* produce tables first, and treat formula as being in text:p. */
+                    TxtBox *hbox = static_cast<TxtBox*>(para->hhstr[n].get());
 
                     if( hbox->style.anchor_type == 0 )
                     {
@@ -3040,7 +3038,7 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart)
                 }
                 case CH_PICTURE:                  // 11
                 {
-                    Picture *hbox = static_cast<Picture *>(para->hhstr[n]);
+                    Picture *hbox = static_cast<Picture*>(para->hhstr[n].get());
                     if( hbox->style.anchor_type == 0 )
                     {
                         if( !pstart ) {STARTP;}
@@ -3062,7 +3060,7 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart)
                 }
                 case CH_LINE:                     // 14
                 {
-                    Line *hbox = static_cast<Line *>(para->hhstr[n]);
+                    Line *hbox = static_cast<Line*>(para->hhstr[n].get());
                     if (str.size() > 0)
                     {
                         if( !pstart ) {STARTP;}
@@ -3079,19 +3077,19 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart)
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
                     makeChars(str);
-                    makeHidden(static_cast<Hidden *>(para->hhstr[n]));
+                    makeHidden(static_cast<Hidden*>(para->hhstr[n].get()));
                     break;
                 case CH_FOOTNOTE:                 // 17
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
                     makeChars(str);
-                    makeFootnote(static_cast<Footnote *>(para->hhstr[n]));
+                    makeFootnote(static_cast<Footnote*>(para->hhstr[n].get()));
                     break;
                 case CH_AUTO_NUM:                 // 18
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
                     makeChars(str);
-                    makeAutoNum(static_cast<AutoNum *>(para->hhstr[n]));
+                    makeAutoNum(static_cast<AutoNum*>(para->hhstr[n].get()));
                     break;
                 case CH_NEW_NUM:                  // 19 -skip
                     break;
@@ -3101,7 +3099,7 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart)
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
                     makeChars(str);
-                    makeMailMerge(static_cast<MailMerge *>(para->hhstr[n]));
+                    makeMailMerge(static_cast<MailMerge*>(para->hhstr[n].get()));
                     break;
                 case CH_COMPOSE:                  /* 23 - overlapping letters */
                     break;
@@ -3121,7 +3119,7 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart)
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
                     makeChars(str);
-                    makeOutline(static_cast<Outline *>(para->hhstr[n]));
+                    makeOutline(static_cast<Outline *>(para->hhstr[n].get()));
                     break;
                      case CH_FIXED_SPACE:
                      case CH_KEEP_SPACE:
@@ -3141,8 +3139,8 @@ void HwpReader::makeFieldCode(hchar_string & rStr, FieldCode *hbox)
         padd("text:placeholder-type", sXML_CDATA, "text");
           if( field )
               padd("text:description", sXML_CDATA, reinterpret_cast<sal_Unicode const *>(hconv(field)));
-        rstartEl( "text:placeholder", rList);
-        pList->clear();
+        rstartEl( "text:placeholder", mxList.get());
+        mxList->clear();
         rchars( reinterpret_cast<sal_Unicode const *>(rStr.c_str()) );
         rendEl( "text:placeholder" );
     }
@@ -3151,25 +3149,25 @@ void HwpReader::makeFieldCode(hchar_string & rStr, FieldCode *hbox)
     {
         if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "title")
         {
-            rstartEl( "text:title", rList );
+            rstartEl( "text:title", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:title" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "subject")
         {
-            rstartEl( "text:subject", rList );
+            rstartEl( "text:subject", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:subject" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "author")
         {
-            rstartEl( "text:author-name", rList );
+            rstartEl( "text:author-name", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:author-name" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "keywords")
         {
-            rstartEl( "text:keywords", rList );
+            rstartEl( "text:keywords", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:keywords" );
         }
@@ -3179,61 +3177,61 @@ void HwpReader::makeFieldCode(hchar_string & rStr, FieldCode *hbox)
     {
         if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "User")
         {
-            rstartEl( "text:sender-lastname", rList );
+            rstartEl( "text:sender-lastname", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:sender-lastname" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "Company")
         {
-            rstartEl( "text:sender-company", rList );
+            rstartEl( "text:sender-company", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:sender-company" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "Position")
         {
-            rstartEl( "text:sender-title", rList );
+            rstartEl( "text:sender-title", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:sender-title" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "Division")
         {
-            rstartEl( "text:sender-position", rList );
+            rstartEl( "text:sender-position", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:sender-position" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "Fax")
         {
-            rstartEl( "text:sender-fax", rList );
+            rstartEl( "text:sender-fax", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:sender-fax" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "Pager")
         {
-            rstartEl( "text:phone-private", rList );
+            rstartEl( "text:phone-private", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:phone-private" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "E-mail")
         {
-            rstartEl( "text:sender-email", rList );
+            rstartEl( "text:sender-email", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:sender-email" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "Zipcode(office)")
         {
-            rstartEl( "text:sender-postal-code", rList );
+            rstartEl( "text:sender-postal-code", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:sender-postal-code" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "Phone(office)")
         {
-            rstartEl( "text:sender-phone-work", rList );
+            rstartEl( "text:sender-phone-work", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:sender-phone-work" );
         }
         else if (OUString(reinterpret_cast<sal_Unicode const *>(hconv(hbox->str3))) == "Address(office)")
         {
-            rstartEl( "text:sender-street", rList );
+            rstartEl( "text:sender-street", mxList.get() );
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:sender-street" );
         }
@@ -3244,8 +3242,8 @@ void HwpReader::makeFieldCode(hchar_string & rStr, FieldCode *hbox)
          if( hbox->m_pDate )
              padd("style:data-style-name", sXML_CDATA,
                      ascii(Int2Str(hbox->m_pDate->key, "N%d", buf)));
-            rstartEl( "text:creation-date", rList );
-            pList->clear();
+            rstartEl( "text:creation-date", mxList.get() );
+            mxList->clear();
             rchars( reinterpret_cast<sal_Unicode const *>(hconv(hbox->str2)) );
             rendEl( "text:creation-date" );
      }
@@ -3261,22 +3259,22 @@ void HwpReader::makeBookmark(Bookmark * hbox)
     if (hbox->type == 0)
     {
         padd("text:name", sXML_CDATA, reinterpret_cast<sal_Unicode const *>(hconv(hbox->id)));
-        rstartEl("text:bookmark", rList);
-        pList->clear();
+        rstartEl("text:bookmark", mxList.get());
+        mxList->clear();
         rendEl("text:bookmark");
     }
     else if (hbox->type == 1)                     /* Block bookmarks days begin and end there if */
     {
         padd("text:name", sXML_CDATA, reinterpret_cast<sal_Unicode const *>(hconv(hbox->id)));
-        rstartEl("text:bookmark-start", rList);
-        pList->clear();
+        rstartEl("text:bookmark-start", mxList.get());
+        mxList->clear();
         rendEl("text:bookmark-start");
     }
     else if (hbox->type == 2)
     {
         padd("text:name", sXML_CDATA, reinterpret_cast<sal_Unicode const *>(hconv(hbox->id)));
-        rstartEl("text:bookmark-end", rList);
-        pList->clear();
+        rstartEl("text:bookmark-end", mxList.get());
+        mxList->clear();
         rendEl("text:bookmark-end");
     }
 }
@@ -3292,8 +3290,8 @@ void HwpReader::makeDateFormat(DateCode * hbox)
     padd("number:language", sXML_CDATA,"ko");
     padd("number:country", sXML_CDATA,"KR");
 
-    rstartEl("number:date-style", rList);
-    pList->clear();
+    rstartEl("number:date-style", mxList.get());
+    mxList->clear();
 
     bool add_zero = false;
     int zero_check = 0;
@@ -3318,67 +3316,67 @@ void HwpReader::makeDateFormat(DateCode * hbox)
                 break;
             case '1':
                 padd("number:style", sXML_CDATA, "long");
-                rstartEl("number:year", rList);
-                pList->clear();
+                rstartEl("number:year", mxList.get());
+                mxList->clear();
                 rendEl("number:year");
                 break;
             case '!':
-                rstartEl("number:year", rList);
-                pList->clear();
+                rstartEl("number:year", mxList.get());
+                mxList->clear();
                 rendEl("number:year");
                 break;
             case '2':
                 if( add_zero )
                     padd("number:style", sXML_CDATA, "long");
-                rstartEl("number:month", rList);
-                pList->clear();
+                rstartEl("number:month", mxList.get());
+                mxList->clear();
                 rendEl("number:month");
                 break;
             case '@':
                 padd("number:textual", sXML_CDATA, "true");
-                rstartEl("number:month", rList);
-                pList->clear();
+                rstartEl("number:month", mxList.get());
+                mxList->clear();
                 rendEl("number:month");
                 break;
             case '*':
                 padd("number:textual", sXML_CDATA, "true");
                 padd("number:style", sXML_CDATA, "long");
-                rstartEl("number:month", rList);
-                pList->clear();
+                rstartEl("number:month", mxList.get());
+                mxList->clear();
                 rendEl("number:month");
                 break;
             case '3':
                 if( add_zero )
                     padd("number:style", sXML_CDATA, "long");
-                rstartEl("number:day", rList);
-                pList->clear();
+                rstartEl("number:day", mxList.get());
+                mxList->clear();
                 rendEl("number:day");
                 break;
             case '#':
                 if( add_zero )
                     padd("number:style", sXML_CDATA, "long");
-                rstartEl("number:day", rList);
-                pList->clear();
+                rstartEl("number:day", mxList.get());
+                mxList->clear();
                 rendEl("number:day");
                 switch( hbox->date[DateCode::DAY]  % 10)
                 {
                     case 1:
-                        rstartEl("number:text", rList);
+                        rstartEl("number:text", mxList.get());
                         rchars("st");
                         rendEl("number:text");
                         break;
                     case 2:
-                        rstartEl("number:text", rList);
+                        rstartEl("number:text", mxList.get());
                         rchars("nd");
                         rendEl("number:text");
                         break;
                     case 3:
-                        rstartEl("number:text", rList);
+                        rstartEl("number:text", mxList.get());
                         rchars("rd");
                         rendEl("number:text");
                         break;
                     default:
-                        rstartEl("number:text", rList);
+                        rstartEl("number:text", mxList.get());
                         rchars("th");
                         rendEl("number:text");
                         break;
@@ -3388,16 +3386,16 @@ void HwpReader::makeDateFormat(DateCode * hbox)
             case '$':
                 if( add_zero )
                     padd("number:style", sXML_CDATA, "long");
-                rstartEl("number:hours", rList);
-                pList->clear();
+                rstartEl("number:hours", mxList.get());
+                mxList->clear();
                 rendEl("number:hours");
                 break;
             case '5':
             case '%':
                 if( add_zero )
                     padd("number:style", sXML_CDATA, "long");
-                rstartEl("number:minutes", rList);
-                pList->clear();
+                rstartEl("number:minutes", mxList.get());
+                mxList->clear();
                 rendEl("number:minutes");
                 break;
             case '_':
@@ -3405,15 +3403,15 @@ void HwpReader::makeDateFormat(DateCode * hbox)
                 SAL_FALLTHROUGH;
             case '6':
             case '^':
-                rstartEl("number:day-of-week", rList);
-                pList->clear();
+                rstartEl("number:day-of-week", mxList.get());
+                mxList->clear();
                 rendEl("number:day-of-week");
                 break;
             case '7':
             case '&':
             case '+':
-                rstartEl("number:am-pm", rList);
-                pList->clear();
+                rstartEl("number:am-pm", mxList.get());
+                mxList->clear();
                 rendEl("number:am-pm");
                 break;
             case '~':                             // Chinese Locale
@@ -3422,13 +3420,13 @@ void HwpReader::makeDateFormat(DateCode * hbox)
                 hchar sbuf[2];
                 sbuf[0] = *fmt;
                 sbuf[1] = 0;
-                rstartEl("number:text", rList);
+                rstartEl("number:text", mxList.get());
                 rchars(reinterpret_cast<sal_Unicode const *>(hconv(sbuf)));
                 rendEl("number:text");
                 break;
         }
     }
-    pList->clear();
+    mxList->clear();
     rendEl("number:date-style");
 }
 
@@ -3437,8 +3435,8 @@ void HwpReader::makeDateCode(DateCode * hbox)
 {
     padd("style:data-style-name", sXML_CDATA,
         ascii(Int2Str(hbox->key, "N%d", buf)));
-    rstartEl( "text:date", rList );
-    pList->clear();
+    rstartEl( "text:date", mxList.get() );
+    mxList->clear();
     hchar_string const boxstr = hbox->GetString();
     rchars(reinterpret_cast<sal_Unicode const *>(hconv(boxstr.c_str())));
     rendEl( "text:date" );
@@ -3447,7 +3445,7 @@ void HwpReader::makeDateCode(DateCode * hbox)
 
 void HwpReader::makeTab(Tab *  )                  /*hbox */
 {
-    rstartEl("text:tab-stop", rList);
+    rstartEl("text:tab-stop", mxList.get());
     rendEl("text:tab-stop");
 }
 
@@ -3458,8 +3456,8 @@ void HwpReader::makeTable(TxtBox * hbox)
         ascii(Int2Str(hbox->style.boxnum, "Table%d", buf)));
     padd("table:style-name", sXML_CDATA,
         ascii(Int2Str(hbox->style.boxnum, "Table%d", buf)));
-    rstartEl("table:table", rList);
-    pList->clear();
+    rstartEl("table:table", mxList.get());
+    mxList->clear();
 
     Table *tbl = hbox->m_pTable;
 // column
@@ -3467,8 +3465,8 @@ void HwpReader::makeTable(TxtBox * hbox)
     {
         sprintf(buf,"Table%d.%c",hbox->style.boxnum, static_cast<char>('A'+i));
         padd("table:style-name", sXML_CDATA, ascii( buf ));
-        rstartEl("table:table-column", rList);
-        pList->clear();
+        rstartEl("table:table-column", mxList.get());
+        mxList->clear();
         rendEl("table:table-column");
     }
 
@@ -3487,8 +3485,8 @@ void HwpReader::makeTable(TxtBox * hbox)
 // row
             sprintf(buf,"Table%d.row%d",hbox->style.boxnum, tcell->nRowIndex + 1);
             padd("table:style-name", sXML_CDATA, ascii( buf ));
-            rstartEl("table:table-row", rList);
-            pList->clear();
+            rstartEl("table:table-row", mxList.get());
+            mxList->clear();
             j = tcell->nRowIndex;
         }
 
@@ -3503,8 +3501,8 @@ void HwpReader::makeTable(TxtBox * hbox)
         padd("table:value-type", sXML_CDATA,"string");
         if( tcell->pCell->protect )
             padd("table:protected", sXML_CDATA,"true");
-        rstartEl("table:table-cell", rList);
-        pList->clear();
+        rstartEl("table:table-cell", mxList.get());
+        mxList->clear();
         parsePara(hbox->plists[tcell->pCell->key].front());
         rendEl("table:table-cell");
     }
@@ -3557,15 +3555,15 @@ void HwpReader::makeTextBox(TxtBox * hbox)
             Double2Str(WTMM(( hbox->box_xs + hbox->cap_xs) )) + "mm");
         padd("fo:min-height", sXML_CDATA,
             Double2Str(WTMM(( hbox->box_ys + hbox->cap_ys) )) + "mm");
-        rstartEl("draw:text-box", rList);
-        pList->clear();
+        rstartEl("draw:text-box", mxList.get());
+        mxList->clear();
         if( hbox->cap_pos % 2 )                   /* The caption is on the top */
         {
             parsePara(hbox->caption.front());
         }
         padd( "text:style-name", sXML_CDATA, "Standard");
-        rstartEl("text:p", rList);
-        pList->clear();
+        rstartEl("text:p", mxList.get());
+        mxList->clear();
     }
      else{
          padd("draw:z-index", sXML_CDATA,
@@ -3624,8 +3622,8 @@ void HwpReader::makeTextBox(TxtBox * hbox)
 
     if( hbox->type != EQU_TYPE )
     {
-        rstartEl("draw:text-box", rList);
-        pList->clear();
+        rstartEl("draw:text-box", mxList.get());
+        mxList->clear();
 /* If captions are present and it is on the top */
         if( hbox->style.cap_len > 0 && (hbox->cap_pos % 2) && hbox->type == TBL_TYPE )
         {
@@ -3658,8 +3656,8 @@ void HwpReader::makeTextBox(TxtBox * hbox)
     }
     else                                          // is Formula
     {
-        rstartEl("draw:object", rList);
-        pList->clear();
+        rstartEl("draw:object", mxList.get());
+        mxList->clear();
         makeFormula(hbox);
         rendEl("draw:object");
     }
@@ -3713,7 +3711,7 @@ void HwpReader::makeFormula(TxtBox * hbox)
 
     Formula *form = new Formula(mybuf);
     form->setDocumentHandler(m_rxDocumentHandler);
-    form->setAttributeListImpl(pList);
+    form->setAttributeListImpl(mxList.get());
     form->parse();
 
     delete form;
@@ -3760,8 +3758,8 @@ void HwpReader::makeHyperText(TxtBox * hbox)
         padd("xlink:href", sXML_CDATA,
                 OUString(tmp.c_str(), tmp.size()+1, RTL_TEXTENCODING_EUC_KR));
     }
-    rstartEl("draw:a", rList);
-    pList->clear();
+    rstartEl("draw:a", mxList.get());
+    mxList->clear();
     makeTextBox(hbox);
     rendEl("draw:a");
 }
@@ -3816,15 +3814,15 @@ void HwpReader::makePicture(Picture * hbox)
                     Double2Str(WTMM( hbox->box_xs + hbox->style.margin[1][0] + hbox->style.margin[1][1] )) + "mm");
                 padd("fo:min-height", sXML_CDATA,
                     Double2Str(WTMM( hbox->box_ys + hbox->style.margin[1][2] + hbox->style.margin[1][3] + hbox->cap_ys )) + "mm");
-                rstartEl("draw:text-box", rList);
-                pList->clear();
+                rstartEl("draw:text-box", mxList.get());
+                mxList->clear();
                 if( hbox->cap_pos % 2 )           /* Caption is on the top */
                 {
                     parsePara(hbox->caption.front());
                 }
                 padd( "text:style-name", sXML_CDATA, "Standard");
-                rstartEl("text:p", rList);
-                pList->clear();
+                rstartEl("text:p", mxList.get());
+                mxList->clear();
             }
             if( hbox->ishyper )
             {
@@ -3842,8 +3840,8 @@ void HwpReader::makePicture(Picture * hbox)
                     padd("xlink:href", sXML_CDATA,
                         reinterpret_cast<sal_Unicode const *>(hconv(kstr2hstr(reinterpret_cast<uchar const *>(urltounix(reinterpret_cast<char *>(hbox->follow + 5)).c_str())).c_str())));
 #endif
-                rstartEl("draw:a", rList);
-                pList->clear();
+                rstartEl("draw:a", mxList.get());
+                mxList->clear();
             }
             padd("draw:style-name", sXML_CDATA,
                 ascii(Int2Str(hbox->style.boxnum, "G%d", buf)));
@@ -3903,14 +3901,14 @@ void HwpReader::makePicture(Picture * hbox)
             }
 
                 if( hbox->pictype == PICTYPE_OLE )
-                    rstartEl("draw:object-ole", rList);
+                    rstartEl("draw:object-ole", mxList.get());
                 else
-                    rstartEl("draw:image", rList);
-            pList->clear();
+                    rstartEl("draw:image", mxList.get());
+            mxList->clear();
             if (hbox->pictype == PICTYPE_EMBED || hbox->pictype == PICTYPE_OLE)
             {
-                rstartEl("office:binary-data", rList);
-                pList->clear();
+                rstartEl("office:binary-data", mxList.get());
+                mxList->clear();
                      if( hbox->pictype == PICTYPE_EMBED ){
                          EmPicture *emp = hwpfile.GetEmPicture(hbox);
                          if( emp )
@@ -4020,8 +4018,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
 
         if (drawobj->type == HWPDO_CONTAINER)
         {
-            rstartEl("draw:g", rList);
-            pList->clear();
+            rstartEl("draw:g", mxList.get());
+            mxList->clear();
             makePictureDRAW(drawobj->child, hbox);
             rendEl("draw:g");
         }
@@ -4132,8 +4130,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
                             Double2Str (WTMM(y + b + drawobj->offset2.y + drawobj->extent.h)) + "mm");
                     }
 
-                    rstartEl("draw:line", rList);
-                    pList->clear();
+                    rstartEl("draw:line", mxList.get());
+                    mxList->clear();
                     rendEl("draw:line");
                     break;
                 case HWPDO_RECT:                  /* rectangle - the starting position, vertical/horizontal  */
@@ -4163,8 +4161,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
                             Double2Str (WTMM( value / 2)) + "mm");
                     }
 
-                    rstartEl("draw:rect", rList);
-                    pList->clear();
+                    rstartEl("draw:rect", mxList.get());
+                    mxList->clear();
                     if( (drawobj->property.flag & HWPDO_FLAG_AS_TEXTBOX) &&
                         drawobj->property.pPara ) // As Textbox
                     {
@@ -4211,8 +4209,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
                                     padd("draw:end-angle", sXML_CDATA, Double2Str(end_angle));
                                 }
                           }
-                    rstartEl("draw:ellipse", rList);
-                    pList->clear();
+                    rstartEl("draw:ellipse", mxList.get());
+                    mxList->clear();
                     if( drawobj->property.flag >> 19 & 0x01 &&
                         drawobj->property.pPara ) // As Textbox
                     {
@@ -4321,8 +4319,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
                                  padd("draw:end-angle", sXML_CDATA, "180");
                             }
                             }
-                    rstartEl("draw:ellipse", rList);
-                    pList->clear();
+                    rstartEl("draw:ellipse", mxList.get());
+                    mxList->clear();
                     if( drawobj->property.flag >> 19 & 0x01 &&
                         drawobj->property.pPara ) // As Textbox
                     {
@@ -4438,8 +4436,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
 
                     padd("svg:d", sXML_CDATA, oustr);
 
-                    rstartEl("draw:path", rList);
-                    pList->clear();
+                    rstartEl("draw:path", mxList.get());
+                    mxList->clear();
                                                   // As Textbox
                     if( drawobj->property.flag >> 19 & 0x01 && drawobj->property.pPara )
                     {
@@ -4501,8 +4499,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
 
                     if(bIsPolygon)
                     {
-                        rstartEl("draw:polygon", rList);
-                        pList->clear();
+                        rstartEl("draw:polygon", mxList.get());
+                        mxList->clear();
                         if( drawobj->property.flag >> 19 & 0x01 &&
                                                   // As Textbox
                             drawobj->property.pPara )
@@ -4519,8 +4517,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
                     }
                     else
                     {
-                        rstartEl("draw:polyline", rList);
-                        pList->clear();
+                        rstartEl("draw:polyline", mxList.get());
+                        mxList->clear();
                         if( drawobj->property.flag >> 19 & 0x01 &&
                                                   // As Textbox
                             drawobj->property.pPara )
@@ -4564,8 +4562,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
                             Double2Str (WTMM( value / 2)) + "mm");
                     }
 
-                    rstartEl("draw:text-box", rList);
-                    pList->clear();
+                    rstartEl("draw:text-box", mxList.get());
+                    mxList->clear();
 
                     HWPPara *pPara = drawobj->u.textbox.h;
                                 //parsePara(pPara);
@@ -4579,7 +4577,7 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
                     break;
             }
         }
-        pList->clear();
+        mxList->clear();
         drawobj = drawobj->next;
     }
 }
@@ -4591,8 +4589,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
 void HwpReader::makeLine(Line *   )
 {
     padd("text:style-name", sXML_CDATA, "Horizontal Line");
-    rstartEl( "text:p", rList);
-    pList->clear();
+    rstartEl( "text:p", mxList.get());
+    mxList->clear();
 }
 
 
@@ -4608,8 +4606,8 @@ void HwpReader::makeHidden(Hidden * hbox)
 
     padd("text:condition", sXML_CDATA, "");
     padd("text:string-value", sXML_CDATA, "");
-    rstartEl("text:hidden-text", rList);
-    pList->clear();
+    rstartEl("text:hidden-text", mxList.get());
+    mxList->clear();
     HWPPara *para = hbox->plist.front();
 
     while (para)
@@ -4639,15 +4637,15 @@ void HwpReader::makeFootnote(Footnote * hbox)
     {
         padd("text:id", sXML_CDATA,
             ascii(Int2Str(hbox->number, "edn%d", buf)));
-        rstartEl("text:endnote", rList);
-        pList->clear();
+        rstartEl("text:endnote", mxList.get());
+        mxList->clear();
         padd("text:label", sXML_CDATA,
             ascii(Int2Str(hbox->number, "%d", buf)));
-        rstartEl("text:endnote-citation", rList);
-        pList->clear();
+        rstartEl("text:endnote-citation", mxList.get());
+        mxList->clear();
         rchars(ascii(Int2Str(hbox->number, "%d", buf)));
         rendEl("text:endnote-citation");
-        rstartEl("text:endnote-body", rList);
+        rstartEl("text:endnote-body", mxList.get());
         parsePara(hbox->plist.front());
         rendEl("text:endnote-body");
         rendEl("text:endnote");
@@ -4656,15 +4654,15 @@ void HwpReader::makeFootnote(Footnote * hbox)
     {
         padd("text:id", sXML_CDATA,
             ascii(Int2Str(hbox->number, "ftn%d", buf)));
-        rstartEl("text:footnote", rList);
-        pList->clear();
+        rstartEl("text:footnote", mxList.get());
+        mxList->clear();
         padd("text:label", sXML_CDATA,
             ascii(Int2Str(hbox->number, "%d", buf)));
-        rstartEl("text:footnote-citation", rList);
-        pList->clear();
+        rstartEl("text:footnote-citation", mxList.get());
+        mxList->clear();
         rchars(ascii(Int2Str(hbox->number, "%d", buf)));
         rendEl("text:footnote-citation");
-        rstartEl("text:footnote-body", rList);
+        rstartEl("text:footnote-body", mxList.get());
         parsePara(hbox->plist.front());
         rendEl("text:footnote-body");
         rendEl("text:footnote");
@@ -4680,7 +4678,7 @@ void HwpReader::makeAutoNum(AutoNum * hbox)
     switch (hbox->type)
     {
         case PGNUM_AUTO:
-            rstartEl("text:page-number", rList);
+            rstartEl("text:page-number", mxList.get());
             rchars(ascii(Int2Str(hbox->number, "%d", buf)));
             rendEl("text:page-number");
             break;
@@ -4694,7 +4692,7 @@ void HwpReader::makeAutoNum(AutoNum * hbox)
                 ascii(Int2Str(hbox->number, "refIllustration%d", buf)));
             padd("text:name",sXML_CDATA, "Illustration");
             padd("style:num-format",sXML_CDATA, "1");
-            rstartEl("text:sequence", rList);
+            rstartEl("text:sequence", mxList.get());
             rchars(ascii(Int2Str(hbox->number, "%d", buf)));
             rendEl("text:sequence");
             break;
@@ -4703,7 +4701,7 @@ void HwpReader::makeAutoNum(AutoNum * hbox)
                 ascii(Int2Str(hbox->number, "refTable%d", buf)));
             padd("text:name",sXML_CDATA, "Table");
             padd("style:num-format",sXML_CDATA, "1");
-            rstartEl("text:sequence", rList);
+            rstartEl("text:sequence", mxList.get());
             rchars(ascii(Int2Str(hbox->number, "%d", buf)));
             rendEl("text:sequence");
             break;
@@ -4737,13 +4735,13 @@ void HwpReader::makeShowPageNum()
     padd("svg:y", sXML_CDATA, "0cm");
     padd("svg:width", sXML_CDATA, "2.0cm");
     padd("fo:min-height", sXML_CDATA, "0.5cm");
-    rstartEl("draw:text-box", rList);
-    pList->clear();
+    rstartEl("draw:text-box", mxList.get());
+    mxList->clear();
 
     padd("text:style-name", sXML_CDATA,
         ascii(Int2Str(nPos, "PNPara%d", buf)));
-    rstartEl("text:p", rList);
-    pList->clear();
+    rstartEl("text:p", mxList.get());
+    mxList->clear();
     if( hbox->shape > 2 )
         rchars("- ");
     if( hbox->shape % 3 == 0 )
@@ -4753,8 +4751,8 @@ void HwpReader::makeShowPageNum()
     else
         padd("style:num-format", sXML_CDATA, "i");
     padd("text:select-page", sXML_CDATA, "current");
-    rstartEl("text:page-number", rList);
-    pList->clear();
+    rstartEl("text:page-number", mxList.get());
+    mxList->clear();
     rchars("2");
     rendEl("text:page-number");
     if( hbox->shape > 2 )
@@ -4793,8 +4791,8 @@ void HwpReader::parsePara(HWPPara * para)
             {
                 padd("text:style-name", sXML_CDATA,
                     ascii(getPStyleName(para->GetParaShape().index, buf)));
-                rstartEl( "text:p",rList);
-                pList->clear();
+                rstartEl( "text:p",mxList.get());
+                mxList->clear();
             }
             if( d->bFirstPara && d->bInBody )
             {
@@ -4807,8 +4805,8 @@ void HwpReader::parsePara(HWPPara * para)
                     // U+C758 HANGUL SYLLABLE YI, U+CC98 HANGUL SYLLABLE CEO,
                     // U+C74C HANGUL SYLLABLE EUM: "Begin of Document"
                 padd("text:name", sXML_CDATA, OUString(buf, strlen(buf), RTL_TEXTENCODING_UTF8));
-                rstartEl("text:bookmark", rList);
-                pList->clear();
+                rstartEl("text:bookmark", mxList.get());
+                mxList->clear();
                 rendEl("text:bookmark");
                 d->bFirstPara = false;
             }
diff --git a/hwpfilter/source/hwpreader.hxx b/hwpfilter/source/hwpreader.hxx
index 8f04e6e06372..9a4b813ed70b 100644
--- a/hwpfilter/source/hwpreader.hxx
+++ b/hwpfilter/source/hwpreader.hxx
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
+#include <rtl/ref.hxx>
 #include <sal/alloca.h>
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
@@ -90,8 +91,7 @@ public:
     }
 private:
     Reference< XDocumentHandler > m_rxDocumentHandler;
-    Reference< XAttributeList > rList;
-    AttributeListImpl *pList;
+    rtl::Reference<AttributeListImpl> mxList;
     HWPFile hwpfile;
     HwpReaderPrivate *d;
 private:
diff --git a/hwpfilter/source/solver.cxx b/hwpfilter/source/solver.cxx
index 144e11c3858a..f297160159f1 100644
--- a/hwpfilter/source/solver.cxx
+++ b/hwpfilter/source/solver.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <math.h>
+#include <memory>
 #include "solver.h"
 
 
@@ -63,18 +64,15 @@ double* mgcLinearSystemD::NewVector (int N)
 
 int mgcLinearSystemD::Solve (int n, double** a, double* b)
 {
-  int* indxc = new int[n];
+  std::unique_ptr<int[]> indxc( new int[n] );
   if ( !indxc )
     return 0;
-  int* indxr = new int[n];
+  std::unique_ptr<int[]> indxr( new int[n] );
   if ( !indxr ) {
-    delete[] indxc;
     return 0;
   }
-  int* ipiv  = new int[n];
+  std::unique_ptr<int[]> ipiv( new int[n] );
   if ( !ipiv ) {
-    delete[] indxc;
-    delete[] indxr;
     return 0;
   }
 
@@ -93,26 +91,23 @@ int mgcLinearSystemD::Solve (int n, double** a, double* b)
     {
       if ( ipiv[j] != 1 )
       {
-    for (k = 0; k < n; k++)
-    {
-      if ( ipiv[k] == 0 )
-      {
-        if ( fabs(a[j][k]) >= big )
+        for (k = 0; k < n; k++)
         {
-          big = fabs(a[j][k]);
-          irow = j;
-          icol = k;
+          if ( ipiv[k] == 0 )
+          {
+            if ( fabs(a[j][k]) >= big )
+            {
+              big = fabs(a[j][k]);
+              irow = j;
+              icol = k;
+            }
+          }
+          else if ( ipiv[k] > 1 )
+          {
+            return 0;
+          }
         }
       }
-      else if ( ipiv[k] > 1 )
-      {
-        delete[] ipiv;
-        delete[] indxr;
-        delete[] indxc;
-        return 0;
-      }
-    }
-      }
     }
     ipiv[icol]++;
 
@@ -131,9 +126,6 @@ int mgcLinearSystemD::Solve (int n, double** a, double* b)
     indxc[i] = icol;
     if ( a[icol][icol] == 0 )
     {
-      delete[] ipiv;
-      delete[] indxr;
-      delete[] indxc;
       return 0;
     }
 
@@ -162,16 +154,13 @@ int mgcLinearSystemD::Solve (int n, double** a, double* b)
     {
       for (k = 0; k < n; k++)
       {
-    save = a[k][indxr[j]];
-    a[k][indxr[j]] = a[k][indxc[j]];
-    a[k][indxc[j]] = save;
+        save = a[k][indxr[j]];
+        a[k][indxr[j]] = a[k][indxc[j]];
+        a[k][indxc[j]] = save;
       }
     }
   }
 
-  delete[] ipiv;
-  delete[] indxr;
-  delete[] indxc;
   return 1;
 }
 


More information about the Libreoffice-commits mailing list