[librsvg: 4/12] Update the png crate




commit c7349b7a7e2598827cdb5be81e5de5717f9e0d6d
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Dec 8 12:20:13 2021 -0600

    Update the png crate
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/641>

 Cargo.lock                  | 23 +++++++----------------
 Cargo.toml                  |  2 +-
 tests/src/predicates/png.rs | 14 +++++---------
 3 files changed, 13 insertions(+), 26 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index 21378d2b..e08eb7e3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -390,12 +390,11 @@ dependencies = [
 
 [[package]]
 name = "deflate"
-version = "0.8.6"
+version = "0.9.1"
 source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174"
+checksum = "5f95bf05dffba6e6cce8dfbb30def788154949ccd9aed761b472119c21e01c70"
 dependencies = [
  "adler32",
- "byteorder",
 ]
 
 [[package]]
@@ -523,7 +522,7 @@ dependencies = [
  "cfg-if",
  "crc32fast",
  "libc",
- "miniz_oxide 0.4.4",
+ "miniz_oxide",
 ]
 
 [[package]]
@@ -1030,15 +1029,6 @@ dependencies = [
  "autocfg",
 ]
 
-[[package]]
-name = "miniz_oxide"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435"
-dependencies = [
- "adler32",
-]
-
 [[package]]
 name = "miniz_oxide"
 version = "0.4.4"
@@ -1375,14 +1365,15 @@ dependencies = [
 
 [[package]]
 name = "png"
-version = "0.16.8"
+version = "0.17.2"
 source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6"
+checksum = "c845088517daa61e8a57eee40309347cea13f273694d1385c553e7a57127763b"
 dependencies = [
  "bitflags",
  "crc32fast",
  "deflate",
- "miniz_oxide 0.3.7",
+ "encoding",
+ "miniz_oxide",
 ]
 
 [[package]]
diff --git a/Cargo.toml b/Cargo.toml
index ed5585ec..297b1058 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -84,7 +84,7 @@ lopdf = "0.26.0"
 matches = "0.1"
 pango = "0.14.0"
 pangocairo = "0.14.0"
-png = "0.16.1"
+png = "0.17.2"
 predicates = "2.0.0"
 proptest = "0.10.1"
 tempfile = "3"
diff --git a/tests/src/predicates/png.rs b/tests/src/predicates/png.rs
index e0cf6f6c..36ab9356 100644
--- a/tests/src/predicates/png.rs
+++ b/tests/src/predicates/png.rs
@@ -59,15 +59,11 @@ pub struct SizePredicate<PngPredicate> {
 }
 
 impl SizePredicate<PngPredicate> {
-    fn eval_info(&self, info: &png::OutputInfo) -> bool {
+    fn eval_info(&self, info: &png::Info) -> bool {
         info.width == self.w && info.height == self.h
     }
 
-    fn find_case_for_info<'a>(
-        &'a self,
-        expected: bool,
-        info: &png::OutputInfo,
-    ) -> Option<Case<'a>> {
+    fn find_case_for_info<'a>(&'a self, expected: bool, info: &png::Info) -> Option<Case<'a>> {
         if self.eval_info(info) == expected {
             let product = self.product_for_info(info);
             Some(Case::new(Some(self), false).add_product(product))
@@ -76,7 +72,7 @@ impl SizePredicate<PngPredicate> {
         }
     }
 
-    fn product_for_info(&self, info: &png::OutputInfo) -> Product {
+    fn product_for_info(&self, info: &png::Info) -> Product {
         let actual_size = format!("{} x {}", info.width, info.height);
         Product::new("actual size", actual_size)
     }
@@ -86,7 +82,7 @@ impl Predicate<[u8]> for SizePredicate<PngPredicate> {
     fn eval(&self, data: &[u8]) -> bool {
         let decoder = png::Decoder::new(data);
         match decoder.read_info() {
-            Ok((info, _)) => self.eval_info(&info),
+            Ok(reader) => self.eval_info(&reader.info()),
             _ => false,
         }
     }
@@ -94,7 +90,7 @@ impl Predicate<[u8]> for SizePredicate<PngPredicate> {
     fn find_case<'a>(&'a self, expected: bool, data: &[u8]) -> Option<Case<'a>> {
         let decoder = png::Decoder::new(data);
         match decoder.read_info() {
-            Ok((info, _)) => self.find_case_for_info(expected, &info),
+            Ok(reader) => self.find_case_for_info(expected, reader.info()),
             Err(e) => Some(Case::new(Some(self), false).add_product(Product::new("Error", e))),
         }
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]