diff --git a/src/chmod/chmod.rs b/src/chmod/chmod.rs index 4517e0e71..74b3e740e 100644 --- a/src/chmod/chmod.rs +++ b/src/chmod/chmod.rs @@ -21,7 +21,7 @@ extern crate regex; use std::io::fs; use std::io::fs::PathExtensions; -use std::u64; +use std::num::from_str_radix; use regex::Regex; #[path = "../common/util.rs"] @@ -273,7 +273,7 @@ fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool '+' | '-' | '=' => (ch, change.slice_from(1)), _ => ('=', change) }; - let mode = u64::parse_bytes(slice.as_bytes(), 8).unwrap(); // already verified + let mode = from_str_radix::(slice, 8).unwrap(); // already verified match action { '+' => fperm |= mode, '-' => fperm &= !mode, diff --git a/src/du/du.rs b/src/du/du.rs index 14f8915a7..d6c49fedc 100644 --- a/src/du/du.rs +++ b/src/du/du.rs @@ -20,6 +20,7 @@ use std::io::{stderr, fs, FileStat, TypeDirectory}; use std::option::Option; use std::path::Path; use std::sync::{Arc, Future}; +use std::str::from_utf8; use time::Timespec; #[path = "../common/util.rs"] @@ -244,7 +245,7 @@ ers of 1000).", letters.push(c); } } - let number = std::uint::parse_bytes(numbers.as_slice(), 10).unwrap(); + let number = from_utf8(numbers.as_slice()).and_then(from_str::).unwrap(); let multiple = match String::from_chars(letters.as_slice()).as_slice() { "K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024, "T" => 1024 * 1024 * 1024 * 1024, "P" => 1024 * 1024 * 1024 * 1024 * 1024, diff --git a/src/echo/echo.rs b/src/echo/echo.rs index 7d19c7aff..545970cbe 100644 --- a/src/echo/echo.rs +++ b/src/echo/echo.rs @@ -14,7 +14,8 @@ extern crate getopts; extern crate libc; use std::io::{print, println}; -use std::uint; +use std::num::from_str_radix; +use std::str::from_utf8; #[path = "../common/util.rs"] mod util; @@ -31,7 +32,7 @@ struct EchoOptions { #[inline(always)] fn to_char(bytes: &Vec, base: uint) -> char { - uint::parse_bytes(bytes.as_slice(), base).unwrap() as u8 as char + from_str_radix::(from_utf8(bytes.as_slice()).unwrap(), base).unwrap() as u8 as char } #[inline(always)] diff --git a/src/factor/factor.rs b/src/factor/factor.rs index 02e8190ee..e5399fdb1 100644 --- a/src/factor/factor.rs +++ b/src/factor/factor.rs @@ -13,7 +13,6 @@ extern crate getopts; extern crate libc; -use std::u64; use std::vec::{Vec}; use std::io::{stdin}; @@ -56,7 +55,7 @@ fn print_factors(num: u64) { } fn print_factors_str(num_str: &str) { - let num = match u64::parse_bytes(num_str.as_bytes(), 10) { + let num = match from_str(num_str) { Some(x) => x, None => { crash!(1, "{} not a number", num_str); } }; diff --git a/src/fold/fold.rs b/src/fold/fold.rs index 9cf46a924..cb9a9fce9 100644 --- a/src/fold/fold.rs +++ b/src/fold/fold.rs @@ -17,7 +17,6 @@ extern crate libc; use std::io; use std::io::fs::File; use std::io::BufferedReader; -use std::uint; #[path = "../common/util.rs"] mod util; @@ -64,7 +63,7 @@ pub fn uumain(args: Vec) -> int { } }; let width = match poss_width { - Some(inp_width) => match uint::parse_bytes(inp_width.as_bytes(), 10) { + Some(inp_width) => match from_str(inp_width.as_slice()) { Some(width) => width, None => crash!(1, "illegal width value (\"{}\")", inp_width) }, diff --git a/src/mkdir/mkdir.rs b/src/mkdir/mkdir.rs index 559a36c99..b9cc0aac0 100644 --- a/src/mkdir/mkdir.rs +++ b/src/mkdir/mkdir.rs @@ -16,7 +16,7 @@ extern crate libc; use std::io::fs::{mod, PathExtensions}; use std::io::FilePermission; -use std::num::strconv; +use std::num::from_str_radix; #[path = "../common/util.rs"] mod util; @@ -64,9 +64,7 @@ pub fn uumain(args: Vec) -> int { let mode_match = matches.opts_str(&["mode".to_string()]); let mode: FilePermission = if mode_match.is_some() { let m = mode_match.unwrap(); - let res: Option = strconv::from_str_common(m.as_slice(), 8, false, false, false, - strconv::ExpNone, - false, false); + let res: Option = from_str_radix(m.as_slice(), 8); if res.is_some() { unsafe { std::mem::transmute(res.unwrap()) } } else { diff --git a/src/truncate/truncate.rs b/src/truncate/truncate.rs index 286743ad7..e1002fb49 100644 --- a/src/truncate/truncate.rs +++ b/src/truncate/truncate.rs @@ -16,7 +16,6 @@ extern crate libc; use std::io::{File, Open, ReadWrite, fs}; use std::io::fs::PathExtensions; -use std::u64; #[path = "../common/util.rs"] mod util; @@ -184,8 +183,8 @@ fn parse_size(size: &str) -> (u64, TruncateMode) { } } slice - }.to_string().into_bytes(); - let mut number = match u64::parse_bytes(bytes.as_slice(), 10) { + }.to_string(); + let mut number = match from_str::(bytes.as_slice()) { Some(num) => num, None => { crash!(1, "'{}' is not a valid number.", size)