diff options
author | John Bowler <jbowler@acm.org> | 2012-03-18 22:37:25 -0500 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp@shaggy.simplesystems.org> | 2012-03-18 22:37:25 -0500 |
commit | 2bc76ffaf19b98e34741fc81946d92ffc654ac2e (patch) | |
tree | 39065e5448f7989398d38a916cd4535c8ebd93eb /pngerror.c | |
parent | 66efa24241b2740868e44ba73130df1e3cf95248 (diff) | |
download | libpng-2bc76ffaf19b98e34741fc81946d92ffc654ac2e.tar.gz |
[ibpng16] Added application error reporting and added chunk names to read
benign errors; also added --strict to pngstest - not enabled
yet because a warning is produced.
Diffstat (limited to 'pngerror.c')
-rw-r--r-- | pngerror.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/pngerror.c b/pngerror.c index 631b80e6a..d53a2b445 100644 --- a/pngerror.c +++ b/pngerror.c @@ -360,12 +360,47 @@ png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p, void PNGAPI png_benign_error(png_const_structrp png_ptr, png_const_charp error_message) { - if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) + if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) + { +# ifdef PNG_READ_SUPPORTED + if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 && + png_ptr->chunk_name != 0) + png_chunk_warning(png_ptr, error_message); + else +# endif + png_warning(png_ptr, error_message); + } + + else + { +# ifdef PNG_READ_SUPPORTED + if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 && + png_ptr->chunk_name != 0) + png_chunk_error(png_ptr, error_message); + else +# endif + png_error(png_ptr, error_message); + } +} + +void /* PRIVATE */ +png_app_warning(png_const_structrp png_ptr, png_const_charp error_message) +{ + if (png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN) png_warning(png_ptr, error_message); else png_error(png_ptr, error_message); } -#endif + +void /* PRIVATE */ +png_app_error(png_const_structrp png_ptr, png_const_charp error_message) +{ + if (png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN) + png_warning(png_ptr, error_message); + else + png_error(png_ptr, error_message); +} +#endif /* BENIGN_ERRORS */ /* These utilities are used internally to build an error message that relates * to the current chunk. The chunk name comes from png_ptr->chunk_name, |