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

Miklos Vajna vmiklos at collabora.co.uk
Mon Mar 23 01:30:56 PDT 2015


 sw/source/filter/ww8/docxattributeoutput.cxx |   13 ++++---------
 sw/source/filter/ww8/docxattributeoutput.hxx |    6 +++---
 2 files changed, 7 insertions(+), 12 deletions(-)

New commits:
commit b0c1d2a7f368ed8af46d358e4b4350eb435fa241
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Mar 23 09:29:29 2015 +0100

    DocxAttributeOutput::m_pParagraph/RunSdtPrTokenChildren: use std::unique_ptr
    
    Change-Id: I8fa221211efcbed8407cd8dccb3dc0962068295e

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b3cc593..15c4c62 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -326,12 +326,11 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText
     m_bIsFirstParagraph = false;
 }
 
-static void lcl_deleteAndResetTheLists( ::sax_fastparser::FastAttributeList* &pSdtPrTokenChildren, ::sax_fastparser::FastAttributeList* &pSdtPrDataBindingAttrs, OUString& rSdtPrAlias)
+static void lcl_deleteAndResetTheLists( std::unique_ptr<sax_fastparser::FastAttributeList> &pSdtPrTokenChildren, ::sax_fastparser::FastAttributeList* &pSdtPrDataBindingAttrs, OUString& rSdtPrAlias)
 {
     if( pSdtPrTokenChildren )
     {
-        delete pSdtPrTokenChildren ;
-        pSdtPrTokenChildren = NULL;
+        pSdtPrTokenChildren.reset(0);
     }
     if( pSdtPrDataBindingAttrs )
     {
@@ -602,7 +601,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
 }
 
 void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
-                                         ::sax_fastparser::FastAttributeList*& pSdtPrTokenChildren,
+                                         std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
                                          ::sax_fastparser::FastAttributeList*& pSdtPrTokenAttributes,
                                          ::sax_fastparser::FastAttributeList*& pSdtPrDataBindingAttrs,
                                          OUString& rSdtPrAlias,
@@ -692,7 +691,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
 
         // clear sdt status
         nSdtPrToken = 0;
-        delete pSdtPrTokenChildren; pSdtPrTokenChildren = NULL;
+        pSdtPrTokenChildren.reset(0);
         if( pSdtPrDataBindingAttrs )
         {
             // do not delete yet; it's in xAttrList inside the parser
@@ -8326,12 +8325,10 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
       m_nParaAfterSpacing(0),
       m_setFootnote(false)
     , m_nParagraphSdtPrToken(0)
-    , m_pParagraphSdtPrTokenChildren(NULL)
     , m_pParagraphSdtPrTokenAttributes(NULL)
     , m_pParagraphSdtPrDataBindingAttrs(NULL)
     , m_nRunSdtPrToken(0)
     , m_nStateOfFlyFrame( FLY_NOT_PROCESSED )
-    , m_pRunSdtPrTokenChildren(NULL)
     , m_pRunSdtPrDataBindingAttrs(NULL)
     , m_bParagraphSdtHasId(false)
 {
@@ -8340,10 +8337,8 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
 DocxAttributeOutput::~DocxAttributeOutput()
 {
     delete m_pTableWrt, m_pTableWrt = NULL;
-    delete m_pParagraphSdtPrTokenChildren; m_pParagraphSdtPrTokenChildren = NULL;
     delete m_pParagraphSdtPrTokenAttributes; m_pParagraphSdtPrTokenAttributes = NULL;
     delete m_pParagraphSdtPrDataBindingAttrs; m_pParagraphSdtPrDataBindingAttrs = NULL;
-    delete m_pRunSdtPrTokenChildren; m_pRunSdtPrTokenChildren = NULL;
     delete m_pRunSdtPrDataBindingAttrs; m_pRunSdtPrDataBindingAttrs = NULL;
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 32f1c79..c2cf6c7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -704,7 +704,7 @@ private:
     void WritePostponedCustomShape();
 
     void WriteSdtBlock(sal_Int32& nSdtPrToken,
-                       ::sax_fastparser::FastAttributeList*& pSdtPrTokenChildren,
+                       std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
                        ::sax_fastparser::FastAttributeList*& pSdtPrTokenAttributes,
                        ::sax_fastparser::FastAttributeList*& pSdtPrDataBindingAttrs,
                        OUString& rSdtPrAlias,
@@ -909,14 +909,14 @@ private:
 
     /// members to control the existence of grabbagged SDT properties in the paragraph
     sal_Int32 m_nParagraphSdtPrToken;
-    ::sax_fastparser::FastAttributeList *m_pParagraphSdtPrTokenChildren;
+    std::unique_ptr<sax_fastparser::FastAttributeList> m_pParagraphSdtPrTokenChildren;
     ::sax_fastparser::FastAttributeList *m_pParagraphSdtPrTokenAttributes;
     ::sax_fastparser::FastAttributeList *m_pParagraphSdtPrDataBindingAttrs;
     /// members to control the existence of grabbagged SDT properties in the text run
     sal_Int32 m_nRunSdtPrToken;
     /// State of the Fly at current position
     FlyProcessingState m_nStateOfFlyFrame;
-    ::sax_fastparser::FastAttributeList *m_pRunSdtPrTokenChildren;
+    std::unique_ptr<sax_fastparser::FastAttributeList> m_pRunSdtPrTokenChildren;
     ::sax_fastparser::FastAttributeList *m_pRunSdtPrDataBindingAttrs;
     /// Value of the <w:alias> paragraph SDT element.
     OUString m_aParagraphSdtPrAlias;


More information about the Libreoffice-commits mailing list