diff options
Diffstat (limited to 'media/libpng/apng.patch')
-rw-r--r-- | media/libpng/apng.patch | 154 |
1 files changed, 43 insertions, 111 deletions
diff --git a/media/libpng/apng.patch b/media/libpng/apng.patch index ab4ca59567..1cb3d35019 100644 --- a/media/libpng/apng.patch +++ b/media/libpng/apng.patch @@ -1,8 +1,7 @@ diff --git a/png.h b/png.h --- a/png.h +++ b/png.h -@@ -329,8 +329,12 @@ - */ +@@ -329,6 +329,10 @@ # include "pnglibconf.h" #endif @@ -13,9 +12,7 @@ diff --git a/png.h b/png.h #ifndef PNG_VERSION_INFO_ONLY /* Machine specific configuration. */ # include "pngconf.h" - #endif -@@ -424,8 +428,19 @@ extern "C" { - * constants. +@@ -424,6 +428,17 @@ extern "C" { * See pngconf.h for base types that vary by machine/system */ @@ -33,9 +30,7 @@ diff --git a/png.h b/png.h /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ - typedef char* png_libpng_version_1_6_37; -@@ -745,8 +760,12 @@ typedef png_unknown_chunk * * png_unknow - #define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */ +@@ -745,6 +760,10 @@ typedef png_unknown_chunk * * png_unknow #define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */ #define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */ #define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */ @@ -46,9 +41,7 @@ diff --git a/png.h b/png.h /* This is used for the transformation routines, as some of them * change these values for the row. It also should enable using - * the routines for other purposes. -@@ -782,8 +801,12 @@ typedef PNG_CALLBACK(void, *png_write_st - +@@ -782,6 +801,10 @@ typedef PNG_CALLBACK(void, *png_write_st #ifdef PNG_PROGRESSIVE_READ_SUPPORTED typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop)); typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop)); @@ -59,9 +52,7 @@ diff --git a/png.h b/png.h /* The following callback receives png_uint_32 row_number, int pass for the * png_bytep data of the row. When transforming an interlaced image the - * row number is the row number within the sub-image of the interlace pass, so -@@ -3226,17 +3249,90 @@ PNG_EXPORT(244, int, png_set_option, (pn - /******************************************************************************* +@@ -3230,6 +3253,75 @@ PNG_EXPORT(244, int, png_set_option, (pn * END OF HARDWARE AND SOFTWARE OPTIONS ******************************************************************************/ @@ -137,8 +128,7 @@ diff --git a/png.h b/png.h /* Maintainer: Put new public prototypes here ^, in libpng.3, in project * defs, and in scripts/symbols.def. */ - - /* The last ordinal number (this is the *last* one already used; the next +@@ -3238,7 +3330,11 @@ PNG_EXPORT(244, int, png_set_option, (pn * one to use is one more than this.) */ #ifdef PNG_EXPORT_LAST_ORDINAL @@ -150,12 +140,10 @@ diff --git a/png.h b/png.h #endif #ifdef __cplusplus - } diff --git a/pngget.c b/pngget.c --- a/pngget.c +++ b/pngget.c -@@ -1245,5 +1245,167 @@ png_get_palette_max(png_const_structp pn - } +@@ -1264,4 +1264,166 @@ png_get_palette_max(png_const_structp pn # endif #endif @@ -325,8 +313,7 @@ diff --git a/pngget.c b/pngget.c diff --git a/pnginfo.h b/pnginfo.h --- a/pnginfo.h +++ b/pnginfo.h -@@ -262,6 +262,19 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) - /* Data valid if (valid & PNG_INFO_IDAT) non-zero */ +@@ -263,5 +263,18 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_bytepp row_pointers; /* the image bits */ #endif @@ -348,8 +335,7 @@ diff --git a/pnginfo.h b/pnginfo.h diff --git a/pngpread.c b/pngpread.c --- a/pngpread.c +++ b/pngpread.c -@@ -194,8 +194,91 @@ png_push_read_chunk(png_structrp png_ptr - } +@@ -195,6 +195,89 @@ png_push_read_chunk(png_structrp png_ptr chunk_name = png_ptr->chunk_name; @@ -439,9 +425,7 @@ diff --git a/pngpread.c b/pngpread.c if (chunk_name == png_IDAT) { if ((png_ptr->mode & PNG_AFTER_IDAT) != 0) - png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; -@@ -260,8 +343,11 @@ png_push_read_chunk(png_structrp png_ptr - } +@@ -261,6 +344,9 @@ png_push_read_chunk(png_structrp png_ptr else if (chunk_name == png_IDAT) { @@ -451,9 +435,7 @@ diff --git a/pngpread.c b/pngpread.c png_ptr->idat_size = png_ptr->push_length; png_ptr->process_mode = PNG_READ_IDAT_MODE; png_push_have_info(png_ptr, info_ptr); - png_ptr->zstream.avail_out = -@@ -406,8 +492,22 @@ png_push_read_chunk(png_structrp png_ptr - png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length); +@@ -415,6 +501,20 @@ png_push_read_chunk(png_structrp png_ptr } #endif @@ -474,9 +456,7 @@ diff --git a/pngpread.c b/pngpread.c else { PNG_PUSH_SAVE_BUFFER_IF_FULL - png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, -@@ -538,27 +638,74 @@ png_push_read_IDAT(png_structrp png_ptr) - png_byte chunk_length[4]; +@@ -547,7 +647,11 @@ png_push_read_IDAT(png_structrp png_ptr) png_byte chunk_tag[4]; /* TODO: this code can be commoned up with the same code in push_read */ @@ -488,7 +468,7 @@ diff --git a/pngpread.c b/pngpread.c png_push_fill_buffer(png_ptr, chunk_length, 4); png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length); png_reset_crc(png_ptr); - png_crc_read(png_ptr, chunk_tag, 4); +@@ -555,17 +659,60 @@ png_push_read_IDAT(png_structrp png_ptr) png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag); png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; @@ -549,9 +529,7 @@ diff --git a/pngpread.c b/pngpread.c } if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0) - { -@@ -630,8 +777,18 @@ png_process_IDAT_data(png_structrp png_p - /* The caller checks for a non-zero buffer length. */ +@@ -639,6 +786,16 @@ png_process_IDAT_data(png_structrp png_p if (!(buffer_length > 0) || buffer == NULL) png_error(png_ptr, "No IDAT data (internal error)"); @@ -568,9 +546,7 @@ diff --git a/pngpread.c b/pngpread.c /* This routine must process all the data it has been given * before returning, calling the row callback as required to * handle the uncompressed results. - */ -@@ -1084,8 +1241,20 @@ png_set_progressive_read_fn(png_structrp - +@@ -1093,6 +1250,18 @@ png_set_progressive_read_fn(png_structrp png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); } @@ -589,14 +565,12 @@ diff --git a/pngpread.c b/pngpread.c png_voidp PNGAPI png_get_progressive_ptr(png_const_structrp png_ptr) { - if (png_ptr == NULL) diff --git a/pngpriv.h b/pngpriv.h --- a/pngpriv.h +++ b/pngpriv.h -@@ -636,8 +636,12 @@ - #define PNG_HAVE_PNG_SIGNATURE 0x1000U +@@ -662,6 +662,10 @@ #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */ - /* 0x4000U (unused) */ + #define PNG_WROTE_eXIf 0x4000U #define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */ +#ifdef PNG_APNG_SUPPORTED +#define PNG_HAVE_acTL 0x10000U @@ -605,9 +579,7 @@ diff --git a/pngpriv.h b/pngpriv.h /* Flags for the transformations the PNG library does on the image data */ #define PNG_BGR 0x0001U - #define PNG_INTERLACE 0x0002U -@@ -872,8 +876,18 @@ - #define png_tIME PNG_U32(116, 73, 77, 69) +@@ -898,6 +902,16 @@ #define png_tRNS PNG_U32(116, 82, 78, 83) #define png_zTXt PNG_U32(122, 84, 88, 116) @@ -624,9 +596,7 @@ diff --git a/pngpriv.h b/pngpriv.h /* The following will work on (signed char*) strings, whereas the get_uint_32 * macro will fail on top-bit-set values because of the sign extension. */ - #define PNG_CHUNK_FROM_STRING(s)\ -@@ -1623,8 +1637,51 @@ PNG_INTERNAL_FUNCTION(void,png_push_read - # endif +@@ -1683,6 +1697,49 @@ PNG_INTERNAL_FUNCTION(void,png_push_read #endif /* PROGRESSIVE_READ */ @@ -676,12 +646,10 @@ diff --git a/pngpriv.h b/pngpriv.h /* Added at libpng version 1.6.0 */ #ifdef PNG_GAMMA_SUPPORTED PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr, - png_colorspacerp colorspace, png_fixed_point gAMA), PNG_EMPTY); diff --git a/pngread.c b/pngread.c --- a/pngread.c +++ b/pngread.c -@@ -160,8 +160,11 @@ png_read_info(png_structrp png_ptr, png_ - png_handle_PLTE(png_ptr, info_ptr, length); +@@ -161,6 +161,9 @@ png_read_info(png_structrp png_ptr, png_ else if (chunk_name == png_IDAT) { @@ -691,9 +659,7 @@ diff --git a/pngread.c b/pngread.c png_ptr->idat_size = length; break; } - -@@ -254,15 +257,92 @@ png_read_info(png_structrp png_ptr, png_ - else if (chunk_name == png_iTXt) +@@ -255,6 +258,17 @@ png_read_info(png_structrp png_ptr, png_ png_handle_iTXt(png_ptr, info_ptr, length); #endif @@ -711,7 +677,7 @@ diff --git a/pngread.c b/pngread.c else png_handle_unknown(png_ptr, info_ptr, length, PNG_HANDLE_CHUNK_AS_DEFAULT); - } +@@ -262,6 +276,72 @@ png_read_info(png_structrp png_ptr, png_ } #endif /* SEQUENTIAL_READ */ @@ -784,12 +750,10 @@ diff --git a/pngread.c b/pngread.c /* Optional call to update the users info_ptr structure */ void PNGAPI png_read_update_info(png_structrp png_ptr, png_inforp info_ptr) - { diff --git a/pngrutil.c b/pngrutil.c --- a/pngrutil.c +++ b/pngrutil.c -@@ -864,8 +864,13 @@ png_handle_IHDR(png_structrp png_ptr, pn - compression_type = buf[10]; +@@ -863,6 +863,11 @@ png_handle_IHDR(png_structrp png_ptr, pn filter_type = buf[11]; interlace_type = buf[12]; @@ -801,9 +765,7 @@ diff --git a/pngrutil.c b/pngrutil.c /* Set internal variables */ png_ptr->width = width; png_ptr->height = height; - png_ptr->bit_depth = (png_byte)bit_depth; -@@ -2856,8 +2861,182 @@ png_handle_iTXt(png_structrp png_ptr, pn - png_chunk_benign_error(png_ptr, errmsg); +@@ -2857,6 +2862,180 @@ png_handle_iTXt(png_structrp png_ptr, pn } #endif @@ -984,9 +946,7 @@ diff --git a/pngrutil.c b/pngrutil.c #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED /* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */ static int - png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length) -@@ -3161,9 +3340,13 @@ png_check_chunk_length(png_const_structr - # elif PNG_USER_CHUNK_MALLOC_MAX > 0 +@@ -3162,7 +3341,11 @@ png_check_chunk_length(png_const_structr if (PNG_USER_CHUNK_MALLOC_MAX < limit) limit = PNG_USER_CHUNK_MALLOC_MAX; # endif @@ -998,9 +958,7 @@ diff --git a/pngrutil.c b/pngrutil.c { png_alloc_size_t idat_limit = PNG_UINT_31_MAX; size_t row_factor = - (size_t)png_ptr->width -@@ -4165,8 +4348,40 @@ png_read_IDAT_data(png_structrp png_ptr, - { +@@ -4166,6 +4349,38 @@ png_read_IDAT_data(png_structrp png_ptr, uInt avail_in; png_bytep buffer; @@ -1039,9 +997,7 @@ diff --git a/pngrutil.c b/pngrutil.c while (png_ptr->idat_size == 0) { png_crc_finish(png_ptr, 0); - -@@ -4176,8 +4391,9 @@ png_read_IDAT_data(png_structrp png_ptr, - */ +@@ -4177,6 +4392,7 @@ png_read_IDAT_data(png_structrp png_ptr, if (png_ptr->chunk_name != png_IDAT) png_error(png_ptr, "Not enough image data"); } @@ -1049,9 +1005,7 @@ diff --git a/pngrutil.c b/pngrutil.c avail_in = png_ptr->IDAT_read_size; - if (avail_in > png_ptr->idat_size) -@@ -4239,8 +4455,11 @@ png_read_IDAT_data(png_structrp png_ptr, - png_ptr->zstream.next_out = NULL; +@@ -4240,6 +4456,9 @@ png_read_IDAT_data(png_structrp png_ptr, png_ptr->mode |= PNG_AFTER_IDAT; png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED; @@ -1061,9 +1015,7 @@ diff --git a/pngrutil.c b/pngrutil.c if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0) png_chunk_benign_error(png_ptr, "Extra compressed data"); - break; -@@ -4677,5 +4896,81 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED - png_error(png_ptr, png_ptr->zstream.msg); +@@ -4677,4 +4896,80 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED png_ptr->flags |= PNG_FLAG_ROW_INIT; } @@ -1147,8 +1099,7 @@ diff --git a/pngrutil.c b/pngrutil.c diff --git a/pngset.c b/pngset.c --- a/pngset.c +++ b/pngset.c -@@ -287,8 +287,13 @@ png_set_IHDR(png_const_structrp png_ptr, - +@@ -280,6 +280,11 @@ png_set_IHDR(png_const_structrp png_ptr, info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth); info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width); @@ -1160,9 +1111,7 @@ diff --git a/pngset.c b/pngset.c } #ifdef PNG_oFFs_SUPPORTED - void PNGAPI -@@ -1157,8 +1162,148 @@ png_set_sPLT(png_const_structrp png_ptr, - png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR); +@@ -1151,6 +1156,146 @@ png_set_sPLT(png_const_structrp png_ptr, } #endif /* sPLT */ @@ -1309,12 +1258,10 @@ diff --git a/pngset.c b/pngset.c #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED static png_byte check_location(png_const_structrp png_ptr, int location) - { diff --git a/pngstruct.h b/pngstruct.h --- a/pngstruct.h +++ b/pngstruct.h -@@ -408,8 +408,29 @@ struct png_struct_def - #ifdef PNG_MNG_FEATURES_SUPPORTED +@@ -399,6 +399,27 @@ struct png_struct_def png_byte filter_type; #endif @@ -1342,12 +1289,10 @@ diff --git a/pngstruct.h b/pngstruct.h /* New members added in libpng-1.2.0 */ /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ - #ifdef PNG_USER_MEM_SUPPORTED diff --git a/pngwrite.c b/pngwrite.c --- a/pngwrite.c +++ b/pngwrite.c -@@ -127,8 +127,12 @@ png_write_info_before_PLTE(png_structrp - * an error and calls png_error while the color space is being set, yet +@@ -128,6 +128,10 @@ png_write_info_before_PLTE(png_structrp * the application continues writing the PNG. So check the 'invalid' * flag here too. */ @@ -1358,9 +1303,7 @@ diff --git a/pngwrite.c b/pngwrite.c #ifdef PNG_GAMMA_SUPPORTED # ifdef PNG_WRITE_gAMA_SUPPORTED if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 && - (info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_gAMA) != 0 && -@@ -364,8 +368,13 @@ png_write_end(png_structrp png_ptr, png_ - +@@ -368,6 +372,11 @@ png_write_end(png_structrp png_ptr, png_ if ((png_ptr->mode & PNG_HAVE_IDAT) == 0) png_error(png_ptr, "No IDATs written into file"); @@ -1370,11 +1313,9 @@ diff --git a/pngwrite.c b/pngwrite.c +#endif + #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED - if (png_ptr->num_palette_max > png_ptr->num_palette) - png_benign_error(png_ptr, "Wrote palette index exceeding num_palette"); - #endif -@@ -2391,5 +2400,43 @@ png_image_write_to_file(png_imagep image - return 0; + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + png_ptr->num_palette_max >= png_ptr->num_palette) +@@ -2415,4 +2424,42 @@ png_image_write_to_file(png_imagep image } #endif /* SIMPLIFIED_WRITE_STDIO */ #endif /* SIMPLIFIED_WRITE */ @@ -1420,8 +1361,7 @@ diff --git a/pngwrite.c b/pngwrite.c diff --git a/pngwutil.c b/pngwutil.c --- a/pngwutil.c +++ b/pngwutil.c -@@ -820,8 +820,13 @@ png_write_IHDR(png_structrp png_ptr, png - +@@ -823,6 +823,11 @@ png_write_IHDR(png_structrp png_ptr, png /* Write the chunk */ png_write_complete_chunk(png_ptr, png_IHDR, buf, 13); @@ -1432,10 +1372,8 @@ diff --git a/pngwutil.c b/pngwutil.c + if ((png_ptr->do_filter) == PNG_NO_FILTERS) { - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE || - png_ptr->bit_depth < 8) -@@ -1002,9 +1007,19 @@ png_compress_IDAT(png_structrp png_ptr, - optimize_cmf(data, png_image_size(png_ptr)); + #ifdef PNG_WRITE_FILTER_SUPPORTED +@@ -1009,7 +1014,17 @@ png_compress_IDAT(png_structrp png_ptr, #endif if (size > 0) @@ -1453,9 +1391,7 @@ diff --git a/pngwutil.c b/pngwutil.c png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->zstream.next_out = data; - png_ptr->zstream.avail_out = size; -@@ -1049,9 +1064,19 @@ png_compress_IDAT(png_structrp png_ptr, - optimize_cmf(data, png_image_size(png_ptr)); +@@ -1056,7 +1071,17 @@ png_compress_IDAT(png_structrp png_ptr, #endif if (size > 0) @@ -1473,9 +1409,7 @@ diff --git a/pngwutil.c b/pngwutil.c png_ptr->zstream.avail_out = 0; png_ptr->zstream.next_out = NULL; png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT; - -@@ -1884,8 +1909,84 @@ png_write_tIME(png_structrp png_ptr, png - png_write_complete_chunk(png_ptr, png_tIME, buf, 7); +@@ -1891,6 +1916,82 @@ png_write_tIME(png_structrp png_ptr, png } #endif @@ -1558,9 +1492,7 @@ diff --git a/pngwutil.c b/pngwutil.c /* Initializes the row writing capability of libpng */ void /* PRIVATE */ png_write_start_row(png_structrp png_ptr) - { -@@ -2777,5 +2878,40 @@ png_write_filtered_row(png_structrp png_ - png_write_flush(png_ptr); +@@ -2784,4 +2885,39 @@ png_write_filtered_row(png_structrp png_ } #endif /* WRITE_FLUSH */ } |