diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-04-04 14:15:09 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-04-04 16:22:07 +0200 |
commit | ef13c536af9a63f0e9bdfa0a65b58a0b5dd9d16f (patch) | |
tree | 42031288cdbcf0e8bce51db18ff3f1e4edd42a29 /sw/source | |
parent | a30be64e4f12bc74673af315f2c9106eb89fbab5 (diff) |
sw: convert DELETEZ to unique_ptr in ww8graf2.cxx
Change-Id: I8734a8293413dd8579db225948135df42a18c973
Reviewed-on: https://gerrit.libreoffice.org/52376
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/ww8graf2.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 2 |
2 files changed, 8 insertions, 10 deletions
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index 68695e277a24..6cda45844ac1 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -245,7 +245,7 @@ bool SwWW8ImplReader::GetPictGrafFromStream(Graphic& rGraphic, SvStream& rSrc) return ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(rGraphic, OUString(), rSrc); } -bool SwWW8ImplReader::ReadGrafFile(OUString& rFileName, Graphic*& rpGraphic, +bool SwWW8ImplReader::ReadGrafFile(OUString& rFileName, std::unique_ptr<Graphic>& rpGraphic, const WW8_PIC& rPic, SvStream* pSt, sal_uLong nFilePos, bool* pbInDoc) { // Write the graphic to the file *pbInDoc = true; // default @@ -283,7 +283,7 @@ bool SwWW8ImplReader::ReadGrafFile(OUString& rFileName, Graphic*& rpGraphic, if (m_xWwFib->m_envr != 1) // !MAC as creator { - rpGraphic = new Graphic( aWMF ); + rpGraphic.reset(new Graphic(aWMF)); return true; } @@ -295,10 +295,10 @@ bool SwWW8ImplReader::ReadGrafFile(OUString& rFileName, Graphic*& rpGraphic, long nData = rPic.lcb - ( pSt->Tell() - nPosFc ); if (nData > 0) { - rpGraphic = new Graphic(); + rpGraphic.reset(new Graphic()); bOk = SwWW8ImplReader::GetPictGrafFromStream(*rpGraphic, *pSt); if (!bOk) - DELETEZ(rpGraphic); + rpGraphic.reset(); } return bOk; // Contains graphic } @@ -426,12 +426,11 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf1(WW8_PIC const & rPic, SvStream* pSt, OUString aFileName; bool bInDoc; - Graphic* pGraph = nullptr; + std::unique_ptr<Graphic> pGraph; bool bOk = ReadGrafFile(aFileName, pGraph, rPic, pSt, nFilePos, &bInDoc); if (!bOk) { - delete pGraph; return nullptr; // Graphic could not be read correctly } @@ -445,10 +444,9 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf1(WW8_PIC const & rPic, SvStream* pSt, } if (m_xWFlyPara && m_xWFlyPara->bGrafApo) - pRet = MakeGrafNotInContent(aPD,pGraph,aFileName,aGrfSet); + pRet = MakeGrafNotInContent(aPD, pGraph.get(), aFileName, aGrfSet); else - pRet = MakeGrafInContent(rPic,aPD,pGraph,aFileName,aGrfSet); - delete pGraph; + pRet = MakeGrafInContent(rPic, aPD, pGraph.get(), aFileName, aGrfSet); return pRet; } diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index a7718498f69b..d24057bb3504 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1496,7 +1496,7 @@ private: bool ProcessSpecial(bool &rbReSync, WW8_CP nStartCp); sal_uInt16 TabRowSprm(int nLevel) const; - bool ReadGrafFile(OUString& rFileName, Graphic*& rpGraphic, + bool ReadGrafFile(OUString& rFileName, std::unique_ptr<Graphic>& rpGraphic, const WW8_PIC& rPic, SvStream* pSt, sal_uLong nFilePos, bool* pDelIt); static void ReplaceObj(const SdrObject &rReplaceTextObj, |