[Libreoffice-commits] .: sc/qa sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Jan 2 12:50:19 PST 2013
sc/qa/unit/ucalc.cxx | 10 ++++++++++
sc/source/core/tool/scmatrix.cxx | 2 ++
2 files changed, 12 insertions(+)
New commits:
commit 79f1ef44e77074d8f5a1d32e0447118e5b9c4e70
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Jan 2 15:49:24 2013 -0500
fdo#58539: Resizing matrix should also resize the flag storage too.
Or else resizing and then putting empty elements may crash. The flag
storage is used only for empty elements.
Change-Id: I1ada8f795a01336af185e6180bc03247c44472ba
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 4b7e4fd..6a8af5d 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1548,6 +1548,16 @@ void Test::testMatrix()
pMat->PutString(aStr, 8, 2);
pMat->PutEmptyPath(8, 11);
checkMatrixElements<PartiallyFilledEmptyMatrix>(*pMat);
+
+ // Test resizing.
+ pMat = new ScMatrix(0, 0);
+ pMat->Resize(2, 2, 1.5);
+ pMat->PutEmpty(1, 1);
+
+ CPPUNIT_ASSERT_EQUAL(1.5, pMat->GetDouble(0, 0));
+ CPPUNIT_ASSERT_EQUAL(1.5, pMat->GetDouble(0, 1));
+ CPPUNIT_ASSERT_EQUAL(1.5, pMat->GetDouble(1, 0));
+ CPPUNIT_ASSERT_MESSAGE("PutEmpty() call failed.", pMat->IsEmpty(1, 1));
}
void Test::testEnterMixedMatrix()
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 66dcb2f..0a92ffc 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -418,11 +418,13 @@ bool ScMatrixImpl::IsImmutable() const
void ScMatrixImpl::Resize(SCSIZE nC, SCSIZE nR)
{
maMat.resize(nR, nC);
+ maMatFlag.resize(nR, nC);
}
void ScMatrixImpl::Resize(SCSIZE nC, SCSIZE nR, double fVal)
{
maMat.resize(nR, nC, fVal);
+ maMatFlag.resize(nR, nC);
}
void ScMatrixImpl::SetErrorInterpreter( ScInterpreter* p)
More information about the Libreoffice-commits
mailing list