[master] Added macros to detect use of deprecated features.

Added PNG_DEPSTRUCT, PNG_DEPRECATED, PNG_USE_RESULT, PNG_NORETURN, and
    PNG_ALLOCATED macros to detect deprecated direct access to the
    png_struct or info_struct members and other deprecated usage in
    applications (John Bowler).
  Added -DPNG_CONFIGURE_LIBPNG to the makefile CFLAGS, to prevent warnings
    about direct access to png structs by libpng functions while building
    libpng.
  Removed three direct references to read_info_ptr members in pngtest.c
    that were detected by the new PNG_DEPSTRUCT macro.
  Moved the png_debug macro definitions and the png_read_destroy(),
    png_write_destroy() and png_far_to_near() prototypes from png.h
    to pngpriv.h (John Bowler)
  Moved the synopsis lines for png_read_destroy(), png_write_destroy()
    png_debug(), png_debug1(), and png_debug2() from libpng.3 to libpngpf.3.
This commit is contained in:
Glenn Randers-Pehrson
2009-11-07 10:46:42 -06:00
parent 047c34b734
commit d29033f264
7 changed files with 436 additions and 355 deletions

View File

@@ -1052,11 +1052,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_tRNS(read_ptr, read_info_ptr, &trans_alpha, &num_trans,
&trans_color))
{
int sample_max = (1 << read_info_ptr->bit_depth);
int sample_max = (1 << bit_depth);
/* libpng doesn't reject a tRNS chunk with out-of-range samples */
if (!((read_info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
if (!((color_type == PNG_COLOR_TYPE_GRAY &&
(int)trans_color->gray > sample_max) ||
(read_info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
(color_type == PNG_COLOR_TYPE_RGB &&
((int)trans_color->red > sample_max ||
(int)trans_color->green > sample_max ||
(int)trans_color->blue > sample_max))))