Skip to content

Commit 816fb85

Browse files
authored
Use libtiff compatible weezl configuration (#276)
1 parent 7648317 commit 816fb85

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ half = { version = "2.4.1" }
2121
quick-error = "2.0.1"
2222

2323
flate2 = { version = "1.0.20", optional = true }
24-
weezl = { version = "0.1.0", optional = true }
24+
weezl = { version = "0.1.10", optional = true }
2525
zstd = { version = "0.13", optional = true }
2626
zune-jpeg = { version = "0.4.17", optional = true }
2727

src/decoder/stream.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,15 @@ pub struct LZWReader<R: Read> {
158158
impl<R: Read> LZWReader<R> {
159159
/// Wraps a reader
160160
pub fn new(reader: R, compressed_length: usize) -> LZWReader<R> {
161+
let configuration =
162+
weezl::decode::Configuration::with_tiff_size_switch(weezl::BitOrder::Msb, 8)
163+
.with_yield_on_full_buffer(true);
161164
Self {
162165
reader: BufReader::with_capacity(
163166
(32 * 1024).min(compressed_length),
164167
reader.take(u64::try_from(compressed_length).unwrap()),
165168
),
166-
decoder: weezl::decode::Decoder::with_tiff_size_switch(weezl::BitOrder::Msb, 8),
169+
decoder: configuration.build(),
167170
}
168171
}
169172
}

0 commit comments

Comments
 (0)