Replacing str::unsafe_from_bytes with str::from_bytes (part 5)
This commit is contained in:
parent
87320a9f27
commit
57717fa4d8
1 changed files with 3 additions and 3 deletions
|
@ -109,7 +109,7 @@ impl reader_util for reader {
|
||||||
if ch == -1 || ch == 10 { break; }
|
if ch == -1 || ch == 10 { break; }
|
||||||
buf += [ch as u8];
|
buf += [ch as u8];
|
||||||
}
|
}
|
||||||
str::unsafe_from_bytes(buf)
|
str::from_bytes(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_c_str() -> str {
|
fn read_c_str() -> str {
|
||||||
|
@ -118,7 +118,7 @@ impl reader_util for reader {
|
||||||
let ch = self.read_byte();
|
let ch = self.read_byte();
|
||||||
if ch < 1 { break; } else { buf += [ch as u8]; }
|
if ch < 1 { break; } else { buf += [ch as u8]; }
|
||||||
}
|
}
|
||||||
str::unsafe_from_bytes(buf)
|
str::from_bytes(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME deal with eof?
|
// 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> {
|
fn read_whole_file_str(file: str) -> result::t<str, str> {
|
||||||
result::chain(read_whole_file(file), { |bytes|
|
result::chain(read_whole_file(file), { |bytes|
|
||||||
result::ok(str::unsafe_from_bytes(bytes))
|
result::ok(str::from_bytes(bytes))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue