[libpng16] Removed need for -Wno-cast-align with clang. clang correctly warns

on alignment increasing pointer casts when -Wcast-align is passed. This
fixes the cases clang warns about either (pngread.c) by eliminating the
casts from png_bytep to png_uint_16p or, for pngrutil.c where the cast
is previously verified or pngstest.c where it is OK by introducing new
png_aligncast macros to do the cast in a way that clang accepts.
This commit is contained in:
John Bowler
2012-04-30 06:31:54 -05:00
committed by Glenn Randers-Pehrson
parent 040575c80b
commit b45416921b
8 changed files with 80 additions and 44 deletions

View File

@@ -3261,8 +3261,9 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
bytes_to_copy % sizeof (png_uint_32) == 0 &&
bytes_to_jump % sizeof (png_uint_32) == 0)
{
png_uint_32p dp32 = (png_uint_32p)dp;
png_const_uint_32p sp32 = (png_const_uint_32p)sp;
png_uint_32p dp32 = png_aligncast(png_uint_32p,dp);
png_const_uint_32p sp32 = png_aligncastconst(
png_const_uint_32p, sp);
unsigned int skip = (bytes_to_jump-bytes_to_copy) /
sizeof (png_uint_32);
@@ -3302,8 +3303,9 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
*/
else
{
png_uint_16p dp16 = (png_uint_16p)dp;
png_const_uint_16p sp16 = (png_const_uint_16p)sp;
png_uint_16p dp16 = png_aligncast(png_uint_16p, dp);
png_const_uint_16p sp16 = png_aligncastconst(
png_const_uint_16p, sp);
unsigned int skip = (bytes_to_jump-bytes_to_copy) /
sizeof (png_uint_16);