diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-06-14 18:33:52 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-06-14 18:33:52 +0200 |
commit | 2618b4013e5acfcc6d9564da36bb24151a8b8280 (patch) | |
tree | b3c8d15182b5d5623df3b206e4586f24da7fd5a6 | |
parent | 0782cdaeb36e254dac3dd0ad69dfa0310aff75d8 (diff) |
Use unique_ptr for SwASCIIParser::pItemSet
Change-Id: Ib4eb12d9615308568e316cfb96250f1d72d70a06
-rw-r--r-- | sw/source/filter/ascii/parasc.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index 0fbf8800c1b7..0479c74e9769 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -18,6 +18,8 @@ */ #include <memory> + +#include <o3tl/make_unique.hxx> #include <tools/stream.hxx> #include <hintids.hxx> #include <rtl/tencinfo.h> @@ -53,7 +55,7 @@ class SwASCIIParser SvStream& rInput; sal_Char* pArr; const SwAsciiOptions& rOpt; - SfxItemSet* pItemSet; + std::unique_ptr<SfxItemSet> pItemSet; long nFileSize; SvtScriptType nScript; bool bNewDoc; @@ -99,7 +101,7 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCursor, SvStream& rIn, pPam = new SwPaM( *rCursor.GetPoint() ); pArr = new sal_Char [ ASC_BUFFLEN + 2 ]; - pItemSet = new SfxItemSet( pDoc->GetAttrPool(), + pItemSet = o3tl::make_unique<SfxItemSet>( pDoc->GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_LANGUAGE, @@ -134,7 +136,6 @@ SwASCIIParser::~SwASCIIParser() { delete pPam; delete [] pArr; - delete pItemSet; } // Calling the parser @@ -240,8 +241,7 @@ sal_uLong SwASCIIParser::CallParser() pDoc->getIDocumentContentOperations().InsertItemSet( *pInsPam, *pItemSet ); } } - delete pItemSet; - pItemSet = nullptr; + pItemSet.reset(); } delete pInsPam; |