sc/source/core/tool/scmatrix.cxx | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-)
New commits: commit dd5e8ff4314a87cf86d473e21902df48668d1dd3 Author: Markus Mohrhard <markus.mohrh...@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 <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/15126 diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 998f562..4398308 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -1999,6 +1999,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 { @@ -2027,7 +2052,6 @@ public: block_type::const_iterator itEnd = block_type::end(*node.data); MatrixIteratorWrapper<block_type, T> aFunc(it, itEnd, maOp); pos = mrMat.set(pos,aFunc.begin(), aFunc.end()); - ++pos.first; } break; case mdds::mtm::element_boolean: @@ -2039,7 +2063,6 @@ public: MatrixIteratorWrapper<block_type, T> aFunc(it, itEnd, maOp); pos = mrMat.set(pos, aFunc.begin(), aFunc.end()); - ++pos.first; } break; case mdds::mtm::element_string: @@ -2051,7 +2074,6 @@ public: MatrixIteratorWrapper<block_type, T> aFunc(it, itEnd, maOp); pos = mrMat.set(pos, aFunc.begin(), aFunc.end()); - ++pos.first; } break; case mdds::mtm::element_empty: @@ -2061,15 +2083,13 @@ public: std::vector<char> aVec(node.size); MatrixIteratorWrapper<std::vector<char>, T> 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); } }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits