1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-24 04:15:36 +02:00

Fix bug #31081 (`lookahead-u8' returns an s8.)

Reported by Göran Weinholt <goran@weinholt.se>.

* libguile/r6rs-ports.c (scm_lookahead_u8): Return an unsigned byte.

* test-suite/tests/r6rs-ports.test ("7.2.8 Binary Input")["lookahead-u8:
  result is unsigned"]: New test.
This commit is contained in:
Ludovic Courtès 2010-09-23 22:34:31 +02:00
parent e7bee74771
commit 3fa882203a
3 changed files with 8 additions and 2 deletions

View file

@ -52,6 +52,11 @@
(= (char->integer #\A) (get-u8 port))
(eof-object? (get-u8 port)))))
(pass-if "lookahead-u8: result is unsigned"
;; Bug #31081.
(let ((port (open-bytevector-input-port #vu8(255))))
(= (lookahead-u8 port) 255)))
(pass-if "get-bytevector-n [short]"
(let* ((port (open-input-string "GNU Guile"))
(bv (get-bytevector-n port 4)))