summaryrefslogtreecommitdiffstats
path: root/lotuswordpro/source/filter/lwpgrfobj.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-18 14:57:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-19 07:58:31 +0200
commit8b1a6e68536daee46c8a39ef855e6638df0f07b0 (patch)
tree086e6f2d4a1da7d2b7b34f932245b57b96b04427 /lotuswordpro/source/filter/lwpgrfobj.cxx
parentclang-tidy readability-misleading-indentation (diff)
downloadcore-8b1a6e68536daee46c8a39ef855e6638df0f07b0.tar.gz
core-8b1a6e68536daee46c8a39ef855e6638df0f07b0.zip
use unique_ptr in LwpGraphicObject::GetGrafData
Change-Id: I19ba8eb5251af3b0c381275a0a18cf8c50944372 Reviewed-on: https://gerrit.libreoffice.org/61941 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lotuswordpro/source/filter/lwpgrfobj.cxx')
-rw-r--r--lotuswordpro/source/filter/lwpgrfobj.cxx12
1 files changed, 4 insertions, 8 deletions
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 61f35d0879e4..6e0069bf98a8 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -355,7 +355,7 @@ std::vector<sal_uInt8> LwpGraphicObject::GetRawGrafData()
* @param pGrafData the array to store the image data. the pointer need to be deleted outside.
* @return the length of the image data.
*/
-sal_uInt32 LwpGraphicObject::GetGrafData(sal_uInt8*& pGrafData)
+sal_uInt32 LwpGraphicObject::GetGrafData(std::unique_ptr<sal_uInt8[]>& pGrafData)
{
// create graphic object
// if small file, use the compressed stream for BENTO
@@ -386,8 +386,8 @@ sal_uInt32 LwpGraphicObject::GetGrafData(sal_uInt8*& pGrafData)
// read image data
sal_uInt32 nDataLen = pGrafStream->TellEnd();
- pGrafData = new sal_uInt8 [nDataLen];
- pMemGrafStream->ReadBytes(pGrafData, nDataLen);
+ pGrafData.reset(new sal_uInt8 [nDataLen]);
+ pMemGrafStream->ReadBytes(pGrafData.get(), nDataLen);
delete pMemGrafStream;
pMemGrafStream = nullptr;
@@ -643,7 +643,7 @@ void LwpGraphicObject::CreateGrafObject()
*/
void LwpGraphicObject::XFConvertEquation(XFContentContainer * pCont)
{
- sal_uInt8* pGrafData = nullptr;
+ std::unique_ptr<sal_uInt8[]> pGrafData;
sal_uInt32 nDataLen = GetGrafData(pGrafData);
if(pGrafData)
{
@@ -687,11 +687,7 @@ void LwpGraphicObject::XFConvertEquation(XFContentContainer * pCont)
pXFPara->Add(pXFNote);
pCont->Add(pXFPara);
-
- delete [] pGrafData;
- pGrafData = nullptr;
}
-
}
void LwpGraphicObject::GetGrafOrgSize(double & rWidth, double & rHeight)