Skip to content

Commit

Permalink
Okay forget lzma
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Jan 26, 2024
1 parent 5f9fb74 commit 5fe9d15
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions .direnv/flake-profile
1 change: 1 addition & 0 deletions .direnv/flake-profile-1-link
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion crates/rc-zip/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
12 changes: 6 additions & 6 deletions crates/rc-zip/src/reader/sync/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use flate2::read::DeflateDecoder;

#[cfg(feature = "lzma")]
use xz2::read::XzDecoder;
use lzma::reader::LzmaReader;

use std::{cmp, io};

Expand All @@ -24,25 +24,25 @@ where
R: io::Read,
{
fn into_inner(self: Box<Self>) -> 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<R> Decoder<R> for XzDecoder<R>
impl<R> Decoder<R> for LzmaReader<R>
where
R: io::Read,
{
fn into_inner(self: Box<Self>) -> R {
XzDecoder::into_inner(*self)
Self::into_inner(*self)
}

fn get_mut(&mut self) -> &mut R {
XzDecoder::get_mut(self)
Self::get_mut(self)
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rc-zip/src/reader/sync/entry_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))]
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
Security
]);
commonArgs = {
pname = "fluke";
pname = "rc_zip";
version = "latest";
strictDeps = true;
dontStrip = true;
Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
components = ["llvm-tools", "clippy", "rust-src"]

0 comments on commit 5fe9d15

Please sign in to comment.