Daniël Mantione wrote:
Op Sun, 2 Dec 2007, schreef Paul Ishenin:

Daniël Mantione ?????:
 Ok, read with me. If we seek backwards (which is the case with offset 0
from beginning), we call reset:

if origin=sofrombeginning then
 dec(offset,raw_read);
if offset<0 then
begin
inc(offset,raw_read);
reset;
end;

Inside reset, we set the source stream position to 0:

No, Daniel. When we just create TDecompressionStream we seeks to
soFromBeginning, 0. We have raw_read = 0, so offset = 0 too after dec(offset,
raw_read). And next condition with offset < 0 then is false => so no reset call.

I fixed that locally after your commit and lazarus works.

This seems extremely strange to me. Are you telling that the source stream is not at the start of the Zstream when you create the decompression stream?
Exactly. At least when I debugged pngreader it was at the end.
By the way, I'm getting some doubts about position:=0. This basically
This is according codegear help. We should folow it since many code depends on it.
seeks the source file to its begin. But what happens if the Zstream does not start at the beginning of the file?
My assumption is that zstream must be at the begining or one should use temporary memory stream to achieve that.

Best regards,
Paul Ishenin.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to