20 #define PNG_NO_PEDANTIC_WARNINGS 22 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) 27 #ifdef PNG_WARNINGS_SUPPORTED 38 #ifdef PNG_ERROR_TEXT_SUPPORTED 42 #ifdef PNG_ERROR_NUMBERS_SUPPORTED 47 (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
53 for (offset = 1; offset<15; offset++)
54 if (error_message[offset] ==
' ')
56 if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
59 for (i = 0; i < offset - 1; i++)
60 msg[i] = error_message[i + 1];
69 if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
79 if (png_ptr !=
NULL && png_ptr->error_fn !=
NULL)
80 (*(png_ptr->error_fn))(png_ptr, error_message);
84 png_default_error(png_ptr, error_message);
95 if (png_ptr !=
NULL && png_ptr->error_fn !=
NULL)
96 (*(png_ptr->error_fn))(png_ptr,
"");
100 png_default_error(png_ptr,
"");
104 #ifdef PNG_WARNINGS_SUPPORTED 116 #ifdef PNG_ERROR_NUMBERS_SUPPORTED 118 (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
123 for (offset = 1; offset < 15; offset++)
124 if (warning_message[offset] ==
' ')
129 if (png_ptr !=
NULL && png_ptr->warning_fn !=
NULL)
130 (*(png_ptr->warning_fn))(png_ptr, warning_message +
offset);
132 png_default_warning(png_ptr, warning_message + offset);
136 #ifdef PNG_BENIGN_ERRORS_SUPPORTED 140 if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
153 #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) 155 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
156 'A',
'B',
'C',
'D',
'E',
'F' 159 #define PNG_MAX_ERROR_TEXT 64 160 #if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED) 165 int iout = 0, iin = 0;
169 int c = png_ptr->chunk_name[iin++];
173 buffer[iout++] = png_digit[(c & 0xf0) >> 4];
174 buffer[iout++] = png_digit[c & 0x0f];
183 if (error_message ==
NULL)
187 buffer[iout++] =
':';
188 buffer[iout++] =
' ';
192 buffer[iout++] = error_message[iin++];
199 #ifdef PNG_READ_SUPPORTED 208 png_format_buffer(png_ptr, msg, error_message);
215 #ifdef PNG_WARNINGS_SUPPORTED 224 png_format_buffer(png_ptr, msg, warning_message);
230 #ifdef PNG_READ_SUPPORTED 231 #ifdef PNG_BENIGN_ERRORS_SUPPORTED 235 if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
251 #ifdef PNG_CONSOLE_IO_SUPPORTED 252 #ifdef PNG_ERROR_NUMBERS_SUPPORTED 257 char error_number[16];
258 for (offset = 0; offset<15; offset++)
260 error_number[
offset] = error_message[offset + 1];
261 if (error_message[offset] ==
' ')
264 if ((offset > 1) && (offset < 15))
266 error_number[offset - 1] =
'\0';
267 fprintf(stderr,
"libpng error no. %s: %s",
268 error_number, error_message + offset + 1);
273 fprintf(stderr,
"libpng error: %s, offset=%d",
274 error_message, offset);
281 fprintf(stderr,
"libpng error: %s", error_message);
286 #ifdef PNG_SETJMP_SUPPORTED 289 # ifdef USE_FAR_KEYWORD 296 longjmp(png_ptr->jmpbuf, 1);
302 #ifndef PNG_CONSOLE_IO_SUPPORTED 307 #ifdef PNG_WARNINGS_SUPPORTED 316 #ifdef PNG_CONSOLE_IO_SUPPORTED 317 # ifdef PNG_ERROR_NUMBERS_SUPPORTED 321 char warning_number[16];
322 for (offset = 0; offset < 15; offset++)
324 warning_number[
offset] = warning_message[offset + 1];
325 if (warning_message[offset] ==
' ')
328 if ((offset > 1) && (offset < 15))
330 warning_number[offset + 1] =
'\0';
331 fprintf(stderr,
"libpng warning no. %s: %s",
332 warning_number, warning_message + offset);
337 fprintf(stderr,
"libpng warning: %s",
345 fprintf(stderr,
"libpng warning: %s", warning_message);
385 #ifdef PNG_ERROR_NUMBERS_SUPPORTED 392 ((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&
strip_mode);
void PNGAPI png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
void PNGAPI png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
png_voidp PNGAPI png_get_error_ptr(png_structp png_ptr)
#define PNG_UNUSED(param)
PNG_CONST char FAR * png_const_charp
png_voidp png_error_ptr png_error_ptr warning_fn
png_struct FAR * png_structp
#define png_error(s1, s2)
png_voidp png_error_ptr error_fn
void PNGAPI png_warning(png_structp png_ptr, png_const_charp warning_message)
#define PNG_LITERAL_LEFT_SQUARE_BRACKET
#define png_chunk_benign_error
void PNGAPI png_chunk_error(png_structp png_ptr, png_const_charp error_message)
#define PNG_LITERAL_SHARP
png_const_charp warning_message
#define PNG_LITERAL_RIGHT_SQUARE_BRACKET
png_const_charp error_message PNG_NORETURN
unsigned long png_uint_32
#define PNG_STRING_NEWLINE
void PNGAPI png_set_error_fn(png_structp png_ptr, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)
#define PNG_MAX_ERROR_TEXT