aboutsummaryrefslogtreecommitdiff
path: root/src/zip
diff options
context:
space:
mode:
Diffstat (limited to 'src/zip')
-rw-r--r--src/zip/driver.rs4
-rw-r--r--src/zip/error.rs8
-rw-r--r--src/zip/mod.rs1
3 files changed, 7 insertions, 6 deletions
diff --git a/src/zip/driver.rs b/src/zip/driver.rs
index 313bf8d..d575509 100644
--- a/src/zip/driver.rs
+++ b/src/zip/driver.rs
@@ -4,7 +4,7 @@ use crate::zip::structs::{EOCDR64Locator, CDR, EOCDR, EOCDR64};
4use crate::zip::ZipFile; 4use crate::zip::ZipFile;
5use std::collections::HashMap as Map; 5use std::collections::HashMap as Map;
6use std::fs::File; 6use std::fs::File;
7use std::io::{Cursor, Read, Seek, SeekFrom, Write}; 7use std::io::{Read, Seek, SeekFrom, Write};
8 8
9pub struct Zip<IO = File> { 9pub struct Zip<IO = File> {
10 io: IO, 10 io: IO,
@@ -43,7 +43,7 @@ impl<IO: Read + Seek> ArchiveRead for Zip<IO> {
43 }; 43 };
44 let eocdr: EOCDR = bincode::deserialize(&buf).map_err(|_| ZipError::InvalidEOCDR)?; 44 let eocdr: EOCDR = bincode::deserialize(&buf).map_err(|_| ZipError::InvalidEOCDR)?;
45 let comment = { 45 let comment = {
46 let mut buf = vec![0; eocdr.comment_len as usize]; 46 let mut buf: Vec<u8> = vec![0; eocdr.comment_len as usize];
47 io.read(&mut buf)?; 47 io.read(&mut buf)?;
48 String::from_utf8(buf).map_err(|_| ZipError::InvalidArchiveComment)? 48 String::from_utf8(buf).map_err(|_| ZipError::InvalidArchiveComment)?
49 }; 49 };
diff --git a/src/zip/error.rs b/src/zip/error.rs
index ad1989a..18bbb22 100644
--- a/src/zip/error.rs
+++ b/src/zip/error.rs
@@ -2,7 +2,7 @@ use crate::{ArchiveError, ArchiveResult};
2use std::error::Error; 2use std::error::Error;
3use std::fmt::Display; 3use std::fmt::Display;
4 4
5pub type ZipResult<R> = ArchiveResult<R, ZipError>; 5pub type ZipResult<T> = ArchiveResult<T, ZipError>;
6 6
7#[derive(Debug)] 7#[derive(Debug)]
8pub enum ZipError { 8pub enum ZipError {
@@ -22,10 +22,10 @@ pub enum ZipError {
22 22
23impl From<ZipError> for ArchiveError<ZipError> { 23impl From<ZipError> for ArchiveError<ZipError> {
24 fn from(value: ZipError) -> Self { 24 fn from(value: ZipError) -> Self {
25 return ArchiveError::Driver { 25 Self::Archivator {
26 name: "Zip", 26 module: "Zip".to_string(),
27 error: value, 27 error: value,
28 }; 28 }
29 } 29 }
30} 30}
31 31
diff --git a/src/zip/mod.rs b/src/zip/mod.rs
index 612a946..5aeca97 100644
--- a/src/zip/mod.rs
+++ b/src/zip/mod.rs
@@ -4,4 +4,5 @@ mod file;
4mod structs; 4mod structs;
5 5
6pub use driver::Zip; 6pub use driver::Zip;
7pub use error::ZipError;
7pub use file::ZipFile; 8pub use file::ZipFile;