Kaydet (Commit) 38667b48 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in LwpDrawPolygon

Change-Id: Ia9a6b312a7e0ce189257395c84f65156546cb955
Reviewed-on: https://gerrit.libreoffice.org/50739Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 23c67746
...@@ -565,17 +565,11 @@ XFFrame* LwpDrawPolyLine::CreateStandardDrawObj(const OUString& rStyleName) ...@@ -565,17 +565,11 @@ XFFrame* LwpDrawPolyLine::CreateStandardDrawObj(const OUString& rStyleName)
LwpDrawPolygon::LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData) LwpDrawPolygon::LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData)
: LwpDrawObj(pStream, pTransData) : LwpDrawObj(pStream, pTransData)
, m_nNumPoints(0) , m_nNumPoints(0)
, m_pVector(nullptr)
{ {
} }
LwpDrawPolygon::~LwpDrawPolygon() LwpDrawPolygon::~LwpDrawPolygon()
{ {
if (m_pVector)
{
delete [] m_pVector;
m_pVector = nullptr;
}
} }
/** /**
...@@ -589,7 +583,7 @@ void LwpDrawPolygon::Read() ...@@ -589,7 +583,7 @@ void LwpDrawPolygon::Read()
if (m_nNumPoints > m_pStream->remainingSize() / 4) if (m_nNumPoints > m_pStream->remainingSize() / 4)
throw BadRead(); throw BadRead();
m_pVector = new SdwPoint[m_nNumPoints]; m_pVector.reset( new SdwPoint[m_nNumPoints] );
for (sal_uInt16 nC = 0; nC < m_nNumPoints; nC++) for (sal_uInt16 nC = 0; nC < m_nNumPoints; nC++)
{ {
......
...@@ -208,7 +208,7 @@ class LwpDrawPolygon : public LwpDrawObj ...@@ -208,7 +208,7 @@ class LwpDrawPolygon : public LwpDrawObj
{ {
private: private:
sal_uInt16 m_nNumPoints; sal_uInt16 m_nNumPoints;
SdwPoint* m_pVector; std::unique_ptr<SdwPoint[]> m_pVector;
public: public:
LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData); LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment