From c7e4ac0c2fe4f9529343719b1c5e09712f2c1aad Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Mon, 23 Oct 2017 14:57:00 -0700 Subject: [PATCH 1/2] Provide the rust_backend feature --- Cargo.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b8fa68af..96bbccfc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ Library to support the reading and writing of zip files. """ [dependencies] -flate2 = "0.2" +flate2 = { git = "https://github.com/alexcrichton/flate2-rs", default-features = false } time = "0.1" podio = "0.1" msdos_time = "0.1" @@ -22,4 +22,5 @@ bzip2 = { version = "0.3", optional = true } walkdir = "1.0" [features] -default = ["bzip2"] +default = ["bzip2", "flate2/default"] +rust_backend = ["flate2/rust_backend"] From 22194687c69e5c94df02530335d3531715bdfe55 Mon Sep 17 00:00:00 2001 From: rardiol Date: Wed, 27 Dec 2017 12:40:47 -0300 Subject: [PATCH 2/2] use flate2 1.0 --- Cargo.toml | 2 +- src/read.rs | 4 ++-- src/write.rs | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 96bbccfc..b1cc64c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ Library to support the reading and writing of zip files. """ [dependencies] -flate2 = { git = "https://github.com/alexcrichton/flate2-rs", default-features = false } +flate2 = { version = "1.0", default-features = false } time = "0.1" podio = "0.1" msdos_time = "0.1" diff --git a/src/read.rs b/src/read.rs index cb3f0725..95df84ea 100644 --- a/src/read.rs +++ b/src/read.rs @@ -8,7 +8,7 @@ use std::io; use std::io::prelude::*; use std::collections::HashMap; use flate2; -use flate2::FlateReadExt; +use flate2::read::DeflateDecoder; use podio::{ReadPodExt, LittleEndian}; use types::{ZipFileData, System}; use cp437::FromCp437; @@ -237,7 +237,7 @@ impl ZipArchive }, CompressionMethod::Deflated => { - let deflate_reader = limit_reader.deflate_decode(); + let deflate_reader = DeflateDecoder::new(limit_reader); ZipFileReader::Deflated(Crc32Reader::new( deflate_reader, data.crc32)) diff --git a/src/write.rs b/src/write.rs index 623df92b..eacefb55 100644 --- a/src/write.rs +++ b/src/write.rs @@ -12,7 +12,6 @@ use std::mem; use std::ascii::AsciiExt; use time; use flate2; -use flate2::FlateWriteExt; use flate2::write::DeflateEncoder; use podio::{WritePodExt, LittleEndian}; use msdos_time::TmMsDosExt; @@ -341,7 +340,7 @@ impl GenericZipWriter *self = match compression { CompressionMethod::Stored => GenericZipWriter::Storer(bare), - CompressionMethod::Deflated => GenericZipWriter::Deflater(bare.deflate_encode(flate2::Compression::Default)), + CompressionMethod::Deflated => GenericZipWriter::Deflater(DeflateEncoder::new(bare, flate2::Compression::default())), #[cfg(feature = "bzip2")] CompressionMethod::Bzip2 => GenericZipWriter::Bzip2(BzEncoder::new(bare, bzip2::Compression::Default)), CompressionMethod::Unsupported(..) => return Err(ZipError::UnsupportedArchive("Unsupported compression")),