[libpng16] Made fixes for new optimization warnings from gcc 4.7.0.

The compiler performs an optimization which is safe; however it then warns
about it.  Changing the type of 'palette_number' in pngvalid.c removes the
warning.
This commit is contained in:
Glenn Randers-Pehrson 2012-06-03 19:17:48 -05:00
parent 1935d0738f
commit ff7b7ba060
3 changed files with 23 additions and 19 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.6.0beta23 - May 29, 2012
Libpng 1.6.0beta23 - June 4, 2012
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@ -369,8 +369,11 @@ Version 1.6.0beta22 [May 23, 2012]
introducing new png_aligncast macros to do the cast in a way that clang
accepts.
Version 1.6.0beta23 [May 29, 2012]
Version 1.6.0beta23 [June 4, 2012]
Revised CMakeLists.txt to not attempt to make a symlink under mingw.
Made fixes for new optimization warnings from gcc 4.7.0. The compiler
performs an optimization which is safe; however it then warns about it.
Changing the type of 'palette_number' in pngvalid.c removes the warning.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4120,8 +4120,11 @@ Version 1.6.0beta22 [May 23, 2012]
introducing new png_aligncast macros to do the cast in a way that clang
accepts.
Version 1.6.0beta23 [May 29, 2012]
Version 1.6.0beta23 [June 4, 2012]
Revised CMakeLists.txt to not attempt to make a symlink under mingw.
Made fixes for new optimization warnings from gcc 4.7.0. The compiler
performs an optimization which is safe; however it then warns about it.
Changing the type of 'palette_number' in pngvalid.c removes the warning.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -255,7 +255,7 @@ random_choice(void)
#define COL_FROM_ID(id) ((png_byte)((id)& 0x7U))
#define DEPTH_FROM_ID(id) ((png_byte)(((id) >> 3) & 0x1fU))
#define PALETTE_FROM_ID(id) ((int)(((id) >> 8) & 0x1f))
#define PALETTE_FROM_ID(id) (((id) >> 8) & 0x1f)
#define INTERLACE_FROM_ID(id) ((int)(((id) >> 13) & 0x3))
#define DO_INTERLACE_FROM_ID(id) ((int)(((id)>>15) & 1))
#define WIDTH_FROM_ID(id) (((id)>>16) & 0xff)
@ -264,7 +264,7 @@ random_choice(void)
/* Utility to construct a standard name for a standard image. */
static size_t
standard_name(char *buffer, size_t bufsize, size_t pos, png_byte colour_type,
int bit_depth, int npalette, int interlace_type,
int bit_depth, unsigned int npalette, int interlace_type,
png_uint_32 w, png_uint_32 h, int do_interlace)
{
pos = safecat(buffer, bufsize, pos, colour_types[colour_type]);
@ -326,10 +326,11 @@ standard_name_from_id(char *buffer, size_t bufsize, size_t pos, png_uint_32 id)
/* The following defines the number of different palettes to generate for
* each log bit depth of a colour type 3 standard image.
*/
#define PALETTE_COUNT(bit_depth) ((bit_depth) > 4 ? 1 : 16)
#define PALETTE_COUNT(bit_depth) ((bit_depth) > 4 ? 1U : 16U)
static int
next_format(png_bytep colour_type, png_bytep bit_depth, int* palette_number)
next_format(png_bytep colour_type, png_bytep bit_depth,
unsigned int* palette_number)
{
if (*bit_depth == 0)
{
@ -3282,8 +3283,8 @@ transform_row(png_const_structp pp, png_byte buffer[TRANSFORM_ROWMAX],
*/
static void
make_transform_image(png_store* PNG_CONST ps, png_byte PNG_CONST colour_type,
png_byte PNG_CONST bit_depth, int palette_number, int interlace_type,
png_const_charp name)
png_byte PNG_CONST bit_depth, unsigned int palette_number,
int interlace_type, png_const_charp name)
{
context(ps, fault);
@ -3410,7 +3411,7 @@ make_transform_images(png_store *ps)
{
png_byte colour_type = 0;
png_byte bit_depth = 0;
int palette_number = 0;
unsigned int palette_number = 0;
/* This is in case of errors. */
safecat(ps->test, sizeof ps->test, 0, "make standard images");
@ -7283,7 +7284,7 @@ perform_transform_test(png_modifier *pm)
{
png_byte colour_type = 0;
png_byte bit_depth = 0;
int palette_number = 0;
unsigned int palette_number = 0;
while (next_format(&colour_type, &bit_depth, &palette_number))
{
@ -8645,7 +8646,7 @@ perform_gamma_threshold_tests(png_modifier *pm)
{
png_byte colour_type = 0;
png_byte bit_depth = 0;
int palette_number = 0;
unsigned int palette_number = 0;
/* Don't test more than one instance of each palette - it's pointless, in
* fact this test is somewhat excessive since libpng doesn't make this
@ -8710,7 +8711,7 @@ static void perform_gamma_transform_tests(png_modifier *pm)
{
png_byte colour_type = 0;
png_byte bit_depth = 0;
int palette_number = 0;
unsigned int palette_number = 0;
while (next_format(&colour_type, &bit_depth, &palette_number))
{
@ -8739,11 +8740,8 @@ static void perform_gamma_sbit_tests(png_modifier *pm)
*/
for (sbit=pm->sbitlow; sbit<(1<<READ_BDHI); ++sbit)
{
png_byte colour_type, bit_depth;
int npalette;
colour_type = bit_depth = 0;
npalette = 0;
png_byte colour_type = 0, bit_depth = 0;
unsigned int npalette = 0;
while (next_format(&colour_type, &bit_depth, &npalette))
if ((colour_type & PNG_COLOR_MASK_ALPHA) == 0 &&
@ -8959,7 +8957,7 @@ perform_gamma_composition_tests(png_modifier *pm, int do_background,
{
png_byte colour_type = 0;
png_byte bit_depth = 0;
int palette_number = 0;
unsigned int palette_number = 0;
/* Skip the non-alpha cases - there is no setting of a transparency colour at
* present.