mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Changed local variable "gamma" to "png_gamma"
This avoids a "shadowed declaration" variable when compiling with "gcc -Wshadow ..." due to another use of this name in math.h on some platforms.
This commit is contained in:
parent
4ec05bf614
commit
8764c2595d
24
pngset.c
24
pngset.c
@ -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.4.0 [April 18, 2009]
|
* Last changed in libpng 1.4.0 [April 19, 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)(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)(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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user