Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: WIP: fix merge
  • Loading branch information
Pr0methean committed May 1, 2024
commit 30aeaf275340ead5d5b1a71273d0b7cf68a6d1ce
8 changes: 1 addition & 7 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,13 +770,7 @@ pub(crate) fn central_header_to_zip_file<R: Read + Seek>(
}

/// Parse a central directory entry to collect the information for the file.
fn central_header_to_zip_file_inner<R: Read>(
reader: &mut R,
archive_offset: u64,
central_header_start: u64,
) -> ZipResult<ZipFileData> {
/// Parse a central directory entry to collect the information for the file.
fn central_header_to_zip_file_inner<R: Read>(
fn central_header_to_zip_file_inner<R: Read + Seek>(
reader: &mut R,
archive_offset: u64,
central_header_start: u64,
Expand Down
4 changes: 2 additions & 2 deletions src/read/stream.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::fs;
use std::io::{self, Read};
use std::io::{self, Read, Seek};
use std::path::{Path, PathBuf};

use super::{
Expand All @@ -20,7 +20,7 @@ impl<R> ZipStreamReader<R> {
}
}

impl<R: Read> ZipStreamReader<R> {
impl<R: Read + Seek> ZipStreamReader<R> {
fn parse_central_directory(&mut self) -> ZipResult<Option<ZipStreamFileMetadata>> {
// Give archive_offset and central_header_start dummy value 0, since
// they are not used in the output.
Expand Down
6 changes: 4 additions & 2 deletions src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,9 @@ fn write_central_directory_header<T: Write>(writer: &mut T, file: &ZipFileData)
let offset = file.header_start.min(spec::ZIP64_BYTES_THR) as u32;

let mut extra_field = zip64_extra_field[..zip64_extra_field_length as usize].to_vec();
extra_field.extend_from_slice(&file.extra_field[..]);
if let Some(extra) = file.extra_field {
extra_field.extend_from_slice(extra);
}
#[allow(deprecated)]
writer.write_u16::<LittleEndian>(file.compression_method.to_u16())?;
// last mod file time + date
Expand Down Expand Up @@ -1609,7 +1611,7 @@ fn write_central_directory_header<T: Write>(writer: &mut T, file: &ZipFileData)
let header = spec::CentralDirectoryHeader {
version_made_by: (file.system as u16) << 8 | (file.version_made_by as u16),
version_to_extract: file.version_needed(),
flags: spec::GeneralPurposeBitFlags(flags),
flags: spec::GeneralPurposeBitFlags(flag),
compression_method,
last_mod_time: file.last_modified_time.timepart(),
last_mod_date: file.last_modified_time.datepart(),
Expand Down