lzip-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lzip-bug] [lzlib] Help with Scheme bindings (for GNU Guix)


From: Antonio Diaz Diaz
Subject: Re: [Lzip-bug] [lzlib] Help with Scheme bindings (for GNU Guix)
Date: Tue, 23 Apr 2019 14:12:06 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14

Hi Pierre,

Pierre Neidhardt wrote:
(If you can't read Scheme, I can help, no problem.)

Thanks. I'm not a Scheme programmer.


1. When am I supposed to call lz_decompress_finish?  In the above
lzread!, you'll see it's commented and it seems to work nonetheless.  If
I uncomment it, it crashes.

You may call LZ_decompress_finish as many times as you wish, but never before all the compresed data has been written with LZ_decompress_write. If you call LZ_decompress_finish prematurely, lzlib will report truncated data. If you don't call it, a truncated member may not be detected.


2. It's unclear in the manual if the lz-decompress-read reads all the
bytes that were written.  Am I supposed to loop until no more bytes are
read?

It can't be guaranteed that LZ_decompress_read reads all the bytes written because up to more than 7000 decompressed bytes can be produced for each compressed byte. You may either read in a loop or alternate write/read calls in a loop.


3. In both functions, should we *compress_write everything first, then
*compress_read as much as we can?  Or chain write-read calls like in
bbexample.c?

Both ways work.


4. In lzwrite, is "written" the number of uncompressed bytes and "read" the
number of compressed bytes?

Yes.


Regards,
Antonio.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]