auto merge of #8997 : fhahn/rust/issue_8985, r=catamorphism,brson

Patch for #8985
This commit is contained in:
bors 2013-09-05 15:00:49 -07:00
commit 6f9ce0948a
38 changed files with 147 additions and 147 deletions

View file

@ -72,7 +72,7 @@ fn sort_and_fmt(mm: &HashMap<~[u8], uint>, total: uint) -> ~str {
for kv in pairs_sorted.iter() {
let (k,v) = (*kv).clone();
unsafe {
let b = str::raw::from_bytes(k);
let b = str::raw::from_utf8(k);
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
// to_ascii_move and to_str_move to not do a unnecessary copy.
buffer.push_str(fmt!("%s %0.3f\n", b.to_ascii().to_upper().to_str_ascii(), v));

View file

@ -60,7 +60,7 @@ impl Code {
}
reverse(result);
str::from_bytes(result)
str::from_utf8(result)
}
}

View file

@ -17,13 +17,13 @@ static C: *u8 = B as *u8;
pub fn main() {
unsafe {
let foo = &A as *u8;
assert_eq!(str::raw::from_bytes(A), ~"hi");
assert_eq!(str::raw::from_utf8(A), ~"hi");
assert_eq!(str::raw::from_buf_len(foo, A.len()), ~"hi");
assert_eq!(str::raw::from_buf_len(C, B.len()), ~"hi");
assert!(*C == A[0]);
assert!(*(&B[0] as *u8) == A[0]);
let bar = str::raw::from_bytes(A).to_c_str();
let bar = str::raw::from_utf8(A).to_c_str();
assert_eq!(bar.with_ref(|buf| str::raw::from_c_str(buf)), ~"hi");
}
}

View file

@ -44,13 +44,13 @@ fn test_destroy_actually_kills(force: bool) {
#[cfg(unix,not(target_os="android"))]
fn process_exists(pid: libc::pid_t) -> bool {
let run::ProcessOutput {output, _} = run::process_output("ps", [~"-p", pid.to_str()]);
str::from_bytes(output).contains(pid.to_str())
str::from_utf8(output).contains(pid.to_str())
}
#[cfg(unix,target_os="android")]
fn process_exists(pid: libc::pid_t) -> bool {
let run::ProcessOutput {output, _} = run::process_output("/system/bin/ps", [pid.to_str()]);
str::from_bytes(output).contains(~"root")
str::from_utf8(output).contains(~"root")
}
#[cfg(windows)]

View file

@ -80,7 +80,7 @@ mod map_reduce {
mapper_done => { num_mappers -= 1; }
find_reducer(k, cc) => {
let mut c;
match reducers.find(&str::from_bytes(k)) {
match reducers.find(&str::from_utf8(k)) {
Some(&_c) => { c = _c; }
None => { c = 0; }
}

View file

@ -246,7 +246,7 @@ fn test_write() {
writeln!(w, "{foo}", foo="bar");
}
let s = str::from_bytes_owned(buf.inner());
let s = str::from_utf8_owned(buf.inner());
t!(s, "34helloline\nbar\n");
}