[Libreoffice-commits] core.git: sw/source
Stephan Bergmann
sbergman at redhat.com
Wed Jun 14 16:34:19 UTC 2017
sw/source/filter/ascii/parasc.cxx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
New commits:
commit 2618b4013e5acfcc6d9564da36bb24151a8b8280
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Jun 14 18:33:52 2017 +0200
Use unique_ptr for SwASCIIParser::pItemSet
Change-Id: Ib4eb12d9615308568e316cfb96250f1d72d70a06
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;
More information about the Libreoffice-commits
mailing list