Skip to content

Commit 64ce563

Browse files
committed
Replacing str::unsafe_from_bytes with str::from_bytes (part 2)
1 parent c7b23f9 commit 64ce563

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/compiletest/procsrv.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn readclose(fd: fd_t) -> str {
8585
let buf = "";
8686
while !reader.eof() {
8787
let bytes = reader.read_bytes(4096u);
88-
buf += str::unsafe_from_bytes(bytes);
88+
buf += str::from_bytes(bytes);
8989
}
9090
os::fclose(file);
9191
ret buf;
@@ -114,8 +114,8 @@ fn worker(p: port<request>) {
114114
// the alt discriminant are wrong.
115115
alt recv(p) {
116116
exec(lib_path, prog, args, respchan) {
117-
{lib_path: str::unsafe_from_bytes(lib_path),
118-
prog: str::unsafe_from_bytes(prog),
117+
{lib_path: str::from_bytes(lib_path),
118+
prog: str::from_bytes(prog),
119119
args: clone_vecu8str(args),
120120
respchan: respchan}
121121
}
@@ -189,7 +189,7 @@ fn clone_vecstr(v: [str]) -> [[u8]] {
189189
fn clone_vecu8str(v: [[u8]]) -> [str] {
190190
let r = [];
191191
for t in vec::slice(v, 0u, vec::len(v)) {
192-
r += [str::unsafe_from_bytes(t)];
192+
r += [str::from_bytes(t)];
193193
}
194194
ret r;
195195
}

src/libcore/extfmt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ mod rt {
390390
fn str_init_elt(n_elts: uint, c: char) -> str {
391391
let svec = vec::init_elt::<u8>(n_elts, c as u8);
392392

393-
ret str::unsafe_from_bytes(svec);
393+
ret str::from_bytes(svec);
394394
}
395395
enum pad_mode { pad_signed, pad_unsigned, pad_nozero, }
396396
fn pad(cv: conv, s: str, mode: pad_mode) -> str {
@@ -439,7 +439,7 @@ mod rt {
439439
if signed && zero_padding && str::byte_len(s) > 0u {
440440
let head = s[0];
441441
if head == '+' as u8 || head == '-' as u8 || head == ' ' as u8 {
442-
let headstr = str::unsafe_from_bytes([head]);
442+
let headstr = str::from_bytes([head]);
443443
// FIXME: not UTF-8 safe
444444
let bytelen = str::byte_len(s);
445445
let numpart = str::substr(s, 1u, bytelen - 1u);

0 commit comments

Comments
 (0)