Merge branch 'rardiol-flate2'

This commit is contained in:
Mathijs van de Nes 2018-01-06 11:43:30 +01:00
commit 30236e9a5c
3 changed files with 6 additions and 6 deletions

View file

@ -12,7 +12,7 @@ Library to support the reading and writing of zip files.
"""
[dependencies]
flate2 = "0.2"
flate2 = { version = "1.0", 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"]

View file

@ -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<R: Read+io::Seek> ZipArchive<R>
},
CompressionMethod::Deflated =>
{
let deflate_reader = limit_reader.deflate_decode();
let deflate_reader = DeflateDecoder::new(limit_reader);
ZipFileReader::Deflated(Crc32Reader::new(
deflate_reader,
data.crc32))

View file

@ -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<W: Write+io::Seek> GenericZipWriter<W>
*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")),