summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-08-18 08:19:20 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-19 10:36:32 +0200
commitc57b7875b4f725187faf113da6d563a9ea43164c (patch)
treec9fcd2ad116a498640d4181f90013a69f8fdfa42
parent1a0fa139e50b0718a2a19ded10366af76d656058 (diff)
svl: no need to iterate in reverse order in GetRedoActionsInfo()
We have random access to the array after all, so the non-reverse order is OK as well, and it's more readable. Change-Id: I966a56ae2e161d95f56927be1b2a9f9162d0f7bb Reviewed-on: https://gerrit.libreoffice.org/28204 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 19eab7b79c13edc657f4e3f380889ed0206357bd)
-rw-r--r--svl/source/undo/undo.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index a9c50b6b8395..f9ed3a91c7db 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -1364,9 +1364,11 @@ OUString SfxUndoManager::GetRedoActionsInfo() const
{
boost::property_tree::ptree aActions;
const SfxUndoArray* pUndoArray = m_xData->pActUndoArray;
- for (size_t i = GetRedoActionCount(); i > 0; --i)
+ size_t nCount = GetRedoActionCount();
+ for (size_t i = 0; i < nCount; ++i)
{
- boost::property_tree::ptree aAction = lcl_ActionToJson(i - 1, pUndoArray->aUndoActions[pUndoArray->nCurUndoAction - 1 + i].pAction);
+ size_t nIndex = nCount - i - 1;
+ boost::property_tree::ptree aAction = lcl_ActionToJson(nIndex, pUndoArray->aUndoActions[pUndoArray->nCurUndoAction + nIndex].pAction);
aActions.push_back(std::make_pair("", aAction));
}