[Libreoffice-commits] core.git: sc/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Thu Apr 2 13:52:46 PDT 2015
sc/source/core/tool/scmatrix.cxx | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
New commits:
commit f9e38cbd3afdf0c8b2ebef0c4995e2443eac4d9a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Thu Apr 2 22:22:09 2015 +0200
we need a more intelligent increment for the iterator, tdf#90391
Change-Id: I5a980f0b1ca47b18ce2e479e46971d7c6690c437
Reviewed-on: https://gerrit.libreoffice.org/15125
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 47554d1..905413c 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -2000,6 +2000,31 @@ public:
}
};
+namespace {
+
+MatrixImplType::position_type increment_position(const MatrixImplType::position_type& pos, size_t n)
+{
+ MatrixImplType::position_type ret = pos;
+ do
+ {
+ if (ret.second + n < ret.first->size)
+ {
+ ret.second += n;
+ break;
+ }
+ else
+ {
+ n -= (ret.first->size - ret.second);
+ ++ret.first;
+ ret.second = 0;
+ }
+ }
+ while (n > 0);
+ return ret;
+}
+
+}
+
template<typename T>
struct MatrixOpWrapper
{
@@ -2028,7 +2053,6 @@ public:
block_type::const_iterator itEnd = block_type::end(*node.data);
MatrixIteratorWrapper<block_type, T, typename T::number_value_type> aFunc(it, itEnd, maOp);
pos = mrMat.set(pos,aFunc.begin(), aFunc.end());
- ++pos.first;
}
break;
case mdds::mtm::element_boolean:
@@ -2040,7 +2064,6 @@ public:
MatrixIteratorWrapper<block_type, T, typename T::number_value_type> aFunc(it, itEnd, maOp);
pos = mrMat.set(pos, aFunc.begin(), aFunc.end());
- ++pos.first;
}
break;
case mdds::mtm::element_string:
@@ -2052,7 +2075,6 @@ public:
MatrixIteratorWrapper<block_type, T, typename T::number_value_type> aFunc(it, itEnd, maOp);
pos = mrMat.set(pos, aFunc.begin(), aFunc.end());
- ++pos.first;
}
break;
case mdds::mtm::element_empty:
@@ -2062,15 +2084,13 @@ public:
std::vector<char> aVec(node.size);
MatrixIteratorWrapper<std::vector<char>, T, typename T::empty_value_type> aFunc(aVec.begin(), aVec.end(), maOp);
pos = mrMat.set(pos, aFunc.begin(), aFunc.end());
- ++pos.first;
}
- else
- pos.second += node.size;
}
break;
default:
;
}
+ pos = increment_position(pos, node.size);
}
};
More information about the Libreoffice-commits
mailing list