Merge pull request #442 from ebfe/fix-build-master

std::num::parse_bytes has been removed
This commit is contained in:
Heather 2014-11-05 15:26:14 +04:00
commit 9cc25bad3c
7 changed files with 13 additions and 16 deletions

View file

@ -21,7 +21,7 @@ extern crate regex;
use std::io::fs; use std::io::fs;
use std::io::fs::PathExtensions; use std::io::fs::PathExtensions;
use std::u64; use std::num::from_str_radix;
use regex::Regex; use regex::Regex;
#[path = "../common/util.rs"] #[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)), '+' | '-' | '=' => (ch, change.slice_from(1)),
_ => ('=', change) _ => ('=', change)
}; };
let mode = u64::parse_bytes(slice.as_bytes(), 8).unwrap(); // already verified let mode = from_str_radix::<u64>(slice, 8).unwrap(); // already verified
match action { match action {
'+' => fperm |= mode, '+' => fperm |= mode,
'-' => fperm &= !mode, '-' => fperm &= !mode,

View file

@ -20,6 +20,7 @@ use std::io::{stderr, fs, FileStat, TypeDirectory};
use std::option::Option; use std::option::Option;
use std::path::Path; use std::path::Path;
use std::sync::{Arc, Future}; use std::sync::{Arc, Future};
use std::str::from_utf8;
use time::Timespec; use time::Timespec;
#[path = "../common/util.rs"] #[path = "../common/util.rs"]
@ -244,7 +245,7 @@ ers of 1000).",
letters.push(c); 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::<uint>).unwrap();
let multiple = match String::from_chars(letters.as_slice()).as_slice() { let multiple = match String::from_chars(letters.as_slice()).as_slice() {
"K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024, "K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024,
"T" => 1024 * 1024 * 1024 * 1024, "P" => 1024 * 1024 * 1024 * 1024 * 1024, "T" => 1024 * 1024 * 1024 * 1024, "P" => 1024 * 1024 * 1024 * 1024 * 1024,

View file

@ -14,7 +14,8 @@ extern crate getopts;
extern crate libc; extern crate libc;
use std::io::{print, println}; use std::io::{print, println};
use std::uint; use std::num::from_str_radix;
use std::str::from_utf8;
#[path = "../common/util.rs"] #[path = "../common/util.rs"]
mod util; mod util;
@ -31,7 +32,7 @@ struct EchoOptions {
#[inline(always)] #[inline(always)]
fn to_char(bytes: &Vec<u8>, base: uint) -> char { fn to_char(bytes: &Vec<u8>, base: uint) -> char {
uint::parse_bytes(bytes.as_slice(), base).unwrap() as u8 as char from_str_radix::<uint>(from_utf8(bytes.as_slice()).unwrap(), base).unwrap() as u8 as char
} }
#[inline(always)] #[inline(always)]

View file

@ -13,7 +13,6 @@
extern crate getopts; extern crate getopts;
extern crate libc; extern crate libc;
use std::u64;
use std::vec::{Vec}; use std::vec::{Vec};
use std::io::{stdin}; use std::io::{stdin};
@ -56,7 +55,7 @@ fn print_factors(num: u64) {
} }
fn print_factors_str(num_str: &str) { 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, Some(x) => x,
None => { crash!(1, "{} not a number", num_str); } None => { crash!(1, "{} not a number", num_str); }
}; };

View file

@ -17,7 +17,6 @@ extern crate libc;
use std::io; use std::io;
use std::io::fs::File; use std::io::fs::File;
use std::io::BufferedReader; use std::io::BufferedReader;
use std::uint;
#[path = "../common/util.rs"] #[path = "../common/util.rs"]
mod util; mod util;
@ -64,7 +63,7 @@ pub fn uumain(args: Vec<String>) -> int {
} }
}; };
let width = match poss_width { 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, Some(width) => width,
None => crash!(1, "illegal width value (\"{}\")", inp_width) None => crash!(1, "illegal width value (\"{}\")", inp_width)
}, },

View file

@ -16,7 +16,7 @@ extern crate libc;
use std::io::fs::{mod, PathExtensions}; use std::io::fs::{mod, PathExtensions};
use std::io::FilePermission; use std::io::FilePermission;
use std::num::strconv; use std::num::from_str_radix;
#[path = "../common/util.rs"] #[path = "../common/util.rs"]
mod util; mod util;
@ -64,9 +64,7 @@ pub fn uumain(args: Vec<String>) -> int {
let mode_match = matches.opts_str(&["mode".to_string()]); let mode_match = matches.opts_str(&["mode".to_string()]);
let mode: FilePermission = if mode_match.is_some() { let mode: FilePermission = if mode_match.is_some() {
let m = mode_match.unwrap(); let m = mode_match.unwrap();
let res: Option<u32> = strconv::from_str_common(m.as_slice(), 8, false, false, false, let res: Option<u32> = from_str_radix(m.as_slice(), 8);
strconv::ExpNone,
false, false);
if res.is_some() { if res.is_some() {
unsafe { std::mem::transmute(res.unwrap()) } unsafe { std::mem::transmute(res.unwrap()) }
} else { } else {

View file

@ -16,7 +16,6 @@ extern crate libc;
use std::io::{File, Open, ReadWrite, fs}; use std::io::{File, Open, ReadWrite, fs};
use std::io::fs::PathExtensions; use std::io::fs::PathExtensions;
use std::u64;
#[path = "../common/util.rs"] #[path = "../common/util.rs"]
mod util; mod util;
@ -184,8 +183,8 @@ fn parse_size(size: &str) -> (u64, TruncateMode) {
} }
} }
slice slice
}.to_string().into_bytes(); }.to_string();
let mut number = match u64::parse_bytes(bytes.as_slice(), 10) { let mut number = match from_str::<u64>(bytes.as_slice()) {
Some(num) => num, Some(num) => num,
None => { None => {
crash!(1, "'{}' is not a valid number.", size) crash!(1, "'{}' is not a valid number.", size)