Skip to content

Commit 3a5094d

Browse files
committed
deps: Replace lzma-rs with liblzma
1 parent b93fc34 commit 3a5094d

File tree

4 files changed

+11
-65
lines changed

4 files changed

+11
-65
lines changed

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ time = { version = "0.3.37", default-features = false }
3030
aes = { version = "0.8", optional = true }
3131
bzip2 = { version = "0.5.0", optional = true }
3232
chrono = { version = "0.4", optional = true }
33-
constant_time_eq = { version = "0.3", optional = true }
33+
constant_time_eq = { version = "0.4.2", optional = true }
3434
crc32fast = "1.4"
3535
flate2 = { version = "1.1.1", default-features = false, optional = true }
3636
getrandom = { version = "0.3.1", features = ["wasm_js", "std"], optional = true}
3737
hmac = { version = "0.12", optional = true, features = ["reset"] }
3838
indexmap = "2"
3939
jiff = { version = "0.2.4", optional = true }
4040
memchr = "2.7"
41-
nt-time = { version = "0.10.6", default-features = false, optional = true }
41+
nt-time = { version = "0.11.1", default-features = false, optional = true }
4242
pbkdf2 = { version = "0.12", optional = true }
4343
sha1 = { version = "0.10", optional = true }
4444
time = { workspace = true, optional = true, features = [
@@ -48,7 +48,6 @@ zeroize = { version = "1.8", optional = true, features = ["zeroize_derive"] }
4848
zstd = { version = "0.13", optional = true, default-features = false }
4949
zopfli = { version = "0.8", optional = true }
5050
deflate64 = { version = "0.1.9", optional = true }
51-
lzma-rs = { version = "0.3", default-features = false, optional = true }
5251
liblzma = { version = "0.4.1", optional = true }
5352

5453
[target.'cfg(fuzzing)'.dependencies]
@@ -78,7 +77,7 @@ deflate-flate2-zlib = ["deflate-flate2", "flate2/zlib"]
7877
deflate-zopfli = ["zopfli", "_deflate-any"]
7978
jiff-02 = ["dep:jiff"]
8079
nt-time = ["dep:nt-time"]
81-
lzma = ["lzma-rs/stream"]
80+
lzma = ["dep:liblzma"]
8281
unreserved = []
8382
xz = ["dep:liblzma"]
8483
default = [

src/compression.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pub(crate) enum Decompressor<R: io::BufRead> {
202202
#[cfg(feature = "zstd")]
203203
Zstd(zstd::Decoder<'static, R>),
204204
#[cfg(feature = "lzma")]
205-
Lzma(Box<crate::read::lzma::LzmaDecoder<R>>),
205+
Lzma(liblzma::bufread::XzDecoder<R>),
206206
#[cfg(feature = "xz")]
207207
Xz(liblzma::bufread::XzDecoder<R>),
208208
}
@@ -245,7 +245,8 @@ impl<R: io::BufRead> Decompressor<R> {
245245
CompressionMethod::Zstd => Decompressor::Zstd(zstd::Decoder::with_buffer(reader)?),
246246
#[cfg(feature = "lzma")]
247247
CompressionMethod::Lzma => {
248-
Decompressor::Lzma(Box::new(crate::read::lzma::LzmaDecoder::new(reader)))
248+
Decompressor::Lzma(liblzma::bufread::XzDecoder::new_stream(reader,
249+
liblzma::stream::Stream::new_lzma_decoder(0).unwrap()))
249250
}
250251
#[cfg(feature = "xz")]
251252
CompressionMethod::Xz => Decompressor::Xz(liblzma::bufread::XzDecoder::new(reader)),

src/read.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ pub use config::*;
3535
/// Provides high level API for reading from a stream.
3636
pub(crate) mod stream;
3737

38-
#[cfg(feature = "lzma")]
39-
pub(crate) mod lzma;
40-
4138
pub(crate) mod magic_finder;
4239

4340
// Put the struct declaration in a private module to convince rustdoc to display ZipArchive nicely
@@ -2160,10 +2157,10 @@ mod test {
21602157
fn test_is_symlink() -> std::io::Result<()> {
21612158
let mut v = Vec::new();
21622159
v.extend_from_slice(include_bytes!("../tests/data/symlink.zip"));
2163-
let mut reader = ZipArchive::new(Cursor::new(v)).unwrap();
2164-
assert!(reader.by_index(0).unwrap().is_symlink());
2160+
let mut reader = ZipArchive::new(Cursor::new(v))?;
2161+
assert!(reader.by_index(0)?.is_symlink());
21652162
let tempdir = TempDir::with_prefix("test_is_symlink")?;
2166-
reader.extract(&tempdir).unwrap();
2163+
reader.extract(&tempdir)?;
21672164
assert!(tempdir.path().join("bar").is_symlink());
21682165
Ok(())
21692166
}
@@ -2234,7 +2231,7 @@ mod test {
22342231
writer.start_file("symlink/dest-file", SimpleFileOptions::default())?;
22352232
let mut reader = writer.finish_into_readable()?;
22362233
let dest_parent =
2237-
TempDir::with_prefix("read__test_cannot_symlink_outside_destination").unwrap();
2234+
TempDir::with_prefix("read__test_cannot_symlink_outside_destination")?;
22382235
let dest_sibling = dest_parent.path().join("dest-sibling");
22392236
create_dir(&dest_sibling)?;
22402237
let dest = dest_parent.path().join("dest");
@@ -2249,7 +2246,7 @@ mod test {
22492246
let mut v = Vec::new();
22502247
v.extend_from_slice(include_bytes!("../tests/data/mimetype.zip"));
22512248
let mut reader = ZipArchive::new(Cursor::new(v))?;
2252-
let dest = TempDir::with_prefix("read__test_can_create_destination").unwrap();
2249+
let dest = TempDir::with_prefix("read__test_can_create_destination")?;
22532250
reader.extract(&dest)?;
22542251
assert!(dest.path().join("mimetype").exists());
22552252
Ok(())

src/read/lzma.rs

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)