Merge branch 'develop' into 'develop'

Prevent CLOS' stream-read-line from signalling end-of-file while reading unterminated lines.

See merge request !40
This commit is contained in:
Daniel Kochmański 2017-01-05 10:27:08 +00:00
commit 2cce45b5c6
2 changed files with 5 additions and 2 deletions

View file

@ -1630,7 +1630,7 @@ do_read_delimited_list(int d, cl_object in, bool proper_list)
if (!ECL_ANSI_STREAM_P(strm)) {
value0 = _ecl_funcall2(@'gray::stream-read-line', strm);
value1 = ecl_nth_value(the_env, 1);
if (!Null(value1)) {
if (Null(value0) && !Null(value1)) {
if (!Null(eof_errorp))
FEend_of_file(strm);
value0 = eof_value;

View file

@ -512,7 +512,10 @@
(loop
(let ((ch (stream-read-char stream)))
(cond ((eq ch :eof)
(return (values (si::shrink-vector res index) t)))
(return (values (if (zerop index)
nil
(si::shrink-vector res index))
t)))
(t
(when (char= ch #\newline)
(return (values (si::shrink-vector res index) nil)))