diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-18 09:46:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-18 11:19:20 +0000 |
commit | 2266b436698f28f3869a025f5aa4a356da04a4f1 (patch) | |
tree | a44156984d68252fc5ca4d0088ea5f0a37546e1f /sw/source/filter/html/htmlatr.cxx | |
parent | feb3b3dbda7af2ba7f2d36dd9174a30912d9cf63 (diff) |
new loplugin: useuniqueptr: sw part 2
Change-Id: Ifa901f75072d8474d8a97ca57c2b5b48d8c6b79d
Reviewed-on: https://gerrit.libreoffice.org/33250
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/html/htmlatr.cxx')
-rw-r--r-- | sw/source/filter/html/htmlatr.cxx | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 286c0b19b415..406a5661e0b3 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -296,8 +296,8 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem if( pReferenceFormat || nDeep==0 ) { - pItemSet = new SfxItemSet( *pFormat->GetAttrSet().GetPool(), - pFormat->GetAttrSet().GetRanges() ); + pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(), + pFormat->GetAttrSet().GetRanges() ) ); // if the differences to a different style are supposed to be // written, hard attribute is necessary. This is always true // for styles that are not derived from HTML-tag styles. @@ -311,8 +311,7 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem // later on if( !pItemSet->Count() ) { - delete pItemSet; - pItemSet = nullptr; + pItemSet.reset(); } } @@ -361,8 +360,8 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem if( rSet != rRef ) { if( !pItemSet ) - pItemSet = new SfxItemSet( *pFormat->GetAttrSet().GetPool(), - pFormat->GetAttrSet().GetRanges() ); + pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(), + pFormat->GetAttrSet().GetRanges() ) ); pItemSet->Put( rSet ); } } @@ -391,8 +390,8 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem if( eLang != eDfltLang ) { if( !pItemSet ) - pItemSet = new SfxItemSet( *pFormat->GetAttrSet().GetPool(), - pFormat->GetAttrSet().GetRanges() ); + pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(), + pFormat->GetAttrSet().GetRanges() ) ); pItemSet->Put( rLang ); } @@ -408,8 +407,8 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem if( rTmpLang.GetLanguage() != eLang ) { if( !pItemSet ) - pItemSet = new SfxItemSet( *pFormat->GetAttrSet().GetPool(), - pFormat->GetAttrSet().GetRanges() ); + pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(), + pFormat->GetAttrSet().GetRanges() ) ); pItemSet->Put( rTmpLang ); } } @@ -419,7 +418,6 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem SwHTMLFormatInfo::~SwHTMLFormatInfo() { - delete pItemSet; } void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat, @@ -1027,14 +1025,14 @@ class HTMLStartEndPos { sal_Int32 nStart; sal_Int32 nEnd; - SfxPoolItem* pItem; + std::unique_ptr<SfxPoolItem> pItem; public: HTMLStartEndPos( const SfxPoolItem& rItem, sal_Int32 nStt, sal_Int32 nE ); ~HTMLStartEndPos(); - const SfxPoolItem *GetItem() const { return pItem; } + const SfxPoolItem *GetItem() const { return pItem.get(); } void SetStart( sal_Int32 nStt ) { nStart = nStt; } sal_Int32 GetStart() const { return nStart; } @@ -1052,7 +1050,6 @@ HTMLStartEndPos::HTMLStartEndPos( const SfxPoolItem& rItem, sal_Int32 nStt, HTMLStartEndPos::~HTMLStartEndPos() { - delete pItem; } typedef std::vector<HTMLStartEndPos *> HTMLStartEndPositions; |