[devel] Added the private PNG_UNUSED() macro definition in pngpriv.h.
(adapted from the UNUSED() macro in pngvalid.c by John Bowler)
diff --git a/ANNOUNCE b/ANNOUNCE
index 1c54af4..debc985 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -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
within a few weeks by a public version or by another test version.
@@ -226,7 +226,7 @@
offset of the png_ptr->rowbuf pointer into png_ptr->big_row_buf.
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
Removed the now-redundant check for out-of-bounds new_row from example.c
@@ -451,7 +451,8 @@
with pngwio.c and pngwutil.c because the 'write' callback and zlib
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:
(subscription required; visit
diff --git a/CHANGES b/CHANGES
index 617e933..bc55f6e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3089,7 +3089,8 @@
with pngwio.c and pngwutil.c because the 'write' callback and zlib
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
(subscription required; visit
diff --git a/png.c b/png.c
index 9b00f79..046173b 100644
--- a/png.c
+++ b/png.c
@@ -550,19 +550,19 @@
png_const_charp PNGAPI
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
- return PNG_STRING_COPYRIGHT
+ return PNG_STRING_COPYRIGHT
#else
# ifdef __STDC__
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) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# 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) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@@ -589,7 +589,7 @@
png_get_header_ver(png_structp png_ptr)
{
/* 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;
}
@@ -597,7 +597,7 @@
png_get_header_version(png_structp png_ptr)
{
/* 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__
return PNG_HEADER_VERSION_STRING
# ifndef PNG_READ_SUPPORTED
diff --git a/pngerror.c b/pngerror.c
index 3fc7242..dac371d 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -322,7 +322,7 @@
}
#endif
#ifndef PNG_CONSOLE_IO_SUPPORTED
- error_message = error_message; /* Make compiler happy */
+ PNG_UNUSED(error_message) /* Make compiler happy */
#endif
png_longjmp(png_ptr, 1);
}
@@ -394,9 +394,9 @@
fprintf(stderr, PNG_STRING_NEWLINE);
}
#else
- warning_message = warning_message; /* Make compiler happy */
+ PNG_UNUSED(warning_message) /* Make compiler happy */
#endif
- png_ptr = png_ptr; /* Make compiler happy */
+ PNG_UNUSED(png_ptr) /* Make compiler happy */
}
#endif /* PNG_WARNINGS_SUPPORTED */
diff --git a/pngpread.c b/pngpread.c
index c893104..9af1b67 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1230,7 +1230,7 @@
{
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");
/*NOT REACHED*/
}
@@ -1327,7 +1327,7 @@
{
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");
/*NOT REACHED*/
}
@@ -1531,7 +1531,7 @@
{
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");
/*NOT REACHED*/
}
@@ -1669,7 +1669,7 @@
#endif
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
diff --git a/pngpriv.h b/pngpriv.h
index 87a89e3..2fa26f4 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -81,6 +81,15 @@
# define PNG_MAX_MALLOC_64K
#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
* contradictory.
*/
diff --git a/pngread.c b/pngread.c
index 30605d1..2233217 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1457,8 +1457,8 @@
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr);
- transforms = transforms; /* Quiet compiler warnings */
- params = params;
+ PNG_UNUSED(transforms) /* Quiet compiler warnings */
+ PNG_UNUSED(params)
}
#endif /* PNG_INFO_IMAGE_SUPPORTED */
diff --git a/pngrutil.c b/pngrutil.c
index 38464d2..6ff9a1e 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -781,7 +781,7 @@
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
@@ -2619,7 +2619,7 @@
png_crc_finish(png_ptr, skip);
#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
}
@@ -3110,7 +3110,7 @@
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width);
}
#ifndef PNG_READ_PACKSWAP_SUPPORTED
- transformations = transformations; /* Silence compiler warning */
+ PNG_UNUSED(transformations) /* Silence compiler warning */
#endif
}
#endif /* PNG_READ_INTERLACING_SUPPORTED */
diff --git a/pngtest.c b/pngtest.c
index 03775f3..42c9352 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -425,7 +425,7 @@
pngtest_flush(png_structp png_ptr)
{
/* 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
diff --git a/pngvalid.c b/pngvalid.c
index d1201e4..aa9207b 100644
--- a/pngvalid.c
+++ b/pngvalid.c
@@ -618,8 +618,7 @@
static void
store_flush(png_structp pp)
{
- pp = pp;
- /*DOES NOTHING*/
+ UNUSED(pp) /*DOES NOTHING*/
}
static size_t
diff --git a/pngwrite.c b/pngwrite.c
index 8fc8d45..97645e0 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1597,8 +1597,8 @@
/* It is REQUIRED to call this to finish writing the rest of the file */
png_write_end(png_ptr, info_ptr);
- transforms = transforms; /* Quiet compiler warnings */
- params = params;
+ PNG_UNUSED(transforms) /* Quiet compiler warnings */
+ PNG_UNUSED(params)
}
#endif
#endif /* PNG_WRITE_SUPPORTED */