From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:53233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUace-00025r-RU for guix-patches@gnu.org; Sat, 25 May 2019 13:38:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hUaPm-00025z-P9 for guix-patches@gnu.org; Sat, 25 May 2019 13:25:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35982) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hUaPm-00025o-MU for guix-patches@gnu.org; Sat, 25 May 2019 13:25:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hUaPm-0002oK-IQ for guix-patches@gnu.org; Sat, 25 May 2019 13:25:02 -0400 Subject: [bug#35880] [PATCH 1/7] lzlib: Add 'make-lzip-input-port/compressed'. Resent-Message-ID: From: Pierre Neidhardt In-Reply-To: <20190524134238.22802-1-ludo@gnu.org> References: <20190524134238.22802-1-ludo@gnu.org> Date: Sat, 25 May 2019 19:24:33 +0200 Message-ID: <87d0k6o3am.fsf@ambrevar.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 35880@debbugs.gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable As an Lzip enthusiast, I have some questions ;) I see you are using make-lzip-input-port/compressed in a subsequent patch, but this does not map how it's done for gzip et al., the latter being invoked via it's system command "gzip -c ...". Why did you decide to do it differently for lzip? Much of the code induced by make-lzip-input-port/compressed seems to repeat the lzread! / lzwrite business, maybe there is a way to factor some of it? > +(define (lzwrite! encoder source source-offset source-count > + target target-offset target-count) > + "Write up to SOURCE-COUNT bytes from SOURCE to ENCODER, and read up to > +TARGET-COUNT bytes into TARGET at TARGET-OFFSET. Return two values: the > +number of bytes read from SOURCE, and the number of bytes written to TAR= GET." > + (define read > + (if (< 0 (lz-compress-write-size encoder)) > + (match (lz-compress-write encoder source source-offset source-co= unt) > + (0 (lz-compress-finish encoder) 0) > + (n n)) > + 0)) > + > + (let loop () > + (match (lz-compress-read encoder target target-offset target-count) > + (0 (loop)) > + (written (values read written))))) Why looping on 0? If there is no byte to read, wouldn't this loop indefini= tely? =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAlzpelEACgkQm9z0l6S7 zH9khggAjW9GVirY7yhqei+pj2GkmLzi7E5bYh5+zCPJtyW8o36VHR93I0/sxM/w wnD3raOmx479JbUmj1QDYiZw+bm056ZWwjLeD8bS9Xk167MhWubAiTbgIbkwjSrv tEtg+TuAUJUGOFbKopksSJhTbykHqpdHKLbMaEW/h2PhkIAGlTjixz6xirZyWpdp oJQTYXqo8eAFOZtUC9IlGvZoeaSBL/1NSpihV5zL99RhRkhxXoGiMUCv8maPgv3b J1ImSuYuhJBkdp8D6znMBQcDHTRFD8Pv3F/hSySIiBz8YpCNZkucrbuK2omKxLIK bVnYrFPjbwzYQjx2/6zisJqIpvmZhw== =T8SE -----END PGP SIGNATURE----- --=-=-=--