[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sc/source
Eike Rathke
erack at redhat.com
Wed Apr 1 00:31:21 PDT 2015
sc/source/core/tool/interpr5.cxx | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
New commits:
commit 0f5cbcc5bd5fbde8f13a6655bd47dca4d7722ce9
Author: Eike Rathke <erack at redhat.com>
Date: Mon Mar 30 19:48:45 2015 +0200
Resolves: tdf#42481 propagate errors as errors in matrix calculations
... instead of setting an error string with an unwanted side effect that
may lead to wrong results instead of error.
Change-Id: I42ade52e86520535c879e9bd68156873d706f33c
(cherry picked from commit 836d05d32e36aafc00de59ca51878f47f7ce816a)
Reviewed-on: https://gerrit.libreoffice.org/15072
Tested-by: David Tardon <dtardon at redhat.com>
Reviewed-by: David Tardon <dtardon at redhat.com>
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index aa425b3..7b46fd8 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1092,7 +1092,6 @@ static inline SCSIZE lcl_GetMinExtent( SCSIZE n1, SCSIZE n2 )
template<class _Function>
static ScMatrixRef lcl_MatrixCalculation(
- svl::SharedStringPool& rPool,
const ScMatrix& rMat1, const ScMatrix& rMat2, ScInterpreter* pInterpreter)
{
static _Function Op;
@@ -1111,13 +1110,19 @@ static ScMatrixRef lcl_MatrixCalculation(
{
for (j = 0; j < nMinR; j++)
{
+ sal_uInt16 nErr;
if (rMat1.IsValueOrEmpty(i,j) && rMat2.IsValueOrEmpty(i,j))
{
double d = Op(rMat1.GetDouble(i,j), rMat2.GetDouble(i,j));
xResMat->PutDouble( d, i, j);
}
+ else if (((nErr = rMat1.GetErrorIfNotString(i,j)) != 0) ||
+ ((nErr = rMat2.GetErrorIfNotString(i,j)) != 0))
+ {
+ xResMat->PutError( nErr, i, j);
+ }
else
- xResMat->PutString(rPool.intern(ScGlobal::GetRscString(STR_NO_VALUE)), i, j);
+ xResMat->PutError( errNoValue, i, j);
}
}
}
@@ -1246,11 +1251,11 @@ void ScInterpreter::CalculateAddSub(bool _bSub)
ScMatrixRef pResMat;
if ( _bSub )
{
- pResMat = lcl_MatrixCalculation<MatrixSub>(mrStrPool, *pMat1, *pMat2, this);
+ pResMat = lcl_MatrixCalculation<MatrixSub>( *pMat1, *pMat2, this);
}
else
{
- pResMat = lcl_MatrixCalculation<MatrixAdd>(mrStrPool, *pMat1, *pMat2, this);
+ pResMat = lcl_MatrixCalculation<MatrixAdd>( *pMat1, *pMat2, this);
}
if (!pResMat)
@@ -1443,7 +1448,7 @@ void ScInterpreter::ScMul()
}
if (pMat1 && pMat2)
{
- ScMatrixRef pResMat = lcl_MatrixCalculation<MatrixMul>(mrStrPool, *pMat1, *pMat2, this);
+ ScMatrixRef pResMat = lcl_MatrixCalculation<MatrixMul>( *pMat1, *pMat2, this);
if (!pResMat)
PushNoValue();
else
@@ -1516,7 +1521,7 @@ void ScInterpreter::ScDiv()
}
if (pMat1 && pMat2)
{
- ScMatrixRef pResMat = lcl_MatrixCalculation<MatrixDiv>(mrStrPool, *pMat1, *pMat2, this);
+ ScMatrixRef pResMat = lcl_MatrixCalculation<MatrixDiv>( *pMat1, *pMat2, this);
if (!pResMat)
PushNoValue();
else
@@ -1595,7 +1600,7 @@ void ScInterpreter::ScPow()
fVal1 = GetDouble();
if (pMat1 && pMat2)
{
- ScMatrixRef pResMat = lcl_MatrixCalculation<MatrixPow>(mrStrPool, *pMat1, *pMat2, this);
+ ScMatrixRef pResMat = lcl_MatrixCalculation<MatrixPow>( *pMat1, *pMat2, this);
if (!pResMat)
PushNoValue();
else
@@ -1792,7 +1797,7 @@ void ScInterpreter::ScSumXMY2()
PushNoValue();
return;
} // if (nC1 != nC2 || nR1 != nR2)
- ScMatrixRef pResMat = lcl_MatrixCalculation<MatrixSub>(mrStrPool, *pMat1, *pMat2, this);
+ ScMatrixRef pResMat = lcl_MatrixCalculation<MatrixSub>( *pMat1, *pMat2, this);
if (!pResMat)
{
PushNoValue();
More information about the Libreoffice-commits
mailing list