guix-commits
[Top][All Lists]
Advanced

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

01/05: lzlib: 'make-lzip-input-port' better handles end of decompression


From: guix-commits
Subject: 01/05: lzlib: 'make-lzip-input-port' better handles end of decompression.
Date: Sat, 1 Jun 2019 09:26:39 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 87399dfc209fdec523947e7b45a1ad348afa4d46
Author: Ludovic Court├Ęs <address@hidden>
Date:   Sat Jun 1 11:38:33 2019 +0200

    lzlib: 'make-lzip-input-port' better handles end of decompression.
    
    Suggested by Pierre Neidhardt <address@hidden>.
    
    * guix/lzlib.scm (lzread!): Call 'lz-decompress-finish' when
    'feed-decoder!' returns EOF.  Call 'lz-decompress-finished?' to
    determine end of compression.
---
 guix/lzlib.scm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/guix/lzlib.scm b/guix/lzlib.scm
index 31d8497..24c7b4b 100644
--- a/guix/lzlib.scm
+++ b/guix/lzlib.scm
@@ -510,9 +510,13 @@ the end-of-stream has been reached."
              (start start))
     (cond ((< read count)
            (match (lz-decompress-read decoder bv start (- count read))
-             (0 (if (eof-object? (feed-decoder! decoder))
-                    read
-                    (loop read start)))
+             (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))))



reply via email to

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