Skip to content

Commit

Permalink
Revert "remove now-dead code"
Browse files Browse the repository at this point in the history
This reverts commit fd11f28.
  • Loading branch information
cosmicexplorer committed Jul 17, 2024
1 parent a28a43d commit 423a263
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/aes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ impl<R: Read> Read for AesReaderValid<R> {
}
}

impl<R> AesReaderValid<R> {
/// Consumes this decoder, returning the underlying reader.
pub fn into_inner(self) -> R {
self.reader
}
}

pub struct AesWriter<W> {
writer: W,
cipher: Cipher,
Expand Down
5 changes: 5 additions & 0 deletions src/crc32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ impl<R> Crc32Reader<R> {
Err("Invalid checksum")
}
}

#[allow(dead_code)]
pub fn into_inner(self) -> R {
self.inner
}
}

impl<R: Read> Read for Crc32Reader<R> {
Expand Down
7 changes: 6 additions & 1 deletion src/read/lzma.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use lzma_rs::decompress::{Options, Stream, UnpackedSize};
use std::collections::VecDeque;
use std::io::{Read, Result, Write};
use std::io::{copy, Error, Read, Result, Write};

const COMPRESSED_BYTES_TO_BUFFER: usize = 4096;

Expand All @@ -23,6 +23,11 @@ impl<R: Read> LzmaDecoder<R> {
stream: Stream::new_with_options(&OPTIONS, VecDeque::new()),
}
}

pub fn finish(mut self) -> Result<VecDeque<u8>> {
copy(&mut self.compressed_reader, &mut self.stream)?;
self.stream.finish().map_err(Error::from)
}
}

impl<R: Read> Read for LzmaDecoder<R> {
Expand Down
6 changes: 6 additions & 0 deletions src/read/xz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,9 @@ impl<R: Read> Read for XzDecoder<R> {
Ok(written)
}
}

impl<R: Read> XzDecoder<R> {
pub fn into_inner(self) -> R {
self.compressed_reader.into_inner()
}
}
8 changes: 8 additions & 0 deletions src/zipcrypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ impl<R: std::io::Read> std::io::Read for ZipCryptoReaderValid<R> {
}
}

impl<R> ZipCryptoReaderValid<R> {
/// Consumes this decoder, returning the underlying reader.
#[allow(dead_code)]
pub fn into_inner(self) -> R {
self.reader.file
}
}

static CRCTABLE: [u32; 256] = [
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
Expand Down

0 comments on commit 423a263

Please sign in to comment.