From d9a2cb1f71e54c8ea08b65a6bee25ee7f7d73940 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Thu, 9 May 2024 12:22:28 -0700 Subject: [PATCH] Update to work without byteorder --- src/write.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/write.rs b/src/write.rs index fe78dfb8..3ccc8903 100644 --- a/src/write.rs +++ b/src/write.rs @@ -1727,36 +1727,36 @@ fn clamp_opt>( fn write_local_file_header(writer: &mut T, file: &ZipFileData) -> ZipResult<()> { // local file header signature - writer.write_u32::(spec::LOCAL_FILE_HEADER_SIGNATURE)?; + writer.write_u32_le(spec::LOCAL_FILE_HEADER_SIGNATURE)?; // version needed to extract - writer.write_u16::(file.version_needed())?; + writer.write_u16_le(file.version_needed())?; // general purpose bit flag let is_utf8 = std::str::from_utf8(&file.file_name_raw).is_ok(); let is_ascii = file.file_name_raw.is_ascii(); let flag = if is_utf8 && !is_ascii { 1u16 << 11 } else { 0 } | if file.encrypted { 1u16 << 0 } else { 0 }; - writer.write_u16::(flag)?; + writer.write_u16_le(flag)?; // Compression method #[allow(deprecated)] - writer.write_u16::(file.compression_method.to_u16())?; + writer.write_u16_le(file.compression_method.to_u16())?; // last mod file time and last mod file date - writer.write_u16::(file.last_modified_time.timepart())?; - writer.write_u16::(file.last_modified_time.datepart())?; + writer.write_u16_le(file.last_modified_time.timepart())?; + writer.write_u16_le(file.last_modified_time.datepart())?; // crc-32 - writer.write_u32::(file.crc32)?; + writer.write_u32_le(file.crc32)?; // compressed size and uncompressed size if file.large_file { - writer.write_u32::(spec::ZIP64_BYTES_THR as u32)?; - writer.write_u32::(spec::ZIP64_BYTES_THR as u32)?; + writer.write_u32_le(spec::ZIP64_BYTES_THR as u32)?; + writer.write_u32_le(spec::ZIP64_BYTES_THR as u32)?; } else { - writer.write_u32::(file.compressed_size as u32)?; - writer.write_u32::(file.uncompressed_size as u32)?; + writer.write_u32_le(file.compressed_size as u32)?; + writer.write_u32_le(file.uncompressed_size as u32)?; } // file name length - writer.write_u16::(file.file_name_raw.len() as u16)?; + writer.write_u16_le(file.file_name_raw.len() as u16)?; // extra field length let extra_field_length = if file.large_file { 20 } else { 0 } + file.extra_field.len() as u16; - writer.write_u16::(extra_field_length)?; + writer.write_u16_le(extra_field_length)?; // file name writer.write_all(&file.file_name_raw)?; // zip64 extra field