From 98448e372d717206c9f5a2a39d42e7417e6889cb Mon Sep 17 00:00:00 2001 From: John Bowler Date: Sat, 19 Apr 2025 08:59:35 -0700 Subject: [PATCH] Remove unused function from write-only configurations `png_icc_profile_error` is no longer used when writing iCCP chunks, therefore it can be compiled out when the reading is disabled. This change includes two `minconfig` files to test read-only and write-only "full" configurations, to supplement the existing tests for "minimal" configurations. Signed-off-by: John Bowler Signed-off-by: Cosmin Truta --- contrib/conftest/read-full.dfa | 13 +++++++++++++ contrib/conftest/write-full.dfa | 13 +++++++++++++ png.c | 4 +--- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 contrib/conftest/read-full.dfa create mode 100644 contrib/conftest/write-full.dfa diff --git a/contrib/conftest/read-full.dfa b/contrib/conftest/read-full.dfa new file mode 100644 index 000000000..4860f83dd --- /dev/null +++ b/contrib/conftest/read-full.dfa @@ -0,0 +1,13 @@ +# read-full.dfa +# Build time configuration of libpng +# +# Author: John Bowler +# Copyright: (c) John Bowler, 2025 +# Usage rights: +# To the extent possible under law, the author has waived all copyright and +# related or neighboring rights to this work. This work is published from: +# United States. +# +# Build libpng with no write support and full read support. +# +option WRITE off diff --git a/contrib/conftest/write-full.dfa b/contrib/conftest/write-full.dfa new file mode 100644 index 000000000..2daf0b055 --- /dev/null +++ b/contrib/conftest/write-full.dfa @@ -0,0 +1,13 @@ +# write-full.dfa +# Build time configuration of libpng +# +# Author: John Bowler +# Copyright: (c) John Bowler, 2025 +# Usage rights: +# To the extent possible under law, the author has waived all copyright and +# related or neighboring rights to this work. This work is published from: +# United States. +# +# Build libpng with no read support and full write support. +# +option READ off diff --git a/png.c b/png.c index 90ca03d65..dcceab293 100644 --- a/png.c +++ b/png.c @@ -1491,7 +1491,7 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy) } #endif /* COLORSPACE */ -#ifdef PNG_iCCP_SUPPORTED +#ifdef PNG_READ_iCCP_SUPPORTED /* Error message generation */ static char png_icc_tag_char(png_uint_32 byte) @@ -1567,9 +1567,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_const_charp name, return 0; } -#endif /* iCCP */ -#ifdef PNG_READ_iCCP_SUPPORTED /* Encoded value of D50 as an ICC XYZNumber. From the ICC 2010 spec the value * is XYZ(0.9642,1.0,0.8249), which scales to: *