Kaydet (Commit) 0f30c9a1 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in GridWindow

Change-Id: I9fd6d8ac159994c894739afbb3dccb72576dccfb
Reviewed-on: https://gerrit.libreoffice.org/54844Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 34652fc3
...@@ -56,6 +56,9 @@ public: ...@@ -56,6 +56,9 @@ public:
// can't use std::set<std::unique_ptr<>> until C++14 // can't use std::set<std::unique_ptr<>> until C++14
if (fn == SRCDIR "/editeng/source/misc/svxacorr.cxx") if (fn == SRCDIR "/editeng/source/misc/svxacorr.cxx")
return; return;
// horrible horrible spawn of evil ownership and deletion here
if (fn == SRCDIR "/sfx2/source/view/ipclient.cxx")
return;
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
} }
......
...@@ -80,7 +80,7 @@ class GridWindow : public vcl::Window ...@@ -80,7 +80,7 @@ class GridWindow : public vcl::Window
double* m_pXValues; double* m_pXValues;
double* m_pOrigYValues; double* m_pOrigYValues;
int m_nValues; int m_nValues;
double* m_pNewYValues; std::unique_ptr<double[]> m_pNewYValues;
sal_uInt16 m_BmOffX; sal_uInt16 m_BmOffX;
sal_uInt16 m_BmOffY; sal_uInt16 m_BmOffY;
...@@ -128,7 +128,7 @@ public: ...@@ -128,7 +128,7 @@ public:
void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY ); void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY );
double* getNewYValues() { return m_pNewYValues; } double* getNewYValues() { return m_pNewYValues.get(); }
void ChangeMode(ResetType nType); void ChangeMode(ResetType nType);
...@@ -172,8 +172,8 @@ void GridWindow::Init(double* pXValues, double* pYValues, int nValues, bool bCut ...@@ -172,8 +172,8 @@ void GridWindow::Init(double* pXValues, double* pYValues, int nValues, bool bCut
if (m_pOrigYValues && m_nValues) if (m_pOrigYValues && m_nValues)
{ {
m_pNewYValues = new double[ m_nValues ]; m_pNewYValues.reset(new double[ m_nValues ]);
memcpy( m_pNewYValues, m_pOrigYValues, sizeof( double ) * m_nValues ); memcpy( m_pNewYValues.get(), m_pOrigYValues, sizeof( double ) * m_nValues );
} }
setBoundings( 0, 0, 1023, 1023 ); setBoundings( 0, 0, 1023, 1023 );
...@@ -238,7 +238,7 @@ GridWindow::~GridWindow() ...@@ -238,7 +238,7 @@ GridWindow::~GridWindow()
void GridWindow::dispose() void GridWindow::dispose()
{ {
delete [] m_pNewYValues; m_pNewYValues.reset();
vcl::Window::dispose(); vcl::Window::dispose();
} }
...@@ -657,7 +657,7 @@ void GridWindow::ChangeMode(ResetType nType) ...@@ -657,7 +657,7 @@ void GridWindow::ChangeMode(ResetType nType)
case ResetType::RESET: case ResetType::RESET:
{ {
if( m_pOrigYValues && m_pNewYValues && m_nValues ) if( m_pOrigYValues && m_pNewYValues && m_nValues )
memcpy( m_pNewYValues, m_pOrigYValues, m_nValues*sizeof(double) ); memcpy( m_pNewYValues.get(), m_pOrigYValues, m_nValues*sizeof(double) );
} }
break; break;
case ResetType::EXPONENTIAL: case ResetType::EXPONENTIAL:
......
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