From c03c6495fcaffce36b376c32263e0c3ec35a68cb Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 6 Aug 2022 18:07:06 -0400 Subject: [PATCH] Combine the AddDirectoryChunk and DeleteDirectoryChunk patch structs They are actually the same structure, so now they are combined into one (similar to DeleteData and ExpandData, I should rename those too) --- src/patch.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/patch.rs b/src/patch.rs index a79453a..e212b8c 100755 --- a/src/patch.rs +++ b/src/patch.rs @@ -23,8 +23,8 @@ enum ChunkType { #[br(pad_after = 1)] FileHeaderChunk), #[br(magic = b"APLY")] ApplyOption(ApplyOptionChunk), - #[br(magic = b"ADIR")] AddDirectory(AddDirectoryChunk), - #[br(magic = b"DELD")] DeleteDirectory(DeleteDirectoryChunk), + #[br(magic = b"ADIR")] AddDirectory(DirectoryChunk), + #[br(magic = b"DELD")] DeleteDirectory(DirectoryChunk), #[br(magic = b"SQPK")] Sqpk(SqpkChunk), #[br(magic = b"EOF_")] EndOfFile, } @@ -81,19 +81,7 @@ struct ApplyOptionChunk { #[binrw::binread] #[derive(PartialEq, Debug)] -struct AddDirectoryChunk { - #[br(temp)] - path_length: u32, - - #[br(count = path_length)] - #[br(map = | x: Vec < u8 > | String::from_utf8(x).unwrap())] - name: String, -} - -#[binread] -#[br(big)] -#[derive(PartialEq, Debug)] -struct DeleteDirectoryChunk { +struct DirectoryChunk { #[br(temp)] path_length: u32,