diff options
Diffstat (limited to 'src/zip/driver.rs')
| -rw-r--r-- | src/zip/driver.rs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/zip/driver.rs b/src/zip/driver.rs index 87f9c1a..62da39f 100644 --- a/src/zip/driver.rs +++ b/src/zip/driver.rs | |||
| @@ -221,7 +221,7 @@ impl<Io: Read + Seek> ArchiveRead for Zip<Io> { | |||
| 221 | indexes.insert(name.clone(), i); | 221 | indexes.insert(name.clone(), i); |
| 222 | files.push(ZipFileInfo::new( | 222 | files.push(ZipFileInfo::new( |
| 223 | CompressionMethod::from_struct_id(cdr.compression_method)?, | 223 | CompressionMethod::from_struct_id(cdr.compression_method)?, |
| 224 | EncryptionMethod::from_bit_flag(bit_flag), | 224 | EncryptionMethod::from_bif_flag(bit_flag, cdr.crc, cdr.dos_time), |
| 225 | bit_flag, | 225 | bit_flag, |
| 226 | mtime, | 226 | mtime, |
| 227 | atime, | 227 | atime, |
| @@ -258,11 +258,22 @@ impl<Io: Read + Seek> ArchiveRead for Zip<Io> { | |||
| 258 | self.files.get(index).ok_or(ZipError::FileNotFound.into()) | 258 | self.files.get(index).ok_or(ZipError::FileNotFound.into()) |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | fn get_file_reader<'d>( | 261 | #[inline] |
| 262 | fn get_file_reader<'d>(&'d mut self, index: usize) -> ZipResult<Self::FileReader<'d>> { | ||
| 263 | self.get_file_reader_with_optional_password(index, None) | ||
| 264 | } | ||
| 265 | } | ||
| 266 | |||
| 267 | impl<Io: Read + Seek> Zip<Io> { | ||
| 268 | pub fn comment(&self) -> &String { | ||
| 269 | &self.comment | ||
| 270 | } | ||
| 271 | |||
| 272 | pub fn get_file_reader_with_optional_password<'d>( | ||
| 262 | &'d mut self, | 273 | &'d mut self, |
| 263 | index: usize, | 274 | index: usize, |
| 264 | password: Option<&str>, | 275 | password: Option<&[u8]>, |
| 265 | ) -> ZipResult<Self::FileReader<'d>> { | 276 | ) -> ZipResult<<Self as ArchiveRead>::FileReader<'d>> { |
| 266 | Ok(ZipFileReader::new( | 277 | Ok(ZipFileReader::new( |
| 267 | &mut self.io, | 278 | &mut self.io, |
| 268 | self.files.get(index).ok_or(ZipError::FileNotFound)?, | 279 | self.files.get(index).ok_or(ZipError::FileNotFound)?, |
| @@ -271,12 +282,6 @@ impl<Io: Read + Seek> ArchiveRead for Zip<Io> { | |||
| 271 | } | 282 | } |
| 272 | } | 283 | } |
| 273 | 284 | ||
| 274 | impl<Io: Read + Seek> Zip<Io> { | ||
| 275 | pub fn comment(&self) -> &String { | ||
| 276 | &self.comment | ||
| 277 | } | ||
| 278 | } | ||
| 279 | |||
| 280 | impl<Io: Read + Write + Seek> ArchiveWrite for Zip<Io> { | 285 | impl<Io: Read + Write + Seek> ArchiveWrite for Zip<Io> { |
| 281 | type FileWriter<'d> = ZipFileWriter<'d, Io> where Io: 'd; | 286 | type FileWriter<'d> = ZipFileWriter<'d, Io> where Io: 'd; |
| 282 | } | 287 | } |
