From 8855efee3f0373f984c1b3f795c4c2272bac7e87 Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Tue, 11 Aug 2015 16:53:59 -0400 Subject: [PATCH] lib/binary: Fix binary lib to properly use Bytes instead of FlatBuffer Signed-off-by: Lucas Bajolet --- lib/binary/binary.nit | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 -- 1.7.9.5