summaryrefslogtreecommitdiff
path: root/lotuswordpro/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-01 11:12:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-05 07:33:44 +0100
commitb7d4573b5c217cd5d32723092911c654452b554d (patch)
treed2986614b307d89a2abb266778bebedb9c2acddb /lotuswordpro/source
parent38667b4895b04fabcd9639d0154e55c23b743c7a (diff)
loplugin:useuniqueptr in LwpDrawBitmap
Change-Id: I577a20f2b80689011f790e6ae97b2cade537fd3c Reviewed-on: https://gerrit.libreoffice.org/50740 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lotuswordpro/source')
-rw-r--r--lotuswordpro/source/filter/lwpdrawobj.cxx13
-rw-r--r--lotuswordpro/source/filter/lwpdrawobj.hxx2
2 files changed, 5 insertions, 10 deletions
diff --git a/lotuswordpro/source/filter/lwpdrawobj.cxx b/lotuswordpro/source/filter/lwpdrawobj.cxx
index 60a7b9a5a306..1fa5233a4ed0 100644
--- a/lotuswordpro/source/filter/lwpdrawobj.cxx
+++ b/lotuswordpro/source/filter/lwpdrawobj.cxx
@@ -1337,17 +1337,12 @@ void LwpDrawMetafile::Read()
* @descr Constructor of class LwpDrawBitmap
* @param pStream The memory stream which contains the lwp-sdw draw objects
*/
-LwpDrawBitmap::LwpDrawBitmap(SvStream* pStream) : LwpDrawObj(pStream), m_pImageData(nullptr)
+LwpDrawBitmap::LwpDrawBitmap(SvStream* pStream) : LwpDrawObj(pStream)
{
}
LwpDrawBitmap::~LwpDrawBitmap()
{
- if (m_pImageData)
- {
- delete [] m_pImageData;
- m_pImageData = nullptr;
- }
}
/**
@@ -1361,7 +1356,7 @@ void LwpDrawBitmap::Read()
// 20 == length of draw-specific fields.
// 14 == length of bmp file header.
m_aBmpRec.nFileSize = m_aObjHeader.nRecLen - 20 + 14;
- m_pImageData = new sal_uInt8 [m_aBmpRec.nFileSize];
+ m_pImageData.reset( new sal_uInt8 [m_aBmpRec.nFileSize] );
BmpInfoHeader2 aInfoHeader2;
m_pStream->ReadUInt32( aInfoHeader2.nHeaderLen );
@@ -1421,7 +1416,7 @@ void LwpDrawBitmap::Read()
m_pImageData[13] = static_cast<sal_uInt8>(nOffBits >> 24);
sal_uInt32 nDIBRemaining;
- sal_uInt8* pPicData = m_pImageData;
+ sal_uInt8* pPicData = m_pImageData.get();
if (aInfoHeader2.nHeaderLen== sizeof(BmpInfoHeader))
{
m_pImageData[14] = static_cast<sal_uInt8>(aInfoHeader2.nHeaderLen);
@@ -1479,7 +1474,7 @@ OUString LwpDrawBitmap::RegisterStyle()
XFFrame* LwpDrawBitmap::CreateDrawObj(const OUString& rStyleName)
{
XFImage* pImage = new XFImage();
- pImage->SetImageData(m_pImageData, m_aBmpRec.nFileSize);
+ pImage->SetImageData(m_pImageData.get(), m_aBmpRec.nFileSize);
SetPosition(pImage);
pImage->SetStyleName(rStyleName);
diff --git a/lotuswordpro/source/filter/lwpdrawobj.hxx b/lotuswordpro/source/filter/lwpdrawobj.hxx
index 01b946653b8b..a44ad489f780 100644
--- a/lotuswordpro/source/filter/lwpdrawobj.hxx
+++ b/lotuswordpro/source/filter/lwpdrawobj.hxx
@@ -357,7 +357,7 @@ class LwpDrawBitmap : public LwpDrawObj
{
private:
SdwBmpRecord m_aBmpRec;
- sal_uInt8* m_pImageData;
+ std::unique_ptr<sal_uInt8[]> m_pImageData;
public:
explicit LwpDrawBitmap(SvStream* pStream);
virtual ~LwpDrawBitmap() override;