about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKevin Cantu <me@kevincantu.org>2012-01-25 01:00:21 -0800
committerKevin Cantu <me@kevincantu.org>2012-01-25 01:00:21 -0800
commit64ce563c054573bd12425e3253b54c1ee91ec84f (patch)
tree6dc466712c7b91d84b450d265ac2e5301a9e4820
parentc7b23f9a86fcdf328ebb349d9a5ad4e4c7dfe6ce (diff)
downloadrust-64ce563c054573bd12425e3253b54c1ee91ec84f.tar.gz
rust-64ce563c054573bd12425e3253b54c1ee91ec84f.zip
Replacing str::unsafe_from_bytes with str::from_bytes (part 2)
-rw-r--r--src/compiletest/procsrv.rs8
-rw-r--r--src/libcore/extfmt.rs4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs
index a758e9a21bb..6f3fd87466a 100644
--- a/src/compiletest/procsrv.rs
+++ b/src/compiletest/procsrv.rs
@@ -85,7 +85,7 @@ fn readclose(fd: fd_t) -> str {
     let buf = "";
     while !reader.eof() {
         let bytes = reader.read_bytes(4096u);
-        buf += str::unsafe_from_bytes(bytes);
+        buf += str::from_bytes(bytes);
     }
     os::fclose(file);
     ret buf;
@@ -114,8 +114,8 @@ fn worker(p: port<request>) {
                 // the alt discriminant are wrong.
                 alt recv(p) {
                   exec(lib_path, prog, args, respchan) {
-                    {lib_path: str::unsafe_from_bytes(lib_path),
-                     prog: str::unsafe_from_bytes(prog),
+                    {lib_path: str::from_bytes(lib_path),
+                     prog: str::from_bytes(prog),
                      args: clone_vecu8str(args),
                      respchan: respchan}
                   }
@@ -189,7 +189,7 @@ fn clone_vecstr(v: [str]) -> [[u8]] {
 fn clone_vecu8str(v: [[u8]]) -> [str] {
     let r = [];
     for t in vec::slice(v, 0u, vec::len(v)) {
-        r += [str::unsafe_from_bytes(t)];
+        r += [str::from_bytes(t)];
     }
     ret r;
 }
diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs
index a06e01f491e..eb91c2cb5d5 100644
--- a/src/libcore/extfmt.rs
+++ b/src/libcore/extfmt.rs
@@ -390,7 +390,7 @@ mod rt {
     fn str_init_elt(n_elts: uint, c: char) -> str {
         let svec = vec::init_elt::<u8>(n_elts, c as u8);
 
-        ret str::unsafe_from_bytes(svec);
+        ret str::from_bytes(svec);
     }
     enum pad_mode { pad_signed, pad_unsigned, pad_nozero, }
     fn pad(cv: conv, s: str, mode: pad_mode) -> str {
@@ -439,7 +439,7 @@ mod rt {
         if signed && zero_padding && str::byte_len(s) > 0u {
             let head = s[0];
             if head == '+' as u8 || head == '-' as u8 || head == ' ' as u8 {
-                let headstr = str::unsafe_from_bytes([head]);
+                let headstr = str::from_bytes([head]);
                 // FIXME: not UTF-8 safe
                 let bytelen = str::byte_len(s);
                 let numpart = str::substr(s, 1u, bytelen - 1u);