Skip to content

Commit

Permalink
code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
HsuJv committed Sep 20, 2023
1 parent 71b98c0 commit 2bd549b
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions src/algorithm/compression/zlib.rs
Original file line number Diff line number Diff line change
@@ -1,57 +1,3 @@
// pub struct Zlib<'a> {
// decompressor: flate2::Decompress,
// compressor: flate2::Compress,
// input: &'a [u8],
// }

// impl<'a> Zlib<'a> {
// pub fn new(decompressor: flate2::Decompress, input: &'a [u8]) -> Zlib<'a> {
// Zlib {
// decompressor,
// input,
// }
// }

// pub fn into_inner(self) -> Result<flate2::Decompress> {
// if self.input.is_empty() {
// Ok(self.decompressor)
// } else {
// Err(std::io::Error::new(
// std::io::ErrorKind::InvalidData,
// "leftover zlib byte data",
// ))
// }
// }

// pub fn read_u8(&mut self) -> std::io::Result<u8> {
// let mut buf = [0; 1];
// self.read_exact(&mut buf)?;
// Ok(buf[0])
// }
// }

// impl<'a> Read for Zlib<'a> {
// fn read(&mut self, output: &mut [u8]) -> std::io::Result<usize> {
// let in_before = self.decompressor.total_in();
// let out_before = self.decompressor.total_out();
// let result =
// self.decompressor
// .decompress(self.input, output, flate2::FlushDecompress::None);
// let consumed = (self.decompressor.total_in() - in_before) as usize;
// let produced = (self.decompressor.total_out() - out_before) as usize;

// self.input = &self.input[consumed..];
// match result {
// Ok(flate2::Status::Ok) => Ok(produced),
// Ok(flate2::Status::BufError) => Ok(0),
// Err(error) => Err(std::io::Error::new(std::io::ErrorKind::InvalidData, error)),
// Ok(flate2::Status::StreamEnd) => Err(std::io::Error::new(
// std::io::ErrorKind::InvalidData,
// "zlib stream end",
// )),
// }
// }
// }
use flate2;

use crate::SshError;
Expand Down

0 comments on commit 2bd549b

Please sign in to comment.