[fpc-devel] zstream, fpc and lazarus
Paul Ishenin
webpirat at mail.ru
Sun Dec 2 09:43:36 CET 2007
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.
More information about the fpc-devel
mailing list