From 69599e174193aa08c4109ea80e7628dc744c736e Mon Sep 17 00:00:00 2001 From: Mathijs van de Nes Date: Thu, 26 Mar 2015 21:56:05 +0100 Subject: [PATCH] Add into_cow feature + removed some trivial casts --- src/lib.rs | 2 +- src/read.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0fb6df0a..cc79121d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ #![feature(unsafe_destructor)] #![warn(missing_docs)] -#![feature(core, io)] +#![feature(core, io, into_cow)] extern crate time; extern crate flate2; diff --git a/src/read.rs b/src/read.rs index 43d88dd0..7288902d 100644 --- a/src/read.rs +++ b/src/read.rs @@ -121,7 +121,7 @@ impl ZipArchive { if file_number >= self.files.len() { return Err(ZipError::FileNotFound); } let ref data = self.files[file_number]; - let pos = data.data_start as u64; + let pos = data.data_start; if data.encrypted { @@ -129,7 +129,7 @@ impl ZipArchive } try!(self.reader.seek(io::SeekFrom::Start(pos))); - let limit_reader = (self.reader.by_ref() as &mut Read).take(data.compressed_size as u64); + let limit_reader = (self.reader.by_ref() as &mut Read).take(data.compressed_size); let reader = match data.compression_method { @@ -224,7 +224,7 @@ fn central_header_to_zip_file(reader: &mut R) -> ZipResult()) as u64; let extra_field_length = try!(reader.read_u16::()) as u64; let magic_and_header = 4 + 22 + 2 + 2; - let data_start = offset as u64 + magic_and_header + file_name_length + extra_field_length; + let data_start = offset + magic_and_header + file_name_length + extra_field_length; // Construct the result let mut result = ZipFileData @@ -237,7 +237,7 @@ fn central_header_to_zip_file(reader: &mut R) -> ZipResult