From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:41937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hWx6e-0003Rg-90 for guix-patches@gnu.org; Sat, 01 Jun 2019 02:03:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hWx6c-0000zj-Ej for guix-patches@gnu.org; Sat, 01 Jun 2019 02:03:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51518) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hWx6c-0000za-Bz for guix-patches@gnu.org; Sat, 01 Jun 2019 02:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hWx6c-0005qL-5f for guix-patches@gnu.org; Sat, 01 Jun 2019 02:03:02 -0400 Subject: [bug#35880] [PATCH 1/7] lzlib: Add 'make-lzip-input-port/compressed'. Resent-Message-ID: From: Pierre Neidhardt In-Reply-To: <87v9xqny4u.fsf@gnu.org> References: <20190524134238.22802-1-ludo@gnu.org> <87d0k6o3am.fsf@ambrevar.xyz> <87ftp1m1te.fsf@gnu.org> <87blznsxym.fsf@gnu.org> <87ef4jlvbr.fsf@ambrevar.xyz> <87lfyrr554.fsf@gnu.org> <87sgszk3ev.fsf@ambrevar.xyz> <877eab3tjq.fsf@gnu.org> <87k1ebj7a8.fsf@ambrevar.xyz> <871s0i1yji.fsf@gnu.org> <87a7f5wbow.fsf@ambrevar.xyz> <87v9xqny4u.fsf@gnu.org> Date: Sat, 01 Jun 2019 08:02:29 +0200 Message-ID: <87ef4dzvuy.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?= Cc: 35880-done@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > I think the =E2=80=98lzread!=E2=80=99 loop should look like this (the tes= ts still pass > with this): > > --8<---------------cut here---------------start------------->8--- > (let loop ((read 0) > (start start)) > (cond ((< read count) > (match (lz-decompress-read decoder bv start (- count read)) > (0 (cond ((lz-decompress-finished? decoder) > read) > ((eof-object? (feed-decoder! decoder)) > (lz-decompress-finish decoder) > (loop read start)) > (else ;read again > (loop read start)))) > (n (loop (+ read n) (+ start n))))) > (else > read))) > --8<---------------cut here---------------end--------------->8--- Looks good to me! >> (match (lz-decompress-read decoder bv start (- count read)) >> (0 (if (eof-object? (feed-decoder! decoder)) >> read >> (loop read start))) >> >> I'm not sure I understand the above: if we read nothing, then we try >> again? > > No: if we read *something*, we try again; if we read nothing, we return. If we read nothing _and_ it is not an EOF (it can be an empty vector), then we loop indefinitely, no? > Thanks for your careful review, much appreciated! You are welcome, thanks for your invaluable work! =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAlzyFPUACgkQm9z0l6S7 zH+nnAgAmoDB/EnDyp3MzWTeDa/rao+g9dFIb8cgEP1vEw6S7Gnc7UgBu29PLGku F4/h2PvuxcWNorl/6eZhqUEeKWgoaznkr0V4mfO/UBWB56r4VuUlc86UvbQrtEeL yALwEfE2z4abJdlNoUnT1Ojl+qBHJIWTzFgVmdp8LVzG8C7SSgsH/ZJ7GEu1NBGQ jxaJ9LsO+7JTJs/8SP4qgwrV5LfLF6rl6TjhMGf5yt6dmcGGVpaHKLItsPDxT+iP +ABTZXwG4z+ZN+Df4mzSuORt38CMNapAG3D30PE9dvPgiszW3985g9hKlT17Gpg1 uayGoEN2t6XBOPqZ/5cKUMWJBVrs0A== =Bu/7 -----END PGP SIGNATURE----- --=-=-=--