diff --git a/Cargo.toml b/Cargo.toml index c9aa374..17a25cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "icns-rs" -version = "0.1.1" +version = "0.1.2" edition = "2021" description = "A library for reading and writing Apple Icon Image (.icns) files." license = "LGPL-3.0-or-later" diff --git a/example.icns b/example.icns index 880d9ae..3a95578 100644 Binary files a/example.icns and b/example.icns differ diff --git a/src/encode.rs b/src/encode.rs index 89fe38d..79f4edc 100644 --- a/src/encode.rs +++ b/src/encode.rs @@ -86,17 +86,17 @@ impl IconFamily { /// and compile all the data into a single file. pub fn build(&self) -> Box<[u8]> { // Calculate the total size of the file - // let contents_table = self.create_contents_table(); + let contents_table = self.create_contents_table(); // Insert the TOC first let mut data = Vec::with_capacity(self.data.len() + 1); - // data.push(contents_table); + data.push(contents_table); for d in &self.data { data.push(d.clone()); } let total_size = data.iter().map(|data| data.len()).sum::(); - let mut buffer = Vec::with_capacity(total_size as usize); + let mut buffer = Vec::with_capacity(8 + total_size as usize); // Add the magic bytes, the total size and the data buffer.extend_from_slice(&MAGIC);