mirror of
https://github.com/uutils/coreutils
synced 2024-12-16 08:12:39 +00:00
Merge pull request #442 from ebfe/fix-build-master
std::num::parse_bytes has been removed
This commit is contained in:
commit
9cc25bad3c
7 changed files with 13 additions and 16 deletions
|
@ -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::<u64>(slice, 8).unwrap(); // already verified
|
||||
match action {
|
||||
'+' => fperm |= mode,
|
||||
'-' => fperm &= !mode,
|
||||
|
|
|
@ -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::<uint>).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,
|
||||
|
|
|
@ -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<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)]
|
||||
|
|
|
@ -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); }
|
||||
};
|
||||
|
|
|
@ -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<String>) -> 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)
|
||||
},
|
||||
|
|
|
@ -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<String>) -> 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<u32> = strconv::from_str_common(m.as_slice(), 8, false, false, false,
|
||||
strconv::ExpNone,
|
||||
false, false);
|
||||
let res: Option<u32> = from_str_radix(m.as_slice(), 8);
|
||||
if res.is_some() {
|
||||
unsafe { std::mem::transmute(res.unwrap()) }
|
||||
} else {
|
||||
|
|
|
@ -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::<u64>(bytes.as_slice()) {
|
||||
Some(num) => num,
|
||||
None => {
|
||||
crash!(1, "'{}' is not a valid number.", size)
|
||||
|
|
Loading…
Reference in a new issue