[fpc-devel] zstream, fpc and lazarus
Sergei Gorelkin
sergei_gorelkin at mail.ru
Sun Dec 2 10:53:52 CET 2007
Daniƫl Mantione wrote:
>
> Okay, that explains it. The memory stream is the only solution to seek in
> a sane way. Now we could switch to Delphi behaviour, but to be honest, I
> don't want to enforce the memory stream to everyone who wants to use a
> compressed stream; it should be usable on plain files.
>
> I'm going to interpret the Delphi docs liberally; "the beginning" is the
> beginning of the zstream, not the beginning of the file. If you want to
> reset the source stream, you will have to reset the source stream :) Ok,
> it is a Delphi incompatibility, but really a corner case, and doing so has
> many advantages.
>
I believe that fpreadpng.pp must be fixed, too. At least it should reset
memory stream to zero position itself and don't assume that zstream will
do it instead. At maximum everything can be done without memory stream
at all - PNG format is designed to be sequential.
As for zstream behaviour, I fully agree: it should remember source
stream position at creation time and seek to it at reset. This way,
compatibility existing with Delphi code won't be broken, because its
authors supply streams in which compression data starts from the beginning.
Furthermore (and I issued a corresponding patch for the previous
version), at destruction decompression stream should adjust source
position to the end of actually decompressed data. This way makes it
possible to process streams that have compressed data followed by some
other data.
Regards,
Sergei
More information about the fpc-devel
mailing list