mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 05:29:21 +02:00
* Observe max capacity. Resolves issue #40720
This commit is contained in:
parent
e42209457e
commit
c17cbbe788
@ -684,6 +684,11 @@ begin
|
||||
if FCapacity > 3 then IncSize := IncSize + 4;
|
||||
if FCapacity > 8 then IncSize := IncSize + 8;
|
||||
if FCapacity > 127 then Inc(IncSize, FCapacity shr 2);
|
||||
if FCapacity+IncSize>MaxListSize then
|
||||
IncSize:=MaxListSize-FCapacity;
|
||||
// If we were at max capacity already, force error.
|
||||
If IncSize<=0 then
|
||||
IncSize:=1; // Will trigger error
|
||||
SetCapacity(FCapacity + IncSize);
|
||||
Result := Self;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user