IndySockets / Indy

Indy - Internet Direct
https://www.indyproject.org
434 stars 147 forks source link

No FHeadIndex - A Bug? #525

Closed caryyu closed 4 months ago

caryyu commented 4 months ago

https://github.com/IndySockets/Indy/blob/40ba7a2b08bb05a2269dd52f281a3dd9349a4974/Lib/Core/IdBuffer.pas#L545

rlebeau commented 4 months ago

I don't think that is a bug. That line is used only when AIndex >= 0, ie the caller wants to extract data from a specific index in the buffer. When AIndex < 0, the data is extracted from FHeadIndex instead. So, unless you have a very specific example where ExtractToBytes() is not working correctly with AIndex >= 0, I'm going to close this ticket.

caryyu commented 4 months ago

If that is the case, how come the indexOf involves the FHeadIndex, I think the concept in here should be unified, you can extend the parameters for giving the choices out. sometimes these two concepts are very confusing by using TIdBuffer.

rlebeau commented 4 months ago

Perhaps, but most people don't use TIdBuffer directly, and the current logic has been in place for a very long time, so it hasn't been a problem under normal usage. So again, can you please provide a real-world example where you think there a problem exists?

caryyu commented 4 months ago

Closed as I eventually chose not to directly use TIdBuffer but wrapped one myself instead.