Skip to content

Commit

Permalink
Revert "Revert "Make cfzlib the default on platforms that support it""
Browse files Browse the repository at this point in the history
This reverts commit ff0e3df.
  • Loading branch information
shssoichiro committed Aug 5, 2018
1 parent 1322416 commit 3b42f42
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ matrix:
env: TARGET=x86_64-apple-darwin
cache: cargo
- os: linux
rust: 1.24.0
rust: 1.27.0
env: TARGET=x86_64-unknown-linux-gnu
cache: cargo
- os: linux
Expand Down
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ optional = true
version = "1.0.1"

[dependencies.cloudflare-zlib-sys]
optional = true
version = "^0.1.2"

[dependencies.image]
Expand All @@ -63,11 +62,10 @@ binary = [
]
default = ["binary", "parallel"]
parallel = ["rayon"]
cfzlib = ["cloudflare-zlib-sys"]
dev = [
"nightly-binary",
]
nightly = ["cfzlib"]
nightly = []
nightly-binary = [
"binary",
"nightly",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cargo build --release
cp target/release/oxipng /usr/local/bin
```

The current minimum supported Rust version is **1.24.0**. Oxipng may compile on earlier versions of Rust,
The current minimum supported Rust version is **1.27.0**. Oxipng may compile on earlier versions of Rust,
but there is no guarantee.

Oxipng follows Semantic Versioning.
Expand Down
2 changes: 1 addition & 1 deletion README.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cargo build --release
cp target/release/oxipng /usr/local/bin
```

The current minimum supported Rust version is **1.24.0**. Oxipng may compile on earlier versions of Rust,
The current minimum supported Rust version is **1.27.0**. Oxipng may compile on earlier versions of Rust,
but there is no guarantee.

Oxipng follows Semantic Versioning.
Expand Down
13 changes: 4 additions & 9 deletions src/deflate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,13 @@ pub fn inflate(data: &[u8]) -> PngResult<Vec<u8>> {

/// Compress a data stream using the DEFLATE algorithm
pub fn deflate(data: &[u8], zc: u8, zs: u8, zw: u8, max_size: &AtomicMin) -> PngResult<Vec<u8>> {
#[cfg(feature = "cfzlib")]
{
if is_cfzlib_supported() {
return cfzlib_deflate(data, zc, zs, zw, max_size);
}
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")]
{
Expand All @@ -43,7 +39,6 @@ fn is_cfzlib_supported() -> bool {
false
}

#[cfg(feature = "cfzlib")]
pub fn cfzlib_deflate(
data: &[u8],
level: u8,
Expand Down Expand Up @@ -84,11 +79,11 @@ pub fn cfzlib_deflate(
Z_OK | Z_BUF_ERROR => {
deflateEnd(&mut stream);
return Err(PngError::DeflatedDataTooLong(stream.total_out as usize));
},
}
_ => {
deflateEnd(&mut stream);
return Err(PngError::new("deflate"));
},
}
}
if Z_OK != deflateEnd(&mut stream) {
return Err(PngError::new("deflateEnd"));
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
extern crate bit_vec;
extern crate byteorder;
#[cfg(feature = "cfzlib")]
extern crate cloudflare_zlib_sys;
extern crate crc;
extern crate image;
Expand Down

0 comments on commit 3b42f42

Please sign in to comment.