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

Miklos Vajna vmiklos at collabora.co.uk
Fri Mar 6 00:17:59 PST 2015


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

New commits:
commit 352c40dd5ce715f6ae654b8dedf2fc2145275a1d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Mar 6 09:17:19 2015 +0100

    DocxAttributeOutput::m_pCharLangAttrList: use unique_ptr
    
    Change-Id: I43b59b4359a010e7b64df5825ae3ce845e47fc4b

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5b6793c..0c4bf84 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -927,8 +927,7 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
     // we are done exporting the redline attributes.
     std::unique_ptr<sax_fastparser::FastAttributeList> pFontsAttrList_Original(m_pFontsAttrList.release());
     std::unique_ptr<sax_fastparser::FastAttributeList> pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList.release());
-    ::sax_fastparser::FastAttributeList *pCharLangAttrList_Original        = m_pCharLangAttrList;
-    m_pCharLangAttrList        = NULL;
+    std::unique_ptr<sax_fastparser::FastAttributeList> pCharLangAttrList_Original(m_pCharLangAttrList.release());
 
     lcl_writeParagraphMarkerProperties(*this, rParagraphMarkerProperties);
 
@@ -938,7 +937,7 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
     // Revert back the original values that were stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList'
     m_pFontsAttrList.reset(pFontsAttrList_Original.release());
     m_pEastAsianLayoutAttrList.reset(pEastAsianLayoutAttrList_Original.release());
-    m_pCharLangAttrList        = pCharLangAttrList_Original;
+    m_pCharLangAttrList.reset(pCharLangAttrList_Original.release());
 
     if ( pRedlineParagraphMarkerDeleted )
     {
@@ -1643,7 +1642,7 @@ void DocxAttributeOutput::InitCollectedRunProperties()
 {
     m_pFontsAttrList = 0;
     m_pEastAsianLayoutAttrList = 0;
-    m_pCharLangAttrList = NULL;
+    m_pCharLangAttrList = 0;
 
     // Write the elements in the spec order
     static const sal_Int32 aOrder[] =
@@ -1900,9 +1899,7 @@ void DocxAttributeOutput::WriteCollectedRunProperties()
 
     if ( m_pCharLangAttrList )
     {
-        XFastAttributeListRef xAttrList( m_pCharLangAttrList );
-        m_pCharLangAttrList = NULL;
-
+        XFastAttributeListRef xAttrList( m_pCharLangAttrList.release() );
         m_pSerializer->singleElementNS( XML_w, XML_lang, xAttrList );
     }
 
@@ -2341,8 +2338,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
                     // we are done exporting the redline attributes.
                     std::unique_ptr<sax_fastparser::FastAttributeList> pFontsAttrList_Original(m_pFontsAttrList.release());
                     std::unique_ptr<sax_fastparser::FastAttributeList> pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList.release());
-                    ::sax_fastparser::FastAttributeList *pCharLangAttrList_Original        = m_pCharLangAttrList;
-                    m_pCharLangAttrList        = NULL;
+                    std::unique_ptr<sax_fastparser::FastAttributeList> pCharLangAttrList_Original(m_pCharLangAttrList.release());
 
                     // Output the redline item set
                     m_rExport.OutputItemSet( *pChangesSet, false, true, i18n::ScriptType::LATIN, m_rExport.mbExportModeRTF );
@@ -2353,7 +2349,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
                     // Revert back the original values that were stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList'
                     m_pFontsAttrList.reset(pFontsAttrList_Original.release());
                     m_pEastAsianLayoutAttrList.reset(pEastAsianLayoutAttrList_Original.release());
-                    m_pCharLangAttrList        = pCharLangAttrList_Original;
+                    m_pCharLangAttrList.reset(pCharLangAttrList_Original.release());
 
                     m_pSerializer->endElementNS( XML_w, XML_rPr );
 
@@ -8286,7 +8282,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
     : m_rExport( rExport ),
       m_pSerializer( pSerializer ),
       m_rDrawingML( *pDrawingML ),
-      m_pCharLangAttrList( NULL ),
       m_pSectionSpacingAttrList( NULL ),
       m_pParagraphSpacingAttrList( NULL ),
       m_pHyperlinkAttrList( NULL ),
@@ -8359,7 +8354,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
 
 DocxAttributeOutput::~DocxAttributeOutput()
 {
-    delete m_pCharLangAttrList, m_pCharLangAttrList = NULL;
     delete m_pSectionSpacingAttrList, m_pSectionSpacingAttrList = NULL;
     delete m_pParagraphSpacingAttrList, m_pParagraphSpacingAttrList = NULL;
     delete m_pHyperlinkAttrList, m_pHyperlinkAttrList = NULL;
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 950bda6..2387b3a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -724,7 +724,7 @@ private:
 
     std::unique_ptr<sax_fastparser::FastAttributeList> m_pFontsAttrList;
     std::unique_ptr<sax_fastparser::FastAttributeList> m_pEastAsianLayoutAttrList;
-    ::sax_fastparser::FastAttributeList *m_pCharLangAttrList;
+    std::unique_ptr<sax_fastparser::FastAttributeList> m_pCharLangAttrList;
     ::sax_fastparser::FastAttributeList *m_pSectionSpacingAttrList;
     ::sax_fastparser::FastAttributeList *m_pParagraphSpacingAttrList;
     ::sax_fastparser::FastAttributeList *m_pHyperlinkAttrList;


More information about the Libreoffice-commits mailing list