From e1c92e2f219629b3a99d6f0f3fe6aeb50ff85d59 Mon Sep 17 00:00:00 2001 From: Danny McClanahan <1305167+cosmicexplorer@users.noreply.github.com> Date: Sat, 18 May 2024 04:21:13 -0400 Subject: [PATCH] make SIG_BYTES const --- src/spec.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/spec.rs b/src/spec.rs index 26c9d4a2..e80b05e8 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -274,8 +274,9 @@ impl Zip32CentralDirectoryEnd { /* TODO: use static_assertions!() */ assert!(END_WINDOW_SIZE > mem::size_of::()); - let sig_bytes = CENTRAL_DIRECTORY_END_SIGNATURE.to_le_bytes(); - let finder = FinderRev::new(&sig_bytes); + const SIG_BYTES: [u8; mem::size_of::()] = + CENTRAL_DIRECTORY_END_SIGNATURE.to_le_bytes(); + let finder = FinderRev::new(&SIG_BYTES); let mut window_start: u64 = file_length.saturating_sub(END_WINDOW_SIZE as u64); let mut window = [0u8; END_WINDOW_SIZE]; @@ -498,8 +499,9 @@ impl Zip64CentralDirectoryEnd { /* TODO: use static_assertions!() */ assert!(END_WINDOW_SIZE > mem::size_of::()); - let sig_bytes = ZIP64_CENTRAL_DIRECTORY_END_SIGNATURE.to_le_bytes(); - let finder = FinderRev::new(&sig_bytes); + const SIG_BYTES: [u8; mem::size_of::()] = + ZIP64_CENTRAL_DIRECTORY_END_SIGNATURE.to_le_bytes(); + let finder = FinderRev::new(&SIG_BYTES); let mut window_start: u64 = search_upper_bound .saturating_sub(END_WINDOW_SIZE as u64)