From 15f6fd34921d9b8e94068cc00f1cc94f7f650ff1 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Mon, 30 Apr 2012 13:59:58 -0500 Subject: [PATCH] [libpng16] checked in contrib/libtests/pngstest.c which was omitted --- contrib/libtests/pngstest.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/libtests/pngstest.c b/contrib/libtests/pngstest.c index eb90682c2..609697509 100644 --- a/contrib/libtests/pngstest.c +++ b/contrib/libtests/pngstest.c @@ -54,8 +54,11 @@ /* The following is to support direct compilation of this file as C++ */ #ifdef __cplusplus # define voidcast(type, value) static_cast(value) +# define aligncastconst(type, value) \ + static_cast(static_cast(value)) #else # define voidcast(type, value) (value) +# define aligncastconst(type, value) ((const void*)(value)) #endif /* __cplusplus */ /* Generate random bytes. This uses a boring repeatable algorithm and it @@ -2928,8 +2931,8 @@ compare_two_images(Image *a, Image *b, int via_linear, */ if (formatb & PNG_FORMAT_FLAG_LINEAR) /* 16-bit checks */ { - png_const_uint_16p pua = (png_const_uint_16p)psa; - png_const_uint_16p pub = (png_const_uint_16p)psb; + png_const_uint_16p pua = aligncastconst(png_const_uint_16p, psa); + png_const_uint_16p pub = aligncastconst(png_const_uint_16p, psb); switch (bchannels) {