diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-12-21 09:31:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-12-21 12:21:45 +0100 |
commit | d30f7435aa7aacb3e196178ebd7407284e6c8230 (patch) | |
tree | 774553560d869e04dfb1731d3496fbcc553487b8 /hwpfilter/source/hwpread.cxx | |
parent | 4ce06f8d162a282025cefe14e5684f82e439e01c (diff) |
use unique_ptr in hwpfilter
Change-Id: I3491777281912e095c9222e83028d358d6826841
Reviewed-on: https://gerrit.libreoffice.org/65522
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'hwpfilter/source/hwpread.cxx')
-rw-r--r-- | hwpfilter/source/hwpread.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index 9d44a00bc87b..c1899045c4e4 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -307,7 +307,8 @@ bool TxtBox::Read(HWPFile & hwpf) hwpf.ReadParaList(caption); if( type == 0 ){ // if table? - TCell* *pArr = ::comphelper::newArray_null<TCell *>(ncell); + std::unique_ptr<TCell*[]> pArr(new TCell*[ncell]); + std::fill(pArr.get(), pArr.get() + ncell, nullptr); if (!pArr) { return hwpf.SetState(HWP_InvalidFileFormat); } @@ -356,7 +357,6 @@ bool TxtBox::Read(HWPFile & hwpf) tbl->box = this; m_pTable = tbl.get(); hwpf.AddTable(std::move(tbl)); - delete[] pArr; } else m_pTable = nullptr; @@ -461,12 +461,12 @@ bool Picture::Read(HWPFile & hwpf) if (pictype == PICTYPE_DRAW) { HIODev* pOldMem = hmem; - HMemIODev* pNewMem = new HMemIODev(reinterpret_cast<char *>(follow.data()), follow_block_size); - hmem = pNewMem; + std::unique_ptr<HMemIODev> pNewMem(new HMemIODev(reinterpret_cast<char *>(follow.data()), follow_block_size)); + hmem = pNewMem.get(); LoadDrawingObjectBlock(this); style.cell = picinfo.picdraw.hdo; - assert(hmem == pNewMem); - delete pNewMem; + assert(hmem == pNewMem.get()); + pNewMem.reset(); hmem = pOldMem; } else if (follow_block_size >= 4) |