diff options
| author | bors <bors@rust-lang.org> | 2014-05-22 15:16:31 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-22 15:16:31 -0700 |
| commit | 87ad19eb78239707f1ceed43e475c6aa052efdbc (patch) | |
| tree | 35940d52f145bca81dcf73e5e7da7f3847ceb413 /src/libnative/io | |
| parent | e402e75f4eb79af09b9451f0f232f994b3e2c998 (diff) | |
| parent | e878721d70349e2055f0ef854085de92e9498fde (diff) | |
| download | rust-87ad19eb78239707f1ceed43e475c6aa052efdbc.tar.gz rust-87ad19eb78239707f1ceed43e475c6aa052efdbc.zip | |
auto merge of #14310 : pcwalton/rust/detildestr-alllibs, r=brson
r? @brson
Diffstat (limited to 'src/libnative/io')
| -rw-r--r-- | src/libnative/io/addrinfo.rs | 5 | ||||
| -rw-r--r-- | src/libnative/io/file_win32.rs | 4 | ||||
| -rw-r--r-- | src/libnative/io/process.rs | 8 |
3 files changed, 10 insertions, 7 deletions
diff --git a/src/libnative/io/addrinfo.rs b/src/libnative/io/addrinfo.rs index 8ebae70f73c..64b082d9f3f 100644 --- a/src/libnative/io/addrinfo.rs +++ b/src/libnative/io/addrinfo.rs @@ -104,9 +104,10 @@ fn get_error(_: c_int) -> IoError { #[cfg(not(windows))] fn get_error(s: c_int) -> IoError { use std::io; - use std::str::raw::from_c_str; - let err_str = unsafe { from_c_str(gai_strerror(s)) }; + let err_str = unsafe { + CString::new(gai_strerror(s), false).as_str().unwrap().to_strbuf() + }; IoError { kind: io::OtherIoError, desc: "unable to resolve host", diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs index 9693f772170..f320aca2bfc 100644 --- a/src/libnative/io/file_win32.rs +++ b/src/libnative/io/file_win32.rs @@ -450,7 +450,9 @@ pub fn readlink(p: &CString) -> IoResult<Path> { libc::VOLUME_NAME_DOS) }); let ret = match ret { - Some(ref s) if s.starts_with(r"\\?\") => Ok(Path::new(s.slice_from(4))), + Some(ref s) if s.as_slice().starts_with(r"\\?\") => { + Ok(Path::new(s.as_slice().slice_from(4))) + } Some(s) => Ok(Path::new(s)), None => Err(super::last_error()), }; diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs index 04911bc5f1b..80b00dfb3fe 100644 --- a/src/libnative/io/process.rs +++ b/src/libnative/io/process.rs @@ -323,7 +323,7 @@ fn spawn_process_os(cfg: ProcessConfig, in_fd: c_int, out_fd: c_int, err_fd: c_i with_envp(cfg.env, |envp| { with_dirp(cfg.cwd, |dirp| { - os::win32::as_mut_utf16_p(cmd_str, |cmdp| { + os::win32::as_mut_utf16_p(cmd_str.as_slice(), |cmdp| { let created = CreateProcessW(ptr::null(), cmdp, ptr::mut_null(), @@ -396,7 +396,7 @@ fn zeroed_process_information() -> libc::types::os::arch::extra::PROCESS_INFORMA } #[cfg(windows)] -fn make_command_line(prog: &CString, args: &[CString]) -> ~str { +fn make_command_line(prog: &CString, args: &[CString]) -> StrBuf { let mut cmd = StrBuf::new(); append_arg(&mut cmd, prog.as_str() .expect("expected program name to be utf-8 encoded")); @@ -405,7 +405,7 @@ fn make_command_line(prog: &CString, args: &[CString]) -> ~str { append_arg(&mut cmd, arg.as_str() .expect("expected argument to be utf-8 encoded")); } - return cmd.into_owned(); + return cmd; fn append_arg(cmd: &mut StrBuf, arg: &str) { let quote = arg.chars().any(|c| c == ' ' || c == '\t'); @@ -1093,7 +1093,7 @@ mod tests { use std::c_str::CString; use super::make_command_line; - fn test_wrapper(prog: &str, args: &[&str]) -> ~str { + fn test_wrapper(prog: &str, args: &[&str]) -> StrBuf { make_command_line(&prog.to_c_str(), args.iter() .map(|a| a.to_c_str()) |
