lib/binary: Fix binary lib to properly use Bytes instead of FlatBuffer
authorLucas Bajolet <r4pass@hotmail.com>
Tue, 11 Aug 2015 20:53:59 +0000 (16:53 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Thu, 20 Aug 2015 14:50:47 +0000 (10:50 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

lib/binary/binary.nit

index 263ad95..7e5c180 100644 (file)
@@ -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