[libpng15] Fixes for C++ compilation using g++ When libpng source is compiled

using g++. The compiler imposes C++ rules on the C source; thus it
    is desireable to make the source work with either C or C++ rules
    without throwing away useful error information.  This change adds
    png_voidcast to allow C semantic (void*) cases or the corresponding
    C++ static_cast operation, as appropriate.
This commit is contained in:
John Bowler
2011-11-16 16:39:16 -06:00
committed by Glenn Randers-Pehrson
parent c2d8399581
commit 4fa96a42f7
6 changed files with 76 additions and 31 deletions

4
png.c
View File

@@ -3028,7 +3028,7 @@ png_byte png_sRGB_delta[512] =
static int
png_image_free_function(png_voidp argument)
{
png_imagep image = argument;
png_imagep image = png_voidcast(png_imagep, argument);
png_controlp cp = image->opaque;
png_control c;
@@ -3042,7 +3042,7 @@ png_image_free_function(png_voidp argument)
# ifdef PNG_STDIO_SUPPORTED
if (cp->owned_file)
{
FILE *fp = cp->png_ptr->io_ptr;
FILE *fp = png_voidcast(FILE*, cp->png_ptr->io_ptr);
cp->owned_file = 0;
/* Ignore errors here. */