diff options
Diffstat (limited to 'vendor/ruzstd/src/decoding/block_decoder.rs')
-rw-r--r-- | vendor/ruzstd/src/decoding/block_decoder.rs | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/vendor/ruzstd/src/decoding/block_decoder.rs b/vendor/ruzstd/src/decoding/block_decoder.rs index 11a4c28c1..0fbce8f48 100644 --- a/vendor/ruzstd/src/decoding/block_decoder.rs +++ b/vendor/ruzstd/src/decoding/block_decoder.rs @@ -11,7 +11,7 @@ use crate::blocks::literals_section::LiteralsSectionParseError; use crate::blocks::sequence_section::SequencesHeaderParseError; use crate::decoding::scratch::DecoderScratch; use crate::decoding::sequence_execution::execute_sequences; -use std::io::{self, Read}; +use crate::io::{self, Read}; pub struct BlockDecoder { header_buffer: [u8; 3], @@ -203,12 +203,12 @@ impl BlockDecoder { let mut section = LiteralsSection::new(); let bytes_in_literals_header = section.parse_from_header(raw)?; let raw = &raw[bytes_in_literals_header as usize..]; - if crate::VERBOSE { - println!( - "Found {} literalssection with regenerated size: {}, and compressed size: {:?}", - section.ls_type, section.regenerated_size, section.compressed_size - ); - } + vprintln!( + "Found {} literalssection with regenerated size: {}, and compressed size: {:?}", + section.ls_type, + section.regenerated_size, + section.compressed_size + ); let upper_limit_for_literals = match section.compressed_size { Some(x) => x as usize, @@ -227,9 +227,7 @@ impl BlockDecoder { } let raw_literals = &raw[..upper_limit_for_literals]; - if crate::VERBOSE { - println!("Slice for literals: {}", raw_literals.len()); - } + vprintln!("Slice for literals: {}", raw_literals.len()); workspace.literals_buffer.clear(); //all literals of the previous block must have been used in the sequence execution anyways. just be defensive here let bytes_used_in_literals_section = decode_literals( @@ -247,20 +245,16 @@ impl BlockDecoder { assert!(bytes_used_in_literals_section == upper_limit_for_literals as u32); let raw = &raw[upper_limit_for_literals..]; - if crate::VERBOSE { - println!("Slice for sequences with headers: {}", raw.len()); - } + vprintln!("Slice for sequences with headers: {}", raw.len()); let mut seq_section = SequencesHeader::new(); let bytes_in_sequence_header = seq_section.parse_from_header(raw)?; let raw = &raw[bytes_in_sequence_header as usize..]; - if crate::VERBOSE { - println!( - "Found sequencessection with sequences: {} and size: {}", - seq_section.num_sequences, - raw.len() - ); - } + vprintln!( + "Found sequencessection with sequences: {} and size: {}", + seq_section.num_sequences, + raw.len() + ); assert!( u32::from(bytes_in_literals_header) @@ -269,9 +263,7 @@ impl BlockDecoder { + raw.len() as u32 == header.content_size ); - if crate::VERBOSE { - println!("Slice for sequences: {}", raw.len()); - } + vprintln!("Slice for sequences: {}", raw.len()); if seq_section.num_sequences != 0 { decode_sequences( @@ -280,9 +272,7 @@ impl BlockDecoder { &mut workspace.fse, &mut workspace.sequences, )?; - if crate::VERBOSE { - println!("Executing sequences"); - } + vprintln!("Executing sequences"); execute_sequences(workspace)?; } else { workspace.buffer.push(&workspace.literals_buffer); |