summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-03-07 19:19:07 +0100
committerEike Rathke <erack@redhat.com>2016-03-07 20:33:40 +0100
commit36483fde78b872a362b7f606d8e5371c231a2957 (patch)
tree26303cf0393de989935b3149930d725582411a12 /sc
parenta9b8fe5e967e9ec78c3c7793d8df60bfbf20d2b6 (diff)
introduce a dedicated errMatrixSize
... to distinguish from other errors, and really, errStackOverflow should mean exactly that. Change-Id: I3d2bfbd38b056c7d0a346797db560717312de069
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr5.cxx14
-rw-r--r--sc/source/core/tool/scmatrix.cxx8
2 files changed, 14 insertions, 8 deletions
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index bd73ecc70b2a..ef551383bedc 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -353,7 +353,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken
if (!ScMatrix::IsSizeAllocatable( nMatCols, nMatRows))
{
- SetError(errStackOverflow);
+ SetError(errMatrixSize);
return nullptr;
}
@@ -601,8 +601,10 @@ void ScInterpreter::ScEMat()
if ( MustHaveParamCount( GetByte(), 1 ) )
{
SCSIZE nDim = static_cast<SCSIZE>(::rtl::math::approxFloor(GetDouble()));
- if (nDim == 0 || !ScMatrix::IsSizeAllocatable( nDim, nDim))
+ if (nDim == 0)
PushIllegalArgument();
+ else if (!ScMatrix::IsSizeAllocatable( nDim, nDim))
+ PushError( errMatrixSize);
else
{
ScMatrixRef pRMat = GetNewMat(nDim, nDim);
@@ -800,8 +802,10 @@ void ScInterpreter::ScMatDet()
}
SCSIZE nC, nR;
pMat->GetDimensions(nC, nR);
- if ( nC != nR || nC == 0 || !ScMatrix::IsSizeAllocatable( nC, nR) )
+ if ( nC != nR || nC == 0 )
PushIllegalArgument();
+ else if (!ScMatrix::IsSizeAllocatable( nC, nR))
+ PushError( errMatrixSize);
else
{
// LUP decomposition is done inplace, use copy.
@@ -923,8 +927,10 @@ void ScInterpreter::ScMatInv()
}
}
- if ( nC != nR || nC == 0 || !ScMatrix::IsSizeAllocatable( nC, nR) )
+ if ( nC != nR || nC == 0 )
PushIllegalArgument();
+ else if (!ScMatrix::IsSizeAllocatable( nC, nR))
+ PushError( errMatrixSize);
else
{
// LUP decomposition is done inplace, use copy.
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 1477d9dea763..0f237e1686d1 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -345,7 +345,7 @@ void ScMatrixImpl::Resize(SCSIZE nC, SCSIZE nR)
else
{
// Invalid matrix size, allocate 1x1 matrix with error value.
- maMat.resize(1, 1, CreateDoubleError( errStackOverflow));
+ maMat.resize(1, 1, CreateDoubleError( errMatrixSize));
maMatFlag.resize(1, 1);
}
}
@@ -2399,7 +2399,7 @@ ScFullMatrix::ScFullMatrix( SCSIZE nC, SCSIZE nR) :
pImpl.reset( new ScMatrixImpl( nC, nR));
else
// Invalid matrix size, allocate 1x1 matrix with error value.
- pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( errStackOverflow)));
+ pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( errMatrixSize)));
}
ScFullMatrix::ScFullMatrix(SCSIZE nC, SCSIZE nR, double fInitVal) :
@@ -2409,7 +2409,7 @@ ScFullMatrix::ScFullMatrix(SCSIZE nC, SCSIZE nR, double fInitVal) :
pImpl.reset( new ScMatrixImpl( nC, nR, fInitVal));
else
// Invalid matrix size, allocate 1x1 matrix with error value.
- pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( errStackOverflow)));
+ pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( errMatrixSize)));
}
ScFullMatrix::ScFullMatrix( size_t nC, size_t nR, const std::vector<double>& rInitVals ) :
@@ -2419,7 +2419,7 @@ ScFullMatrix::ScFullMatrix( size_t nC, size_t nR, const std::vector<double>& rIn
pImpl.reset( new ScMatrixImpl( nC, nR, rInitVals));
else
// Invalid matrix size, allocate 1x1 matrix with error value.
- pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( errStackOverflow)));
+ pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( errMatrixSize)));
}
ScFullMatrix::~ScFullMatrix()