diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-25 17:06:52 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-26 12:10:22 -0700 |
| commit | 43bfaa4a336095eb5697fb2df50909fd3c72ed14 (patch) | |
| tree | e10610e1ce9811c89e1291b786d7a49b63ee02d9 /src/libterm | |
| parent | 54f16b818b58f6d6e81891b041fc751986e75155 (diff) | |
| download | rust-43bfaa4a336095eb5697fb2df50909fd3c72ed14.tar.gz rust-43bfaa4a336095eb5697fb2df50909fd3c72ed14.zip | |
Mass rename uint/int to usize/isize
Now that support has been removed, all lingering use cases are renamed.
Diffstat (limited to 'src/libterm')
| -rw-r--r-- | src/libterm/lib.rs | 1 | ||||
| -rw-r--r-- | src/libterm/terminfo/mod.rs | 4 | ||||
| -rw-r--r-- | src/libterm/terminfo/parm.rs | 40 | ||||
| -rw-r--r-- | src/libterm/terminfo/parser/compiled.rs | 30 | ||||
| -rw-r--r-- | src/libterm/terminfo/searcher.rs | 2 |
5 files changed, 38 insertions, 39 deletions
diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 41e066cc94a..ed2d00d6ad7 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -57,7 +57,6 @@ #![feature(box_syntax)] #![feature(collections)] -#![feature(int_uint)] #![feature(rustc_private)] #![feature(staged_api)] #![feature(std_misc)] diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs index 1d6657d5932..4840cd1fdda 100644 --- a/src/libterm/terminfo/mod.rs +++ b/src/libterm/terminfo/mod.rs @@ -82,7 +82,7 @@ impl<T: Write+Send+'static> Terminal<T> for TerminfoTerminal<T> { .get("setaf") .unwrap() , - &[Number(color as int)], &mut Variables::new()); + &[Number(color as isize)], &mut Variables::new()); if s.is_ok() { try!(self.out.write_all(&s.unwrap())); return Ok(true) @@ -99,7 +99,7 @@ impl<T: Write+Send+'static> Terminal<T> for TerminfoTerminal<T> { .get("setab") .unwrap() , - &[Number(color as int)], &mut Variables::new()); + &[Number(color as isize)], &mut Variables::new()); if s.is_ok() { try!(self.out.write_all(&s.unwrap())); return Ok(true) diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 30b732781db..d6a4659c45a 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -27,12 +27,12 @@ enum States { PushParam, CharConstant, CharClose, - IntConstant(int), + IntConstant(isize), FormatPattern(Flags, FormatState), - SeekIfElse(int), - SeekIfElsePercent(int), - SeekIfEnd(int), - SeekIfEndPercent(int) + SeekIfElse(isize), + SeekIfElsePercent(isize), + SeekIfEnd(isize), + SeekIfEndPercent(isize) } #[derive(Copy, PartialEq)] @@ -47,7 +47,7 @@ enum FormatState { #[derive(Clone)] pub enum Param { Words(String), - Number(int) + Number(isize) } /// Container for static and dynamic variable arrays @@ -143,7 +143,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) '{' => state = IntConstant(0), 'l' => if stack.len() > 0 { match stack.pop().unwrap() { - Words(s) => stack.push(Number(s.len() as int)), + Words(s) => stack.push(Number(s.len() as isize)), _ => return Err("a non-str was used with %l".to_string()) } } else { return Err("stack is empty".to_string()) }, @@ -268,7 +268,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) ' ' => flags.space = true, '.' => fstate = FormatStatePrecision, '0'...'9' => { - flags.width = cur as uint - '0' as uint; + flags.width = cur as usize - '0' as usize; fstate = FormatStateWidth; } _ => unreachable!() @@ -305,12 +305,12 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) if cur >= 'A' && cur <= 'Z' { if stack.len() > 0 { let idx = (cur as u8) - b'A'; - vars.sta[idx as uint] = stack.pop().unwrap(); + vars.sta[idx as usize] = stack.pop().unwrap(); } else { return Err("stack is empty".to_string()) } } else if cur >= 'a' && cur <= 'z' { if stack.len() > 0 { let idx = (cur as u8) - b'a'; - vars.dyn[idx as uint] = stack.pop().unwrap(); + vars.dyn[idx as usize] = stack.pop().unwrap(); } else { return Err("stack is empty".to_string()) } } else { return Err("bad variable name in %P".to_string()); @@ -319,16 +319,16 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) GetVar => { if cur >= 'A' && cur <= 'Z' { let idx = (cur as u8) - b'A'; - stack.push(vars.sta[idx as uint].clone()); + stack.push(vars.sta[idx as usize].clone()); } else if cur >= 'a' && cur <= 'z' { let idx = (cur as u8) - b'a'; - stack.push(vars.dyn[idx as uint].clone()); + stack.push(vars.dyn[idx as usize].clone()); } else { return Err("bad variable name in %g".to_string()); } }, CharConstant => { - stack.push(Number(c as int)); + stack.push(Number(c as isize)); state = CharClose; }, CharClose => { @@ -343,10 +343,10 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) state = Nothing; } '0'...'9' => { - state = IntConstant(i*10 + (cur as int - '0' as int)); + state = IntConstant(i*10 + (cur as isize - '0' as isize)); old_state = Nothing; } - _ => return Err("bad int constant".to_string()) + _ => return Err("bad isize constant".to_string()) } } FormatPattern(ref mut flags, ref mut fstate) => { @@ -372,7 +372,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) flags.space = true; } (FormatStateFlags,'0'...'9') => { - flags.width = cur as uint - '0' as uint; + flags.width = cur as usize - '0' as usize; *fstate = FormatStateWidth; } (FormatStateFlags,'.') => { @@ -380,7 +380,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) } (FormatStateWidth,'0'...'9') => { let old = flags.width; - flags.width = flags.width * 10 + (cur as uint - '0' as uint); + flags.width = flags.width * 10 + (cur as usize - '0' as usize); if flags.width < old { return Err("format width overflow".to_string()) } } (FormatStateWidth,'.') => { @@ -388,7 +388,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) } (FormatStatePrecision,'0'...'9') => { let old = flags.precision; - flags.precision = flags.precision * 10 + (cur as uint - '0' as uint); + flags.precision = flags.precision * 10 + (cur as usize - '0' as usize); if flags.precision < old { return Err("format precision overflow".to_string()) } @@ -446,8 +446,8 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) #[derive(Copy, PartialEq)] struct Flags { - width: uint, - precision: uint, + width: usize, + precision: usize, alternate: bool, left: bool, sign: bool, diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index 8d0a9e6e971..01d191f3014 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -189,31 +189,31 @@ pub fn parse(file: &mut Read, longnames: bool) 0x011A_usize, magic as usize)); } - let names_bytes = try!(read_le_u16(file)) as int; - let bools_bytes = try!(read_le_u16(file)) as int; - let numbers_count = try!(read_le_u16(file)) as int; - let string_offsets_count = try!(read_le_u16(file)) as int; - let string_table_bytes = try!(read_le_u16(file)) as int; + let names_bytes = try!(read_le_u16(file)) as isize; + let bools_bytes = try!(read_le_u16(file)) as isize; + let numbers_count = try!(read_le_u16(file)) as isize; + let string_offsets_count = try!(read_le_u16(file)) as isize; + let string_table_bytes = try!(read_le_u16(file)) as isize; assert!(names_bytes > 0); - if (bools_bytes as uint) > boolnames.len() { + if (bools_bytes as usize) > boolnames.len() { return Err("incompatible file: more booleans than \ expected".to_string()); } - if (numbers_count as uint) > numnames.len() { + if (numbers_count as usize) > numnames.len() { return Err("incompatible file: more numbers than \ expected".to_string()); } - if (string_offsets_count as uint) > stringnames.len() { + if (string_offsets_count as usize) > stringnames.len() { return Err("incompatible file: more string offsets than \ expected".to_string()); } // don't read NUL - let bytes = try!(read_exact(file, names_bytes as uint - 1)); + let bytes = try!(read_exact(file, names_bytes as usize - 1)); let names_str = match String::from_utf8(bytes) { Ok(s) => s, Err(_) => return Err("input not utf-8".to_string()), @@ -230,7 +230,7 @@ pub fn parse(file: &mut Read, longnames: bool) for i in 0..bools_bytes { let b = try!(read_byte(file)); if b == 1 { - bools_map.insert(bnames[i as uint].to_string(), true); + bools_map.insert(bnames[i as usize].to_string(), true); } } } @@ -244,7 +244,7 @@ pub fn parse(file: &mut Read, longnames: bool) for i in 0..numbers_count { let n = try!(read_le_u16(file)); if n != 0xFFFF { - numbers_map.insert(nnames[i as uint].to_string(), n); + numbers_map.insert(nnames[i as usize].to_string(), n); } } } @@ -259,7 +259,7 @@ pub fn parse(file: &mut Read, longnames: bool) let string_table = try!(read_exact(file, string_table_bytes as usize)); - if string_table.len() != string_table_bytes as uint { + if string_table.len() != string_table_bytes as usize { return Err("error: hit EOF before end of string \ table".to_string()); } @@ -285,13 +285,13 @@ pub fn parse(file: &mut Read, longnames: bool) // Find the offset of the NUL we want to go to - let nulpos = string_table[offset as uint .. string_table_bytes as uint] + let nulpos = string_table[offset as usize .. string_table_bytes as usize] .iter().position(|&b| b == 0); match nulpos { Some(len) => { string_map.insert(name.to_string(), - string_table[offset as uint .. - (offset as uint + len)].to_vec()) + string_table[offset as usize .. + (offset as usize + len)].to_vec()) }, None => { return Err("invalid file: missing NUL in \ diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs index 66ee2b1ba87..3083f8e8929 100644 --- a/src/libterm/terminfo/searcher.rs +++ b/src/libterm/terminfo/searcher.rs @@ -67,7 +67,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<Box<PathBuf>> { return Some(box newp); } // on some installations the dir is named after the hex of the char (e.g. OS X) - let f = format!("{:x}", first_char as uint); + let f = format!("{:x}", first_char as usize); let newp = p.join(&f).join(term); if newp.exists() { return Some(box newp); |
