mindustry logic execution, map- and schematic- parsing and rendering
allow using miniz-oxide
| -rw-r--r-- | mindus/Cargo.toml | 4 | ||||
| -rw-r--r-- | mindus/src/data/mod.rs | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/mindus/Cargo.toml b/mindus/Cargo.toml index 150aded..46c77f8 100644 --- a/mindus/Cargo.toml +++ b/mindus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mindus" -version = "5.0.2" +version = "5.0.3" edition = "2021" description = "A library for working with mindustry data formats (eg schematics and maps) (fork of plandustry)" authors = [ @@ -14,7 +14,7 @@ readme = "README.md" keywords = ["mindustry", "format", "drawing"] [dependencies] -flate2 = { version = "1.0", features = ["zlib-ng"], default-features = false } +flate2 = "1.0" base64 = "0.21" paste = "1.0" strconv = "0.1" diff --git a/mindus/src/data/mod.rs b/mindus/src/data/mod.rs index d399c18..c6c3743 100644 --- a/mindus/src/data/mod.rs +++ b/mindus/src/data/mod.rs @@ -184,19 +184,18 @@ impl<'d> DataRead<'d> { pub fn deflate(&mut self) -> Result<Vec<u8>, DecompressError> { let mut dec = Decompress::new(true); - let mut raw = Vec::<u8>::new(); - raw.reserve(1024); + let mut raw = Vec::with_capacity(1024); loop { let t_in = dec.total_in(); let t_out = dec.total_out(); - let res = dec.decompress_vec(self.data, &mut raw, FlushDecompress::Finish)?; + let res = dec.decompress_vec(self.data, &mut raw, FlushDecompress::None)?; if dec.total_in() > t_in { // we have to advance input every time, decompress_vec only knows the output position self.data = &self.data[(dec.total_in() - t_in) as usize..]; } match res { // there's no more input (and the flush mode says so), we need to reserve additional space - Status::Ok | Status::BufError => (), + Status::Ok | Status::BufError => {} // input was already at the end, so this is referring to the output Status::StreamEnd => break, } |