[devel] Added the private PNG_UNUSED() macro definition in pngpriv.h.

(adapted from the UNUSED() macro in pngvalid.c by John Bowler)
This commit is contained in:
Glenn Randers-Pehrson 2010-12-04 20:41:36 -06:00
parent 38ef3a592c
commit d546f4399f
11 changed files with 37 additions and 27 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.0beta56 - November 25, 2010 Libpng 1.5.0beta56 - December 5, 2010
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.
@ -226,7 +226,7 @@ version 1.5.0beta24 [May 7, 2010]
offset of the png_ptr->rowbuf pointer into png_ptr->big_row_buf. offset of the png_ptr->rowbuf pointer into png_ptr->big_row_buf.
Added more blank lines for readability. Added more blank lines for readability.
version 1.5.0beta25 [November 25, 2010] version 1.5.0beta25 [December 5, 2010]
In pngpread.c: png_push_have_row() add check for new_row > height In pngpread.c: png_push_have_row() add check for new_row > height
Removed the now-redundant check for out-of-bounds new_row from example.c Removed the now-redundant check for out-of-bounds new_row from example.c
@ -451,7 +451,8 @@ Version 1.5.0beta55 [November 21, 2010]
with pngwio.c and pngwutil.c because the 'write' callback and zlib with pngwio.c and pngwutil.c because the 'write' callback and zlib
compression both fail to declare their input buffers with 'const'. compression both fail to declare their input buffers with 'const'.
Version 1.5.0beta56 [November 25, 2010] Version 1.5.0beta56 [December 5, 2010]
Added the private PNG_UNUSED() macro definition in pngpriv.h.
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

View File

@ -3089,7 +3089,8 @@ Version 1.5.0beta55 [November 21, 2010]
with pngwio.c and pngwutil.c because the 'write' callback and zlib with pngwio.c and pngwutil.c because the 'write' callback and zlib
compression both fail to declare their input buffers with 'const'. compression both fail to declare their input buffers with 'const'.
Version 1.5.0beta56 [November 25, 2010] Version 1.5.0beta56 [December 5, 2010]
Added the private PNG_UNUSED() macro definition in pngpriv.h.
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

12
png.c
View File

@ -550,19 +550,19 @@ png_convert_to_rfc1123(png_structp png_ptr, png_const_timep ptime)
png_const_charp PNGAPI png_const_charp PNGAPI
png_get_copyright(png_structp png_ptr) png_get_copyright(png_structp png_ptr)
{ {
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
#ifdef PNG_STRING_COPYRIGHT #ifdef PNG_STRING_COPYRIGHT
return PNG_STRING_COPYRIGHT return PNG_STRING_COPYRIGHT
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.5.0beta56 - November 25, 2010" PNG_STRING_NEWLINE \ "libpng version 1.5.0beta56 - December 5, 2010" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE; PNG_STRING_NEWLINE;
# else # else
return "libpng version 1.5.0beta56 - November 25, 2010\ return "libpng version 1.5.0beta56 - December 5, 2010\
Copyright (c) 1998-2010 Glenn Randers-Pehrson\ Copyright (c) 1998-2010 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -589,7 +589,7 @@ png_const_charp PNGAPI
png_get_header_ver(png_structp png_ptr) png_get_header_ver(png_structp png_ptr)
{ {
/* Version of *.h files used when building libpng */ /* Version of *.h files used when building libpng */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
return PNG_LIBPNG_VER_STRING; return PNG_LIBPNG_VER_STRING;
} }
@ -597,7 +597,7 @@ png_const_charp PNGAPI
png_get_header_version(png_structp png_ptr) png_get_header_version(png_structp png_ptr)
{ {
/* Returns longer string containing both version and date */ /* Returns longer string containing both version and date */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
#ifdef __STDC__ #ifdef __STDC__
return PNG_HEADER_VERSION_STRING return PNG_HEADER_VERSION_STRING
# ifndef PNG_READ_SUPPORTED # ifndef PNG_READ_SUPPORTED

View File

@ -322,7 +322,7 @@ png_default_error,(png_structp png_ptr, png_const_charp error_message),
} }
#endif #endif
#ifndef PNG_CONSOLE_IO_SUPPORTED #ifndef PNG_CONSOLE_IO_SUPPORTED
error_message = error_message; /* Make compiler happy */ PNG_UNUSED(error_message) /* Make compiler happy */
#endif #endif
png_longjmp(png_ptr, 1); png_longjmp(png_ptr, 1);
} }
@ -394,9 +394,9 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
fprintf(stderr, PNG_STRING_NEWLINE); fprintf(stderr, PNG_STRING_NEWLINE);
} }
#else #else
warning_message = warning_message; /* Make compiler happy */ PNG_UNUSED(warning_message) /* Make compiler happy */
#endif #endif
png_ptr = png_ptr; /* Make compiler happy */ PNG_UNUSED(png_ptr) /* Make compiler happy */
} }
#endif /* PNG_WARNINGS_SUPPORTED */ #endif /* PNG_WARNINGS_SUPPORTED */

