[devel] Moved replacements for png_error() and png_warning() from the
contrib/pngminim project to pngerror.c, for use when warnings or
errors are disabled via PNG_NO_WARN or PNG_NO_ERROR_TEXT, to avoid
storing unneeded error/warning text.
diff --git a/pngerror.c b/pngerror.c
index 8e0569e..f6762b1 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -184,8 +184,9 @@
buffer[iout + PNG_MAX_ERROR_TEXT - 1] = '\0';
}
}
+#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
-#ifdef PNG_READ_SUPPORTED
+#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
void PNGAPI
png_chunk_error(png_structp png_ptr, png_const_charp error_message)
{
@@ -198,8 +199,7 @@
png_error(png_ptr, msg);
}
}
-#endif /* PNG_READ_SUPPORTED */
-#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
+#endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */
#ifdef PNG_WARNINGS_SUPPORTED
void PNGAPI