diff --git a/src/hashsum/hashsum.rs b/src/hashsum/hashsum.rs index f5ed9a056..e055b8f2b 100644 --- a/src/hashsum/hashsum.rs +++ b/src/hashsum/hashsum.rs @@ -63,12 +63,12 @@ fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box< let mut alg: Option> = None; let mut name: &'static str = ""; match program { - "md5sum" => ("MD5", box Md5::new() as Box), - "sha1sum" => ("SHA1", box Sha1::new() as Box), - "sha224sum" => ("SHA224", box Sha224::new() as Box), - "sha256sum" => ("SHA256", box Sha256::new() as Box), - "sha384sum" => ("SHA384", box Sha384::new() as Box), - "sha512sum" => ("SHA512", box Sha512::new() as Box), + "md5sum" => ("MD5", Box::new(Md5::new()) as Box), + "sha1sum" => ("SHA1", Box::new(Sha1::new()) as Box), + "sha224sum" => ("SHA224", Box::new(Sha224::new()) as Box), + "sha256sum" => ("SHA256", Box::new(Sha256::new()) as Box), + "sha384sum" => ("SHA384", Box::new(Sha384::new()) as Box), + "sha512sum" => ("SHA512", Box::new(Sha512::new()) as Box), _ => { { let mut set_or_crash = |&mut: n, val| -> () { @@ -76,12 +76,12 @@ fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box< name = n; alg = Some(val); }; - if matches.opt_present("md5") { set_or_crash("MD5", box Md5::new()) }; - if matches.opt_present("sha1") { set_or_crash("SHA1", box Sha1::new()) }; - if matches.opt_present("sha224") { set_or_crash("SHA224", box Sha224::new()) }; - if matches.opt_present("sha256") { set_or_crash("SHA256", box Sha256::new()) }; - if matches.opt_present("sha384") { set_or_crash("SHA384", box Sha384::new()) }; - if matches.opt_present("sha512") { set_or_crash("SHA512", box Sha512::new()) }; + if matches.opt_present("md5") { set_or_crash("MD5", Box::new(Md5::new())) }; + if matches.opt_present("sha1") { set_or_crash("SHA1", Box::new(Sha1::new())) }; + if matches.opt_present("sha224") { set_or_crash("SHA224", Box::new(Sha224::new())) }; + if matches.opt_present("sha256") { set_or_crash("SHA256", Box::new(Sha256::new())) }; + if matches.opt_present("sha384") { set_or_crash("SHA384", Box::new(Sha384::new())) }; + if matches.opt_present("sha512") { set_or_crash("SHA512", Box::new(Sha512::new())) }; } if alg.is_none() { crash!(1, "You must specify hash algorithm!") }; (name, alg.unwrap()) @@ -89,7 +89,7 @@ fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box< } } -pub fn uumain(args: Vec) -> int { +pub fn uumain(args: Vec) -> isize { let program = args[0].clone(); let binary = Path::new(program.as_slice()); let binary_name = binary.filename_str().unwrap(); @@ -167,9 +167,9 @@ fn usage(program: &str, binary_name: &str, opts: &[getopts::OptGroup]) { pipe_print!("{}", getopts::usage("Compute and check message digests.", opts)); } -fn hashsum(algoname: &str, mut digest: Box, files: Vec, binary: bool, check: bool, tag: bool, status: bool, quiet: bool, strict: bool, warn: bool) -> Result<(), int> { - let mut bad_format = 0u; - let mut failed = 0u; +fn hashsum(algoname: &str, mut digest: Box, files: Vec, binary: bool, check: bool, tag: bool, status: bool, quiet: bool, strict: bool, warn: bool) -> Result<(), isize> { + let mut bad_format = 0; + let mut failed = 0; let binary_marker = if binary { "*" } else {