diff --git a/.direnv/flake-profile b/.direnv/flake-profile new file mode 120000 index 0000000..0c05709 --- /dev/null +++ b/.direnv/flake-profile @@ -0,0 +1 @@ +flake-profile-1-link \ No newline at end of file diff --git a/.direnv/flake-profile-1-link b/.direnv/flake-profile-1-link new file mode 120000 index 0000000..356f6b6 --- /dev/null +++ b/.direnv/flake-profile-1-link @@ -0,0 +1 @@ +/nix/store/bdw4nizg6fg6i13gyi43skk3clwg7fjs-nix-shell-env \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index f64bdac..6f055ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -607,8 +607,6 @@ dependencies = [ [[package]] name = "rust-lzma" version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d62915608f6cee1d7f2fc00f28b4f058ff79d6e4ec3c2fe0006b09b52437c84" dependencies = [ "pkg-config", "vcpkg", diff --git a/crates/rc-zip/Cargo.toml b/crates/rc-zip/Cargo.toml index e2ba977..5ec9c42 100644 --- a/crates/rc-zip/Cargo.toml +++ b/crates/rc-zip/Cargo.toml @@ -26,7 +26,9 @@ chardetng = "0.1.17" flate2 = { version = "1.0.28", optional = true } num_enum = "0.7.2" byteorder = "1.5.0" -rust-lzma = { version = "0.6.0", optional = true } +# rust-lzma = { version = "0.6.0", optional = true } +# FIXME: +rust-lzma = { path = "../../../rust-lzma", optional = true } [features] default = ["sync", "file", "deflate"] diff --git a/crates/rc-zip/src/reader/sync/decoder.rs b/crates/rc-zip/src/reader/sync/decoder.rs index 479d129..88a8de3 100644 --- a/crates/rc-zip/src/reader/sync/decoder.rs +++ b/crates/rc-zip/src/reader/sync/decoder.rs @@ -2,7 +2,7 @@ use flate2::read::DeflateDecoder; #[cfg(feature = "lzma")] -use xz2::read::XzDecoder; +use lzma::reader::LzmaReader; use std::{cmp, io}; @@ -24,25 +24,25 @@ where R: io::Read, { fn into_inner(self: Box) -> R { - DeflateDecoder::into_inner(*self) + Self::into_inner(*self) } fn get_mut(&mut self) -> &mut R { - DeflateDecoder::get_mut(self) + Self::get_mut(self) } } #[cfg(feature = "lzma")] -impl Decoder for XzDecoder +impl Decoder for LzmaReader where R: io::Read, { fn into_inner(self: Box) -> R { - XzDecoder::into_inner(*self) + Self::into_inner(*self) } fn get_mut(&mut self) -> &mut R { - XzDecoder::get_mut(self) + Self::get_mut(self) } } diff --git a/crates/rc-zip/src/reader/sync/entry_reader.rs b/crates/rc-zip/src/reader/sync/entry_reader.rs index 0ef3067..b1f2130 100644 --- a/crates/rc-zip/src/reader/sync/entry_reader.rs +++ b/crates/rc-zip/src/reader/sync/entry_reader.rs @@ -102,7 +102,7 @@ where let data = &data[..size as usize]; trace!(%major, %minor, %size, "LZMA properties header, data = {data:02x?}"); - Box::new(xz2::read::XzDecoder::new_stream(limited_reader, xz2::stream::Stream::new_lzma_decoder(128 * 1024 * 1024)?)) + Box::new(lzma::reader::LzmaReader::new_decompressor(limited_reader).map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?) } #[cfg(not(feature = "lzma"))] diff --git a/crates/rc-zip/testdata/test-zips/found-me.txt b/crates/rc-zip/testdata/test-zips/found-me.txt new file mode 100644 index 0000000..e69de29 diff --git a/flake.nix b/flake.nix index a3b1e57..be8ef3e 100644 --- a/flake.nix +++ b/flake.nix @@ -46,7 +46,7 @@ Security ]); commonArgs = { - pname = "fluke"; + pname = "rc_zip"; version = "latest"; strictDeps = true; dontStrip = true; diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..d24f9dc --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "stable" +components = ["llvm-tools", "clippy", "rust-src"]