![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Ошибка в стандартной библиотеке?
vlk32 © (2012-12-28 17:50:00)
procedure TQueue<T>.SetCapacity(Value: Integer);
var
tailCount, offset: Integer;
begin
offset := Value - Length(FItems);
if offset = 0 then
Exit;
// If head <= tail, then part of the queue wraps around
// the end of the array; don't introduce a gap in the queue.
if (FHead < FTail) or ((FHead = FTail) and (Count > 0)) then
tailCount := Length(FItems) - FTail
else
tailCount := 0;
if offset > 0 then
SetLength(FItems, Value);
if tailCount > 0 then
begin
Move(FItems[FTail], FItems[FTail + offset], tailCount * SizeOf(FItems[0]));
if offset > 0 then
FillChar(FItems[FTail], offset * SizeOf(FItems[0]), 0)
else if offset < 0 then
FillChar(FItems[Count], (- offset) * SizeOf(FItems[0]), 0); <<< !? ВОТ ТУТ ПОХОЖЕ ТРЕТСЯ НЕ ТО ЧТО НАДО
Inc(FTail, offset);
end
else if FTail > 0 then
begin
if Count > 0 then
begin
Move(FItems[FTail], FItems[0], Count * SizeOf(FItems[0]));
FillChar(FItems[FCount], FTail * SizeOf(FItems[0]), 0);
end;
Dec(FHead, FTail);
FTail := 0;
end;
if offset < 0 then
SetLength(FItems, Value);
end;
Правильный код в том месте, что я указал должен быть
FillChar(FItems[Length(FItems)+offset], (- offset) * SizeOf(FItems[0]), 0);
Есть сильно вумные чтобы проверить досконально этот момент? А то я на 146% не уверен, но бага серьезная похоже. И причем в одной из ключевых коллекций. Может в эмбаркодеро надо зарепортить?
Игорь Шевченко (2012-12-28 20:17:00) [1]
> Может в эмбаркодеро надо зарепортить?
Стоит поискать по QC, может, уже кто наткнулся
Anatoly Podgoretsky (2012-12-28 18:34:00) [2]А в чем вопрос?