diff --git a/src/spec.rs b/src/spec.rs index af4deaf5..f97e7247 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -82,7 +82,7 @@ impl CentralDirectoryEnd try!(writer.write_le_u32(self.central_directory_size)); try!(writer.write_le_u32(self.central_directory_offset)); try!(writer.write_le_u16(self.zip_file_comment.len() as u16)); - try!(writer.write(self.zip_file_comment.as_slice())); + try!(writer.write_all(self.zip_file_comment.as_slice())); Ok(()) } } diff --git a/src/writer.rs b/src/writer.rs index 9e565c81..691e02af 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -60,15 +60,15 @@ struct ZipWriterStats impl Writer for ZipWriter { - fn write(&mut self, buf: &[u8]) -> old_io::IoResult<()> + fn write_all(&mut self, buf: &[u8]) -> old_io::IoResult<()> { if self.files.len() == 0 { return Err(old_io::IoError { kind: old_io::OtherIoError, desc: "No file has been started", detail: None, }) } self.stats.update(buf); match self.inner { - GenericZipWriter::Storer(ref mut w) => w.write(buf), - GenericZipWriter::Deflater(ref mut w) => w.write(buf), - GenericZipWriter::Bzip2(ref mut w) => w.write(buf), + GenericZipWriter::Storer(ref mut w) => w.write_all(buf), + GenericZipWriter::Deflater(ref mut w) => w.write_all(buf), + GenericZipWriter::Bzip2(ref mut w) => w.write_all(buf), GenericZipWriter::Closed => Err(old_io::standard_error(old_io::Closed)), } } diff --git a/src/writer_spec.rs b/src/writer_spec.rs index 4cc9ebe5..5df725b4 100644 --- a/src/writer_spec.rs +++ b/src/writer_spec.rs @@ -20,8 +20,8 @@ pub fn write_local_file_header(writer: &mut T, file: &ZipFile) -> Zip try!(writer.write_le_u16(file.file_name.as_bytes().len() as u16)); let extra_field = try!(build_extra_field(file)); try!(writer.write_le_u16(extra_field.len() as u16)); - try!(writer.write(file.file_name.as_bytes())); - try!(writer.write(extra_field.as_slice())); + try!(writer.write_all(file.file_name.as_bytes())); + try!(writer.write_all(extra_field.as_slice())); Ok(()) } @@ -57,8 +57,8 @@ pub fn write_central_directory_header(writer: &mut T, file: &ZipFile) try!(writer.write_le_u16(0)); try!(writer.write_le_u32(0)); try!(writer.write_le_u32(file.header_start as u32)); - try!(writer.write(file.file_name.as_bytes())); - try!(writer.write(extra_field.as_slice())); + try!(writer.write_all(file.file_name.as_bytes())); + try!(writer.write_all(extra_field.as_slice())); Ok(()) }