@@ 8,7 8,7 @@ use strings;
use math;
fn scan_buf(h: io::handle, buf: const []u8) (void | error) = {
- let result = io::read(h, buf)?;
+ let result = io::readall(h, buf)?;
match (result) {
case let sz: size =>
if (sz != len(buf))
@@ 152,6 152,9 @@ fn scan_type(h: io::handle) (tagtype | error) = {
fn scan_string(h: io::handle) (str | error) = {
let length = scan_short(h)?: u16;
+ if (length == 0) {
+ return "";
+ };
let buf: []u8 = alloc([0...], length);
scan_buf(h, buf)?;
return strings::fromutf8_unsafe(buf);