diff --git a/src/chroot/chroot.rs b/src/chroot/chroot.rs index daa6795ec..c0467dd32 100644 --- a/src/chroot/chroot.rs +++ b/src/chroot/chroot.rs @@ -96,7 +96,7 @@ pub fn uumain(args: Vec) -> isize { unsafe { let executable = CString::from_slice(command[0].as_bytes()).as_bytes_with_nul().as_ptr(); - let mut command_parts: Vec<*const i8> = command.iter().map(|x| CString::from_slice(x.as_bytes()).as_bytes_with_nul().as_ptr()).collect(); + 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 } diff --git a/src/common/c_types.rs b/src/common/c_types.rs index 50fcb287e..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_bytes_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) }) @@ -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 }