Improper use of TZCustomElementList?

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
stoffman
Senior Boarder
Senior Boarder
Posts: 50
Joined: 03.12.2020, 06:55

Improper use of TZCustomElementList?

Post by stoffman »

Hi,

Reading the code I found something that I don’t fully understand and I hope someone can clarify it.

TZCustomElementList has 2 properties Count and Capacity. Count being the actual number of elements in the list and Capacity being the size of the memory allocated for the list. Capacity must be equal or bigger than Count and it is an implementation detail of the list as it can reduce the number of memory allocations for the list.

In ZDbcPostgreSqlStatement.pas there are 12 references for Capacity which look like an error to me.

For example in line 982, the code checks if the parameter is out of bounds of the list, the user can still reference an item that was not yet allocated but it will still be valid.

https://github.com/frones/ZeosLib/blob/ ... t.pas#L982

This is just one example, there are more cases like that.

Or am I missing something?

Thanks
Post Reply