This function doesn't work properly.
For example, with a TIntegerList [0, 1, 2, 3, 4], a call to TIntegerList.Move(4, 0) should produce [4, 0, 1, 2, 3], but the result obtained is [4, 0, 1, 2, 4]
Here is a patch to fix it :
Index: VectorLists.pas===================================================================--- VectorLists.pas (révision 6451)+++ VectorLists.pas (copie de travail)@@ -1198,13 +1198,13 @@
begin
// curIndex+1 necessarily exists since curIndex<newIndex and newIndex<Count
System.Move(FBaseList[(curIndex + 1) * FItemSize], FBaseList[curIndex * FItemSize],
- (newIndex - curIndex - 1) * FItemSize);+ (newIndex - curIndex) * FItemSize);
end
else
begin
// newIndex+1 necessarily exists since newIndex<curIndex and curIndex<Count
System.Move(FBaseList[newIndex * FItemSize], FBaseList[(newIndex + 1) * FItemSize],
- (curIndex - newIndex - 1) * FItemSize);+ (curIndex - newIndex) * FItemSize);
end;
if FItemSize = 4 then
PInteger(@FBaseList[newIndex * FItemSize])^ := PInteger(BufferItem)^
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Alexandre,
Thanks for finding but could you give an example when and how it appears in your demos? Or explain consequences in more details. I'll fix it.
PW
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This function doesn't work properly.
For example, with a TIntegerList [0, 1, 2, 3, 4], a call to TIntegerList.Move(4, 0) should produce [4, 0, 1, 2, 3], but the result obtained is [4, 0, 1, 2, 4]
Here is a patch to fix it :
Alexandre,
Thanks for finding but could you give an example when and how it appears in your demos? Or explain consequences in more details. I'll fix it.
PW