summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/wrtw8num.cxx
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-02-01 17:17:38 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2019-02-03 14:46:31 +0100
commit3a5e05ebdd2da36c6a3d28d486bd114e491a951b (patch)
tree2fa2bb6f761a310b2cd1dfe5e511ba946032b269 /sw/source/filter/ww8/wrtw8num.cxx
parent4e897ceede564c6ad5400e985bf0962fa210bf24 (diff)
sw: convert WW8Export::pO to unique_ptr
Change-Id: I2cb029574a3f44105a847debaef2caea16e5b66d Reviewed-on: https://gerrit.libreoffice.org/67288 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sw/source/filter/ww8/wrtw8num.cxx')
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 3fdd90134014..508ea7d0aad6 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -281,11 +281,11 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 /*nLevel*/,
SwWW8Writer::WriteLong( *m_rWW8Export.pTableStrm, 0 );
// cbGrpprlChpx
- ww::bytes aCharAtrs;
+ std::unique_ptr<ww::bytes> pCharAtrs;
if ( pOutSet )
{
- ww::bytes* pOldpO = m_rWW8Export.pO;
- m_rWW8Export.pO = &aCharAtrs;
+ std::unique_ptr<ww::bytes> pOldpO = std::move(m_rWW8Export.pO);
+ m_rWW8Export.pO.reset(new ww::bytes);
if ( pFont )
{
sal_uInt16 nFontID = m_rWW8Export.m_aFontHelper.GetId( *pFont );
@@ -310,9 +310,10 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 /*nLevel*/,
}
}
- m_rWW8Export.pO = pOldpO;
+ pCharAtrs = std::move(m_rWW8Export.pO);
+ m_rWW8Export.pO = std::move(pOldpO);
}
- m_rWW8Export.pTableStrm->WriteUChar( sal_uInt8( aCharAtrs.size() ) );
+ m_rWW8Export.pTableStrm->WriteUChar(sal_uInt8(pCharAtrs ? pCharAtrs->size() : 0));
// cbGrpprlPapx
sal_uInt8 aPapSprms [] = {
@@ -336,8 +337,8 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 /*nLevel*/,
m_rWW8Export.pTableStrm->WriteBytes(aPapSprms, sizeof(aPapSprms));
// write Chpx
- if( !aCharAtrs.empty() )
- m_rWW8Export.pTableStrm->WriteBytes(aCharAtrs.data(), aCharAtrs.size());
+ if (pCharAtrs && !pCharAtrs->empty())
+ m_rWW8Export.pTableStrm->WriteBytes(pCharAtrs->data(), pCharAtrs->size());
// write the num string
SwWW8Writer::WriteShort( *m_rWW8Export.pTableStrm, rNumberingString.getLength() );