Update Write for spec

This commit is contained in:
Mathijs van de Nes 2015-02-24 14:37:46 +01:00
parent af22baf13b
commit 69b38b3ce5
2 changed files with 4 additions and 2 deletions

View file

@ -1,6 +1,8 @@
use std::old_io; use std::old_io;
use std::io::prelude::*;
use result::{ZipResult, ZipError}; use result::{ZipResult, ZipError};
use std::iter::range_step_inclusive; use std::iter::range_step_inclusive;
use util::WriteIntExt;
pub static LOCAL_FILE_HEADER_SIGNATURE : u32 = 0x04034b50; pub static LOCAL_FILE_HEADER_SIGNATURE : u32 = 0x04034b50;
pub static CENTRAL_DIRECTORY_HEADER_SIGNATURE : u32 = 0x02014b50; pub static CENTRAL_DIRECTORY_HEADER_SIGNATURE : u32 = 0x02014b50;
@ -72,7 +74,7 @@ impl CentralDirectoryEnd
Err(ZipError::UnsupportedZipFile("Could not find central directory end")) Err(ZipError::UnsupportedZipFile("Could not find central directory end"))
} }
pub fn write<T: Writer>(&self, writer: &mut T) -> ZipResult<()> pub fn write<T: Write>(&self, writer: &mut T) -> ZipResult<()>
{ {
try!(writer.write_le_u32(CENTRAL_DIRECTORY_END_SIGNATURE)); try!(writer.write_le_u32(CENTRAL_DIRECTORY_END_SIGNATURE));
try!(writer.write_le_u16(self.disk_number)); try!(writer.write_le_u16(self.disk_number));

View file

@ -206,7 +206,7 @@ impl<W: Write+io::Seek> ZipWriter<W>
zip_file_comment: b"zip-rs".to_vec(), zip_file_comment: b"zip-rs".to_vec(),
}; };
try!(footer.write(&mut IoConverter::new(writer))); try!(footer.write(writer));
} }
Ok(()) Ok(())