summaryrefslogtreecommitdiff
path: root/png/pngerror.c
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2026-01-20 18:01:12 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2026-01-20 18:01:12 +0100
commit2f7d7adfcf4bec55fa5e007947e4a455e85d8930 (patch)
tree2258a700e13d8582fcf5eedb30394c78641d739a /png/pngerror.c
parentd30ca1866463c4091c3e0bcf5ca730f409ddc78d (diff)
Update bundled libpng to last upstream version 1.6.54
Diffstat (limited to 'png/pngerror.c')
-rw-r--r--png/pngerror.c155
1 files changed, 17 insertions, 138 deletions
diff --git a/png/pngerror.c b/png/pngerror.c
index 01a7ef534..72dc20ea8 100644
--- a/png/pngerror.c
+++ b/png/pngerror.c
@@ -39,46 +39,6 @@ PNG_FUNCTION(void,PNGAPI
png_error,(png_const_structrp png_ptr, png_const_charp error_message),
PNG_NORETURN)
{
-#ifdef PNG_ERROR_NUMBERS_SUPPORTED
- char msg[16];
- if (png_ptr != NULL)
- {
- if ((png_ptr->flags &
- (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
- {
- if (*error_message == PNG_LITERAL_SHARP)
- {
- /* Strip "#nnnn " from beginning of error message. */
- int offset;
- for (offset = 1; offset<15; offset++)
- if (error_message[offset] == ' ')
- break;
-
- if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
- {
- int i;
- for (i = 0; i < offset - 1; i++)
- msg[i] = error_message[i + 1];
- msg[i - 1] = '\0';
- error_message = msg;
- }
-
- else
- error_message += offset;
- }
-
- else
- {
- if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
- {
- msg[0] = '0';
- msg[1] = '\0';
- error_message = msg;
- }
- }
- }
- }
-#endif
if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_constcast(png_structrp,png_ptr),
error_message);
@@ -89,7 +49,8 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
}
#else
PNG_FUNCTION(void,PNGAPI
-png_err,(png_const_structrp png_ptr),PNG_NORETURN)
+png_err,(png_const_structrp png_ptr),
+ PNG_NORETURN)
{
/* Prior to 1.5.2 the error_fn received a NULL pointer, expressed
* erroneously as '\0', instead of the empty string "". This was
@@ -216,21 +177,6 @@ void PNGAPI
png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
{
int offset = 0;
- if (png_ptr != NULL)
- {
-#ifdef PNG_ERROR_NUMBERS_SUPPORTED
- if ((png_ptr->flags &
- (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
-#endif
- {
- if (*warning_message == PNG_LITERAL_SHARP)
- {
- for (offset = 1; offset < 15; offset++)
- if (warning_message[offset] == ' ')
- break;
- }
- }
- }
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_constcast(png_structrp,png_ptr),
warning_message + offset);
@@ -431,8 +377,8 @@ static const char png_digit[16] = {
};
static void /* PRIVATE */
-png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
- error_message)
+png_format_buffer(png_const_structrp png_ptr, png_charp buffer,
+ png_const_charp error_message)
{
png_uint_32 chunk_name = png_ptr->chunk_name;
int iout = 0, ishift = 24;
@@ -511,8 +457,8 @@ png_chunk_warning(png_const_structrp png_ptr, png_const_charp warning_message)
#ifdef PNG_READ_SUPPORTED
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI
-png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
- error_message)
+png_chunk_benign_error(png_const_structrp png_ptr,
+ png_const_charp error_message)
{
if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
png_chunk_warning(png_ptr, error_message);
@@ -569,7 +515,8 @@ png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
#ifdef PNG_ERROR_TEXT_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_FUNCTION(void,
-png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
+png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),
+ PNG_NORETURN)
{
# define fixed_message "fixed point overflow in "
# define fixed_message_ln ((sizeof fixed_message)-1)
@@ -712,42 +659,9 @@ png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
PNG_NORETURN)
{
#ifdef PNG_CONSOLE_IO_SUPPORTED
-#ifdef PNG_ERROR_NUMBERS_SUPPORTED
- /* Check on NULL only added in 1.5.4 */
- if (error_message != NULL && *error_message == PNG_LITERAL_SHARP)
- {
- /* Strip "#nnnn " from beginning of error message. */
- int offset;
- char error_number[16];
- for (offset = 0; offset<15; offset++)
- {
- error_number[offset] = error_message[offset + 1];
- if (error_message[offset] == ' ')
- break;
- }
-
- if ((offset > 1) && (offset < 15))
- {
- error_number[offset - 1] = '\0';
- fprintf(stderr, "libpng error no. %s: %s",
- error_number, error_message + offset + 1);
- fprintf(stderr, PNG_STRING_NEWLINE);
- }
-
- else
- {
- fprintf(stderr, "libpng error: %s, offset=%d",
- error_message, offset);
- fprintf(stderr, PNG_STRING_NEWLINE);
- }
- }
- else
-#endif
- {
- fprintf(stderr, "libpng error: %s", error_message ? error_message :
- "undefined");
- fprintf(stderr, PNG_STRING_NEWLINE);
- }
+ fprintf(stderr, "libpng error: %s", error_message ? error_message :
+ "undefined");
+ fprintf(stderr, PNG_STRING_NEWLINE);
#else
PNG_UNUSED(error_message) /* Make compiler happy */
#endif
@@ -755,7 +669,8 @@ png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
}
PNG_FUNCTION(void,PNGAPI
-png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
+png_longjmp,(png_const_structrp png_ptr, int val),
+ PNG_NORETURN)
{
#ifdef PNG_SETJMP_SUPPORTED
if (png_ptr != NULL && png_ptr->longjmp_fn != NULL &&
@@ -785,40 +700,8 @@ static void /* PRIVATE */
png_default_warning(png_const_structrp png_ptr, png_const_charp warning_message)
{
#ifdef PNG_CONSOLE_IO_SUPPORTED
-# ifdef PNG_ERROR_NUMBERS_SUPPORTED
- if (*warning_message == PNG_LITERAL_SHARP)
- {
- int offset;
- char warning_number[16];
- for (offset = 0; offset < 15; offset++)
- {
- warning_number[offset] = warning_message[offset + 1];
- if (warning_message[offset] == ' ')
- break;
- }
-
- if ((offset > 1) && (offset < 15))
- {
- warning_number[offset + 1] = '\0';
- fprintf(stderr, "libpng warning no. %s: %s",
- warning_number, warning_message + offset);
- fprintf(stderr, PNG_STRING_NEWLINE);
- }
-
- else
- {
- fprintf(stderr, "libpng warning: %s",
- warning_message);
- fprintf(stderr, PNG_STRING_NEWLINE);
- }
- }
- else
-# endif
-
- {
- fprintf(stderr, "libpng warning: %s", warning_message);
- fprintf(stderr, PNG_STRING_NEWLINE);
- }
+ fprintf(stderr, "libpng warning: %s", warning_message);
+ fprintf(stderr, PNG_STRING_NEWLINE);
#else
PNG_UNUSED(warning_message) /* Make compiler happy */
#endif
@@ -866,12 +749,8 @@ png_get_error_ptr(png_const_structrp png_ptr)
void PNGAPI
png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
{
- if (png_ptr != NULL)
- {
- png_ptr->flags &=
- ((~(PNG_FLAG_STRIP_ERROR_NUMBERS |
- PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
- }
+ PNG_UNUSED(png_ptr)
+ PNG_UNUSED(strip_mode)
}
#endif