mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
fixing sexp_port_size after buffered read on non-custom ports
This commit is contained in:
parent
582c46935e
commit
f2f6aadb3d
1 changed files with 2 additions and 2 deletions
4
sexp.c
4
sexp.c
|
@ -1352,7 +1352,7 @@ int sexp_buffered_read_char (sexp ctx, sexp p) {
|
|||
res = fread(sexp_port_buf(p) + BUF_START, 1, SEXP_PORT_BUFFER_SIZE - BUF_START, sexp_port_stream(p));
|
||||
if (res >= 0) {
|
||||
sexp_port_offset(p) = BUF_START;
|
||||
sexp_port_size(p) = res;
|
||||
sexp_port_size(p) = res + BUF_START;
|
||||
res = ((sexp_port_offset(p) < sexp_port_size(p))
|
||||
? ((unsigned char*)sexp_port_buf(p))[sexp_port_offset(p)++] : EOF);
|
||||
}
|
||||
|
@ -1360,7 +1360,7 @@ int sexp_buffered_read_char (sexp ctx, sexp p) {
|
|||
res = read(sexp_port_fileno(p), sexp_port_buf(p) + BUF_START, SEXP_PORT_BUFFER_SIZE - BUF_START);
|
||||
if (res >= 0) {
|
||||
sexp_port_offset(p) = BUF_START;
|
||||
sexp_port_size(p) = res;
|
||||
sexp_port_size(p) = res + BUF_START;
|
||||
res = ((sexp_port_offset(p) < sexp_port_size(p))
|
||||
? ((unsigned char*)sexp_port_buf(p))[sexp_port_offset(p)++] : EOF);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue