* 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
This commit is contained in:
parent
68f40fccf7
commit
a4da9c8634
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user