diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-01-21 23:39:30 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-01-21 23:39:53 +0100 |
commit | 45a28515c13348dfd18e53038ad63dd091a5a3c1 (patch) | |
tree | 8a41b122f1c34088b817890030d80301048affe6 /libguile/r6rs-ports.c | |
parent | a5cbbaa66a2491453db0edff9b0cb592a98f61bf (diff) |
Buffered custom binary input ports correctly handle partial read requests.
* libguile/r6rs-ports.c (cbip_fill_input): Always initialize 'read_pos'
when BUFFERED.
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
input port buffered partial reads"]: New test.
Diffstat (limited to 'libguile/r6rs-ports.c')
-rw-r--r-- | libguile/r6rs-ports.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libguile/r6rs-ports.c b/libguile/r6rs-ports.c index 30456a856..5f3b156c0 100644 --- a/libguile/r6rs-ports.c +++ b/libguile/r6rs-ports.c @@ -406,9 +406,12 @@ cbip_fill_input (SCM port) (c_port->read_buf == (unsigned char *) SCM_BYTEVECTOR_CONTENTS (bv)); if (buffered) - /* Make sure the buffer isn't corrupt. BV can be passed directly - to READ_PROC. */ - assert (c_port->read_buf_size == SCM_BYTEVECTOR_LENGTH (bv)); + { + /* Make sure the buffer isn't corrupt. BV can be passed directly + to READ_PROC. */ + assert (c_port->read_buf_size == SCM_BYTEVECTOR_LENGTH (bv)); + c_port->read_pos = (unsigned char *) SCM_BYTEVECTOR_CONTENTS (bv); + } else { /* This is an unbuffered port. When called via the |