Replace usage of range{,_step}_inclusive
This commit is contained in:
parent
32c54f7d6b
commit
c185c0cd38
3 changed files with 4 additions and 5 deletions
|
@ -149,9 +149,9 @@ mod test
|
||||||
#[test]
|
#[test]
|
||||||
fn to_char_valid()
|
fn to_char_valid()
|
||||||
{
|
{
|
||||||
for i in ::std::iter::range_inclusive(0x00, 0xFF)
|
for i in 0x00_u32 .. 0x100
|
||||||
{
|
{
|
||||||
super::to_char(i);
|
super::to_char(i as u8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#![feature(unsafe_destructor)]
|
#![feature(unsafe_destructor)]
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
#![feature(core, io, into_cow)]
|
#![feature(io, into_cow, step_by)]
|
||||||
|
|
||||||
extern crate time;
|
extern crate time;
|
||||||
extern crate flate2;
|
extern crate flate2;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use result::{ZipResult, ZipError};
|
use result::{ZipResult, ZipError};
|
||||||
use std::iter::range_step_inclusive;
|
|
||||||
use podio::{ReadPodExt, WritePodExt, LittleEndian};
|
use podio::{ReadPodExt, WritePodExt, LittleEndian};
|
||||||
|
|
||||||
pub static LOCAL_FILE_HEADER_SIGNATURE : u32 = 0x04034b50;
|
pub static LOCAL_FILE_HEADER_SIGNATURE : u32 = 0x04034b50;
|
||||||
|
@ -56,7 +55,7 @@ impl CentralDirectoryEnd
|
||||||
let file_length = try!(reader.seek(io::SeekFrom::End(0))) as i64;
|
let file_length = try!(reader.seek(io::SeekFrom::End(0))) as i64;
|
||||||
|
|
||||||
let search_upper_bound = ::std::cmp::max(0, file_length - header_size - ::std::u16::MAX as i64);
|
let search_upper_bound = ::std::cmp::max(0, file_length - header_size - ::std::u16::MAX as i64);
|
||||||
for pos in range_step_inclusive(file_length - header_size, search_upper_bound, -1)
|
for pos in (file_length - header_size .. search_upper_bound - 1).step_by(-1)
|
||||||
{
|
{
|
||||||
try!(reader.seek(io::SeekFrom::Start(pos as u64)));
|
try!(reader.seek(io::SeekFrom::Start(pos as u64)));
|
||||||
if try!(reader.read_u32::<LittleEndian>()) == CENTRAL_DIRECTORY_END_SIGNATURE
|
if try!(reader.read_u32::<LittleEndian>()) == CENTRAL_DIRECTORY_END_SIGNATURE
|
||||||
|
|
Loading…
Add table
Reference in a new issue