From a4da9c8634369e84a66fa8a4a97ce50d010e190d Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Sun, 5 Oct 2008 22:44:33 +0000 Subject: [PATCH] * fix of by one bug while moving from front to back git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27883 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/support/List.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kits/support/List.cpp b/src/kits/support/List.cpp index f64eb9a0b1..e61c5e1625 100644 --- a/src/kits/support/List.cpp +++ b/src/kits/support/List.cpp @@ -285,17 +285,17 @@ BList::MoveItem(int32 fromIndex, int32 toIndex) || (toIndex < 0)) return false; + void * tmpMover = fObjectList[fromIndex]; if (fromIndex < toIndex) { - void * tmpMover = fObjectList[fromIndex]; - memmove(fObjectList + fromIndex + 1, fObjectList + fromIndex, + memmove(fObjectList + fromIndex, fObjectList + fromIndex + 1, (toIndex - fromIndex) * sizeof(void *)); fObjectList[toIndex] = tmpMover; } else if (fromIndex > toIndex) { - void * tmpMover = fObjectList[fromIndex]; memmove(fObjectList + toIndex + 1, fObjectList + toIndex, (fromIndex - toIndex) * sizeof(void *)); - fObjectList[toIndex] = tmpMover; }; + fObjectList[toIndex] = tmpMover; + return true; }