From 9f8fd55b4ac0f0be968f51f4bd3fc42ce6c127b3 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Sun, 8 Mar 2015 19:06:30 +0100 Subject: [PATCH] Integer type changes --- src/nl/nl.rs | 4 ++-- src/od/od.rs | 4 ++-- src/split/split.rs | 4 ++-- src/stdbuf/stdbuf.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/nl/nl.rs b/src/nl/nl.rs index 7e1e0b9cb..31f052dee 100644 --- a/src/nl/nl.rs +++ b/src/nl/nl.rs @@ -167,7 +167,7 @@ fn nl (reader: &mut BufferedReader, settings: &Settings) { let line_no_width_initial = line_no_width; // 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. - 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 fill_char = match settings.number_format { NumberFormat::RightZero => '0', @@ -229,7 +229,7 @@ fn nl (reader: &mut BufferedReader, settings: &Settings) { if settings.renumber { line_no = settings.starting_line_number; 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 }, diff --git a/src/od/od.rs b/src/od/od.rs index 32519b3ce..b8dec3845 100644 --- a/src/od/od.rs +++ b/src/od/od.rs @@ -73,12 +73,12 @@ fn main(input_offset_base: &Radix, fname: &str) { match f.read(bytes) { Ok(n) => { 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 p: u16 = (bs[1] as u16) << 8 | bs[0] as u16; print!(" {:06o}", p); } - if n % std::u16::BYTES == 1 { + if n % std::u16::BYTES as usize == 1 { print!(" {:06o}", bytes[n - 1]); } print!("\n"); diff --git a/src/split/split.rs b/src/split/split.rs index 1a35421e1..b8ba7256f 100644 --- a/src/split/split.rs +++ b/src/split/split.rs @@ -225,7 +225,7 @@ fn str_prefix(i: usize, width: usize) -> String { let mut w = width; while w > 0 { w -= 1; - let div = Int::pow(26 as usize, w); + let div = Int::pow(26 as usize, w as u32); let r = n / div; n -= r * div; 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; while w > 0 { w -= 1; - let div = Int::pow(10 as usize, w); + let div = Int::pow(10 as usize, w as u32); let r = n / div; n -= r * div; c.push(char::from_digit(r as u32, 10).unwrap()); diff --git a/src/stdbuf/stdbuf.rs b/src/stdbuf/stdbuf.rs index 9920f7f53..cc05e8f6b 100644 --- a/src/stdbuf/stdbuf.rs +++ b/src/stdbuf/stdbuf.rs @@ -101,7 +101,7 @@ fn parse_size(size: &str) -> Option { Some(m) => m, None => return None, }; - let (power, base): (usize, u64) = match ext { + let (power, base): (u32, u64) = match ext { "" => (0, 0), "KB" => (1, 1024), "K" => (1, 1000),