summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-13 20:42:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-14 10:13:46 +0200
commit8e39ef66928a3e37c618d3a70a631e71266db274 (patch)
tree8cab0264e58c885ae7d78a77d90fd041bcdbe15d /sw
parentd7e06e46acc2ee17101cef63e59b9f5efcbfab14 (diff)
extend loplugin useuniqueptr to POD types
Change-Id: I6ff24f048bd8f75bf87a78b718f37b57855d4781 Reviewed-on: https://gerrit.libreoffice.org/39932 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/html/htmlctxt.cxx20
1 files changed, 11 insertions, 9 deletions
diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx
index 0646803f9c92..4e67462f6ade 100644
--- a/sw/source/filter/html/htmlctxt.cxx
+++ b/sw/source/filter/html/htmlctxt.cxx
@@ -37,13 +37,17 @@
#include "swcss1.hxx"
#include "swhtml.hxx"
+#include <memory>
+
using namespace ::com::sun::star;
class HTMLAttrContext_SaveDoc
{
SwHTMLNumRuleInfo aNumRuleInfo; // Numbering for this environment
- SwPosition *pPos; // Jump back to here when leaving context
- HTMLAttrTable *pAttrTab; // Valid attributes for the environment,
+ std::unique_ptr<SwPosition>
+ pPos; // Jump back to here when leaving context
+ std::unique_ptr<HTMLAttrTable>
+ pAttrTab; // Valid attributes for the environment,
// if attributes shouldn't be preserved
size_t nContextStMin; // Stack lower bound for the environment
@@ -64,11 +68,9 @@ public:
bFixHeaderDist( false ), bFixFooterDist( false )
{}
- ~HTMLAttrContext_SaveDoc() { delete pPos; delete pAttrTab; }
-
// The position is ours, so we need to create and delete it
- void SetPos( const SwPosition& rPos ) { pPos = new SwPosition(rPos); }
- const SwPosition *GetPos() const { return pPos; }
+ void SetPos( const SwPosition& rPos ) { pPos.reset( new SwPosition(rPos) ); }
+ const SwPosition *GetPos() const { return pPos.get(); }
// The index isn't ours. So no creation or deletion
void SetNumInfo( const SwHTMLNumRuleInfo& rInf ) { aNumRuleInfo.Set(rInf); }
@@ -99,10 +101,10 @@ HTMLAttrTable *HTMLAttrContext_SaveDoc::GetAttrTab( bool bCreate )
{
if( !pAttrTab && bCreate )
{
- pAttrTab = new HTMLAttrTable;
- memset( pAttrTab, 0, sizeof( HTMLAttrTable ));
+ pAttrTab.reset( new HTMLAttrTable );
+ memset( pAttrTab.get(), 0, sizeof( HTMLAttrTable ));
}
- return pAttrTab;
+ return pAttrTab.get();
}
HTMLAttrContext_SaveDoc *HTMLAttrContext::GetSaveDocContext( bool bCreate )