From de85408c02286230bf251d5f1e1ba697e726438c Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Sun, 2 Sep 2007 16:56:54 +0000 Subject: [PATCH] Fixed handling of closed ports in `get-bytevector*'. * src/ports.c (SCM_VALIDATE_R6RS_BINARY_INPUT_PORT): Use `SCM_VALIDATE_OPINPORT'. * tests/io-ports.test (7.2.8 Binary Input)[get-bytevector-n with closed port]: New test. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-r6rs-libs--devo--0--patch-46 --- ChangeLog | 17 +++++++++++++++++ src/ports.c | 2 +- tests/io-ports.test | 8 ++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 47d521f..1f5f15c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,23 @@ # arch-tag: automatic-ChangeLog--lcourtes@laas.fr--2006-libre/guile-r6rs-libs--devo--0 # +2007-09-02 16:56:54 GMT Ludovic Courtes patch-46 + + Summary: + Fixed handling of closed ports in `get-bytevector*'. + Revision: + guile-r6rs-libs--devo--0--patch-46 + + * src/ports.c (SCM_VALIDATE_R6RS_BINARY_INPUT_PORT): Use + `SCM_VALIDATE_OPINPORT'. + + * tests/io-ports.test (7.2.8 Binary Input)[get-bytevector-n with closed + port]: New test. + + modified files: + ChangeLog src/ports.c tests/io-ports.test + + 2007-09-02 14:55:30 GMT Ludovic Courtes patch-45 Summary: diff --git a/src/ports.c b/src/ports.c index 50e1e28..8d5c016 100644 --- a/src/ports.c +++ b/src/ports.c @@ -401,7 +401,7 @@ initialize_custom_binary_input_ports (void) /* Binary input. */ /* We currently don't support specific binary input ports. */ -#define SCM_VALIDATE_R6RS_BINARY_INPUT_PORT SCM_VALIDATE_INPUT_PORT +#define SCM_VALIDATE_R6RS_BINARY_INPUT_PORT SCM_VALIDATE_OPINPORT SCM_DEFINE (scm_r6rs_get_u8, "get-u8", 1, 0, 0, (SCM port), diff --git a/tests/io-ports.test b/tests/io-ports.test index 6d8ddab..ea018e1 100644 --- a/tests/io-ports.test +++ b/tests/io-ports.test @@ -63,6 +63,14 @@ (equal? (bytevector->u8-list bv) (map char->integer (string->list "GNU Guile")))))) + (pass-if-exception "get-bytevector-n with closed port" + exception:wrong-type-arg + + (let ((port (%make-void-port "r"))) + + (close-port port) + (get-bytevector-n port 3))) + (pass-if "get-bytevector-n! [short]" (let* ((port (open-input-string "GNU Guile")) (bv (make-bytevector 4)) -- 2.11.4.GIT