summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-02-10 22:34:35 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-02-10 22:40:33 -0500
commit1da03a88a98b50633d61557de27e4c0702a665eb (patch)
tree525e318d328da79e7ff3c2af0df42581f5d2fb07
parentbe32e707859b3a80766ac29eb5879da3c07544bf (diff)
fdo#74209: This search algorithm had another issue. This fixes it.
When the search range was i.e. 1-3, and the match was found at 5, the old code would return 5 when in fact it should have failed. This change would honor the end position and limit the search within specified search range. Change-Id: If12a92fd3930ad128a5b0699a1addd96fb3a8eba
-rw-r--r--sc/inc/mtvfunctions.hxx2
-rw-r--r--sc/source/core/data/column.cxx8
2 files changed, 5 insertions, 5 deletions
diff --git a/sc/inc/mtvfunctions.hxx b/sc/inc/mtvfunctions.hxx
index 6955d21c3c5a..fdf79fa017f9 100644
--- a/sc/inc/mtvfunctions.hxx
+++ b/sc/inc/mtvfunctions.hxx
@@ -618,7 +618,7 @@ FindElement2(
break;
default:
{
- ElseRetType aRet = rFuncElse(*it, nOffset);
+ ElseRetType aRet = rFuncElse(*it, nOffset, nDataSize);
if (aRet.second)
return PositionType(it, aRet.first);
}
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 8e3d3650f4ea..3768808a6268 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2984,20 +2984,20 @@ public:
return const_cast<ScFormulaCell*>(p)->IsMultilineResult();
}
- std::pair<size_t,bool> operator() (const sc::CellStoreType::value_type& node, size_t nOffset)
+ std::pair<size_t,bool> operator() (const sc::CellStoreType::value_type& node, size_t nOffset, size_t nDataSize)
{
typedef std::pair<size_t,bool> RetType;
if (node.type == sc::element_type_empty)
return RetType(0, false);
- for (size_t i = nOffset; i < node.size; ++i)
+ for (size_t i = 0; i < nDataSize; ++i)
{
- SCROW nRow = node.position + i;
+ SCROW nRow = node.position + i + nOffset;
sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow, miCellPos);
if (IsAmbiguousScriptNonZero(nScriptType))
// Return the offset from the first row.
- return RetType(i, true);
+ return RetType(i+nOffset, true);
}
return RetType(0, false);