From e352b3a6bbcec8bf37224d1c7d7756878bdfe092 Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 10 Nov 2014 20:27:29 +0000 Subject: [PATCH] Updated PNG library to latest version Decided that the next version will be 4.5, since it requires new compilers and, in the OSX case, a newer version of the OS. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3069 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- Announce.txt | 22 ++-- Changes.txt | 4 +- debian/changelog | 7 ++ src/libpng/png.c | 35 ++++--- src/libpng/png.h | 40 ++++--- src/libpng/pngconf.h | 2 +- src/libpng/pngerror.c | 12 +-- src/libpng/pngget.c | 2 +- src/libpng/pngpread.c | 197 +++++++---------------------------- src/libpng/pngpriv.h | 10 +- src/libpng/pngread.c | 18 ++-- src/libpng/pngrtran.c | 4 +- src/libpng/pngrutil.c | 97 +++++++++-------- src/libpng/pngset.c | 16 +-- src/libpng/pngtrans.c | 4 +- src/libpng/pngwrite.c | 37 ++++--- src/libpng/pngwutil.c | 27 ++--- src/macosx/Info-Stella.plist | 2 +- src/unix/stella.spec | 5 +- src/windows/stella.rc | 8 +- 20 files changed, 230 insertions(+), 319 deletions(-) diff --git a/Announce.txt b/Announce.txt index c294be050..ce13ce6d3 100644 --- a/Announce.txt +++ b/Announce.txt @@ -9,7 +9,7 @@ SSSS ttt eeeee llll llll aaaaa =========================================================================== - Release 4.2 for Linux, MacOSX and Windows + Release 4.5 for Linux, MacOSX and Windows =========================================================================== The Atari 2600 Video Computer System (VCS), introduced in 1977, was the @@ -21,27 +21,27 @@ all of your favourite Atari 2600 games again! Stella was originally developed for Linux by Bradford W. Mott, however, it has been ported to a number of other platforms and is currently maintained by Stephen Anthony. -This is the 4.2 release of Stella for Linux, Mac OSX and Windows. The +This is the 4.5 release of Stella for Linux, Mac OSX and Windows. The distributions currently available are: * Binaries for Windows XP_SP3/Vista/7/8 : - Stella-4.2-win32.exe (32-bit EXE installer) - Stella-4.2-x64.exe (64-bit EXE installer) - Stella-4.2-windows.zip (32/64 bit versions) + Stella-4.5-win32.exe (32-bit EXE installer) + Stella-4.5-x64.exe (64-bit EXE installer) + Stella-4.5-windows.zip (32/64 bit versions) * Binary distribution for MacOS X 10.7 and above : - Stella-4.2-macosx.dmg (64-bit Intel) + Stella-4.5-macosx.dmg (64-bit Intel) * Binary distribution in 32-bit & 64-bit Ubuntu DEB format : - stella_4.2-1_i386.deb - stella_4.2-1_amd64.deb + stella_4.5-1_i386.deb + stella_4.5-1_amd64.deb * Binary distribution in 32-bit & 64-bit RPM format : - stella-4.2-2.i386.rpm - stella-4.2-2.x86_64.rpm + stella-4.5-2.i386.rpm + stella-4.5-2.x86_64.rpm * Source code distribution for all platforms : - stella-4.2-src.tar.gz + stella-4.5-src.tar.gz Distribution Site diff --git a/Changes.txt b/Changes.txt index 59fc26297..12b5c778a 100644 --- a/Changes.txt +++ b/Changes.txt @@ -21,7 +21,9 @@ * The minimum supported version for the OSX port is now OSX 10.7. Because of this, the 32-bit version is also discontinued, as 10.7 - is 64-bit only. + is 64-bit Intel only. + + * Updated included PNG library to latest stable version. -Have fun! diff --git a/debian/changelog b/debian/changelog index 1a190468b..6cf09fe23 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +stella (4.5-1) stable; urgency=high + + * Version 4.5 release + + -- Stephen Anthony Mon, 10 Nov 2014 16:54:34 -0330 + + stella (4.2-1) stable; urgency=high * Version 4.2 release diff --git a/src/libpng/png.c b/src/libpng/png.c index f813e0a22..ea5a92e6d 100644 --- a/src/libpng/png.c +++ b/src/libpng/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.6.12 [June 12, 2014] + * Last changed in libpng 1.6.14 [October 23, 2014] * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -14,7 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_12 Your_png_h_is_not_version_1_6_12; +typedef png_libpng_version_1_6_14 Your_png_h_is_not_version_1_6_14; /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another @@ -773,13 +773,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.12 - June 12, 2014" PNG_STRING_NEWLINE \ + "libpng version 1.6.14 - October 23, 2014" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.12 - June 12, 2014\ + return "libpng version 1.6.14 - October 23, 2014\ Copyright (c) 1998-2014 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -2219,10 +2219,12 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr, #endif unsigned int i; +#ifdef PNG_SET_OPTION_SUPPORTED /* First see if PNG_SKIP_sRGB_CHECK_PROFILE has been set to "on" */ if (((png_ptr->options >> PNG_SKIP_sRGB_CHECK_PROFILE) & 3) == PNG_OPTION_ON) return 0; +#endif for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i) { @@ -2293,8 +2295,8 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr, */ else if (!png_sRGB_checks[i].have_md5) { - png_chunk_report(png_ptr, - "out-of-date sRGB profile with no signature", + png_chunk_report(png_ptr, "out-of-date sRGB profile with" + " no signature", PNG_CHUNK_WARNING); } @@ -2307,8 +2309,8 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr, * way. This probably indicates a data error or uninformed hacking. * Fall through to "no match". */ - png_chunk_report(png_ptr, - "Not recognizing known sRGB profile that has been edited", + png_chunk_report(png_ptr, "Not recognizing known sRGB profile that" + " has been edited", PNG_CHUNK_WARNING); break; # endif @@ -3569,8 +3571,8 @@ png_log16bit(png_uint_32 x) * each case only the low 16 bits are relevant - the fraction - since the * integer bits (the top 4) simply determine a shift. * - * The worst case is the 16-bit distinction between 65535 and 65534, this - * requires perhaps spurious accuracty in the decoding of the logarithm to + * The worst case is the 16-bit distinction between 65535 and 65534. This + * requires perhaps spurious accuracy in the decoding of the logarithm to * distinguish log2(65535/65534.5) - 10^-5 or 17 bits. There is little chance * of getting this accuracy in practice. * @@ -3658,7 +3660,7 @@ png_exp8bit(png_fixed_point lg2) /* Get a 32-bit value: */ png_uint_32 x = png_exp(lg2); - /* Convert the 32-bit value to 0..255 by multiplying by 256-1, note that the + /* Convert the 32-bit value to 0..255 by multiplying by 256-1. Note that the * second, rounding, step can't overflow because of the first, subtraction, * step. */ @@ -3840,7 +3842,7 @@ png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable, /* 'num' is the number of tables and also the number of low bits of low * bits of the input 16-bit value used to select a table. Each table is - * itself index by the high 8 bits of the value. + * itself indexed by the high 8 bits of the value. */ for (i = 0; i < num; i++) table[i] = (png_uint_16p)png_malloc(png_ptr, @@ -3892,7 +3894,7 @@ png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable, /* Build a single 8-bit table: same as the 16-bit case but much simpler (and * typically much faster). Note that libpng currently does no sBIT processing - * (apparently contrary to the spec) so a 256 entry table is always generated. + * (apparently contrary to the spec) so a 256-entry table is always generated. */ static void png_build_8bit_table(png_structrp png_ptr, png_bytepp ptable, @@ -4033,7 +4035,7 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth) * Where 'iv' is the input color value and 'ov' is the output value - * pow(iv, gamma). * - * Thus the gamma table consists of up to 256 256 entry tables. The table + * Thus the gamma table consists of up to 256 256-entry tables. The table * is selected by the (8-gamma_shift) most significant of the low 8 bits of * the color value then indexed by the upper 8 bits: * @@ -4141,7 +4143,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff) * * error: -0.513727 - 0.607759, 308 (0.469978%) of readings inexact * - * In all cases the inexact readings are off by one. + * In all cases the inexact readings are only off by one. */ #ifdef PNG_SIMPLIFIED_READ_SUPPORTED @@ -4181,8 +4183,7 @@ const png_uint_16 png_sRGB_table[256] = 57105,57646,58190,58737,59287,59840,60396,60955, 61517,62082,62650,63221,63795,64372,64952,65535 }; - -#endif /* simplified read only */ +#endif /* PNG_SIMPLIFIED_READ_SUPPORTED */ /* The base/delta tables are required for both read and write (but currently * only the simplified versions.) diff --git a/src/libpng/png.h b/src/libpng/png.h index 75e87362d..73ff4c6a0 100644 --- a/src/libpng/png.h +++ b/src/libpng/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.12 - June 12, 2014 + * libpng version 1.6.14 - October 23, 2014 * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -11,7 +11,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.12 - June 12, 2014: Glenn + * libpng versions 0.97, January 1998, through 1.6.14 - October 23, 2014: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -200,6 +200,12 @@ * 1.6.11 16 10611 16.so.16.11[.0] * 1.6.12rc01-03 16 10612 16.so.16.12[.0] * 1.6.12 16 10612 16.so.16.12[.0] + * 1.6.13beta01-04 16 10613 16.so.16.13[.0] + * 1.6.13rc01-02 16 10613 16.so.16.13[.0] + * 1.6.13 16 10613 16.so.16.13[.0] + * 1.6.14beta01-07 16 10614 16.so.16.14[.0] + * 1.6.14rc01-02 16 10614 16.so.16.14[.0] + * 1.6.14 16 10614 16.so.16.14[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -231,7 +237,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.6.12, June 12, 2014, are + * libpng versions 1.2.6, August 15, 2004, through 1.6.14, October 23, 2014, are * Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: @@ -343,13 +349,13 @@ * Y2K compliance in libpng: * ========================= * - * June 12, 2014 + * October 23, 2014 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.6.12 are Y2K compliant. It is my belief that + * upward through 1.6.14 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer @@ -411,9 +417,9 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.12" +#define PNG_LIBPNG_VER_STRING "1.6.14" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.6.12 - June 12, 2014\n" + " libpng version 1.6.14 - October 23, 2014\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -421,7 +427,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 12 +#define PNG_LIBPNG_VER_RELEASE 14 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: @@ -452,7 +458,7 @@ * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10612 /* 1.6.12 */ +#define PNG_LIBPNG_VER 10614 /* 1.6.14 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -557,7 +563,7 @@ extern "C" { /* 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_12; +typedef char* png_libpng_version_1_6_14; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -2742,6 +2748,8 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); # endif #endif +#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \ + defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) /******************************************************************************* * SIMPLIFIED API ******************************************************************************* @@ -2813,7 +2821,7 @@ typedef struct # define PNG_IMAGE_WARNING 1 # define PNG_IMAGE_ERROR 2 /* - * The result is a two bit code such that a value more than 1 indicates + * The result is a two-bit code such that a value more than 1 indicates * a failure in the API just called: * * 0 - no warning or error @@ -3194,6 +3202,7 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file, /******************************************************************************* * END OF SIMPLIFIED API ******************************************************************************/ +#endif /* PNG_SIMPLIFIED_{READ|WRITE}_SUPPORTED */ #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED PNG_EXPORT(242, void, png_set_check_for_invalid_index, @@ -3241,19 +3250,18 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr, PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option, int onoff)); -#endif +#endif /* PNG_SET_OPTION_SUPPORTED */ /******************************************************************************* * END OF HARDWARE AND SOFTWARE OPTIONS ******************************************************************************/ -/* Maintainer: Put new public prototypes here ^, in libpng.3, and project - * defs, scripts/pnglibconf.h, and scripts/pnglibconf.h.prebuilt +/* 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 - * one to use is one more than this.) Maintainer, remember to add an entry to - * scripts/symbols.def as well. + * one to use is one more than this.) */ #ifdef PNG_EXPORT_LAST_ORDINAL PNG_EXPORT_LAST_ORDINAL(244); diff --git a/src/libpng/pngconf.h b/src/libpng/pngconf.h index 72ec81fa2..13f48f73b 100644 --- a/src/libpng/pngconf.h +++ b/src/libpng/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.6.12 - June 12, 2014 + * libpng version 1.6.14 - October 23, 2014 * * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/src/libpng/pngerror.c b/src/libpng/pngerror.c index f21f4dda5..a2f8a563d 100644 --- a/src/libpng/pngerror.c +++ b/src/libpng/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.6.11 [June 12, 2014] + * Last changed in libpng 1.6.13 [August 21, 2014] * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -415,10 +415,13 @@ png_app_error(png_const_structrp png_ptr, png_const_charp error_message) } #endif /* BENIGN_ERRORS */ +#define PNG_MAX_ERROR_TEXT 196 /* Currently limited by profile_error in png.c */ +#if defined(PNG_WARNINGS_SUPPORTED) || \ + (defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)) /* These utilities are used internally to build an error message that relates * to the current chunk. The chunk name comes from png_ptr->chunk_name, - * this is used to prefix the message. The message is limited in length - * to 63 bytes, the name characters are output as hex digits wrapped in [] + * which is used to prefix the message. The message is limited in length + * to 63 bytes. The name characters are output as hex digits wrapped in [] * if the character is invalid. */ #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) @@ -427,9 +430,6 @@ static PNG_CONST char png_digit[16] = { 'A', 'B', 'C', 'D', 'E', 'F' }; -#define PNG_MAX_ERROR_TEXT 196 /* Currently limited be profile_error in png.c */ -#if defined(PNG_WARNINGS_SUPPORTED) || \ - (defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)) static void /* PRIVATE */ png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp error_message) diff --git a/src/libpng/pngget.c b/src/libpng/pngget.c index 9e205ad1e..172f50a90 100644 --- a/src/libpng/pngget.c +++ b/src/libpng/pngget.c @@ -1,7 +1,7 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.6.11 [June 12, 2014] + * Last changed in libpng 1.6.11 [June 5, 2014] * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) diff --git a/src/libpng/pngpread.c b/src/libpng/pngpread.c index 819db0305..bcd9261df 100644 --- a/src/libpng/pngpread.c +++ b/src/libpng/pngpread.c @@ -1,7 +1,7 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.6.11 [June 12, 2014] + * Last changed in libpng 1.6.14 [October 23, 2014] * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -26,6 +26,13 @@ #define PNG_READ_iTXt_MODE 7 #define PNG_ERROR_MODE 8 +#define PNG_PUSH_SAVE_BUFFER_IF_FULL \ +if (png_ptr->push_length + 4 > png_ptr->buffer_size) \ + { png_push_save_buffer(png_ptr); return; } +#define PNG_PUSH_SAVE_BUFFER_IF_LT(N) \ +if (png_ptr->buffer_size < N) \ + { png_push_save_buffer(png_ptr); return; } + void PNGAPI png_process_data(png_structrp png_ptr, png_inforp info_ptr, png_bytep buffer, png_size_t buffer_size) @@ -46,7 +53,7 @@ png_process_data_pause(png_structrp png_ptr, int save) { if (png_ptr != NULL) { - /* It's easiest for the caller if we do the save, then the caller doesn't + /* It's easiest for the caller if we do the save; then the caller doesn't * have to supply the same data again: */ if (save != 0) @@ -189,10 +196,10 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) int keep; /* unknown handling method */ #endif - /* First we make sure we have enough data for the 4 byte chunk name - * and the 4 byte chunk length before proceeding with decoding the + /* First we make sure we have enough data for the 4-byte chunk name + * and the 4-byte chunk length before proceeding with decoding the * chunk data. To fully decode each of these chunks, we also make - * sure we have enough data in the buffer for the 4 byte CRC at the + * sure we have enough data in the buffer for the 4-byte CRC at the * end of every chunk (except IDAT, which is handled separately). */ if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) @@ -200,12 +207,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) png_byte chunk_length[4]; png_byte chunk_tag[4]; - if (png_ptr->buffer_size < 8) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_LT(8) 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); @@ -249,23 +251,13 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) if (png_ptr->push_length != 13) png_error(png_ptr, "Invalid IHDR length"); - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length); } else if (chunk_name == png_IEND) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length); png_ptr->process_mode = PNG_READ_DONE_MODE; @@ -275,12 +267,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, keep); if (chunk_name == png_PLTE) @@ -290,11 +277,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) else if (chunk_name == png_PLTE) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length); } @@ -313,12 +296,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_gAMA_SUPPORTED else if (png_ptr->chunk_name == png_gAMA) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length); } @@ -326,12 +304,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_sBIT_SUPPORTED else if (png_ptr->chunk_name == png_sBIT) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length); } @@ -339,12 +312,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_cHRM_SUPPORTED else if (png_ptr->chunk_name == png_cHRM) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length); } @@ -352,12 +320,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_sRGB_SUPPORTED else if (chunk_name == png_sRGB) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length); } @@ -365,12 +328,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_iCCP_SUPPORTED else if (png_ptr->chunk_name == png_iCCP) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length); } @@ -378,12 +336,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_sPLT_SUPPORTED else if (chunk_name == png_sPLT) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length); } @@ -391,12 +344,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_tRNS_SUPPORTED else if (chunk_name == png_tRNS) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length); } @@ -404,12 +352,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_bKGD_SUPPORTED else if (chunk_name == png_bKGD) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length); } @@ -417,12 +360,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_hIST_SUPPORTED else if (chunk_name == png_hIST) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length); } @@ -430,12 +368,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_pHYs_SUPPORTED else if (chunk_name == png_pHYs) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length); } @@ -443,12 +376,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_oFFs_SUPPORTED else if (chunk_name == png_oFFs) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length); } #endif @@ -456,12 +384,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_pCAL_SUPPORTED else if (chunk_name == png_pCAL) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length); } @@ -469,12 +392,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_sCAL_SUPPORTED else if (chunk_name == png_sCAL) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length); } @@ -482,12 +400,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_tIME_SUPPORTED else if (chunk_name == png_tIME) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length); } @@ -495,12 +408,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_tEXt_SUPPORTED else if (chunk_name == png_tEXt) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length); } @@ -508,12 +416,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_zTXt_SUPPORTED else if (chunk_name == png_zTXt) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length); } @@ -521,23 +424,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_iTXt_SUPPORTED else if (chunk_name == png_iTXt) { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length); } #endif else { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } + PNG_PUSH_SAVE_BUFFER_IF_FULL png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, PNG_HANDLE_CHUNK_AS_DEFAULT); } @@ -602,12 +496,7 @@ png_push_crc_finish(png_structrp png_ptr) } if (!png_ptr->skip_length) { - if (png_ptr->buffer_size < 4) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_LT(4) png_crc_finish(png_ptr, 0); png_ptr->process_mode = PNG_READ_CHUNK_MODE; } @@ -732,12 +621,7 @@ 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 */ - if (png_ptr->buffer_size < 8) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_LT(8) 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); @@ -812,12 +696,7 @@ png_push_read_IDAT(png_structrp png_ptr) } if (!png_ptr->idat_size) { - if (png_ptr->buffer_size < 4) - { - png_push_save_buffer(png_ptr); - return; - } - + PNG_PUSH_SAVE_BUFFER_IF_LT(4) png_crc_finish(png_ptr, 0); png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; png_ptr->mode |= PNG_AFTER_IDAT; diff --git a/src/libpng/pngpriv.h b/src/libpng/pngpriv.h index c4983137c..aa63cfa47 100644 --- a/src/libpng/pngpriv.h +++ b/src/libpng/pngpriv.h @@ -119,8 +119,12 @@ * PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail * to compile with an appropriate #error if ALIGNED_MEMORY has been turned * off. + * + * Note that gcc-4.9 defines __ARM_NEON instead of __ARM_NEON__, so we + * check both variants. */ -# if defined(__ARM_NEON__) && defined(PNG_ALIGNED_MEMORY_SUPPORTED) +# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \ + defined(PNG_ALIGNED_MEMORY_SUPPORTED) # define PNG_ARM_NEON_OPT 2 # else # define PNG_ARM_NEON_OPT 0 @@ -148,7 +152,7 @@ * libpng implementation list for incorporation in the next minor release. */ # ifndef PNG_ARM_NEON_IMPLEMENTATION -# ifdef __ARM_NEON__ +# if defined(__ARM_NEON__) || defined(__ARM_NEON) # if defined(__clang__) /* At present it is unknown by the libpng developers which versions * of clang support the intrinsics, however some or perhaps all @@ -1086,7 +1090,7 @@ PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr, #ifdef PNG_WRITE_zTXt_SUPPORTED PNG_INTERNAL_FUNCTION(void,png_write_zTXt,(png_structrp png_ptr, png_const_charp - key, png_const_charp text, png_size_t text_len, int compression),PNG_EMPTY); + key, png_const_charp text, int compression),PNG_EMPTY); #endif #ifdef PNG_WRITE_iTXt_SUPPORTED diff --git a/src/libpng/pngread.c b/src/libpng/pngread.c index 4bf20219b..53b9c3b9b 100644 --- a/src/libpng/pngread.c +++ b/src/libpng/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.6.11 [June 12, 2014] + * Last changed in libpng 1.6.11 [June 5, 2014] * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -396,6 +396,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row) row_info.pixel_depth = png_ptr->pixel_depth; row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width); +#ifdef PNG_WARNINGS_SUPPORTED if (png_ptr->row_number == 0 && png_ptr->pass == 0) { /* Check for transforms that have been set but were defined out */ @@ -435,6 +436,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row) png_warning(png_ptr, "PNG_READ_SWAP_SUPPORTED is not defined"); #endif } +#endif /* PNG_WARNINGS_SUPPORTED */ #ifdef PNG_READ_INTERLACING_SUPPORTED /* If interlaced and we do not need a new row, combine row and return. @@ -945,7 +947,7 @@ png_read_destroy(png_structrp png_ptr) png_free(png_ptr, png_ptr->save_buffer); #endif -#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) &&\ +#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) && \ defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) png_free(png_ptr, png_ptr->unknown_chunk.data); #endif @@ -1220,7 +1222,7 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr, # define P_LINEAR8 4 /* 8-bit linear: only from a file value */ /* Color-map processing: after libpng has run on the PNG image further - * processing may be needed to conver the data to color-map indicies. + * processing may be needed to convert the data to color-map indices. */ #define PNG_CMAP_NONE 0 #define PNG_CMAP_GA 1 /* Process GA data to a color-map with alpha */ @@ -2187,7 +2189,7 @@ png_image_read_colormap(png_voidp argument) data_encoding = P_FILE; /* The rows from libpng, while technically gray values, are now also - * color-map indicies; however, they may need to be expanded to 1 + * color-map indices; however, they may need to be expanded to 1 * byte per pixel. This is what png_set_packing does (i.e., it * unpacks the bit values into bytes.) */ @@ -2273,8 +2275,8 @@ png_image_read_colormap(png_voidp argument) * 8-bit GA and it has to be processing to single byte color-map * values. Entry 254 is replaced by either a completely * transparent entry or by the background color at full - * precision (and the background color is not a simple gray leve - * in this case.) + * precision (and the background color is not a simple gray + * level in this case.) */ expand_tRNS = 1; output_processing = PNG_CMAP_TRANS; @@ -2752,7 +2754,7 @@ png_image_read_colormap(png_voidp argument) num_trans = 0; output_processing = PNG_CMAP_NONE; - data_encoding = P_FILE; /* Don't change from color-map indicies */ + data_encoding = P_FILE; /* Don't change from color-map indices */ cmap_entries = png_ptr->num_palette; if (cmap_entries > 256) cmap_entries = 256; @@ -2792,7 +2794,7 @@ png_image_read_colormap(png_voidp argument) i < num_trans ? trans[i] : 255U, P_FILE/*8-bit*/); } - /* The PNG data may have indicies packed in fewer than 8 bits, it + /* The PNG data may have indices packed in fewer than 8 bits, it * must be expanded if so. */ if (png_ptr->bit_depth < 8) diff --git a/src/libpng/pngrtran.c b/src/libpng/pngrtran.c index 5b8942397..91e647161 100644 --- a/src/libpng/pngrtran.c +++ b/src/libpng/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.6.11 [June 12, 2014] + * Last changed in libpng 1.6.11 [June 5, 2014] * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -959,7 +959,7 @@ png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action, if (!png_rtran_ok(png_ptr, 1)) return; - switch(error_action) + switch (error_action) { case PNG_ERROR_ACTION_NONE: png_ptr->transformations |= PNG_RGB_TO_GRAY; diff --git a/src/libpng/pngrutil.c b/src/libpng/pngrutil.c index cc52202a5..a48907aeb 100644 --- a/src/libpng/pngrutil.c +++ b/src/libpng/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.6.11 [June 12, 2014] + * Last changed in libpng 1.6.14 [October 23, 2014] * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -341,12 +341,12 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) * are minimal. */ (void)png_safecat(msg, (sizeof msg), 4, " using zstream"); -# if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC - png_chunk_warning(png_ptr, msg); - png_ptr->zowner = 0; -# else - png_chunk_error(png_ptr, msg); -# endif +#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC + png_chunk_warning(png_ptr, msg); + png_ptr->zowner = 0; +#else + png_chunk_error(png_ptr, msg); +#endif } /* Implementation note: unlike 'png_deflate_claim' this internal function @@ -364,22 +364,21 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) */ { int ret; /* zlib return code */ -# if PNG_ZLIB_VERNUM >= 0x1240 +#if PNG_ZLIB_VERNUM >= 0x1240 -# if defined(PNG_SET_OPTION_SUPPORTED) && \ - defined(PNG_MAXIMUM_INFLATE_WINDOW) - int window_bits; +# if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW) + int window_bits; - if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) == - PNG_OPTION_ON) - window_bits = 15; + if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) == + PNG_OPTION_ON) + window_bits = 15; - else - window_bits = 0; -# else -# define window_bits 0 -# endif -# endif + else + window_bits = 0; +# else +# define window_bits 0 +# endif +#endif /* Set this for safety, just in case the previous owner left pointers to * memory allocations. @@ -391,20 +390,20 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) if (png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) { -# if PNG_ZLIB_VERNUM < 0x1240 - ret = inflateReset(&png_ptr->zstream); -# else - ret = inflateReset2(&png_ptr->zstream, window_bits); -# endif +#if PNG_ZLIB_VERNUM < 0x1240 + ret = inflateReset(&png_ptr->zstream); +#else + ret = inflateReset2(&png_ptr->zstream, window_bits); +#endif } else { -# if PNG_ZLIB_VERNUM < 0x1240 - ret = inflateInit(&png_ptr->zstream); -# else - ret = inflateInit2(&png_ptr->zstream, window_bits); -# endif +#if PNG_ZLIB_VERNUM < 0x1240 + ret = inflateInit(&png_ptr->zstream); +#else + ret = inflateInit2(&png_ptr->zstream, window_bits); +#endif if (ret == Z_OK) png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED; @@ -419,9 +418,9 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) return ret; } -# ifdef window_bits -# undef window_bits -# endif +#ifdef window_bits +# undef window_bits +#endif } #ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED @@ -518,7 +517,7 @@ png_inflate(png_structrp png_ptr, png_uint_32 owner, int finish, * end of the output buffer. */ ret = inflate(&png_ptr->zstream, avail_out > 0 ? Z_NO_FLUSH : - (finish ? Z_FINISH : Z_SYNC_FLUSH)); + (finish ? Z_FINISH : Z_SYNC_FLUSH)); } while (ret == Z_OK); /* For safety kill the local buffer pointer now */ @@ -576,14 +575,14 @@ png_decompress_chunk(png_structrp png_ptr, */ png_alloc_size_t limit = PNG_SIZE_MAX; -# ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED - if (png_ptr->user_chunk_malloc_max > 0 && - png_ptr->user_chunk_malloc_max < limit) - limit = png_ptr->user_chunk_malloc_max; -# elif PNG_USER_CHUNK_MALLOC_MAX > 0 - if (PNG_USER_CHUNK_MALLOC_MAX < limit) - limit = PNG_USER_CHUNK_MALLOC_MAX; -# endif +# ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED + if (png_ptr->user_chunk_malloc_max > 0 && + png_ptr->user_chunk_malloc_max < limit) + limit = png_ptr->user_chunk_malloc_max; +# elif PNG_USER_CHUNK_MALLOC_MAX > 0 + if (PNG_USER_CHUNK_MALLOC_MAX < limit) + limit = PNG_USER_CHUNK_MALLOC_MAX; +# endif if (limit >= prefix_size + (terminate != 0)) { @@ -1011,7 +1010,7 @@ png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) */ #ifdef PNG_READ_tRNS_SUPPORTED if (png_ptr->num_trans > 0 || - (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS) != 0)) + (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS) != 0)) { /* Cancel this because otherwise it would be used if the transforms * require it. Don't cancel the 'valid' flag because this would prevent @@ -1319,9 +1318,9 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) * chunk is just ignored, so does not invalidate the color space. An * alternative is to set the 'invalid' flags at the start of this routine * and only clear them in they were not set before and all the tests pass. - * The minimum 'deflate' stream is assumed to be just the 2 byte header and 4 - * byte checksum. The keyword must be one character and there is a - * terminator (0) byte and the compression method. + * The minimum 'deflate' stream is assumed to be just the 2 byte header and + * 4 byte checksum. The keyword must be at least one character and there is + * a terminator (0) byte and the compression method. */ if (length < 9) { @@ -2640,7 +2639,7 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) /* prefix_length should now be at the trailing '\0' of the translated * keyword, but it may already be over the end. None of this arithmetic * can overflow because chunks are at most 2^31 bytes long, but on 16-bit - * systems the available allocaton may overflow. + * systems the available allocation may overflow. */ ++prefix_length; @@ -2672,7 +2671,7 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) buffer[uncompressed_length+prefix_length] = 0; - if (compressed != 0) + if (compressed == 0) text.compression = PNG_ITXT_COMPRESSION_NONE; else @@ -3331,7 +3330,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) /* This can only be the RGB case, so each copy is exactly one * pixel and it is not necessary to check for a partial copy. */ - for(;;) + for (;;) { dp[0] = sp[0], dp[1] = sp[1], dp[2] = sp[2]; diff --git a/src/libpng/pngset.c b/src/libpng/pngset.c index 0c827d3c1..8eb5f6e30 100644 --- a/src/libpng/pngset.c +++ b/src/libpng/pngset.c @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.6.11 [June 12, 2014] + * Last changed in libpng 1.6.11 [June 5, 2014] * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -726,7 +726,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr, else max_text = INT_MAX; - /* Now allocate a new array and copy the old members in, this does all + /* Now allocate a new array and copy the old members in; this does all * the overflow checks. */ new_text = png_voidcast(png_textp,png_realloc_array(png_ptr, @@ -1020,8 +1020,8 @@ png_set_sPLT(png_const_structrp png_ptr, np->depth = entries->depth; - /* In the even of out-of-memory just return - there's no point keeping on - * trying to add sPLT chunks. + /* In the event of out-of-memory just return - there's no point keeping + * on trying to add sPLT chunks. */ length = strlen(entries->name) + 1; np->name = png_voidcast(png_charp, png_malloc_base(png_ptr, length)); @@ -1032,8 +1032,8 @@ png_set_sPLT(png_const_structrp png_ptr, memcpy(np->name, entries->name, length); /* IMPORTANT: we have memory now that won't get freed if something else - * goes wrong, this code must free it. png_malloc_array produces no - * warnings, use a png_chunk_report (below) if there is an error. + * goes wrong; this code must free it. png_malloc_array produces no + * warnings; use a png_chunk_report (below) if there is an error. */ np->entries = png_voidcast(png_sPLT_entryp, png_malloc_array(png_ptr, entries->nentries, sizeof (png_sPLT_entry))); @@ -1072,7 +1072,7 @@ check_location(png_const_structrp png_ptr, int location) location &= (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT); /* New in 1.6.0; copy the location and check it. This is an API - * change, previously the app had to use the + * change; previously the app had to use the * png_set_unknown_chunk_location API below for each chunk. */ if (location == 0 && !(png_ptr->mode & PNG_IS_READ_STRUCT)) @@ -1578,7 +1578,7 @@ png_set_benign_errors(png_structrp png_ptr, int allowed) * It is possible for an indexed (color-type==3) PNG file to contain * pixels with invalid (out-of-range) indexes if the PLTE chunk has * fewer entries than the image's bit-depth would allow. We recover - * from this gracefully by filling any incomplete palette with zeroes + * from this gracefully by filling any incomplete palette with zeros * (opaque black). By default, when this occurs libpng will issue * a benign error. This API can be used to override that behavior. */ diff --git a/src/libpng/pngtrans.c b/src/libpng/pngtrans.c index 792e13a44..631e3c15e 100644 --- a/src/libpng/pngtrans.c +++ b/src/libpng/pngtrans.c @@ -1,7 +1,7 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.6.11 [June 12, 2014] + * Last changed in libpng 1.6.11 [June 5, 2014] * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -828,7 +828,7 @@ png_get_user_transform_ptr(png_const_structrp png_ptr) png_uint_32 PNGAPI png_get_current_row_number(png_const_structrp png_ptr) { - /* See the comments in png.h - this is the sub-image row when reading and + /* See the comments in png.h - this is the sub-image row when reading an * interlaced image. */ if (png_ptr != NULL) diff --git a/src/libpng/pngwrite.c b/src/libpng/pngwrite.c index 7087d08cd..6a831f62c 100644 --- a/src/libpng/pngwrite.c +++ b/src/libpng/pngwrite.c @@ -1,7 +1,7 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.6.11 [June 12, 2014] + * Last changed in libpng 1.6.14 [October 23, 2014] * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -292,11 +292,14 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr) info_ptr->text[i].lang, info_ptr->text[i].lang_key, info_ptr->text[i].text); + /* Mark this chunk as written */ + if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; + else + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; #else - png_warning(png_ptr, "Unable to write international text"); + png_warning(png_ptr, "Unable to write international text"); #endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; } /* If we want a compressed text chunk */ @@ -305,13 +308,12 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr) #ifdef PNG_WRITE_zTXt_SUPPORTED /* Write compressed chunk */ png_write_zTXt(png_ptr, info_ptr->text[i].key, - info_ptr->text[i].text, 0, - info_ptr->text[i].compression); + info_ptr->text[i].text, info_ptr->text[i].compression); + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; #else png_warning(png_ptr, "Unable to write compressed text"); #endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; } else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) @@ -387,11 +389,14 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) info_ptr->text[i].lang, info_ptr->text[i].lang_key, info_ptr->text[i].text); + /* Mark this chunk as written */ + if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; + else + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; #else png_warning(png_ptr, "Unable to write international text"); #endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; } else if (info_ptr->text[i].compression >= PNG_TEXT_COMPRESSION_zTXt) @@ -399,13 +404,12 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_WRITE_zTXt_SUPPORTED /* Write compressed chunk */ png_write_zTXt(png_ptr, info_ptr->text[i].key, - info_ptr->text[i].text, 0, - info_ptr->text[i].compression); + info_ptr->text[i].text, info_ptr->text[i].compression); + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; #else png_warning(png_ptr, "Unable to write compressed text"); #endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; } else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) @@ -414,12 +418,11 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) /* Write uncompressed chunk */ png_write_tEXt(png_ptr, info_ptr->text[i].key, info_ptr->text[i].text, 0); + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; #else png_warning(png_ptr, "Unable to write uncompressed text"); #endif - - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; } } #endif diff --git a/src/libpng/pngwutil.c b/src/libpng/pngwutil.c index cfc331246..45b6b1e35 100644 --- a/src/libpng/pngwutil.c +++ b/src/libpng/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.6.11 [June 12, 2014] + * Last changed in libpng 1.6.14 [October 23, 2014] * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -136,7 +136,7 @@ png_write_chunk_data(png_structrp png_ptr, png_const_bytep data, png_write_data(png_ptr, data, length); /* Update the CRC after writing the data, - * in case that the user I/O routine alters it. + * in case the user I/O routine alters it. */ png_calculate_crc(png_ptr, data, length); } @@ -181,7 +181,7 @@ png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name, /* On 64 bit architectures 'length' may not fit in a png_uint_32. */ if (length > PNG_UINT_31_MAX) - png_error(png_ptr, "length exceeds PNG maxima"); + png_error(png_ptr, "length exceeds PNG maximum"); png_write_chunk_header(png_ptr, chunk_name, (png_uint_32)length); png_write_chunk_data(png_ptr, data, length); @@ -204,7 +204,7 @@ png_write_chunk(png_structrp png_ptr, png_const_bytep chunk_string, static png_alloc_size_t png_image_size(png_structrp png_ptr) { - /* Only return sizes up to the maximum of a png_uint_32, do this by limiting + /* Only return sizes up to the maximum of a png_uint_32; do this by limiting * the width and height used to 15 bits. */ png_uint_32 h = png_ptr->height; @@ -297,6 +297,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner, { if (png_ptr->zowner != 0) { +# if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED) char msg[64]; PNG_STRING_FROM_CHUNK(msg, owner); @@ -308,6 +309,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner, * are minimal. */ (void)png_safecat(msg, (sizeof msg), 10, " using zstream"); +# endif # if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC png_warning(png_ptr, msg); @@ -492,7 +494,7 @@ png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name, int ret; /* To find the length of the output it is necessary to first compress the - * input, the result is buffered rather than using the two-pass algorithm + * input. The result is buffered rather than using the two-pass algorithm * that is used on the inflate side; deflate is assumed to be slower and a * PNG writer is assumed to have more memory available than a PNG reader. * @@ -589,7 +591,7 @@ png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name, } while (ret == Z_OK); - /* There may be some space left in the last output buffer, this needs to + /* There may be some space left in the last output buffer. This needs to * be subtracted from output_len. */ output_len -= png_ptr->zstream.avail_out; @@ -612,7 +614,7 @@ png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name, /* Reset zlib for another zTXt/iTXt or image data */ png_ptr->zowner = 0; - /* The only success case is Z_STREAM_END, input_len must be 0, if not this + /* The only success case is Z_STREAM_END, input_len must be 0; if not this * is an internal error. */ if (ret == Z_STREAM_END && input_len == 0) @@ -728,6 +730,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key) if (key_len == 0) return 0; +#ifdef PNG_WARNINGS_SUPPORTED /* Try to only output one warning per keyword: */ if (*key) /* keyword too long */ png_warning(png_ptr, "keyword truncated"); @@ -741,6 +744,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key) png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'"); } +#endif /* PNG_WARNINGS_SUPPORTED */ return key_len; } @@ -998,7 +1002,7 @@ png_write_PLTE(png_structrp png_ptr, png_const_colorp palette, * Z_FINISH: this is the end of the input, do a Z_FINISH and clean up * * The routine manages the acquire and release of the png_ptr->zstream by - * checking and (at the end) clearing png_ptr->zowner, it does some sanity + * checking and (at the end) clearing png_ptr->zowner; it does some sanity * checks on the 'mode' flags while doing this. */ void /* PRIVATE */ @@ -1058,7 +1062,7 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, input_len += png_ptr->zstream.avail_in; png_ptr->zstream.avail_in = 0; - /* OUTPUT: write complete IDAT chunks when avail_out drops to zero, note + /* OUTPUT: write complete IDAT chunks when avail_out drops to zero. Note * that these two zstream fields are preserved across the calls, therefore * there is no need to set these up on entry to the loop. */ @@ -1090,7 +1094,7 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, continue; } - /* The order of these checks doesn't matter much; it just effect which + /* The order of these checks doesn't matter much; it just affects which * possible error might be detected if multiple things go wrong at once. */ if (ret == Z_OK) /* most likely return code! */ @@ -1621,14 +1625,13 @@ png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text, /* Write a compressed text chunk */ void /* PRIVATE */ png_write_zTXt(png_structrp png_ptr, png_const_charp key, png_const_charp text, - png_size_t text_len, int compression) + int compression) { png_uint_32 key_len; png_byte new_key[81]; compression_state comp; png_debug(1, "in png_write_zTXt"); - PNG_UNUSED(text_len) /* Always use strlen */ if (compression == PNG_TEXT_COMPRESSION_NONE) { diff --git a/src/macosx/Info-Stella.plist b/src/macosx/Info-Stella.plist index 84a012dc9..9922a684f 100644 --- a/src/macosx/Info-Stella.plist +++ b/src/macosx/Info-Stella.plist @@ -53,7 +53,7 @@ CFBundleSignature StLa CFBundleVersion - 4.2 + 4.5 LSMinimumSystemVersionByArchitecture i386 diff --git a/src/unix/stella.spec b/src/unix/stella.spec index f5f81b8c4..8f6e89e7e 100644 --- a/src/unix/stella.spec +++ b/src/unix/stella.spec @@ -1,5 +1,5 @@ %define name stella -%define version 4.2 +%define version 4.5 %define rel 1 %define enable_sound 1 @@ -101,6 +101,9 @@ rm -rf $RPM_BUILD_DIR/%{name}-%{version} %_datadir/icons/large/%{name}.png %changelog +* xxx Dec xx 2014 Stephen Anthony 4.5-1 +- Version 4.5 release + * Tue Oct 28 2014 Stephen Anthony 4.2-1 - Version 4.2 release diff --git a/src/windows/stella.rc b/src/windows/stella.rc index ce2e638bc..6d3450700 100755 --- a/src/windows/stella.rc +++ b/src/windows/stella.rc @@ -36,8 +36,8 @@ IDI_ICON ICON "stella.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,2,0,0 - PRODUCTVERSION 4,2,0,0 + FILEVERSION 4,5,0,0 + PRODUCTVERSION 4,5,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -55,12 +55,12 @@ BEGIN VALUE "Comments", "The multi-platform Atari 2600 emulator. Stella is released under the GPLv2." VALUE "CompanyName", "The Stella Team (http://stella.sourceforge.net)" VALUE "FileDescription", "Stella" - VALUE "FileVersion", "4.2" + VALUE "FileVersion", "4.5" VALUE "InternalName", "Stella" VALUE "LegalCopyright", "Copyright (C) 1995-2014 The Stella Team" VALUE "OriginalFilename", "Stella.exe" VALUE "ProductName", "Stella" - VALUE "ProductVersion", "4.2" + VALUE "ProductVersion", "4.5" END END BLOCK "VarFileInfo"