diff --git a/deps/regex b/deps/regex index 90ef3c4b5..8b44176a9 160000 --- a/deps/regex +++ b/deps/regex @@ -1 +1 @@ -Subproject commit 90ef3c4b58140d672ed97cdf45e59592d122368e +Subproject commit 8b44176a91326ec0b5e33bc36443ba00cb528c16 diff --git a/deps/rust-crypto b/deps/rust-crypto index 6e70e4b98..d06c8672a 160000 --- a/deps/rust-crypto +++ b/deps/rust-crypto @@ -1 +1 @@ -Subproject commit 6e70e4b98137f247f8d30b698c179d2f973dc23b +Subproject commit d06c8672a212add38edfcc5b504e4b4cb30c5a8b diff --git a/src/chroot/chroot.rs b/src/chroot/chroot.rs index c88f3b35f..c0467dd32 100644 --- a/src/chroot/chroot.rs +++ b/src/chroot/chroot.rs @@ -95,8 +95,8 @@ pub fn uumain(args: Vec) -> isize { set_context(&newroot, &opts); unsafe { - let executable = CString::from_slice(command[0].as_bytes()).as_slice_with_nul().as_ptr(); - let mut command_parts: Vec<*const i8> = command.iter().map(|x| CString::from_slice(x.as_bytes()).as_slice_with_nul().as_ptr()).collect(); + let executable = CString::from_slice(command[0].as_bytes()).as_bytes_with_nul().as_ptr(); + let mut command_parts: Vec<*const u8> = command.iter().map(|x| CString::from_slice(x.as_bytes()).as_bytes_with_nul().as_ptr()).collect(); command_parts.push(std::ptr::null()); execvp(executable as *const libc::c_char, command_parts.as_ptr() as *mut *const libc::c_char) as isize } @@ -131,7 +131,7 @@ fn enter_chroot(root: &Path) { let root_str = root.display(); std::os::change_dir(root).unwrap(); let err = unsafe { - chroot(CString::from_slice(b".").as_slice_with_nul().as_ptr() as *const libc::c_char) + chroot(CString::from_slice(b".").as_bytes_with_nul().as_ptr() as *const libc::c_char) }; if err != 0 { crash!(1, "cannot chroot to {}: {}", root_str, strerror(err).as_slice()) diff --git a/src/common/c_types.rs b/src/common/c_types.rs index 78fde5648..a84142ff8 100644 --- a/src/common/c_types.rs +++ b/src/common/c_types.rs @@ -134,7 +134,7 @@ pub fn get_pw_from_args(free: &Vec) -> Option { } else { let pw_pointer = unsafe { let cstr = CString::from_slice(username.as_bytes()); - getpwnam(cstr.as_slice_with_nul().as_ptr()) + getpwnam(cstr.as_bytes_with_nul().as_ptr() as *const i8) }; if !pw_pointer.is_null() { Some(unsafe { read(pw_pointer) }) @@ -153,7 +153,7 @@ pub fn get_group(groupname: &str) -> Option { } else { unsafe { let cstr = CString::from_slice(groupname.as_bytes()); - getgrnam(cstr.as_slice_with_nul().as_ptr() as *const c_char) + getgrnam(cstr.as_bytes_with_nul().as_ptr() as *const c_char) } }; @@ -199,7 +199,7 @@ unsafe fn get_group_list_internal(name: *const c_char, gid: gid_t, groups: *mut } } -pub fn get_groups() -> Result, usize> { +pub fn get_groups() -> Result, i32> { let ngroups = unsafe { getgroups(0, null_mut()) }; if ngroups == -1 { return Err(os::errno()); diff --git a/src/echo/echo.rs b/src/echo/echo.rs index f44862011..df90b432a 100644 --- a/src/echo/echo.rs +++ b/src/echo/echo.rs @@ -31,7 +31,7 @@ struct EchoOptions { } #[inline(always)] -fn to_char(bytes: &Vec, base: usize) -> char { +fn to_char(bytes: &Vec, base: u32) -> char { from_str_radix::(from_utf8(bytes.as_slice()).unwrap(), base).unwrap() as u8 as char } @@ -52,10 +52,10 @@ fn isodigit(c: u8) -> bool { } } -fn convert_str(string: &[u8], index: usize, base: usize) -> (char, usize) { +fn convert_str(string: &[u8], index: usize, base: u32) -> (char, usize) { let (max_digits, is_legal_digit) : (usize, fn(u8) -> bool) = match base { - 8us => (3, isodigit), - 16us => (2, isxdigit), + 8 => (3, isodigit), + 16 => (2, isxdigit), _ => panic!(), }; @@ -202,7 +202,7 @@ pub fn uumain(args: Vec) -> isize { 't' => print!("\t"), 'v' => print!("\x0B"), 'x' => { - let (c, num_char_used) = convert_str(string.as_bytes(), index + 1, 16us); + let (c, num_char_used) = convert_str(string.as_bytes(), index + 1, 16); if num_char_used == 0 { print!("\\x"); } else { @@ -213,7 +213,7 @@ pub fn uumain(args: Vec) -> isize { } }, '0' => { - let (c, num_char_used) = convert_str(string.as_bytes(), index + 1, 8us); + let (c, num_char_used) = convert_str(string.as_bytes(), index + 1, 8); if num_char_used == 0 { print!("\0"); } else { @@ -224,7 +224,7 @@ pub fn uumain(args: Vec) -> isize { } } _ => { - let (esc_c, num_char_used) = convert_str(string.as_bytes(), index, 8us); + let (esc_c, num_char_used) = convert_str(string.as_bytes(), index, 8); if num_char_used == 0 { print!("\\{}", c); } else { diff --git a/src/split/split.rs b/src/split/split.rs index 696410b7c..c92170e2a 100644 --- a/src/split/split.rs +++ b/src/split/split.rs @@ -243,7 +243,7 @@ fn num_prefix(i: usize, width: usize) -> String { let div = Int::pow(10 as usize, w); let r = n / div; n -= r * div; - c.push(char::from_digit(r, 10).unwrap()); + c.push(char::from_digit(r as u32, 10).unwrap()); } c } diff --git a/src/tail/tail.rs b/src/tail/tail.rs index 8fa4d69fa..1e27f521d 100644 --- a/src/tail/tail.rs +++ b/src/tail/tail.rs @@ -20,7 +20,7 @@ use std::old_io::fs::File; use std::old_path::Path; use std::str::from_utf8; use getopts::{optopt, optflag, getopts, usage}; -use std::collections::ring_buf::RingBuf; +use std::collections::VecDeque; use std::old_io::timer::sleep; use std::time::duration::Duration; @@ -241,7 +241,7 @@ macro_rules! tail_impl ( // read through each line and store them in a ringbuffer that always contains // count lines/chars. When reaching the end of file, output the data in the // ringbuf. - let mut ringbuf: RingBuf<$kind> = RingBuf::new(); + let mut ringbuf: VecDeque<$kind> = VecDeque::new(); let data = $reader.$kindfn().skip( if $beginning { let temp = $count; diff --git a/src/tr/tr.rs b/src/tr/tr.rs index bf3b2ff92..69a34ea18 100644 --- a/src/tr/tr.rs +++ b/src/tr/tr.rs @@ -15,7 +15,7 @@ extern crate getopts; use getopts::OptGroup; use std::char::from_u32; -use std::collections::{BitvSet, VecMap}; +use std::collections::{BitSet, VecMap}; use std::old_io::{BufferedReader, print}; use std::old_io::stdio::{stdin_raw, stdout}; use std::iter::FromIterator; @@ -89,7 +89,7 @@ fn expand_set(s: &str) -> Vec { } fn delete(set: Vec, complement: bool) { - let mut bset = BitvSet::new(); + let mut bset = BitSet::new(); let mut out = stdout(); for &c in set.iter() {