Skip to content

Commit

Permalink
Update miniz_oxide to 0.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdm committed Jul 8, 2020
1 parent d8fcff5 commit 64ba7fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include = [
]

[dependencies]
miniz_oxide = "0.3.5"
miniz_oxide = "0.4"
deflate = { version = "0.8.2", optional = true }
bitflags = "1.0"
crc32fast = "1.2.0"
Expand Down
9 changes: 2 additions & 7 deletions src/decoder/zlib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::{DecodingError, CHUNCK_BUFFER_SIZE};
use std::io;

use miniz_oxide::inflate::core::{decompress, inflate_flags, DecompressorOxide};
use miniz_oxide::inflate::TINFLStatus;
Expand Down Expand Up @@ -67,14 +66,12 @@ impl ZlibStream {
self.prepare_vec_for_appending();

let (status, mut in_consumed, out_consumed) = {
let mut cursor = io::Cursor::new(self.out_buffer.as_mut_slice());
cursor.set_position(self.out_pos as u64);
let in_data = if self.in_buffer.is_empty() {
data
} else {
&self.in_buffer[self.in_pos..]
};
decompress(&mut self.state, in_data, &mut cursor, BASE_FLAGS)
decompress(&mut self.state, in_data, self.out_buffer.as_mut_slice(), self.out_pos as usize, BASE_FLAGS)
};

if !self.in_buffer.is_empty() {
Expand Down Expand Up @@ -130,9 +127,7 @@ impl ZlibStream {
// TODO: we may be able to avoid the indirection through the buffer here.
// First append all buffered data and then create a cursor on the image_data
// instead.
let mut cursor = io::Cursor::new(self.out_buffer.as_mut_slice());
cursor.set_position(self.out_pos as u64);
decompress(&mut self.state, &tail[start..], &mut cursor, BASE_FLAGS)
decompress(&mut self.state, &tail[start..], self.out_buffer.as_mut_slice(), self.out_pos as usize, BASE_FLAGS)
};

start += in_consumed;
Expand Down

0 comments on commit 64ba7fa

Please sign in to comment.