diff options
-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, |