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 <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
diff --git a/contrib/conftest/read-full.dfa b/contrib/conftest/read-full.dfa
new file mode 100644
index 0000000..4860f83
--- /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 0000000..2daf0b0
--- /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 90ca03d..dcceab2 100644
--- a/png.c
+++ b/png.c
@@ -1491,7 +1491,7 @@
}
#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 @@
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:
*