Skip to content

Commit

Permalink
Address comments from #59 in src/decode/lzma.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
gendx committed Jan 30, 2021
1 parent b59396e commit 5aa7eb1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/decode/lzma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const MAX_REQUIRED_INPUT: usize = 20;
/// Tells the decompressor if we should expect more data after parsing the
/// current input.
#[derive(Debug, PartialEq)]
pub enum ProcessingMode {
enum ProcessingMode {
/// Streaming mode. Process the input bytes but assume there will be more
/// chunks of input data to receive in future calls to `process_mode()`.
Partial,
Expand Down Expand Up @@ -438,7 +438,7 @@ where
Ok(())
}

pub fn process_mode<'a, R: io::BufRead>(
fn process_mode<'a, R: io::BufRead>(
&mut self,
mut rangecoder: &mut rangecoder::RangeDecoder<'a, R>,
mode: ProcessingMode,
Expand Down Expand Up @@ -468,7 +468,7 @@ where
&& (self.partial_input_buf.position() as usize) < MAX_REQUIRED_INPUT
&& self
.try_process_next(
&tmp[0..self.partial_input_buf.position() as usize],
&tmp[..self.partial_input_buf.position() as usize],
rangecoder.range,
rangecoder.code,
)
Expand All @@ -479,7 +479,7 @@ where

// Run the decompressor on the tmp buffer
let mut tmp_reader =
io::Cursor::new(&tmp[0..self.partial_input_buf.position() as usize]);
io::Cursor::new(&tmp[..self.partial_input_buf.position() as usize]);
let mut tmp_rangecoder = rangecoder::RangeDecoder::from_parts(
&mut tmp_reader,
rangecoder.range,
Expand All @@ -493,7 +493,7 @@ where
// Update tmp buffer
let end = self.partial_input_buf.position();
let new_len = end - tmp_reader.position();
self.partial_input_buf.get_mut()[0..new_len as usize]
self.partial_input_buf.get_mut()[..new_len as usize]
.copy_from_slice(&tmp[tmp_reader.position() as usize..end as usize]);
self.partial_input_buf.set_position(new_len);

Expand Down

0 comments on commit 5aa7eb1

Please sign in to comment.