1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 04:27:45 +00:00

Merge pull request #532 from ebfe/fix-build

Fix build with rust nightly
This commit is contained in:
Heather 2015-03-08 22:14:44 +03:00
commit e526de0079
14 changed files with 20 additions and 20 deletions

2
deps/regex vendored

@ -1 +1 @@
Subproject commit 8b44176a91326ec0b5e33bc36443ba00cb528c16 Subproject commit b8cc898f17442e5769cbce081d884e47d28c54e5

2
deps/rust-crypto vendored

@ -1 +1 @@
Subproject commit d06c8672a212add38edfcc5b504e4b4cb30c5a8b Subproject commit e2ba6ea926782278222558557d3d87221b87c740

View file

@ -1,10 +1,10 @@
#![feature(core, env, old_io, old_path)] #![feature(core, exit_status, old_io, old_path)]
use std::env; use std::env;
use std::old_io::{File, Truncate, ReadWrite}; use std::old_io::{File, Truncate, ReadWrite};
use std::old_path::Path; use std::old_path::Path;
static TEMPLATE: &'static str = "\ static TEMPLATE: &'static str = "\
#![feature(env)] #![feature(exit_status)]
extern crate \"@UTIL_CRATE@\" as uu@UTIL_CRATE@; extern crate \"@UTIL_CRATE@\" as uu@UTIL_CRATE@;
use std::env; use std::env;

View file

@ -1,4 +1,4 @@
#![feature(core, env, old_io, old_path)] #![feature(core, exit_status, old_io, old_path)]
use std::env; use std::env;
use std::old_io::{File, Truncate, Write}; use std::old_io::{File, Truncate, Write};

View file

