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

Miklos Vajna vmiklos at collabora.co.uk
Wed Mar 25 01:13:18 PDT 2015


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

New commits:
commit c2ca1152f19702fbbefecbe5331fad06950f35a2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Mar 25 09:11:51 2015 +0100

    DocxAttributeOutput::m_pParagraphSdtPrTokenAttributes: use std::unique_ptr
    
    Change-Id: Ibc8e21c5572c06fc929c308d519601d2ea0c830d

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 737a80c..44a7aef 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -597,7 +597,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
 
 void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
                                          std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
-                                         ::sax_fastparser::FastAttributeList*& pSdtPrTokenAttributes,
+                                         std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenAttributes,
                                          std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
                                          OUString& rSdtPrAlias,
                                          bool bPara )
@@ -618,9 +618,8 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
                 m_pSerializer->startElement( nSdtPrToken, FSEND );
             else
             {
-                XFastAttributeListRef xAttrList(pSdtPrTokenAttributes);
+                XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.release());
                 m_pSerializer->startElement(nSdtPrToken, xAttrList);
-                pSdtPrTokenAttributes = 0;
             }
 
             if (nSdtPrToken ==  FSNS( XML_w, XML_date ) || nSdtPrToken ==  FSNS( XML_w, XML_docPartObj ) || nSdtPrToken ==  FSNS( XML_w, XML_docPartList ) || nSdtPrToken ==  FSNS( XML_w14, XML_checkbox )) {
@@ -640,9 +639,8 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
                 m_pSerializer->singleElement( nSdtPrToken, FSEND );
             else
             {
-                XFastAttributeListRef xAttrList(pSdtPrTokenAttributes);
+                XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.release());
                 m_pSerializer->singleElement(nSdtPrToken, xAttrList);
-                pSdtPrTokenAttributes = 0;
             }
         }
 
@@ -1175,7 +1173,7 @@ void DocxAttributeOutput::EndRun()
     // (so on export sdt blocks are never nested ATM)
     if ( !m_bAnchorLinkedToNode && !m_bStartedCharSdt )
     {
-        ::sax_fastparser::FastAttributeList* pRunSdtPrTokenAttributes = 0;
+        std::unique_ptr<sax_fastparser::FastAttributeList> pRunSdtPrTokenAttributes;
         WriteSdtBlock( m_nRunSdtPrToken, m_pRunSdtPrTokenChildren, pRunSdtPrTokenAttributes, m_pRunSdtPrDataBindingAttrs, m_aRunSdtPrAlias, /*bPara=*/false );
     }
     else
@@ -8317,7 +8315,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
       m_nParaAfterSpacing(0),
       m_setFootnote(false)
     , m_nParagraphSdtPrToken(0)
-    , m_pParagraphSdtPrTokenAttributes(NULL)
     , m_nRunSdtPrToken(0)
     , m_nStateOfFlyFrame( FLY_NOT_PROCESSED )
     , m_bParagraphSdtHasId(false)
@@ -8327,7 +8324,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
 DocxAttributeOutput::~DocxAttributeOutput()
 {
     delete m_pTableWrt, m_pTableWrt = NULL;
-    delete m_pParagraphSdtPrTokenAttributes; m_pParagraphSdtPrTokenAttributes = NULL;
 }
 
 DocxExport& DocxAttributeOutput::GetExport()
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index a96bb22..fbf5d2d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -705,7 +705,7 @@ private:
 
     void WriteSdtBlock(sal_Int32& nSdtPrToken,
                        std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
-                       ::sax_fastparser::FastAttributeList*& pSdtPrTokenAttributes,
+                       std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrTokenAttributes,
                        std::unique_ptr<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
                        OUString& rSdtPrAlias,
                        bool bPara);
@@ -910,7 +910,7 @@ private:
     /// members to control the existence of grabbagged SDT properties in the paragraph
     sal_Int32 m_nParagraphSdtPrToken;
     std::unique_ptr<sax_fastparser::FastAttributeList> m_pParagraphSdtPrTokenChildren;
-    ::sax_fastparser::FastAttributeList *m_pParagraphSdtPrTokenAttributes;
+    std::unique_ptr<sax_fastparser::FastAttributeList> m_pParagraphSdtPrTokenAttributes;
     std::unique_ptr<sax_fastparser::FastAttributeList> m_pParagraphSdtPrDataBindingAttrs;
     /// members to control the existence of grabbagged SDT properties in the text run
     sal_Int32 m_nRunSdtPrToken;


More information about the Libreoffice-commits mailing list