Kaydet (Commit) bdf9ece3 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Actually check the return values of the various Coin* calls

...the code had been like this ever since it got introduced with
6d492447 "118160: Use CoinMP as replacement for
lp_solve," but it looks more plausible that the return values should be checked
rather than be ignored.  At least, CppunitTest_sccomp_lpsolver keeps succeeding
after the change (with --enable-coinmp).

Change-Id: If450827ae034079c9ee69b4e49c55b480ac0de06
üst 040204ab
...@@ -294,7 +294,10 @@ void SAL_CALL CoinMPSolver::solve() throw(uno::RuntimeException, std::exception) ...@@ -294,7 +294,10 @@ void SAL_CALL CoinMPSolver::solve() throw(uno::RuntimeException, std::exception)
pLowerBounds, pUpperBounds, pRowType, pRHS, NULL, pLowerBounds, pUpperBounds, pRowType, pRHS, NULL,
pMatrixBegin, pMatrixCount, pMatrixIndex, pMatrix, pMatrixBegin, pMatrixCount, pMatrixIndex, pMatrix,
NULL, NULL, NULL ); NULL, NULL, NULL );
if (nResult == SOLV_CALL_SUCCESS)
{
nResult = CoinLoadInteger( hProb, pColType ); nResult = CoinLoadInteger( hProb, pColType );
}
delete[] pColType; delete[] pColType;
delete[] pMatrixIndex; delete[] pMatrixIndex;
...@@ -314,8 +317,13 @@ void SAL_CALL CoinMPSolver::solve() throw(uno::RuntimeException, std::exception) ...@@ -314,8 +317,13 @@ void SAL_CALL CoinMPSolver::solve() throw(uno::RuntimeException, std::exception)
// solve model // solve model
if (nResult == SOLV_CALL_SUCCESS)
{
nResult = CoinCheckProblem( hProb ); nResult = CoinCheckProblem( hProb );
}
if (nResult == SOLV_CALL_SUCCESS)
{
try try
{ {
nResult = CoinOptimizeProblem( hProb, 0 ); nResult = CoinOptimizeProblem( hProb, 0 );
...@@ -324,6 +332,7 @@ void SAL_CALL CoinMPSolver::solve() throw(uno::RuntimeException, std::exception) ...@@ -324,6 +332,7 @@ void SAL_CALL CoinMPSolver::solve() throw(uno::RuntimeException, std::exception)
{ {
throw std::runtime_error(e.message()); throw std::runtime_error(e.message());
} }
}
mbSuccess = ( nResult == SOLV_CALL_SUCCESS ); mbSuccess = ( nResult == SOLV_CALL_SUCCESS );
if ( mbSuccess ) if ( mbSuccess )
......
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