From 2dfcf6598193403435e003c3ead83a43d076cd45 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Wed, 3 Jun 2015 14:58:18 -0500 Subject: [PATCH] [libpng16] Fixed NO_WRITE_FILTER and -Wconversion build breaks (John Bowler). --- ANNOUNCE | 8 +++++--- CHANGES | 7 ++++--- pngwrite.c | 13 ++++--------- pngwutil.c | 6 +++--- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index eabb7f2de..a29dd4807 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -73,11 +73,13 @@ Version 1.6.18beta07 [June 3, 2015] Removed non-working progressive reader 'skip' function. This function has apparently never been used. It was implemented to support back-door modification of png_struct in libpng-1.4.x - but was apparently never tested (because it does nothing and cannot - do anything). + but (because it does nothing and cannot do anything) was apparently + never tested (John Bowler). Fixed cexcept.h in which GCC 5 now reports that one of the auto variables in the Try macro needs to be volatile to prevent value - being lost over the setjmp. + being lost over the setjmp (John Bowler). + Fixed NO_WRITE_FILTER and -Wconversion build breaks (John Bowler). + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 5fb4b24a7..fecc756aa 100644 --- a/CHANGES +++ b/CHANGES @@ -5258,11 +5258,12 @@ Version 1.6.18beta07 [June 3, 2015] Removed non-working progressive reader 'skip' function. This function has apparently never been used. It was implemented to support back-door modification of png_struct in libpng-1.4.x - but was apparently never tested (because it does nothing and cannot - do anything). + but (because it does nothing and cannot do anything) was apparently + never tested (John Bowler). Fixed cexcept.h in which GCC 5 now reports that one of the auto variables in the Try macro needs to be volatile to prevent value - being lost over the setjmp. + being lost over the setjmp (John Bowler). + Fixed NO_WRITE_FILTER and -Wconversion build breaks (John Bowler). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngwrite.c b/pngwrite.c index ccdc47f65..cfc5570df 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -1032,6 +1032,7 @@ png_set_filter(png_structrp png_ptr, int method, int filters) #endif /* WRITE_FILTER */ } +#ifdef PNG_WRITE_FILTER_SUPPORTED /* If we have allocated the row_buf, this means we have already started * with the image and we should have allocated all of the filter buffers * that have been selected. If prev_row isn't already allocated, then @@ -1101,20 +1102,14 @@ png_set_filter(png_structrp png_ptr, int method, int filters) } } png_ptr->do_filter = (png_byte)filters; +#endif } else png_error(png_ptr, "Unknown custom filter method"); } -/* This allows us to influence the way in which libpng chooses the "best" - * filter for the current scanline. While the "minimum-sum-of-absolute- - * differences metric is relatively fast and effective, there is some - * question as to whether it can be improved upon by trying to keep the - * filtered data going to zlib more consistent, hopefully resulting in - * better compression. - */ -#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */ -/* Provide floating and fixed point APIs (DEPRECATED) */ +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */ +/* Provide floating and fixed point APIs */ #ifdef PNG_FLOATING_POINT_SUPPORTED void PNGAPI png_set_filter_heuristics(png_structrp png_ptr, int heuristic_method, diff --git a/pngwutil.c b/pngwutil.c index 871075b9e..3bb6cf15c 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1962,7 +1962,7 @@ png_write_start_row(png_structrp png_ptr) int usr_pixel_depth; #ifdef PNG_WRITE_FILTER_SUPPORTED - int filters; + png_byte filters; #endif png_debug(1, "in png_write_start_row"); @@ -1983,10 +1983,10 @@ png_write_start_row(png_structrp png_ptr) filters = png_ptr->do_filter; if (png_ptr->height == 1) - filters &= ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH); + filters &= 0xff & ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH); if (png_ptr->width == 1) - filters &= ~(PNG_FILTER_SUB|PNG_FILTER_AVG|PNG_FILTER_PAETH); + filters &= 0xff & ~(PNG_FILTER_SUB|PNG_FILTER_AVG|PNG_FILTER_PAETH); if (filters == 0) filters = PNG_FILTER_NONE;