View File

@ -1230,7 +1230,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{ {
info_ptr = info_ptr; /* To quiet some compiler warnings */ PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
png_error(png_ptr, "Out of place tEXt"); png_error(png_ptr, "Out of place tEXt");
/*NOT REACHED*/ /*NOT REACHED*/
} }
@ -1327,7 +1327,7 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{ {
info_ptr = info_ptr; /* To quiet some compiler warnings */ PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
png_error(png_ptr, "Out of place zTXt"); png_error(png_ptr, "Out of place zTXt");
/*NOT REACHED*/ /*NOT REACHED*/
} }
@ -1531,7 +1531,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{ {
info_ptr = info_ptr; /* To quiet some compiler warnings */ PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
png_error(png_ptr, "Out of place iTXt"); png_error(png_ptr, "Out of place iTXt");
/*NOT REACHED*/ /*NOT REACHED*/
} }
@ -1669,7 +1669,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
#endif #endif
png_chunk_error(png_ptr, "unknown critical chunk"); png_chunk_error(png_ptr, "unknown critical chunk");
info_ptr = info_ptr; /* To quiet some compiler warnings */ PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
} }
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED

View File

@ -81,6 +81,15 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
# define PNG_MAX_MALLOC_64K # define PNG_MAX_MALLOC_64K
#endif #endif
/* Unused formal parameter errors are removed using the following macro
* which is expected to have no bad effects on performance. Note that
* if you replace it with something other than whitespace, you must include
* the terminating semicolon.
*/
#ifndef PNG_UNUSED
# define PNG_UNUSED(param) param = param;
#endif
/* Just a little check that someone hasn't tried to define something /* Just a little check that someone hasn't tried to define something
* contradictory. * contradictory.
*/ */

View File

@ -1457,8 +1457,8 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr); png_read_end(png_ptr, info_ptr);
transforms = transforms; /* Quiet compiler warnings */ PNG_UNUSED(transforms) /* Quiet compiler warnings */
params = params; PNG_UNUSED(params)
} }
#endif /* PNG_INFO_IMAGE_SUPPORTED */ #endif /* PNG_INFO_IMAGE_SUPPORTED */

View File

@ -781,7 +781,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_crc_finish(png_ptr, length); png_crc_finish(png_ptr, length);
info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */ PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */
} }
#ifdef PNG_READ_gAMA_SUPPORTED #ifdef PNG_READ_gAMA_SUPPORTED
@ -2619,7 +2619,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_crc_finish(png_ptr, skip); png_crc_finish(png_ptr, skip);
#ifndef PNG_READ_USER_CHUNKS_SUPPORTED #ifndef PNG_READ_USER_CHUNKS_SUPPORTED
info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */ PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */
#endif #endif
} }
@ -3110,7 +3110,7 @@ png_do_read_interlace(png_structp png_ptr)
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width); row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width);
} }
#ifndef PNG_READ_PACKSWAP_SUPPORTED #ifndef PNG_READ_PACKSWAP_SUPPORTED
transformations = transformations; /* Silence compiler warning */ PNG_UNUSED(transformations) /* Silence compiler warning */
#endif #endif
} }
#endif /* PNG_READ_INTERLACING_SUPPORTED */ #endif /* PNG_READ_INTERLACING_SUPPORTED */

View File

@ -425,7 +425,7 @@ static void PNGCBAPI
pngtest_flush(png_structp png_ptr) pngtest_flush(png_structp png_ptr)
{ {
/* Do nothing; fflush() is said to be just a waste of energy. */ /* Do nothing; fflush() is said to be just a waste of energy. */
png_ptr = png_ptr; /* Stifle compiler warning */ PNG_UNUSED(png_ptr) /* Stifle compiler warning */
} }
#endif #endif

View File

@ -618,8 +618,7 @@ store_write(png_structp pp, png_bytep pb, png_size_t st)
static void static void
store_flush(png_structp pp) store_flush(png_structp pp)
{ {
pp = pp; UNUSED(pp) /*DOES NOTHING*/
/*DOES NOTHING*/
} }
static size_t static size_t

View File

@ -1597,8 +1597,8 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
/* It is REQUIRED to call this to finish writing the rest of the file */ /* It is REQUIRED to call this to finish writing the rest of the file */
png_write_end(png_ptr, info_ptr); png_write_end(png_ptr, info_ptr);
transforms = transforms; /* Quiet compiler warnings */ PNG_UNUSED(transforms) /* Quiet compiler warnings */
params = params; PNG_UNUSED(params)
} }
#endif #endif
#endif /* PNG_WRITE_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */