Merge: Read char
authorJean Privat <jean@pryen.org>
Thu, 14 May 2015 23:35:54 +0000 (19:35 -0400)
committerJean Privat <jean@pryen.org>
Thu, 14 May 2015 23:35:54 +0000 (19:35 -0400)
commit506f4b1efdd9d548becca066036e3cd5c1456a09
tree31e24f2bc9dc4c2bb9b0c945d59f1ab7e1c07579
parentfcd9049c2a3a123605a567b7caaf8ed39053e50c
parent4420f41816bd4ef646902e1213df2d40ec58557d
Merge: Read char

Semantics have been changed, before this PR, read_char was used to read a single byte and return -1 if EOF or timeout.

Since a Byte can have a value of -1, it is changed here:

* `read_char` now returns a Char (which, for the moment, is a byte, but this will change once UTF-8 is properly supported), and returns null on EOF or timeout
* `read_byte` has more or less the semantics of the old read_char, but returns null on EOF instead of -1 for the reasons mentioned earlier which could induce a wrong assumption about the state of the Stream

Edit: Still related to #1309

Pull-Request: #1334
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>
lib/standard/file.nit
lib/standard/stream.nit