aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcarvsdriver <carvsdriver@gmail.com>2013-06-27 13:11:21 -0400
committerMike Grissom <mikeyman77@gmail.com>2013-07-13 10:34:41 -0700
commit1c1a497260ca86a5907469e7218e0faef22f3873 (patch)
tree1559e4dfac812a038e8d050d447d42d8a783b4bf
parent41e4a032ef9f599ea597dcdff1797f0ea49bdd97 (diff)
downloadexternal_libpng-1c1a497260ca86a5907469e7218e0faef22f3873.zip
external_libpng-1c1a497260ca86a5907469e7218e0faef22f3873.tar.gz
external_libpng-1c1a497260ca86a5907469e7218e0faef22f3873.tar.bz2
external: libpng: fix numerous compiler warnings
Clean up the code for unused variables to handle them a bit more elegantly. Change-Id: I8b01c27673128719dad74276599d5a286c4dd412
-rw-r--r--png.c8
-rw-r--r--png.h3
-rw-r--r--pngerror.c2
-rw-r--r--pngget.c4
-rw-r--r--pngpread.c6
-rw-r--r--pngread.c4
-rw-r--r--pngrutil.c4
-rw-r--r--pngset.c6
-rw-r--r--pngwrite.c4
9 files changed, 23 insertions, 18 deletions
diff --git a/png.c b/png.c
index 5fea8b1..3f3ae0b 100644
--- a/png.c
+++ b/png.c
@@ -719,7 +719,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
- png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
+ UNUSED(png_ptr); /* Silence compiler warning about unused png_ptr */
#ifdef PNG_STRING_COPYRIGHT
return PNG_STRING_COPYRIGHT
#else
@@ -751,7 +751,7 @@ png_charp PNGAPI
png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
- png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
+ UNUSED(png_ptr); /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING);
}
@@ -759,7 +759,7 @@ png_charp PNGAPI
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 */
+ UNUSED(png_ptr); /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING);
}
@@ -767,7 +767,7 @@ png_charp PNGAPI
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 */
+ UNUSED(png_ptr); /* Silence compiler warning about unused png_ptr */
#ifdef __STDC__
return ((png_charp) PNG_HEADER_VERSION_STRING
#ifndef PNG_READ_SUPPORTED
diff --git a/png.h b/png.h
index d379dea..a968e94 100644
--- a/png.h
+++ b/png.h
@@ -468,6 +468,9 @@
#ifndef PNG_H
#define PNG_H
+/* This is used to quiet the compiler for unused variables */
+#define UNUSED(x) (void)(x);
+
/* This is not the place to learn how to use libpng. The file libpng.txt
* describes how to use libpng, and the file example.c summarizes it
* with some code on which to build. This file is useful for looking
diff --git a/pngerror.c b/pngerror.c
index 025d52e..5b43790 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -348,7 +348,7 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
#else
warning_message = warning_message; /* Make compiler happy */
#endif
- png_ptr = png_ptr; /* Make compiler happy */
+ UNUSED(png_ptr); /* Make compiler happy */
}
#endif /* PNG_WARNINGS_SUPPORTED */
diff --git a/pngget.c b/pngget.c
index d397329..1d61491 100644
--- a/pngget.c
+++ b/pngget.c
@@ -893,7 +893,7 @@ png_uint_32 PNGAPI
png_get_asm_flagmask (int flag_select)
{
/* Obsolete, to be removed from libpng-1.4.0 */
- flag_select=flag_select;
+ UNUSED(flag_select);
return 0L;
}
@@ -903,7 +903,7 @@ png_uint_32 PNGAPI
png_get_mmx_flagmask (int flag_select, int *compilerID)
{
/* Obsolete, to be removed from libpng-1.4.0 */
- flag_select=flag_select;
+ UNUSED(flag_select);
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
return 0L;
}
diff --git a/pngpread.c b/pngpread.c
index d066944..2ab4907 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1209,7 +1209,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))
{
png_error(png_ptr, "Out of place tEXt");
- info_ptr = info_ptr; /* To quiet some compiler warnings */
+ UNUSED(info_ptr); /* To quiet some compiler warnings */
}
#ifdef PNG_MAX_MALLOC_64K
@@ -1307,7 +1307,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))
{
png_error(png_ptr, "Out of place zTXt");
- info_ptr = info_ptr; /* To quiet some compiler warnings */
+ UNUSED(info_ptr); /* To quiet some compiler warnings */
}
#ifdef PNG_MAX_MALLOC_64K
@@ -1643,7 +1643,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
#endif
png_chunk_error(png_ptr, "unknown critical chunk");
- info_ptr = info_ptr; /* To quiet some compiler warnings */
+ UNUSED(info_ptr); /* To quiet some compiler warnings */
}
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
diff --git a/pngread.c b/pngread.c
index b301d41..9f1cd74 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1699,8 +1699,8 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* 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;
+ UNUSED(transforms); /* Quiet compiler warnings */
+ UNUSED(params);
}
#endif /* PNG_INFO_IMAGE_SUPPORTED */
diff --git a/pngrutil.c b/pngrutil.c
index d49c25b..9407fe4 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -692,7 +692,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
png_crc_finish(png_ptr, length);
- info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */
+ UNUSED(info_ptr); /* Quiet compiler warnings about unused info_ptr */
}
#ifdef PNG_READ_gAMA_SUPPORTED
@@ -3074,6 +3074,8 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
break;
}
#endif
+
+ UNUSED(png_ptr);
}
#ifdef PNG_INDEX_SUPPORTED
diff --git a/pngset.c b/pngset.c
index c9ab8f6..168edb1 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1184,7 +1184,7 @@ png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
/* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */
if (png_ptr != NULL)
png_ptr->asm_flags = 0;
- asm_flags = asm_flags; /* Quiet the compiler */
+ UNUSED(asm_flags); /* Quiet the compiler */
}
/* This function was added to libpng 1.2.0 */
@@ -1197,8 +1197,8 @@ png_set_mmx_thresholds (png_structp png_ptr,
if (png_ptr == NULL)
return;
/* Quiet the compiler */
- mmx_bitdepth_threshold = mmx_bitdepth_threshold;
- mmx_rowbytes_threshold = mmx_rowbytes_threshold;
+ UNUSED(mmx_bitdepth_threshold);
+ UNUSED(mmx_rowbytes_threshold);
}
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
diff --git a/pngwrite.c b/pngwrite.c
index 1d8c53f..646c3d3 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1586,8 +1586,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 */
png_write_end(png_ptr, info_ptr);
- transforms = transforms; /* Quiet compiler warnings */
- params = params;
+ UNUSED(transforms); /* Quiet compiler warnings */
+ UNUSED(params);
}
#endif
#endif /* PNG_WRITE_SUPPORTED */