1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 12:37:49 +00:00

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

Partially fix build with rust master
This commit is contained in:
Alex Lyon 2014-08-31 16:10:44 -07:00
commit 80810da987
8 changed files with 10 additions and 12 deletions

2
deps/rust-crypto vendored

@ -1 +1 @@
Subproject commit 24f91a8194440af39a017ef25a13c1db1d4a8f4f Subproject commit 44317cac3c4b36a95ebd5654acbf0e1fff9c4b2e

View file

@ -105,7 +105,7 @@ pub fn uumain(args: Vec<String>) -> int {
return 0; return 0;
} }
fn open(path: String) -> io::BufferedReader<Box<Reader>> { fn open(path: String) -> io::BufferedReader<Box<Reader+'static>> {
let mut file_buf; let mut file_buf;
if path.as_slice() == "-" { if path.as_slice() == "-" {
io::BufferedReader::new(box io::stdio::stdin_raw() as Box<Reader>) io::BufferedReader::new(box io::stdio::stdin_raw() as Box<Reader>)

View file

@ -59,7 +59,7 @@ fn get_algo_opts(program: &str) -> Vec<getopts::OptGroup> {
} }
} }
fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box<Digest>) { fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box<Digest+'static>) {
let mut alg: Option<Box<Digest>> = None; let mut alg: Option<Box<Digest>> = None;
let mut name: &'static str = ""; let mut name: &'static str = "";
match program { match program {
@ -71,7 +71,7 @@ fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box<
"sha512sum" => ("SHA512", box Sha512::new() as Box<Digest>), "sha512sum" => ("SHA512", box Sha512::new() as Box<Digest>),
_ => { _ => {
{ {
let set_or_crash = |n: &'static str, val: Box<Digest>| -> () { let set_or_crash = |n, val| -> () {
if alg.is_some() { crash!(1, "You cannot combine multiple hash algorithms!") }; if alg.is_some() { crash!(1, "You cannot combine multiple hash algorithms!") };
name = n; name = n;
alg = Some(val); alg = Some(val);

View file

@ -80,8 +80,7 @@ fn sleep(args: Vec<String>) {
let sleep_dur = if sleep_time == f64::INFINITY { let sleep_dur = if sleep_time == f64::INFINITY {
duration::MAX duration::MAX
} else { } else {
let (days, secs, millis) = (sleep_time / 86400., sleep_time % 86400., (sleep_time * 1_000.) % 1_000.); Duration::seconds(sleep_time as i64)
Duration::days(days as i32) + Duration::seconds(secs as i32) + Duration::milliseconds(millis as i32)
}; };
timer::sleep(sleep_dur); timer::sleep(sleep_dur);
} }

View file

@ -170,8 +170,7 @@ fn tail<T: Reader> (reader: &mut BufferedReader<T>, line_count:uint, follow:bool
// if we follow the file, sleep a bit and print the rest if the file has grown. // if we follow the file, sleep a bit and print the rest if the file has grown.
while follow { while follow {
let (days, secs, millis) = ((sleep_msec / 1000) / 86400, (sleep_msec / 1000) % 86400, sleep_msec % 1000); sleep(Duration::milliseconds(sleep_msec as i64));
sleep(Duration::days(days as i32) + Duration::seconds(secs as i32) + Duration::milliseconds(millis as i32));
for io_line in reader.lines() { for io_line in reader.lines() {
match io_line { match io_line {
Ok(line) => print!("{}", line), Ok(line) => print!("{}", line),

View file

@ -107,7 +107,7 @@ pub fn uumain(args: Vec<String>) -> int {
return 0; return 0;
} }
fn open(path: String) -> io::BufferedReader<Box<Reader>> { fn open(path: String) -> io::BufferedReader<Box<Reader+'static>> {
let mut file_buf; let mut file_buf;
if path.as_slice() == "-" { if path.as_slice() == "-" {
io::BufferedReader::new(box io::stdio::stdin_raw() as Box<Reader>) io::BufferedReader::new(box io::stdio::stdin_raw() as Box<Reader>)

View file

@ -190,7 +190,7 @@ pub fn uumain(args: Vec<String>) -> int {
0 0
} }
fn open_input_file(in_file_name: String) -> io::BufferedReader<Box<Reader>> { fn open_input_file(in_file_name: String) -> io::BufferedReader<Box<Reader+'static>> {
let in_file = if in_file_name.as_slice() == "-" { let in_file = if in_file_name.as_slice() == "-" {
box io::stdio::stdin_raw() as Box<Reader> box io::stdio::stdin_raw() as Box<Reader>
} else { } else {
@ -201,7 +201,7 @@ fn open_input_file(in_file_name: String) -> io::BufferedReader<Box<Reader>> {
io::BufferedReader::new(in_file) io::BufferedReader::new(in_file)
} }
fn open_output_file(out_file_name: String) -> io::BufferedWriter<Box<Writer>> { fn open_output_file(out_file_name: String) -> io::BufferedWriter<Box<Writer+'static>> {
let out_file = if out_file_name.as_slice() == "-" { let out_file = if out_file_name.as_slice() == "-" {
box io::stdio::stdout_raw() as Box<Writer> box io::stdio::stdout_raw() as Box<Writer>
} else { } else {

View file

@ -230,7 +230,7 @@ fn print_stats(filename: &str, line_count: uint, word_count: uint, char_count: u
} }
} }
fn open(path: String) -> StdResult<BufferedReader<Box<Reader>>, int> { fn open(path: String) -> StdResult<BufferedReader<Box<Reader+'static>>, int> {
if "-" == path.as_slice() { if "-" == path.as_slice() {
let reader = box stdin_raw() as Box<Reader>; let reader = box stdin_raw() as Box<Reader>;
return Ok(BufferedReader::new(reader)); return Ok(BufferedReader::new(reader));