diff --git a/Cargo.lock b/Cargo.lock index 48ae1e76..00e84300 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,7 +85,7 @@ dependencies = [ [[package]] name = "cloudflare-zlib" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudflare-zlib-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -265,7 +265,7 @@ dependencies = [ "bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cloudflare-zlib 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudflare-zlib 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -422,7 +422,7 @@ dependencies = [ "checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" -"checksum cloudflare-zlib 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "398f5d6b4431f230c89858e5389803bd0135bc764fbf9b7b50d4be0ca2657a6c" +"checksum cloudflare-zlib 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cd97a72b7777ef134de513cef589e48c393dc2ea7180ff6dca87dcd3ee078dac" "checksum cloudflare-zlib-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7e195cb274a0d6ee87e718838a09baecd7cbc9f6075dac256a84cb5842739c06" "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" diff --git a/Cargo.toml b/Cargo.toml index 1c3528ce..9540ced0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ optional = true version = "2.0.0" [target.'cfg(any(target_arch = "x86_64", target_arch = "aarch64"))'.dependencies] -cloudflare-zlib = "^0.2.0" +cloudflare-zlib = "^0.2.2" [dependencies.image] default-features = false diff --git a/src/deflate/mod.rs b/src/deflate/mod.rs index 70a62ea7..b2339c90 100644 --- a/src/deflate/mod.rs +++ b/src/deflate/mod.rs @@ -9,7 +9,14 @@ use PngResult; pub mod miniz_stream; #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] -mod cfzlib; +pub mod cfzlib; + +#[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))] +pub mod cfzlib { + pub fn is_supported() -> bool { + return false; + } +} /// Decompress a data stream using the DEFLATE algorithm pub fn inflate(data: &[u8]) -> PngResult> { diff --git a/tests/interlaced.rs b/tests/interlaced.rs index 43c14f45..7b93f0ee 100644 --- a/tests/interlaced.rs +++ b/tests/interlaced.rs @@ -444,6 +444,10 @@ fn interlaced_palette_8_should_be_palette_8() { #[test] fn interlaced_palette_8_should_be_palette_4() { + // miniz doesn't estimate compression that well + if !oxipng::internal_tests::cfzlib::is_supported() { + return; + } test_it_converts( "tests/files/interlaced_palette_8_should_be_palette_4.png", ColorType::Indexed,