Correctly interpret the first field of the footer

This commit is contained in:
Mathijs van de Nes 2014-09-11 09:32:47 +02:00
parent 08dbe1c3fc
commit 02361b5dd5
2 changed files with 4 additions and 4 deletions

View file

@ -29,7 +29,7 @@ impl<T: Reader+Seek> ZipReader<T>
{
let footer = try!(spec::CentralDirectoryEnd::find_and_parse(&mut reader));
if footer.number_of_disks > 1 { return unsupported_zip_error("Support for multi-disk files is not implemented") }
if footer.disk_number != footer.disk_with_central_directory { return unsupported_zip_error("Support for multi-disk files is not implemented") }
let directory_start = footer.central_directory_offset as i64;
let number_of_files = footer.number_of_files_on_this_disk as uint;

View file

@ -97,7 +97,7 @@ pub fn write_local_file_header<T: Writer>(writer: &mut T, file: &ZipFile) -> IoR
pub struct CentralDirectoryEnd
{
pub number_of_disks: u16,
pub disk_number: u16,
pub disk_with_central_directory: u16,
pub number_of_files_on_this_disk: u16,
pub number_of_files: u16,
@ -118,7 +118,7 @@ impl CentralDirectoryEnd
desc: "Invalid digital signature header",
detail: None })
}
let number_of_disks = try!(reader.read_le_u16());
let disk_number = try!(reader.read_le_u16());
let disk_with_central_directory = try!(reader.read_le_u16());
let number_of_files_on_this_disk = try!(reader.read_le_u16());
let number_of_files = try!(reader.read_le_u16());
@ -129,7 +129,7 @@ impl CentralDirectoryEnd
Ok(CentralDirectoryEnd
{
number_of_disks: number_of_disks,
disk_number: disk_number,
disk_with_central_directory: disk_with_central_directory,
number_of_files_on_this_disk: number_of_files_on_this_disk,
number_of_files: number_of_files,