Revert "Make cfzlib the default on platforms that support it"

This reverts commit 2702145f3f.

cfzlib seems to have a MASSIVE memory leak in it. Trying to use it
when processing many files at once will cause your system to run out
of memory.

Closes #125
This commit is contained in:
Josh Holmer 2018-07-21 00:37:57 -04:00
parent d110949d2a
commit ff0e3df948
6 changed files with 14 additions and 6 deletions

View file

@ -11,7 +11,7 @@ matrix:
env: TARGET=x86_64-apple-darwin
cache: cargo
- os: linux
rust: 1.27.0
rust: 1.24.0
env: TARGET=x86_64-unknown-linux-gnu
cache: cargo
- os: linux

View file

@ -48,6 +48,7 @@ optional = true
version = "1.0.1"
[dependencies.cloudflare-zlib-sys]
optional = true
version = "^0.1.2"
[dependencies.image]
@ -62,10 +63,11 @@ binary = [
]
default = ["binary", "parallel"]
parallel = ["rayon"]
cfzlib = ["cloudflare-zlib-sys"]
dev = [
"nightly-binary",
]
nightly = []
nightly = ["cfzlib"]
nightly-binary = [
"binary",
"nightly",

View file

@ -26,7 +26,7 @@ cargo build --release
cp target/release/oxipng /usr/local/bin
```
The current minimum supported Rust version is **1.27.0**. Oxipng may compile on earlier versions of Rust,
The current minimum supported Rust version is **1.24.0**. Oxipng may compile on earlier versions of Rust,
but there is no guarantee.
Oxipng follows Semantic Versioning.

View file

@ -26,7 +26,7 @@ cargo build --release
cp target/release/oxipng /usr/local/bin
```
The current minimum supported Rust version is **1.27.0**. Oxipng may compile on earlier versions of Rust,
The current minimum supported Rust version is **1.24.0**. Oxipng may compile on earlier versions of Rust,
but there is no guarantee.
Oxipng follows Semantic Versioning.

View file

@ -21,13 +21,17 @@ pub fn deflate(
zw: u8,
max_size: &AtomicMin,
) -> Result<Vec<u8>, PngError> {
if is_cfzlib_supported() {
return cfzlib_deflate(data, zc, zs, zw, max_size);
#[cfg(feature = "cfzlib")]
{
if is_cfzlib_supported() {
return cfzlib_deflate(data, zc, zs, zw, max_size);
}
}
miniz_stream::compress_to_vec_oxipng(data, zc, zw.into(), zs.into(), max_size)
}
#[cfg(feature = "cfzlib")]
fn is_cfzlib_supported() -> bool {
#[cfg(target_arch = "x86_64")]
{
@ -44,6 +48,7 @@ fn is_cfzlib_supported() -> bool {
false
}
#[cfg(feature = "cfzlib")]
pub fn cfzlib_deflate(
data: &[u8],
level: u8,

View file

@ -1,5 +1,6 @@
extern crate bit_vec;
extern crate byteorder;
#[cfg(feature = "cfzlib")]
extern crate cloudflare_zlib_sys;
extern crate crc;
extern crate image;