diff --git a/Cargo.toml b/Cargo.toml index 2fbb331d..9bdab53e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" [dependencies] flate2 = { version = "1.0", default-features = false, optional = true } time = { version = "0.1", optional = true } -podio = "0.1" +byteorder = "1.3" bzip2 = { version = "0.3", optional = true } crc32fast = "1.0" thiserror = "1.0" diff --git a/src/read.rs b/src/read.rs index 52fe75cf..cffd0a95 100644 --- a/src/read.rs +++ b/src/read.rs @@ -11,7 +11,7 @@ use std::io::prelude::*; use crate::cp437::FromCp437; use crate::types::{DateTime, System, ZipFileData}; -use podio::{LittleEndian, ReadPodExt}; +use byteorder::{LittleEndian, ReadBytesExt}; #[cfg(feature = "deflate")] use flate2::read::DeflateDecoder; @@ -341,9 +341,12 @@ fn central_header_to_zip_file( let _internal_file_attributes = reader.read_u16::()?; let external_file_attributes = reader.read_u32::()?; let offset = reader.read_u32::()? as u64; - let file_name_raw = ReadPodExt::read_exact(reader, file_name_length)?; - let extra_field = ReadPodExt::read_exact(reader, extra_field_length)?; - let file_comment_raw = ReadPodExt::read_exact(reader, file_comment_length)?; + let mut file_name_raw = vec![0; file_name_length]; + reader.read_exact(&mut file_name_raw)?; + let mut extra_field = vec![0; extra_field_length]; + reader.read_exact(&mut extra_field)?; + let mut file_comment_raw = vec![0; file_comment_length]; + reader.read_exact(&mut file_comment_raw)?; let file_name = match is_utf8 { true => String::from_utf8_lossy(&*file_name_raw).into_owned(), @@ -621,8 +624,10 @@ pub fn read_zipfile_from_stream<'a, R: io::Read>( let file_name_length = reader.read_u16::()? as usize; let extra_field_length = reader.read_u16::()? as usize; - let file_name_raw = ReadPodExt::read_exact(reader, file_name_length)?; - let extra_field = ReadPodExt::read_exact(reader, extra_field_length)?; + let mut file_name_raw = vec![0; file_name_length]; + reader.read_exact(&mut file_name_raw)?; + let mut extra_field = vec![0; extra_field_length]; + reader.read_exact(&mut extra_field)?; let file_name = match is_utf8 { true => String::from_utf8_lossy(&*file_name_raw).into_owned(), diff --git a/src/spec.rs b/src/spec.rs index c2ff907b..8fa8c5c1 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -1,5 +1,5 @@ use crate::result::{ZipError, ZipResult}; -use podio::{LittleEndian, ReadPodExt, WritePodExt}; +use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use std::io; use std::io::prelude::*; @@ -32,7 +32,8 @@ impl CentralDirectoryEnd { let central_directory_size = reader.read_u32::()?; let central_directory_offset = reader.read_u32::()?; let zip_file_comment_length = reader.read_u16::()? as usize; - let zip_file_comment = ReadPodExt::read_exact(reader, zip_file_comment_length)?; + let mut zip_file_comment = vec![0; zip_file_comment_length]; + reader.read_exact(&mut zip_file_comment)?; Ok(CentralDirectoryEnd { disk_number, diff --git a/src/write.rs b/src/write.rs index d7ed628e..b3e9abac 100644 --- a/src/write.rs +++ b/src/write.rs @@ -4,8 +4,8 @@ use crate::compression::CompressionMethod; use crate::result::{ZipError, ZipResult}; use crate::spec; use crate::types::{DateTime, System, ZipFileData, DEFAULT_VERSION}; +use byteorder::{LittleEndian, WriteBytesExt}; use crc32fast::Hasher; -use podio::{LittleEndian, WritePodExt}; use std::default::Default; use std::io; use std::io::prelude::*;