Skip to content

Commit 3e1fe71

Browse files
committed
Migrate from unmaintained xz2 to liblzma
1 parent ca2245c commit 3e1fe71

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ all-algorithms = ["brotli", "bzip2", "deflate", "gzip", "lzma", "xz", "zlib", "z
2424
# algorithms
2525
deflate = ["flate2"]
2626
gzip = ["flate2"]
27-
lzma = ["xz2"]
28-
xz = ["xz2"]
27+
lzma = ["liblzma"]
28+
xz = ["liblzma"]
2929
zlib = ["flate2"]
3030
zstd = ["libzstd", "zstd-safe"]
3131
zstdmt = ["zstd", "zstd-safe/zstdmt"]
@@ -41,7 +41,7 @@ libzstd = { package = "zstd", version = "0.13.1", optional = true, default-featu
4141
memchr = "2"
4242
pin-project-lite = "0.2"
4343
tokio = { version = "1.24.2", optional = true, default-features = false }
44-
xz2 = { version = "0.1.6", optional = true }
44+
liblzma = { version = "0.3.2", optional = true }
4545
zstd-safe = { version = "7", optional = true, default-features = false }
4646
deflate64 = { version = "0.1.5", optional = true }
4747

src/codec/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod gzip;
1717
mod lzma;
1818
#[cfg(feature = "xz")]
1919
mod xz;
20-
#[cfg(feature = "xz2")]
20+
#[cfg(feature = "liblzma")]
2121
mod xz2;
2222
#[cfg(feature = "zlib")]
2323
mod zlib;
@@ -40,7 +40,7 @@ pub(crate) use self::gzip::{GzipDecoder, GzipEncoder};
4040
pub(crate) use self::lzma::{LzmaDecoder, LzmaEncoder};
4141
#[cfg(feature = "xz")]
4242
pub(crate) use self::xz::{XzDecoder, XzEncoder};
43-
#[cfg(feature = "xz2")]
43+
#[cfg(feature = "liblzma")]
4444
pub(crate) use self::xz2::{Xz2Decoder, Xz2Encoder, Xz2FileFormat};
4545
#[cfg(feature = "zlib")]
4646
pub(crate) use self::zlib::{ZlibDecoder, ZlibEncoder};

src/codec/xz2/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{fmt, io};
22

3-
use xz2::stream::{Action, Status, Stream};
3+
use liblzma::stream::{Action, Status, Stream};
44

55
use crate::{codec::Decode, util::PartialBuffer};
66

src/codec/xz2/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{fmt, io};
22

3-
use xz2::stream::{Action, Check, LzmaOptions, Status, Stream};
3+
use liblzma::stream::{Action, Check, LzmaOptions, Status, Stream};
44

55
use crate::{
66
codec::{Encode, Xz2FileFormat},

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
)]
140140
#![cfg_attr(not(all), allow(unused))]
141141

142-
#[cfg(any(feature = "bzip2", feature = "flate2", feature = "xz2"))]
142+
#[cfg(any(feature = "bzip2", feature = "flate2", feature = "liblzma"))]
143143
use std::convert::TryInto;
144144

145145
#[macro_use]
@@ -241,7 +241,7 @@ impl Level {
241241
}
242242
}
243243

244-
#[cfg(feature = "xz2")]
244+
#[cfg(feature = "liblzma")]
245245
fn into_xz2(self) -> u32 {
246246
match self {
247247
Self::Fastest => 0,

tests/artifacts/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
)]
131131
#![cfg_attr(not(all), allow(unused))]
132132

133-
#[cfg(any(feature = "bzip2", feature = "flate2", feature = "xz2"))]
133+
#[cfg(any(feature = "bzip2", feature = "flate2", feature = "liblzma"))]
134134
use std::convert::TryInto;
135135

136136
#[macro_use]
@@ -225,7 +225,7 @@ impl Level {
225225
}
226226
}
227227

228-
#[cfg(feature = "xz2")]
228+
#[cfg(feature = "liblzma")]
229229
fn into_xz2(self) -> u32 {
230230
match self {
231231
Self::Fastest => 0,

tests/utils/algos.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ algos! {
169169
pub use crate::utils::impls::sync::to_vec;
170170

171171
pub fn compress(bytes: &[u8]) -> Vec<u8> {
172-
use xz2::bufread::XzEncoder;
172+
use liblzma::bufread::XzEncoder;
173173

174174
to_vec(XzEncoder::new(bytes, 0))
175175
}
176176

177177
pub fn decompress(bytes: &[u8]) -> Vec<u8> {
178-
use xz2::bufread::XzDecoder;
178+
use liblzma::bufread::XzDecoder;
179179

180180
to_vec(XzDecoder::new(bytes))
181181
}
@@ -187,8 +187,8 @@ algos! {
187187
pub use crate::utils::impls::sync::to_vec;
188188

189189
pub fn compress(bytes: &[u8]) -> Vec<u8> {
190-
use xz2::bufread::XzEncoder;
191-
use xz2::stream::{LzmaOptions, Stream};
190+
use liblzma::bufread::XzEncoder;
191+
use liblzma::stream::{LzmaOptions, Stream};
192192

193193
to_vec(XzEncoder::new_stream(
194194
bytes,
@@ -197,8 +197,8 @@ algos! {
197197
}
198198

199199
pub fn decompress(bytes: &[u8]) -> Vec<u8> {
200-
use xz2::bufread::XzDecoder;
201-
use xz2::stream::Stream;
200+
use liblzma::bufread::XzDecoder;
201+
use liblzma::stream::Stream;
202202

203203
to_vec(XzDecoder::new_stream(
204204
bytes,

0 commit comments

Comments
 (0)