From: Lucas Bajolet Date: Tue, 11 Aug 2015 20:53:59 +0000 (-0400) Subject: lib/binary: Fix binary lib to properly use Bytes instead of FlatBuffer X-Git-Tag: v0.7.8~79^2~1 X-Git-Url: http://nitlanguage.org lib/binary: Fix binary lib to properly use Bytes instead of FlatBuffer Signed-off-by: Lucas Bajolet --- diff --git a/lib/binary/binary.nit b/lib/binary/binary.nit index 263ad95..7e5c180 100644 --- a/lib/binary/binary.nit +++ b/lib/binary/binary.nit @@ -178,11 +178,13 @@ redef abstract class Reader # Returns a truncated string when an error is pending (`last_error != null`). fun read_string: String do - var buf = new FlatBuffer + var buf = new Bytes.empty loop var byte = read_byte - if byte == null or byte == 0x00u8 then return buf.to_s - buf.bytes.add byte + if byte == null or byte == 0u8 then + return buf.to_s + end + buf.add byte end end