#64 Problem with read-from-string (latest CVS version)

closed-fixed
nobody
Lisp (13)
5
2003-10-23
2003-10-23
No

(read-from-string "a b c d" nil nil :start 4) returns
(values 'c 7) but should return (values 'c 6). The
problem lies in StringInputStream.java, in particular
the read and unread methods.

Fix as below:

protected int read()
{
if ((offset + start) >= end) // fixed - was
(offset >= end)
return -1;
int n = s.charAt(offset + start); // fixed -
was s.charAt(offset)
++offset;
if (n == '\n')
++lineNumber;
return n;
}

protected void unread(int n)
{
if (offset > 0) { // fixed - was (offset
> start)
--offset;
if (n == '\n')
--lineNumber;
}
}

Discussion

  • Peter Graves

    Peter Graves - 2003-10-23
    • status: open --> closed-fixed
     
  • Peter Graves

    Peter Graves - 2003-10-23

    Logged In: YES
    user_id=558172

    Fixed in CVS.

    Thanks!

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks