[Libreoffice-commits] core.git: sc/inc sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Wed Mar 5 15:54:49 PST 2014
sc/inc/formulagroup.hxx | 3 ++
sc/source/core/data/formulacell.cxx | 44 ++++++++++++-----------------------
sc/source/core/tool/formulagroup.cxx | 4 +++
3 files changed, 23 insertions(+), 28 deletions(-)
New commits:
commit 95637452609260c97d8e5aaa7500531bb458a8bc
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Wed Mar 5 18:47:07 2014 -0500
Fix incorrect group calc state check.
And the code in the else block is pretty dangerous as it passes an empty
token array to the group interpreter whose effect is entirely unpredictable.
Also, declare the destructor of CompiledFormula class to be virtual as it
serves as a base class for DynamicKernel.
Change-Id: I4e191550a4437ad6ebac55fcdeee4f3654722ff1
diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx
index 602c4a4..a3f1891 100644
--- a/sc/inc/formulagroup.hxx
+++ b/sc/inc/formulagroup.hxx
@@ -81,6 +81,9 @@ struct FormulaGroupContext : boost::noncopyable
*/
class SC_DLLPUBLIC CompiledFormula
{
+public:
+ CompiledFormula();
+ virtual ~CompiledFormula();
};
/**
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 8528828..3b20408 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3660,38 +3660,26 @@ bool ScFormulaCell::InterpretFormulaGroup()
if (mxGroup->mbInvariant && false)
return InterpretInvariantFormulaGroup();
- if (mxGroup->meCalcState == sc::GroupCalcEnabled)
- {
- ScTokenArray aCode;
- ScAddress aTopPos = aPos;
- aTopPos.SetRow(mxGroup->mpTopCell->aPos.Row());
- ScGroupTokenConverter aConverter(aCode, *pDocument, *this, mxGroup->mpTopCell->aPos);
- if (!aConverter.convert(*pCode))
- {
- SAL_INFO("sc.opencl", "conversion of group " << this << " failed, disabling");
- mxGroup->meCalcState = sc::GroupCalcDisabled;
- return false;
- }
- mxGroup->meCalcState = sc::GroupCalcRunning;
- if (!sc::FormulaGroupInterpreter::getStatic()->interpret(*pDocument, mxGroup->mpTopCell->aPos, mxGroup, aCode))
- {
- SAL_INFO("sc.opencl", "interpreting group " << mxGroup << " (state " << mxGroup->meCalcState << ") failed, disabling");
- mxGroup->meCalcState = sc::GroupCalcDisabled;
- return false;
- }
- mxGroup->meCalcState = sc::GroupCalcEnabled;
+ ScTokenArray aCode;
+ ScAddress aTopPos = aPos;
+ aTopPos.SetRow(mxGroup->mpTopCell->aPos.Row());
+ ScGroupTokenConverter aConverter(aCode, *pDocument, *this, mxGroup->mpTopCell->aPos);
+ if (!aConverter.convert(*pCode))
+ {
+ SAL_INFO("sc.opencl", "conversion of group " << this << " failed, disabling");
+ mxGroup->meCalcState = sc::GroupCalcDisabled;
+ return false;
}
- else
+
+ mxGroup->meCalcState = sc::GroupCalcRunning;
+ if (!sc::FormulaGroupInterpreter::getStatic()->interpret(*pDocument, mxGroup->mpTopCell->aPos, mxGroup, aCode))
{
- ScTokenArray aDummy;
- if (!sc::FormulaGroupInterpreter::getStatic()->interpret(*pDocument, mxGroup->mpTopCell->aPos, mxGroup, aDummy))
- {
- SAL_INFO("sc.opencl", "interpreting group " << mxGroup << " (state " << mxGroup->meCalcState << ") failed, disabling");
- mxGroup->meCalcState = sc::GroupCalcDisabled;
- return false;
- }
+ SAL_INFO("sc.opencl", "interpreting group " << mxGroup << " (state " << mxGroup->meCalcState << ") failed, disabling");
+ mxGroup->meCalcState = sc::GroupCalcDisabled;
+ return false;
}
+ mxGroup->meCalcState = sc::GroupCalcEnabled;
return true;
}
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 8ddafd2..806d2d1 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -279,6 +279,10 @@ void fillMatrix( ScMatrix& rMat, size_t nCol, const double* pNums, rtl_uString**
}
+CompiledFormula::CompiledFormula() {}
+
+CompiledFormula::~CompiledFormula() {}
+
FormulaGroupInterpreterSoftware::FormulaGroupInterpreterSoftware() : FormulaGroupInterpreter()
{
}
More information about the Libreoffice-commits
mailing list