Skip to content

Commit

Permalink
Allow resetting the Inflate state without zeroing the output buffer
Browse files Browse the repository at this point in the history
Related to Frommi#89
  • Loading branch information
Byron committed Aug 11, 2020
1 parent f8c25f3 commit 0c6e803
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion miniz_oxide/src/inflate/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,15 @@ impl InflateState {
/// Reset the decompressor without re-allocating memory, using the given
/// data format.
pub fn reset(&mut self, data_format: DataFormat) {
self.decompressor().init();
self.reset_without_zeroing_output_buffer(data_format);
self.dict = [0; TINFL_LZ_DICT_SIZE];
}

/// Reset the decompressor without re-allocating memory, using the given
/// data format. It does not not zero the output buffer, which potentially
/// leaves decompressed bytes of previous runs in memory, but saves time.
pub fn reset_without_zeroing_output_buffer(&mut self, data_format: DataFormat) {
self.decompressor().init();
self.dict_ofs = 0;
self.dict_avail = 0;
self.first_call = true;
Expand Down

0 comments on commit 0c6e803

Please sign in to comment.