summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-02-10 22:34:35 -0500
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-02-11 12:29:10 +0000
commit517cf1185e5e3fd4eaedf6b49ffecbd957317bbb (patch)
tree925ccba57e9cd2e60ac2a539a097462da279bf06
parentcd519128e9719875ccdc185afc47a28a5f107e0f (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 (cherry picked from commit 1da03a88a98b50633d61557de27e4c0702a665eb) Reviewed-on: https://gerrit.libreoffice.org/7988 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-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 487e3a07b020..47ef9cbdde62 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2985,20 +2985,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);