summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/ww8par6.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-26 12:06:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-26 13:30:49 +0200
commit4054dff516367b332b7e3ce6fa91a452bf690571 (patch)
tree74ce35623e84933e4da9b134855ac1c74c4bce1d /sw/source/filter/ww8/ww8par6.cxx
parentc0cc59adca23580864a2e5cdadf66212246cbfcc (diff)
use unique_ptr when Clone()'ing PoolItems
and fix a handful of small leaks in the process Change-Id: I876e12ff5305f9dda84532d4182fb91657d6fa0c Reviewed-on: https://gerrit.libreoffice.org/62389 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/ww8/ww8par6.cxx')
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx18
1 files changed, 7 insertions, 11 deletions
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 3b6468c0dac4..f240b8ffe969 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -3540,14 +3540,13 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh
{
if( SfxItemState::SET == m_pCurrentColl->GetItemState( RES_CHRATR_UNDERLINE, false ) )
{
- const SwAttrSet& aSet = m_pCurrentColl->GetAttrSet();
- SvxUnderlineItem *pUnderline
- = static_cast<SvxUnderlineItem *>(aSet.Get( RES_CHRATR_UNDERLINE, false ).Clone());
- if (pUnderline && nLen >= 4)
+ if (nLen >= 4)
{
+ const SwAttrSet& aSet = m_pCurrentColl->GetAttrSet();
+ std::unique_ptr<SvxUnderlineItem> pUnderline(
+ static_cast<SvxUnderlineItem *>(aSet.Get( RES_CHRATR_UNDERLINE, false ).Clone()));
pUnderline->SetColor( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) );
m_pCurrentColl->SetFormatAttr( *pUnderline );
- delete pUnderline;
}
}
}
@@ -3555,13 +3554,11 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh
{
if ( SfxItemState::SET == m_xCurrentItemSet->GetItemState( RES_CHRATR_UNDERLINE, false ) )
{
- SvxUnderlineItem *pUnderline
- = static_cast<SvxUnderlineItem*>(m_xCurrentItemSet->Get(RES_CHRATR_UNDERLINE, false).Clone());
- if (pUnderline && nLen >= 4)
+ if (nLen >= 4)
{
+ std::unique_ptr<SvxUnderlineItem> pUnderline(static_cast<SvxUnderlineItem*>(m_xCurrentItemSet->Get(RES_CHRATR_UNDERLINE, false).Clone()));
pUnderline->SetColor( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) );
m_xCurrentItemSet->Put( *pUnderline );
- delete pUnderline;
}
}
}
@@ -4541,10 +4538,9 @@ void SwWW8ImplReader::Read_BoolItem( sal_uInt16 nId, const sal_uInt8* pData, sho
m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), nId );
else
{
- SfxBoolItem* pI = static_cast<SfxBoolItem*>(GetDfltAttr( nId )->Clone());
+ std::unique_ptr<SfxBoolItem> pI(static_cast<SfxBoolItem*>(GetDfltAttr( nId )->Clone()));
pI->SetValue( 0 != *pData );
NewAttr( *pI );
- delete pI;
}
}