* 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:
@@ -285,17 +285,17 @@ BList::MoveItem(int32 fromIndex, int32 toIndex)
|
|||||||
|| (toIndex < 0))
|
|| (toIndex < 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
void * tmpMover = fObjectList[fromIndex];
|
||||||
if (fromIndex < toIndex) {
|
if (fromIndex < toIndex) {
|
||||||
void * tmpMover = fObjectList[fromIndex];
|
memmove(fObjectList + fromIndex, fObjectList + fromIndex + 1,
|
||||||
memmove(fObjectList + fromIndex + 1, fObjectList + fromIndex,
|
|
||||||
(toIndex - fromIndex) * sizeof(void *));
|
(toIndex - fromIndex) * sizeof(void *));
|
||||||
fObjectList[toIndex] = tmpMover;
|
fObjectList[toIndex] = tmpMover;
|
||||||
} else if (fromIndex > toIndex) {
|
} else if (fromIndex > toIndex) {
|
||||||
void * tmpMover = fObjectList[fromIndex];
|
|
||||||
memmove(fObjectList + toIndex + 1, fObjectList + toIndex,
|
memmove(fObjectList + toIndex + 1, fObjectList + toIndex,
|
||||||
(fromIndex - toIndex) * sizeof(void *));
|
(fromIndex - toIndex) * sizeof(void *));
|
||||||
fObjectList[toIndex] = tmpMover;
|
|
||||||
};
|
};
|
||||||
|
fObjectList[toIndex] = tmpMover;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user