zlib: Clarify when 'gzread!' can return zero.

* guix/zlib.scm (gzread!): Augment docstring to clarify when zero is
returned (based on reading zlib code).
(make-gzip-input-port)[read!]: Remove scary comment.
This commit is contained in:
Ludovic Courtès 2016-07-27 11:44:34 +02:00
parent 46bd451520
commit d00240c36e
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 2 additions and 2 deletions

View File

@ -92,7 +92,8 @@ closes FD."
(let ((proc (zlib-procedure int "gzread" (list '* '* unsigned-int)))) (let ((proc (zlib-procedure int "gzread" (list '* '* unsigned-int))))
(lambda* (gzfile bv #:optional (start 0) (count (bytevector-length bv))) (lambda* (gzfile bv #:optional (start 0) (count (bytevector-length bv)))
"Read up to COUNT bytes from GZFILE into BV at offset START. Return the "Read up to COUNT bytes from GZFILE into BV at offset START. Return the
number of uncompressed bytes actually read." number of uncompressed bytes actually read; it is zero if COUNT is zero or if
the end-of-stream has been reached."
(let ((ret (proc (gzip-file->pointer gzfile) (let ((ret (proc (gzip-file->pointer gzfile)
(bytevector->pointer bv start) (bytevector->pointer bv start)
count))) count)))
@ -172,7 +173,6 @@ buffer increases decompression speed."
(gzdopen (fileno port) "r")) (gzdopen (fileno port) "r"))
(define (read! bv start count) (define (read! bv start count)
;; XXX: Can 'gzread!' return zero even though we haven't reached the EOF?
(gzread! gzfile bv start count)) (gzread! gzfile bv start count))
(unless (= buffer-size %default-buffer-size) (unless (= buffer-size %default-buffer-size)