summaryrefslogtreecommitdiff
path: root/svl/source/undo
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-18 06:56:33 +0000
commit19eab7b79c13edc657f4e3f380889ed0206357bd (patch)
tree42d561f4d82ebf84f5202ea1d262be0c4ef07719 /svl/source/undo
parent6fdfa13a096c55f5038c4a850cfb108d30143d4b (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>
Diffstat (limited to 'svl/source/undo')
-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 f2f6bd84dccf..ae5553915f1d 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -1333,9 +1333,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));
}