From b66de48b3bb8af60f6748f8012a438087b2e7fac Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 30 May 2015 22:57:33 -0500 Subject: [PATCH] [libpng16] Changed png_voidcast(), etc., to voidcast(), etc., in contrib/tools/pngfix.c to avoid confusion with the libpng private macros. --- ANNOUNCE | 6 ++++-- CHANGES | 4 +++- contrib/tools/pngfix.c | 28 ++++++++++++++-------------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index b9a22623a..fdb90c069 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.18beta05 - May 30, 2015 +Libpng 1.6.18beta05 - May 31, 2015 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. @@ -54,9 +54,11 @@ Version 1.6.18beta04 [May 20, 2015] Avoid a harmless potential integer overflow in png_XYZ_from_xy() (Bug report from Christopher Ferris). -Version 1.6.18beta05 [May 30, 2015] +Version 1.6.18beta05 [May 31, 2015] Backport filter selection code from libpng-1.7.0beta51, to combine sub_row, up_row, avg_row, and paeth_row into try_row and tst_row. + Changed png_voidcast(), etc., to voidcast(), etc., in contrib/tools/pngfix.c + to avoid confusion with the libpng private macros. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 11786b391..14cdf1661 100644 --- a/CHANGES +++ b/CHANGES @@ -5239,9 +5239,11 @@ Version 1.6.18beta04 [May 20, 2015] Avoid a harmless potential integer overflow in png_XYZ_from_xy() (Bug report from Christopher Ferris). -Version 1.6.18beta05 [May 30, 2015] +Version 1.6.18beta05 [May 31, 2015] Backport filter selection code from libpng-1.7.0beta51, to combine sub_row, up_row, avg_row, and paeth_row into try_row and tst_row. + Changed png_voidcast(), etc., to voidcast(), etc., in contrib/tools/pngfix.c + to avoid confusion with the libpng private macros. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/contrib/tools/pngfix.c b/contrib/tools/pngfix.c index f788f0b46..00942627c 100644 --- a/contrib/tools/pngfix.c +++ b/contrib/tools/pngfix.c @@ -71,8 +71,8 @@ * with older builds. */ #if ZLIB_VERNUM < 0x1260 -# define PNGZ_MSG_CAST(s) png_constcast(char*,s) -# define PNGZ_INPUT_CAST(b) png_constcast(png_bytep,b) +# define PNGZ_MSG_CAST(s) constcast(char*,s) +# define PNGZ_INPUT_CAST(b) constcast(png_bytep,b) #else # define PNGZ_MSG_CAST(s) (s) # define PNGZ_INPUT_CAST(b) (b) @@ -86,17 +86,17 @@ /* Copied from pngpriv.h */ #ifdef __cplusplus -# define png_voidcast(type, value) static_cast(value) -# define png_constcast(type, value) const_cast(value) -# define png_aligncast(type, value) \ +# define voidcast(type, value) static_cast(value) +# define constcast(type, value) const_cast(value) +# define aligncast(type, value) \ static_cast(static_cast(value)) -# define png_aligncastconst(type, value) \ +# define aligncastconst(type, value) \ static_cast(static_cast(value)) #else -# define png_voidcast(type, value) (value) -# define png_constcast(type, value) ((type)(value)) -# define png_aligncast(type, value) ((void*)(value)) -# define png_aligncastconst(type, value) ((const void*)(value)) +# define voidcast(type, value) (value) +# define constcast(type, value) ((type)(value)) +# define aligncast(type, value) ((void*)(value)) +# define aligncastconst(type, value) ((const void*)(value)) #endif /* __cplusplus */ #if PNG_LIBPNG_VER < 10700 @@ -446,7 +446,7 @@ static void make_random_bytes(png_uint_32* seed, void* pv, size_t size) { png_uint_32 u0 = seed[0], u1 = seed[1]; - png_bytep bytes = png_voidcast(png_bytep, pv); + png_bytep bytes = voidcast(png_bytep, pv); /* There are thirty-three bits; the next bit in the sequence is bit-33 XOR * bit-20. The top 1 bit is in u1, the bottom 32 are in u0. @@ -668,7 +668,7 @@ IDAT_list_extend(struct IDAT_list *tail) if (length < tail->length) /* arithmetic overflow */ length = tail->length; - next = png_voidcast(IDAT_list*, malloc(IDAT_list_size(NULL, length))); + next = voidcast(IDAT_list*, malloc(IDAT_list_size(NULL, length))); CLEAR(*next); /* The caller must handle this: */ @@ -3535,7 +3535,7 @@ get_control(png_const_structrp png_ptr) /* This just returns the (file*). The chunk and idat control structures * don't always exist. */ - struct control *control = png_voidcast(struct control*, + struct control *control = voidcast(struct control*, png_get_error_ptr(png_ptr)); return &control->file; } @@ -3543,7 +3543,7 @@ get_control(png_const_structrp png_ptr) static void allocate(struct file *file, int allocate_idat) { - struct control *control = png_voidcast(struct control*, file->alloc_ptr); + struct control *control = voidcast(struct control*, file->alloc_ptr); if (allocate_idat) {