diff options
Diffstat (limited to 'src/libextra/terminfo/parser/compiled.rs')
| -rw-r--r-- | src/libextra/terminfo/parser/compiled.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libextra/terminfo/parser/compiled.rs b/src/libextra/terminfo/parser/compiled.rs index 66649c62fca..063d26d1424 100644 --- a/src/libextra/terminfo/parser/compiled.rs +++ b/src/libextra/terminfo/parser/compiled.rs @@ -10,11 +10,10 @@ /// ncurses-compatible compiled terminfo format parsing (term(5)) -use core::prelude::*; -use core::{vec, int, str}; -use core::io::Reader; -use core::hashmap::HashMap; +use std::{vec, int, str}; +use std::io::Reader; +use std::hashmap::HashMap; use super::super::TermInfo; // These are the orders ncurses uses in its compiled format (as of 5.9). Not sure if portable. @@ -271,7 +270,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { return Err(~"error: hit EOF before end of string table"); } - for string_offsets.eachi |i, v| { + for string_offsets.iter().enumerate().advance |(i, v)| { let offset = *v; if offset == 0xFFFF { // non-entry loop; @@ -292,12 +291,13 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { // Find the offset of the NUL we want to go to - let nulpos = vec::position_between(string_table, offset as uint, - string_table_bytes as uint, |&b| b == 0); + let nulpos = string_table.slice(offset as uint, string_table_bytes as uint) + .iter().position_(|&b| b == 0); match nulpos { - Some(x) => { + Some(len) => { string_map.insert(name.to_owned(), - string_table.slice(offset as uint, x).to_owned()) + string_table.slice(offset as uint, + offset as uint + len).to_owned()) }, None => { return Err(~"invalid file: missing NUL in string_table"); |