@ -268,7 +268,7 @@ ers of 1000).",
None => 1024 None => 1024
}; };
let convert_size = |&: size: u64| -> String { let convert_size = |size: u64| -> String {
if matches.opt_present("human-readable") || matches.opt_present("si") { if matches.opt_present("human-readable") || matches.opt_present("si") {
if size >= MB { if size >= MB {
format!("{:.1}M", (size as f64) / (MB as f64)) format!("{:.1}M", (size as f64) / (MB as f64))

View file

@ -124,7 +124,7 @@ fn fold_file<T: io::Reader>(file: BufferedReader<T>, bytes: bool, spaces: bool,
let slice = { let slice = {
let slice = &line[i..i + width]; let slice = &line[i..i + width];
if spaces && i + width < len { if spaces && i + width < len {
match slice.rfind(|&: ch: char| ch.is_whitespace()) { match slice.rfind(|ch: char| ch.is_whitespace()) {
Some(m) => &slice[..m + 1], Some(m) => &slice[..m + 1],
None => slice None => slice
} }

View file

@ -161,7 +161,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
verbose: matches.opt_present("v"), verbose: matches.opt_present("v"),
}; };
let string_to_path = |&: s: &String| { Path::new(s.as_slice()) }; let string_to_path = |s: &String| { Path::new(s.as_slice()) };
let paths: Vec<Path> = matches.free.iter().map(string_to_path).collect(); let paths: Vec<Path> = matches.free.iter().map(string_to_path).collect();
if matches.opt_present("version") { if matches.opt_present("version") {

View file

@ -167,7 +167,7 @@ fn nl<T: Reader> (reader: &mut BufferedReader<T>, settings: &Settings) {
let line_no_width_initial = line_no_width; let line_no_width_initial = line_no_width;
// Stores the smallest integer with one more digit than line_no, so that // Stores the smallest integer with one more digit than line_no, so that
// when line_no >= line_no_threshold, we need to use one more digit. // when line_no >= line_no_threshold, we need to use one more digit.
let mut line_no_threshold = Int::pow(10u64, line_no_width); let mut line_no_threshold = Int::pow(10u64, line_no_width as u32);
let mut empty_line_count: u64 = 0; let mut empty_line_count: u64 = 0;
let fill_char = match settings.number_format { let fill_char = match settings.number_format {
NumberFormat::RightZero => '0', NumberFormat::RightZero => '0',
@ -229,7 +229,7 @@ fn nl<T: Reader> (reader: &mut BufferedReader<T>, settings: &Settings) {
if settings.renumber { if settings.renumber {
line_no = settings.starting_line_number; line_no = settings.starting_line_number;
line_no_width = line_no_width_initial; line_no_width = line_no_width_initial;
line_no_threshold = Int::pow(10u64, line_no_width); line_no_threshold = Int::pow(10u64, line_no_width as u32);
} }
&settings.header_numbering &settings.header_numbering
}, },

View file

@ -73,12 +73,12 @@ fn main(input_offset_base: &Radix, fname: &str) {
match f.read(bytes) { match f.read(bytes) {
Ok(n) => { Ok(n) => {
print_with_radix(input_offset_base, addr); print_with_radix(input_offset_base, addr);
for b in range(0, n / std::u16::BYTES) { for b in range(0, n / std::u16::BYTES as usize) {
let bs = &bytes[(2 * b) .. (2 * b + 2)]; let bs = &bytes[(2 * b) .. (2 * b + 2)];
let p: u16 = (bs[1] as u16) << 8 | bs[0] as u16; let p: u16 = (bs[1] as u16) << 8 | bs[0] as u16;
print!(" {:06o}", p); print!(" {:06o}", p);
} }
if n % std::u16::BYTES == 1 { if n % std::u16::BYTES as usize == 1 {
print!(" {:06o}", bytes[n - 1]); print!(" {:06o}", bytes[n - 1]);
} }
print!("\n"); print!("\n");

View file

@ -225,7 +225,7 @@ fn str_prefix(i: usize, width: usize) -> String {
let mut w = width; let mut w = width;
while w > 0 { while w > 0 {
w -= 1; w -= 1;
let div = Int::pow(26 as usize, w); let div = Int::pow(26 as usize, w as u32);
let r = n / div; let r = n / div;
n -= r * div; n -= r * div;
c.push(char::from_u32((r as u32) + 97).unwrap()); c.push(char::from_u32((r as u32) + 97).unwrap());
@ -240,7 +240,7 @@ fn num_prefix(i: usize, width: usize) -> String {
let mut w = width; let mut w = width;
while w > 0 { while w > 0 {
w -= 1; w -= 1;
let div = Int::pow(10 as usize, w); let div = Int::pow(10 as usize, w as u32);
let r = n / div; let r = n / div;
n -= r * div; n -= r * div;
c.push(char::from_digit(r as u32, 10).unwrap()); c.push(char::from_digit(r as u32, 10).unwrap());

View file

@ -90,8 +90,8 @@ fn print_usage(opts: &[OptGroup]) {
} }
fn parse_size(size: &str) -> Option<u64> { fn parse_size(size: &str) -> Option<u64> {
let ext = size.trim_left_matches(|&: c: char| c.is_digit(10)); let ext = size.trim_left_matches(|c: char| c.is_digit(10));
let num = size.trim_right_matches(|&: c: char| c.is_alphabetic()); let num = size.trim_right_matches(|c: char| c.is_alphabetic());
let mut recovered = num.to_string(); let mut recovered = num.to_string();
recovered.push_str(ext); recovered.push_str(ext);
if recovered.as_slice() != size { if recovered.as_slice() != size {
@ -101,7 +101,7 @@ fn parse_size(size: &str) -> Option<u64> {
Some(m) => m, Some(m) => m,
None => return None, None => return None,
}; };
let (power, base): (usize, u64) = match ext { let (power, base): (u32, u64) = match ext {
"" => (0, 0), "" => (0, 0),
"KB" => (1, 1024), "KB" => (1, 1024),
"K" => (1, 1000), "K" => (1, 1000),

View file

@ -336,7 +336,7 @@ fn path(path: &[u8], cond: PathCondition) -> bool {
Write = 0o2, Write = 0o2,
Execute = 0o1, Execute = 0o1,
} }
let perm = |&: stat: stat, p: Permission| { let perm = |stat: stat, p: Permission| {
use libc::{getgid, getuid}; use libc::{getgid, getuid};
let (uid, gid) = unsafe { (getuid(), getgid()) }; let (uid, gid) = unsafe { (getuid(), getgid()) };
if uid == stat.st_uid { if uid == stat.st_uid {

View file

@ -96,7 +96,7 @@ fn delete(set: Vec<char>, complement: bool) {
bset.insert(c as usize); bset.insert(c as usize);
} }
let is_allowed = |&: c : char| { let is_allowed = |c : char| {
if complement { if complement {
bset.contains(&(c as usize)) bset.contains(&(c as usize))
} else { } else {

View file

@ -1,5 +1,5 @@
#![crate_name = "uutils"] #![crate_name = "uutils"]
#![feature(core, env, old_path, rustc_private)] #![feature(core, exit_status, old_path, rustc_private)]
/* /*
* This file is part of the uutils coreutils package. * This file is part of the uutils coreutils package.