Suppress "shadowed declaration" warnings about "gamma" in pngset.c

The variable "gamma" is also defined in math.h on some platforms.
This commit is contained in:
Glenn Randers-Pehrson 2009-04-20 13:23:24 -05:00
parent 55b921dab2
commit 89ad3aa168
4 changed files with 3027 additions and 17 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.2.36beta05 - April 13, 2009 Libpng 1.2.36beta05 - April 20, 2009
This is not intended to be a public release. It will be replaced 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. within a few weeks by a public version or by another test version.
@ -85,10 +85,14 @@ version 1.2.36beta03 [March 27, 2009]
version 1.2.36beta04 [April 5, 2009] version 1.2.36beta04 [April 5, 2009]
Fixed potential memory leak of "new_name" in png_write_iCCP() (Ralph Giles) Fixed potential memory leak of "new_name" in png_write_iCCP() (Ralph Giles)
version 1.2.36beta05 [April 13, 2009] version 1.2.36beta05 [April 20, 2009]
Added "ifndef PNG_SKIP_SETJMP_CHECK" block in pngconf.h to allow Added "ifndef PNG_SKIP_SETJMP_CHECK" block in pngconf.h to allow
application code writers to bypass the check for multiple inclusion application code writers to bypass the check for multiple inclusion
of setjmp.h when they know that it is safe to ignore the situation. of setjmp.h when they know that it is safe to ignore the situation.
Renamed "user_chunk_data" to "my_user_chunk_data" in pngtest.c to suppress
"shadowed declaration" warning from gcc-4.3.3.
Renamed "gamma" to "png_gamma" in pngset.c to avoid "shadowed declaration"
warning about a global "gamma" variable in math.h on some platforms.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net

View File

@ -2352,11 +2352,15 @@ version 1.2.36beta03 [March 27, 2009]
version 1.2.36beta04 [April 5, 2009] version 1.2.36beta04 [April 5, 2009]
Fixed potential memory leak of "new_name" in png_write_iCCP() (Ralph Giles) Fixed potential memory leak of "new_name" in png_write_iCCP() (Ralph Giles)
version 1.2.36beta05 [April 13, 2009] version 1.2.36beta05 [April 20, 2009]
Added "ifndef PNG_SKIP_SETJMP_CHECK" block in pngconf.h to allow Added "ifndef PNG_SKIP_SETJMP_CHECK" block in pngconf.h to allow
application code writers to bypass the check for multiple inclusion application code writers to bypass the check for multiple inclusion
of setjmp.h when they know that it is safe to ignore the situation. of setjmp.h when they know that it is safe to ignore the situation.
Made some cosmetic changes to whitespace in pngtest output. Made some cosmetic changes to whitespace in pngtest output.
Renamed "user_chunk_data" to "my_user_chunk_data" in pngtest.c to suppress
"shadowed declaration" warning from gcc-4.3.3.
Renamed "gamma" to "png_gamma" in pngset.c to avoid "shadowed declaration"
warning about a global "gamma" variable in math.h on some platforms.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

3002
libpng-1.2.36beta05.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* Last changed in libpng 1.2.35 [February 14, 2009] * Last changed in libpng 1.2.36 [April 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -108,7 +108,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
void PNGAPI void PNGAPI
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma) png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
{ {
double gamma; double png_gamma;
png_debug1(1, "in %s storage function", "gAMA"); png_debug1(1, "in %s storage function", "gAMA");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@ -117,16 +117,16 @@ png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
if (file_gamma > 21474.83) if (file_gamma > 21474.83)
{ {
png_warning(png_ptr, "Limiting gamma to 21474.83"); png_warning(png_ptr, "Limiting gamma to 21474.83");
gamma=21474.83; png_gamma=21474.83;
} }
else else
gamma = file_gamma; png_gamma = file_gamma;
info_ptr->gamma = (float)gamma; info_ptr->gamma = (float)png_gamma;
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
info_ptr->int_gamma = (int)(gamma*100000.+.5); info_ptr->int_gamma = (int)(png_gamma*100000.+.5);
#endif #endif
info_ptr->valid |= PNG_INFO_gAMA; info_ptr->valid |= PNG_INFO_gAMA;
if (gamma == 0.0) if (png_gamma == 0.0)
png_warning(png_ptr, "Setting gamma=0"); png_warning(png_ptr, "Setting gamma=0");
} }
#endif #endif
@ -134,7 +134,7 @@ void PNGAPI
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
int_gamma) int_gamma)
{ {
png_fixed_point gamma; png_fixed_point png_gamma;
png_debug1(1, "in %s storage function", "gAMA"); png_debug1(1, "in %s storage function", "gAMA");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
@ -143,26 +143,26 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
if (int_gamma > (png_fixed_point) PNG_UINT_31_MAX) if (int_gamma > (png_fixed_point) PNG_UINT_31_MAX)
{ {
png_warning(png_ptr, "Limiting gamma to 21474.83"); png_warning(png_ptr, "Limiting gamma to 21474.83");
gamma=PNG_UINT_31_MAX; png_gamma=PNG_UINT_31_MAX;
} }
else else
{ {
if (int_gamma < 0) if (int_gamma < 0)
{ {
png_warning(png_ptr, "Setting negative gamma to zero"); png_warning(png_ptr, "Setting negative gamma to zero");
gamma = 0; png_gamma = 0;
} }
else else
gamma = int_gamma; png_gamma = int_gamma;
} }
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
info_ptr->gamma = (float)(gamma/100000.); info_ptr->gamma = (float)(png_gamma/100000.);
#endif #endif
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
info_ptr->int_gamma = gamma; info_ptr->int_gamma = png_gamma;
#endif #endif
info_ptr->valid |= PNG_INFO_gAMA; info_ptr->valid |= PNG_INFO_gAMA;
if (gamma == 0) if (png_gamma == 0)
png_warning(png_ptr, "Setting gamma=0"); png_warning(png_ptr, "Setting gamma=0");
} }
#endif #endif