Replacing str::unsafe_from_bytes with str::from_bytes (part 5)

This commit is contained in:
Kevin Cantu 2012-01-25 01:29:44 -08:00
parent 87320a9f27
commit 57717fa4d8

View file

@ -109,7 +109,7 @@ impl reader_util for reader {
if ch == -1 || ch == 10 { break; }
buf += [ch as u8];
}
str::unsafe_from_bytes(buf)
str::from_bytes(buf)
}
fn read_c_str() -> str {
@ -118,7 +118,7 @@ impl reader_util for reader {
let ch = self.read_byte();
if ch < 1 { break; } else { buf += [ch as u8]; }
}
str::unsafe_from_bytes(buf)
str::from_bytes(buf)
}
// FIXME deal with eof?
@ -479,7 +479,7 @@ fn seek_in_buf(offset: int, pos: uint, len: uint, whence: seek_style) ->
fn read_whole_file_str(file: str) -> result::t<str, str> {
result::chain(read_whole_file(file), { |bytes|
result::ok(str::unsafe_from_bytes(bytes))
result::ok(str::from_bytes(bytes))
})
}