nixpkgs/pkgs/by-name/co/coinmp/0001-change-more-reinterpret_cast-from-NULL-to-C-cast-see.patch
2024-06-16 16:24:30 +02:00

96 lines
5.6 KiB
Diff

From 0259f2b936ee0d9288ff39c509c69a66f5b13b80 Mon Sep 17 00:00:00 2001
From: Stefan Vigerske <svigerske@gams.com>
Date: Mon, 11 Mar 2019 16:34:25 +0000
Subject: [PATCH 1/2] change more reinterpret_cast from NULL to C-cast, see
also #93
---
Clp/src/AbcSimplex.cpp | 48 +++++++++++++++++++++---------------------
Clp/src/ClpModel.cpp | 2 +-
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/Clp/src/AbcSimplex.cpp b/Clp/src/AbcSimplex.cpp
index 0eacd91e..1715e6d8 100644
--- a/Clp/src/AbcSimplex.cpp
+++ b/Clp/src/AbcSimplex.cpp
@@ -368,19 +368,19 @@ AbcSimplex::gutsOfInitialize(int numberRows,int numberColumns,bool doMore)
// say Steepest pricing
abcDualRowPivot_ = new AbcDualRowSteepest();
abcPrimalColumnPivot_ = new AbcPrimalColumnSteepest();
- internalStatus_ = newArray(reinterpret_cast<unsigned char *>(NULL),
+ internalStatus_ = newArray((unsigned char *)NULL,
sizeArray+maximumNumberTotal_);
- abcLower_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- abcUpper_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- abcCost_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+maximumNumberTotal_);
- abcDj_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- abcSolution_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+maximumNumberTotal_);
- //fromExternal_ = newArray(reinterpret_cast<int *>(NULL),sizeArray);
- //toExternal_ = newArray(reinterpret_cast<int *>(NULL),sizeArray);
- scaleFromExternal_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- offset_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- abcPerturbation_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- abcPivotVariable_ = newArray(reinterpret_cast<int *>(NULL),maximumAbcNumberRows_);
+ abcLower_ = newArray((double *)NULL,sizeArray);
+ abcUpper_ = newArray((double *)NULL,sizeArray);
+ abcCost_ = newArray((double *)NULL,sizeArray+maximumNumberTotal_);
+ abcDj_ = newArray((double *)NULL,sizeArray);
+ abcSolution_ = newArray((double *)NULL,sizeArray+maximumNumberTotal_);
+ //fromExternal_ = newArray((int *)NULL,sizeArray);
+ //toExternal_ = newArray((int *)NULL,sizeArray);
+ scaleFromExternal_ = newArray((double *)NULL,sizeArray);
+ offset_ = newArray((double *)NULL,sizeArray);
+ abcPerturbation_ = newArray((double *)NULL,sizeArray);
+ abcPivotVariable_ = newArray((int *)NULL,maximumAbcNumberRows_);
// Fill perturbation array
setupPointers(maximumAbcNumberRows_,maximumAbcNumberColumns_);
fillPerturbation(0,maximumNumberTotal_);
@@ -554,19 +554,19 @@ AbcSimplex::createSubProblem(int numberColumns,const int * whichColumn)
subProblem->maximumNumberTotal_= maximumAbcNumberRows_+numberColumns;
subProblem->numberTotalWithoutFixed_= subProblem->numberTotal_;
int sizeArray=2*subProblem->maximumNumberTotal_+maximumAbcNumberRows_;
- subProblem->internalStatus_ = newArray(reinterpret_cast<unsigned char *>(NULL),
+ subProblem->internalStatus_ = newArray((unsigned char *)NULL,
sizeArray+subProblem->maximumNumberTotal_);
- subProblem->abcLower_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- subProblem->abcUpper_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- subProblem->abcCost_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+subProblem->maximumNumberTotal_);
- subProblem->abcDj_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- subProblem->abcSolution_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+subProblem->maximumNumberTotal_);
- //fromExternal_ = newArray(reinterpret_cast<int *>(NULL),sizeArray);
- //toExternal_ = newArray(reinterpret_cast<int *>(NULL),sizeArray);
- subProblem->scaleFromExternal_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- subProblem->offset_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- subProblem->abcPerturbation_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
- subProblem->abcPivotVariable_ = newArray(reinterpret_cast<int *>(NULL),maximumAbcNumberRows_);
+ subProblem->abcLower_ = newArray((double *)NULL,sizeArray);
+ subProblem->abcUpper_ = newArray((double *)NULL,sizeArray);
+ subProblem->abcCost_ = newArray((double *)NULL,sizeArray+subProblem->maximumNumberTotal_);
+ subProblem->abcDj_ = newArray((double *)NULL,sizeArray);
+ subProblem->abcSolution_ = newArray((double *)NULL,sizeArray+subProblem->maximumNumberTotal_);
+ //fromExternal_ = newArray((int *)NULL,sizeArray);
+ //toExternal_ = newArray((int *)NULL,sizeArray);
+ subProblem->scaleFromExternal_ = newArray((double *)NULL,sizeArray);
+ subProblem->offset_ = newArray((double *)NULL,sizeArray);
+ subProblem->abcPerturbation_ = newArray((double *)NULL,sizeArray);
+ subProblem->abcPivotVariable_ = newArray((int *)NULL,maximumAbcNumberRows_);
subProblem->setupPointers(maximumAbcNumberRows_,numberColumns);
// could use arrays - but for now be safe
int * backward = new int [numberFullColumns+numberRows_];
diff --git a/Clp/src/ClpModel.cpp b/Clp/src/ClpModel.cpp
index 1fc905c4..83aa3b63 100644
--- a/Clp/src/ClpModel.cpp
+++ b/Clp/src/ClpModel.cpp
@@ -3845,7 +3845,7 @@ ClpModel::writeMps(const char *filename,
writer.setMpsData(*(matrix_->getPackedMatrix()), COIN_DBL_MAX,
getColLower(), getColUpper(),
objective,
- reinterpret_cast<const char*> (NULL) /*integrality*/,
+ (const char*)NULL /*integrality*/,
getRowLower(), getRowUpper(),
columnNames, rowNames);
// Pass in array saying if each variable integer
--
2.37.3