From 2bfc7d480980ec9da723e46f21f1e73ff37b7127 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 Sep 2018 11:25:47 +0200 Subject: loplugin:useuniqueptr in CoinMPSolver Change-Id: Ibe0dfdfabf6f56498564406441a9c505e93dd9a6 Reviewed-on: https://gerrit.libreoffice.org/60112 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sccomp/source/solver/CoinMPSolver.cxx | 53 +++++++++++++++++----------------- sccomp/source/solver/LpsolveSolver.cxx | 6 ++-- 2 files changed, 29 insertions(+), 30 deletions(-) (limited to 'sccomp/source/solver') diff --git a/sccomp/source/solver/CoinMPSolver.cxx b/sccomp/source/solver/CoinMPSolver.cxx index 23426e140e42..dbd19a4d9f43 100644 --- a/sccomp/source/solver/CoinMPSolver.cxx +++ b/sccomp/source/solver/CoinMPSolver.cxx @@ -143,7 +143,7 @@ void SAL_CALL CoinMPSolver::solve() // set objective function const std::vector& rObjCoeff = aCellsHash[maObjective]; - double* pObjectCoeffs = new double[nVariables]; + std::unique_ptr pObjectCoeffs(new double[nVariables]); for (nVar=0; nVar pCompMatrix(new double[nCompSize]); // first collect all coefficients, row-wise for (size_t i=0; i pRHS(new double[nRows]); + std::unique_ptr pRowType(new char[nRows]); for (size_t i=0; i pMatrixBegin(new int[nVariables+1]); + std::unique_ptr pMatrixCount(new int[nVariables]); + std::unique_ptr pMatrix(new double[nCompSize]); // not always completely used + std::unique_ptr pMatrixIndex(new int[nCompSize]); int nMatrixPos = 0; for (nVar=0; nVar pLowerBounds(new double[nVariables]); + std::unique_ptr pUpperBounds(new double[nVariables]); for (nVar=0; nVar pColType(new char[nVariables]); for (nVar=0; nVar& rObjCoeff = aCellsHash[maObjective]; - REAL* pObjVal = new REAL[nVariables+1]; + std::unique_ptr pObjVal(new REAL[nVariables+1]); pObjVal[0] = 0.0; // ignored for (nVar=0; nVar