diff options
| -rw-r--r-- | html/en/history.html | 4 | ||||
| -rw-r--r-- | html/en/liblzf.txt | 5 | ||||
| -rw-r--r-- | html/en/libpng.txt | 6 | ||||
| -rw-r--r-- | include/im_format_all.h | 2 | ||||
| -rw-r--r-- | include/im_util.h | 6 | ||||
| -rw-r--r-- | mak.vc9/im_view.vcproj | 4 | ||||
| -rw-r--r-- | src/liblzf/lzf.h | 37 | ||||
| -rw-r--r-- | src/liblzf/lzfP.h | 68 | ||||
| -rw-r--r-- | src/liblzf/lzf_c.c | 288 | ||||
| -rw-r--r-- | src/liblzf/lzf_d.c | 70 | ||||
| -rw-r--r-- | src/libpng/png.c | 22 | ||||
| -rw-r--r-- | src/libpng/png.h | 231 | ||||
| -rw-r--r-- | src/libpng/pngconf.h | 96 | ||||
| -rw-r--r-- | src/libpng/pngerror.c | 5 | ||||
| -rw-r--r-- | src/libpng/pngget.c | 8 | ||||
| -rw-r--r-- | src/libpng/pngmem.c | 5 | ||||
| -rw-r--r-- | src/libpng/pngpread.c | 7 | ||||
| -rw-r--r-- | src/libpng/pngread.c | 7 | ||||
| -rw-r--r-- | src/libpng/pngrio.c | 5 | ||||
| -rw-r--r-- | src/libpng/pngrtran.c | 25 | ||||
| -rw-r--r-- | src/libpng/pngrutil.c | 20 | ||||
| -rw-r--r-- | src/libpng/pngset.c | 28 | ||||
| -rw-r--r-- | src/libpng/pngtrans.c | 9 | ||||
| -rw-r--r-- | src/libpng/pngwio.c | 5 | ||||
| -rw-r--r-- | src/libpng/pngwrite.c | 5 | ||||
| -rw-r--r-- | src/libpng/pngwtran.c | 5 | ||||
| -rw-r--r-- | src/libpng/pngwutil.c | 24 | ||||
| -rw-r--r-- | src/lua5/imlua_image.c | 3 | 
28 files changed, 597 insertions, 403 deletions
| diff --git a/html/en/history.html b/html/en/history.html index 731a424..96404bd 100644 --- a/html/en/history.html +++ b/html/en/history.html @@ -23,8 +23,10 @@  		"FileFormat", "FileCompression" and "FileImageCount" when reading from   		file. Available for all formats.</li>  		<li><span style="color: #008000">Changed:</span> libPNG updated to version  -	1.2.37. Removed changes to the library that made it incompatible with other  +	1.2.39. Removed changes to the library that made it incompatible with other   		libPNG distributions.</li> +		<li><span style="color: #008000">Changed:</span> libLZF updated to  +		version 3.5.</li>  		<li><span style="color: #008000">Changed: <span              style="color: #000000"> <strong>imImageCreateBased</strong> and  		<strong>imConvertColorSpace</strong> now also  diff --git a/html/en/liblzf.txt b/html/en/liblzf.txt index 00ec071..9d8e6ec 100644 --- a/html/en/liblzf.txt +++ b/html/en/liblzf.txt @@ -1,4 +1,4 @@ -Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de> +Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de>  Redistribution and use in source and binary forms, with or without modifica-  tion, are permitted provided that the following conditions are met: @@ -10,9 +10,6 @@ tion, are permitted provided that the following conditions are met:        notice, this list of conditions and the following disclaimer in the        documentation and/or other materials provided with the distribution. -  3.  The name of the author may not be used to endorse or promote products -      derived from this software without specific prior written permission. -  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-  CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO diff --git a/html/en/libpng.txt b/html/en/libpng.txt index cdb787d..48eaead 100644 --- a/html/en/libpng.txt +++ b/html/en/libpng.txt @@ -8,7 +8,9 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:  If you modify libpng you may insert additional notices immediately following  this sentence. -libpng versions 1.2.6, August 15, 2004, through 1.2.37, June 4, 2009, are +This code is released under the libpng license. + +libpng versions 1.2.6, August 15, 2004, through 1.2.39, August 13, 2009, are  Copyright (c) 2004, 2006-2009 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 @@ -106,4 +108,4 @@ certification mark of the Open Source Initiative.  Glenn Randers-Pehrson  glennrp at users.sourceforge.net -June 4, 2009 +August 13, 2009 diff --git a/include/im_format_all.h b/include/im_format_all.h index 7ae8052..2a6ab96 100644 --- a/include/im_format_all.h +++ b/include/im_format_all.h @@ -176,7 +176,7 @@ void imFormatRegisterJPEG(void);   * \section Description   *   * \par - * Access to the PNG file format uses libPNG version 1.2.37. \n + * Access to the PNG file format uses libPNG version 1.2.39. \n   * http://www.libpng.org                                    \n   * Copyright (C) 1998-2009 Glenn Randers-Pehrson   * diff --git a/include/im_util.h b/include/im_util.h index ab50671..7858b39 100644 --- a/include/im_util.h +++ b/include/im_util.h @@ -241,9 +241,9 @@ void imBinSwapBytes8(void *data, int count);   * http://www.zlib.org/                                      \n   * Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler   * \par - * LZF compression support uses libLZF version 1.51.     \n - * http://liblzf.plan9.de/                                \n - * Copyright (C) 2000-2005 Marc Alexander Lehmann + * LZF compression support uses libLZF version 3.5.       \n + * http://software.schmorp.de/pkg/liblzf                  \n + * Copyright (C) 2000-2009 Marc Alexander Lehmann   * See \ref im_util.h   * \ingroup util */ diff --git a/mak.vc9/im_view.vcproj b/mak.vc9/im_view.vcproj index 64a71e6..4881ad3 100644 --- a/mak.vc9/im_view.vcproj +++ b/mak.vc9/im_view.vcproj @@ -106,10 +106,6 @@  				RelativePath="..\test\im_view.c"  				>  			</File> -			<File -				RelativePath="..\..\..\Downloads\_Tecgraf\image.cpp" -				> -			</File>  		</Filter>  	</Files>  	<Globals> diff --git a/src/liblzf/lzf.h b/src/liblzf/lzf.h index 8538609..919b6e6 100644 --- a/src/liblzf/lzf.h +++ b/src/liblzf/lzf.h @@ -1,5 +1,5 @@  /* - * Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de> + * Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp@schmorp.de>   *    * Redistribution and use in source and binary forms, with or without modifica-   * tion, are permitted provided that the following conditions are met: @@ -11,9 +11,6 @@   *       notice, this list of conditions and the following disclaimer in the   *       documentation and/or other materials provided with the distribution.   *  - *   3.  The name of the author may not be used to endorse or promote products - *       derived from this software without specific prior written permission. - *    * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-   * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO @@ -26,14 +23,15 @@   * OF THE POSSIBILITY OF SUCH DAMAGE.   *   * Alternatively, the contents of this file may be used under the terms of - * the GNU General Public License version 2 (the "GPL"), in which case the - * provisions of the GPL are applicable instead of the above. If you wish to - * allow the use of your version of this file only under the terms of the - * GPL and not to allow others to use your version of this file under the - * BSD license, indicate your decision by deleting the provisions above and - * replace them with the notice and other provisions required by the GPL. If - * you do not delete the provisions above, a recipient may use your version - * of this file under either the BSD or the GPL. + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL.   */  #ifndef LZF_H @@ -48,21 +46,22 @@  **  ***********************************************************************/ -#define LZF_VERSION 0x0105 /* 1.5 */ +#define LZF_VERSION 0x0105 /* 1.5, API version */  /*   * Compress in_len bytes stored at the memory block starting at   * in_data and write the result to out_data, up to a maximum length   * of out_len bytes.   * - * If the output buffer is not large enough or any error occurs - * return 0, otherwise return the number of bytes used (which might - * be considerably larger than in_len, so it makes sense to always - * use out_len == in_len - 1), to ensure _some_ compression, and store - * the data uncompressed otherwise. + * If the output buffer is not large enough or any error occurs return 0, + * otherwise return the number of bytes used, which might be considerably + * more than in_len (but less than 104% of the original size), so it + * makes sense to always use out_len == in_len - 1), to ensure _some_ + * compression, and store the data uncompressed otherwise (with a flag, of + * course.   *   * lzf_compress might use different algorithms on different systems and - * even diferent runs, thus might result in different compressed strings + * even different runs, thus might result in different compressed strings   * depending on the phase of the moon or similar factors. However, all   * these strings are architecture-independent and will result in the   * original data when decompressed using lzf_decompress. diff --git a/src/liblzf/lzfP.h b/src/liblzf/lzfP.h index 48963b2..d533f18 100644 --- a/src/liblzf/lzfP.h +++ b/src/liblzf/lzfP.h @@ -1,5 +1,5 @@  /* - * Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de> + * Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de>   *    * Redistribution and use in source and binary forms, with or without modifica-   * tion, are permitted provided that the following conditions are met: @@ -11,9 +11,6 @@   *       notice, this list of conditions and the following disclaimer in the   *       documentation and/or other materials provided with the distribution.   *  - *   3.  The name of the author may not be used to endorse or promote products - *       derived from this software without specific prior written permission. - *    * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-   * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO @@ -26,14 +23,15 @@   * OF THE POSSIBILITY OF SUCH DAMAGE.   *   * Alternatively, the contents of this file may be used under the terms of - * the GNU General Public License version 2 (the "GPL"), in which case the - * provisions of the GPL are applicable instead of the above. If you wish to - * allow the use of your version of this file only under the terms of the - * GPL and not to allow others to use your version of this file under the - * BSD license, indicate your decision by deleting the provisions above and - * replace them with the notice and other provisions required by the GPL. If - * you do not delete the provisions above, a recipient may use your version - * of this file under either the BSD or the GPL. + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL.   */  #ifndef LZFP_h @@ -46,29 +44,28 @@  #endif  /* - * size of hashtable is (1 << HLOG) * sizeof (char *) + * Size of hashtable is (1 << HLOG) * sizeof (char *)   * decompression is independent of the hash table size   * the difference between 15 and 14 is very small - * for small blocks (and 14 is usually a but faster). + * for small blocks (and 14 is usually a bit faster).   * For a low-memory/faster configuration, use HLOG == 13; - * For best compression, use 15 or 16 (or more). + * For best compression, use 15 or 16 (or more, up to 23).   */  #ifndef HLOG -# define HLOG 14 +# define HLOG 16  #endif  /* - * sacrifice very little compression quality in favour of compression speed. + * Sacrifice very little compression quality in favour of compression speed.   * This gives almost the same compression as the default code, and is - * (very roughly) 15% faster. This is the preferable mode of operation. + * (very roughly) 15% faster. This is the preferred mode of operation.   */ -  #ifndef VERY_FAST  # define VERY_FAST 1  #endif  /* - * sacrifice some more compression quality in favour of compression speed. + * Sacrifice some more compression quality in favour of compression speed.   * (roughly 1-2% worse compression for large blocks and   * 9-10% for small, redundant, blocks and >>20% better speed in both cases)   * In short: when in need for speed, enable this for binary data, @@ -79,30 +76,23 @@  #endif  /* - * unconditionally aligning does not cost very much, so do it if unsure + * Unconditionally aligning does not cost very much, so do it if unsure   */  #ifndef STRICT_ALIGN  # define STRICT_ALIGN !(defined(__i386) || defined (__amd64))  #endif  /* - * use string functions to copy memory. - * this is usually a loss, even with glibc's optimized memcpy - */ -#ifndef USE_MEMCPY -# define USE_MEMCPY 0 -#endif - -/* - * you may choose to pre-set the hash table (might be faster on some - * modern cpus and large (>>64k) blocks) + * You may choose to pre-set the hash table (might be faster on some + * modern cpus and large (>>64k) blocks, and also makes compression + * deterministic/repeatable when the configuration otherwise is the same).   */  #ifndef INIT_HTAB  # define INIT_HTAB 0  #endif  /* - * avoid assigning values to errno variable? for some embedding purposes + * Avoid assigning values to errno variable? for some embedding purposes   * (linux kernel for example), this is neccessary. NOTE: this breaks   * the documentation in lzf.h.   */ @@ -119,6 +109,18 @@  # define LZF_STATE_ARG 0  #endif +/* + * Wether to add extra checks for input validity in lzf_decompress + * and return EINVAL if the input stream has been corrupted. This + * only shields against overflowing the input buffer and will not + * detect most corrupted streams. + * This check is not normally noticable on modern hardware + * (<1% slowdown), but might slow down older cpus considerably. + */ +#ifndef CHECK_INPUT +# define CHECK_INPUT 1 +#endif +  /*****************************************************************************/  /* nothing should be changed below */ @@ -145,7 +147,7 @@ typedef const u8 *LZF_STATE[1 << (HLOG)];  # endif  #endif -#if USE_MEMCPY || INIT_HTAB +#if INIT_HTAB  # ifdef __cplusplus  #  include <cstring>  # else diff --git a/src/liblzf/lzf_c.c b/src/liblzf/lzf_c.c index b9b9ef9..0b5d816 100644 --- a/src/liblzf/lzf_c.c +++ b/src/liblzf/lzf_c.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de> + * Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp@schmorp.de>   *    * Redistribution and use in source and binary forms, with or without modifica-   * tion, are permitted provided that the following conditions are met: @@ -11,9 +11,6 @@   *       notice, this list of conditions and the following disclaimer in the   *       documentation and/or other materials provided with the distribution.   *  - *   3.  The name of the author may not be used to endorse or promote products - *       derived from this software without specific prior written permission. - *    * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-   * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO @@ -26,14 +23,15 @@   * OF THE POSSIBILITY OF SUCH DAMAGE.   *   * Alternatively, the contents of this file may be used under the terms of - * the GNU General Public License version 2 (the "GPL"), in which case the - * provisions of the GPL are applicable instead of the above. If you wish to - * allow the use of your version of this file only under the terms of the - * GPL and not to allow others to use your version of this file under the - * BSD license, indicate your decision by deleting the provisions above and - * replace them with the notice and other provisions required by the GPL. If - * you do not delete the provisions above, a recipient may use your version - * of this file under either the BSD or the GPL. + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL.   */  #include "lzfP.h" @@ -49,12 +47,18 @@  #ifndef FRST  # define FRST(p) (((p[0]) << 8) | p[1])  # define NEXT(v,p) (((v) << 8) | p[2]) -# define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1)) +# if ULTRA_FAST +#  define IDX(h) ((( h             >> (3*8 - HLOG)) - h  ) & (HSIZE - 1)) +# elif VERY_FAST +#  define IDX(h) ((( h             >> (3*8 - HLOG)) - h*5) & (HSIZE - 1)) +# else +#  define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1)) +# endif  #endif  /*   * IDX works because it is very similar to a multiplicative hash, e.g.   * ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1)) - * the latter is also quite fast on newer CPUs, and sligthly better + * the latter is also quite fast on newer CPUs, and compresses similarly.   *   * the next one is also quite good, albeit slow ;)   * (int)(cos(h & 0xffffff) * 1e6) @@ -69,7 +73,18 @@  #define        MAX_LIT        (1 <<  5)  #define        MAX_OFF        (1 << 13) -#define        MAX_REF        ((1 <<  8) + (1 << 3)) +#define        MAX_REF        ((1 << 8) + (1 << 3)) + +#if __GNUC__ >= 3 +# define expect(expr,value)         __builtin_expect ((expr),(value)) +# define inline                     inline +#else +# define expect(expr,value)         (expr) +# define inline                     static +#endif + +#define expect_false(expr) expect ((expr) != 0, 0) +#define expect_true(expr)  expect ((expr) != 0, 1)  /*   * compressed format @@ -84,7 +99,7 @@ unsigned int  lzf_compress (const void *const in_data, unsigned int in_len,  	      void *out_data, unsigned int out_len  #if LZF_STATE_ARG -              , LZF_STATE *htab +              , LZF_STATE htab  #endif                )  { @@ -98,145 +113,184 @@ lzf_compress (const void *const in_data, unsigned int in_len,          u8 *out_end = op + out_len;    const u8 *ref; -  unsigned int hval = FRST (ip); +  /* off requires a type wide enough to hold a general pointer difference. +   * ISO C doesn't have that (size_t might not be enough and ptrdiff_t only +   * works for differences within a single object). We also assume that no +   * no bit pattern traps. Since the only platform that is both non-POSIX +   * and fails to support both assumptions is windows 64 bit, we make a +   * special workaround for it. +   */ +#if defined (WIN32) && defined (_M_X64) +  unsigned _int64 off; /* workaround for missing POSIX compliance */ +#else    unsigned long off; -           int lit = 0; +#endif +  unsigned int hval; +  int lit; + +  if (!in_len || !out_len) +    return 0;  #if INIT_HTAB -# if USE_MEMCPY -    memset (htab, 0, sizeof (htab)); -# else -    for (hslot = htab; hslot < htab + HSIZE; hslot++) -      *hslot++ = ip; +  memset (htab, 0, sizeof (htab)); +# if 0 +  for (hslot = htab; hslot < htab + HSIZE; hslot++) +    *hslot++ = ip;  # endif  #endif -  for (;;) +  lit = 0; op++; /* start run */ + +  hval = FRST (ip); +  while (ip < in_end - 2)      { -      if (ip < in_end - 2) -        { -          hval = NEXT (hval, ip); -          hslot = htab + IDX (hval); -          ref = *hslot; *hslot = ip; +      hval = NEXT (hval, ip); +      hslot = htab + IDX (hval); +      ref = *hslot; *hslot = ip; -          if (1 -#if INIT_HTAB && !USE_MEMCPY -              && ref < ip /* the next test will actually take care of this, but this is faster */ +      if (1 +#if INIT_HTAB +          && ref < ip /* the next test will actually take care of this, but this is faster */  #endif -              && (off = ip - ref - 1) < MAX_OFF -              && ip + 4 < in_end -              && ref > (u8 *)in_data +          && (off = ip - ref - 1) < MAX_OFF +          && ip + 4 < in_end +          && ref > (u8 *)in_data  #if STRICT_ALIGN -              && ref[0] == ip[0] -              && ref[1] == ip[1] -              && ref[2] == ip[2] +          && ref[0] == ip[0] +          && ref[1] == ip[1] +          && ref[2] == ip[2]  #else -              && *(u16 *)ref == *(u16 *)ip -              && ref[2] == ip[2] +          && *(u16 *)ref == *(u16 *)ip +          && ref[2] == ip[2]  #endif -            ) +        ) +        { +          /* match found at *ref++ */ +          unsigned int len = 2; +          unsigned int maxlen = in_end - ip - len; +          maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; + +          if (expect_false (op + 3 + 1 >= out_end)) /* first a faster conservative test */ +            if (op - !lit + 3 + 1 >= out_end) /* second the exact but rare test */ +              return 0; + +          op [- lit - 1] = lit - 1; /* stop run */ +          op -= !lit; /* undo run if length is zero */ + +          for (;;)              { -              /* match found at *ref++ */ -              unsigned int len = 2; -              unsigned int maxlen = in_end - ip - len; -              maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; +              if (expect_true (maxlen > 16)) +                { +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; + +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; -              if (op + lit + 1 + 3 >= out_end) -                return 0; +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; + +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; +                  len++; if (ref [len] != ip [len]) break; +                }                do                  len++;                while (len < maxlen && ref[len] == ip[len]); -              if (lit) -                { -                  *op++ = lit - 1; -                  lit = -lit; -                  do -                    *op++ = ip[lit]; -                  while (++lit); -                } +              break; +            } -              len -= 2; -              ip++; +          len -= 2; /* len is now #octets - 1 */ +          ip++; -              if (len < 7) -                { -                  *op++ = (off >> 8) + (len << 5); -                } -              else -                { -                  *op++ = (off >> 8) + (  7 << 5); -                  *op++ = len - 7; -                } +          if (len < 7) +            { +              *op++ = (off >> 8) + (len << 5); +            } +          else +            { +              *op++ = (off >> 8) + (  7 << 5); +              *op++ = len - 7; +            } -              *op++ = off; +          *op++ = off; +          lit = 0; op++; /* start run */ + +          ip += len + 1; + +          if (expect_false (ip >= in_end - 2)) +            break;  #if ULTRA_FAST || VERY_FAST -              ip += len; -#if VERY_FAST && !ULTRA_FAST -              --ip; -#endif -              hval = FRST (ip); +          --ip; +# if VERY_FAST && !ULTRA_FAST +          --ip; +# endif +          hval = FRST (ip); -              hval = NEXT (hval, ip); -              htab[IDX (hval)] = ip; -              ip++; +          hval = NEXT (hval, ip); +          htab[IDX (hval)] = ip; +          ip++; + +# if VERY_FAST && !ULTRA_FAST +          hval = NEXT (hval, ip); +          htab[IDX (hval)] = ip; +          ip++; +# endif +#else +          ip -= len + 1; -#if VERY_FAST && !ULTRA_FAST +          do +            {                hval = NEXT (hval, ip);                htab[IDX (hval)] = ip;                ip++; -#endif -#else -              do -                { -                  hval = NEXT (hval, ip); -                  htab[IDX (hval)] = ip; -                  ip++; -                } -              while (len--); -#endif -              continue;              } +          while (len--); +#endif          } -      else if (ip == in_end) -        break; - -      /* one more literal byte we must copy */ -      lit++; -      ip++; - -      if (lit == MAX_LIT) +      else          { -          if (op + 1 + MAX_LIT >= out_end) +          /* one more literal byte we must copy */ +          if (expect_false (op >= out_end))              return 0; -          *op++ = MAX_LIT - 1; -#if USE_MEMCPY -          memcpy (op, ip - MAX_LIT, MAX_LIT); -          op += MAX_LIT; -          lit = 0; -#else -          lit = -lit; -          do -            *op++ = ip[lit]; -          while (++lit); -#endif +          lit++; *op++ = *ip++; + +          if (expect_false (lit == MAX_LIT)) +            { +              op [- lit - 1] = lit - 1; /* stop run */ +              lit = 0; op++; /* start run */ +            }          }      } -  if (lit) +  if (op + 3 > out_end) /* at most 3 bytes can be missing here */ +    return 0; + +  while (ip < in_end)      { -      if (op + lit + 1 >= out_end) -	return 0; - -      *op++ = lit - 1; -      lit = -lit; -      do -	*op++ = ip[lit]; -      while (++lit); +      lit++; *op++ = *ip++; + +      if (expect_false (lit == MAX_LIT)) +        { +          op [- lit - 1] = lit - 1; /* stop run */ +          lit = 0; op++; /* start run */ +        }      } -  return op - (u8 *) out_data; +  op [- lit - 1] = lit - 1; /* end run */ +  op -= !lit; /* undo run if length is zero */ + +  return op - (u8 *)out_data;  } + diff --git a/src/liblzf/lzf_d.c b/src/liblzf/lzf_d.c index d0229d7..9e2cd82 100644 --- a/src/liblzf/lzf_d.c +++ b/src/liblzf/lzf_d.c @@ -1,5 +1,5 @@  /* - * Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de> + * Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de>   *    * Redistribution and use in source and binary forms, with or without modifica-   * tion, are permitted provided that the following conditions are met: @@ -11,9 +11,6 @@   *       notice, this list of conditions and the following disclaimer in the   *       documentation and/or other materials provided with the distribution.   *  - *   3.  The name of the author may not be used to endorse or promote products - *       derived from this software without specific prior written permission. - *    * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-   * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO @@ -26,14 +23,15 @@   * OF THE POSSIBILITY OF SUCH DAMAGE.   *   * Alternatively, the contents of this file may be used under the terms of - * the GNU General Public License version 2 (the "GPL"), in which case the - * provisions of the GPL are applicable instead of the above. If you wish to - * allow the use of your version of this file only under the terms of the - * GPL and not to allow others to use your version of this file under the - * BSD license, indicate your decision by deleting the provisions above and - * replace them with the notice and other provisions required by the GPL. If - * you do not delete the provisions above, a recipient may use your version - * of this file under either the BSD or the GPL. + * the GNU General Public License ("GPL") version 2 or any later version, + * in which case the provisions of the GPL are applicable instead of + * the above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your + * version of this file under the BSD license, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete the + * provisions above, a recipient may use your version of this file under + * either the BSD or the GPL.   */  #include "lzfP.h" @@ -45,6 +43,13 @@  # define SET_ERRNO(n) errno = (n)  #endif +#if (__i386 || __amd64) && __GNUC__ >= 3 +# define lzf_movsb(dst, src, len)                \ +   asm ("rep movsb"                              \ +        : "=D" (dst), "=S" (src), "=c" (len)     \ +        :  "0" (dst),  "1" (src),  "2" (len)); +#endif +  unsigned int   lzf_decompress (const void *const in_data,  unsigned int in_len,                  void             *out_data, unsigned int out_len) @@ -68,10 +73,16 @@ lzf_decompress (const void *const in_data,  unsigned int in_len,                return 0;              } -#if USE_MEMCPY -          memcpy (op, ip, ctrl); -          op += ctrl; -          ip += ctrl; +#if CHECK_INPUT +          if (ip + ctrl > in_end) +            { +              SET_ERRNO (EINVAL); +              return 0; +            } +#endif + +#ifdef lzf_movsb +          lzf_movsb (op, ip, ctrl);  #else            do              *op++ = *ip++; @@ -84,9 +95,25 @@ lzf_decompress (const void *const in_data,  unsigned int in_len,            u8 *ref = op - ((ctrl & 0x1f) << 8) - 1; +#if CHECK_INPUT +          if (ip >= in_end) +            { +              SET_ERRNO (EINVAL); +              return 0; +            } +#endif            if (len == 7) -            len += *ip++; -           +            { +              len += *ip++; +#if CHECK_INPUT +              if (ip >= in_end) +                { +                  SET_ERRNO (EINVAL); +                  return 0; +                } +#endif +            } +            ref -= *ip++;            if (op + len + 2 > out_end) @@ -101,15 +128,20 @@ lzf_decompress (const void *const in_data,  unsigned int in_len,                return 0;              } +#ifdef lzf_movsb +          len += 2; +          lzf_movsb (op, ref, len); +#else            *op++ = *ref++;            *op++ = *ref++;            do              *op++ = *ref++;            while (--len); +#endif          }      } -  while (op < out_end && ip < in_end); +  while (ip < in_end);    return op - (u8 *)out_data;  } diff --git a/src/libpng/png.c b/src/libpng/png.c index 62b86e1..c1f3e3e 100644 --- a/src/libpng/png.c +++ b/src/libpng/png.c @@ -1,11 +1,14 @@  /* png.c - location for general purpose libpng functions   * - * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h + * Last changed in libpng 1.2.39 [August 13, 2009]   * Copyright (c) 1998-2009 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.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h   */  #define PNG_INTERNAL @@ -13,7 +16,7 @@  #include "png.h"  /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_2_37 Your_png_h_is_not_version_1_2_37; +typedef version_1_2_39 Your_png_h_is_not_version_1_2_39;  /* Version information for C files.  This had better match the version   * string defined in png.h.  */ @@ -145,7 +148,7 @@ png_check_sig(png_bytep sig, int num)  #ifdef PNG_1_0_X  voidpf PNGAPI  #else -voidpf /* private */ +voidpf /* PRIVATE */  #endif  png_zalloc(voidpf png_ptr, uInt items, uInt size)  { @@ -189,7 +192,7 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)  #ifdef PNG_1_0_X  void PNGAPI  #else -void /* private */ +void /* PRIVATE */  #endif  png_zfree(voidpf png_ptr, voidpf ptr)  { @@ -602,7 +605,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)     png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +#if defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)     if (png_ptr->num_chunk_list)     {        png_free(png_ptr, png_ptr->chunk_list); @@ -702,7 +705,7 @@ png_charp PNGAPI  png_get_copyright(png_structp png_ptr)  {     png_ptr = png_ptr;  /* Silence compiler warning about unused png_ptr */ -   return ((png_charp) "\n libpng version 1.2.37 - June 4, 2009\n\ +   return ((png_charp) "\n libpng version 1.2.39 - August 13, 2009\n\     Copyright (c) 1998-2009 Glenn Randers-Pehrson\n\     Copyright (c) 1996-1997 Andreas Dilger\n\     Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); @@ -825,7 +828,8 @@ png_convert_size(size_t size)   *    A and D, and X || Y is (X << 16) + Y.  */ -void png_64bit_product (long v1, long v2, unsigned long *hi_product, +void /* PRIVATE */ +png_64bit_product (long v1, long v2, unsigned long *hi_product,     unsigned long *lo_product)  {     int a, b, c, d; @@ -849,7 +853,7 @@ void png_64bit_product (long v1, long v2, unsigned long *hi_product,     *lo_product = (unsigned long)lo;  } -int /* private */ +int /* PRIVATE */  png_check_cHRM_fixed(png_structp png_ptr,     png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,     png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y, diff --git a/src/libpng/png.h b/src/libpng/png.h index 8092989..f6330be 100644 --- a/src/libpng/png.h +++ b/src/libpng/png.h @@ -1,14 +1,16 @@  /* png.h - header file for PNG reference library   * - * libpng version 1.2.37 - June 4, 2009 + * libpng version 1.2.39 - August 13, 2009   * Copyright (c) 1998-2009 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.)   * + * This code is released under the libpng license (See LICENSE, below) + *   * 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.2.37 - June 4, 2009: Glenn + *  libpng versions 0.97, January 1998, through 1.2.39 - August 13, 2009: Glenn   *  See also "Contributing Authors", below.   *   * Note about libpng version numbers: @@ -229,6 +231,16 @@   *    1.2.37beta01-03         13    10237  12.so.0.37[.0]   *    1.2.37rc01              13    10237  12.so.0.37[.0]   *    1.2.37                  13    10237  12.so.0.37[.0] + *    1.2.45                  10    10045  12.so.0.45[.0] + *    1.0.46                  10    10046  10.so.0.46[.0] + *    1.2.38beta01            13    10238  12.so.0.38[.0] + *    1.2.38rc01-03           13    10238  12.so.0.38[.0] + *    1.0.47                  10    10047  10.so.0.47[.0] + *    1.2.38                  13    10238  12.so.0.38[.0] + *    1.2.39beta01-05         13    10239  12.so.0.39[.0] + *    1.2.39rc01              13    10239  12.so.0.39[.0] + *    1.0.48                  10    10048  10.so.0.48[.0] + *    1.2.39                  13    10239  12.so.0.39[.0]   *   *    Henceforth the source version will match the shared-library major   *    and minor numbers; the shared-library major version number will be @@ -258,7 +270,9 @@   * If you modify libpng you may insert additional notices immediately following   * this sentence.   * - * libpng versions 1.2.6, August 15, 2004, through 1.2.37, June 4, 2009, are + * This code is released under the libpng license. + * + * libpng versions 1.2.6, August 15, 2004, through 1.2.39, August 13, 2009, are   * Copyright (c) 2004, 2006-2009 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: @@ -370,13 +384,13 @@   * Y2K compliance in libpng:   * =========================   * - *    June 4, 2009 + *    August 13, 2009   *   *    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.2.37 are Y2K compliant.  It is my belief that earlier + *    upward through 1.2.39 are Y2K compliant.  It is my belief that earlier   *    versions were also Y2K compliant.   *   *    Libpng only has three year fields.  One is a 2-byte unsigned integer @@ -432,9 +446,9 @@   */  /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.2.37" +#define PNG_LIBPNG_VER_STRING "1.2.39"  #define PNG_HEADER_VERSION_STRING \ -   " libpng version 1.2.37 - June 4, 2009\n" +   " libpng version 1.2.39 - August 13, 2009\n"  #define PNG_LIBPNG_VER_SONUM   0  #define PNG_LIBPNG_VER_DLLNUM  13 @@ -442,9 +456,10 @@  /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */  #define PNG_LIBPNG_VER_MAJOR   1  #define PNG_LIBPNG_VER_MINOR   2 -#define PNG_LIBPNG_VER_RELEASE 37 +#define PNG_LIBPNG_VER_RELEASE 39  /* This should match the numeric part of the final component of - * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ + * PNG_LIBPNG_VER_STRING, omitting any leading zero: + */  #define PNG_LIBPNG_VER_BUILD  0 @@ -454,7 +469,7 @@  #define PNG_LIBPNG_BUILD_RC       3  #define PNG_LIBPNG_BUILD_STABLE   4  #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7 -   +  /* Release-Specific Flags */  #define PNG_LIBPNG_BUILD_PATCH    8 /* Can be OR'ed with                                         PNG_LIBPNG_BUILD_STABLE only */ @@ -469,8 +484,9 @@   * We must not include leading zeros.   * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only   * 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 10237 /* 1.2.37 */ + * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release + */ +#define PNG_LIBPNG_VER 10239 /* 1.2.39 */  #ifndef PNG_VERSION_INFO_ONLY  /* include the compression library's header */ @@ -485,12 +501,12 @@  /* Ref MSDN: Private as priority over Special   * VS_FF_PRIVATEBUILD File *was not* built using standard release   * procedures. If this value is given, the StringFileInfo block must - * contain a PrivateBuild string.  + * contain a PrivateBuild string.   *   * VS_FF_SPECIALBUILD File *was* built by the original company using   * standard release procedures but is a variation of the standard   * file of the same version number. If this value is given, the - * StringFileInfo block must contain a SpecialBuild string.  + * StringFileInfo block must contain a SpecialBuild string.   */  #if defined(PNG_USER_PRIVATEBUILD) @@ -552,7 +568,7 @@ extern "C" {  #define png_write_status_ptr_NULL NULL  #endif -/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ +/* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */  #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)  /* Version information for C files, stored in png.c.  This had better match   * the version above. @@ -678,7 +694,8 @@ typedef png_text FAR * FAR * png_textpp;  #endif  /* Supported compression types for text in PNG files (tEXt, and zTXt). - * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */ + * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. + */  #define PNG_TEXT_COMPRESSION_NONE_WR -3  #define PNG_TEXT_COMPRESSION_zTXt_WR -2  #define PNG_TEXT_COMPRESSION_NONE    -1 @@ -705,7 +722,8 @@ typedef struct png_time_struct  typedef png_time FAR * png_timep;  typedef png_time FAR * FAR * png_timepp; -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \ + defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)  /* png_unknown_chunk is a structure to hold queued chunks for which there is   * no specific support.  The idea is that we can use this to queue   * up private chunks for output even though the library doesn't actually @@ -940,8 +958,9 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)     png_uint_32 free_me;     /* flags items libpng is responsible for freeing */  #endif -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) -   /* storage for unknown chunks that the library doesn't recognize. */ +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \ + defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED) +   /* Storage for unknown chunks that the library doesn't recognize. */     png_unknown_chunkp unknown_chunks;     png_size_t unknown_chunks_num;  #endif @@ -956,7 +975,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)  #endif  #if defined(PNG_sPLT_SUPPORTED) -   /* data on sPLT chunks (there may be more than one). */ +   /* Data on sPLT chunks (there may be more than one). */     png_sPLT_tp splt_palettes;     png_uint_32 splt_palettes_num;  #endif @@ -1291,7 +1310,7 @@ struct png_struct_def  #endif /* PNG_bKGD_SUPPORTED */  #if defined(PNG_WRITE_FLUSH_SUPPORTED) -   png_flush_ptr output_flush_fn;/* Function for flushing output */ +   png_flush_ptr output_flush_fn; /* Function for flushing output */     png_uint_32 flush_dist;    /* how many rows apart to flush, 0 - no flush */     png_uint_32 flush_rows;    /* number of rows written since last flush */  #endif @@ -1389,7 +1408,7 @@ struct png_struct_def  /* New members added in libpng-1.0.6 */  #ifdef PNG_FREE_ME_SUPPORTED -   png_uint_32 free_me;       /* flags items libpng is responsible for freeing */ +   png_uint_32 free_me;   /* flags items libpng is responsible for freeing */  #endif  #if defined(PNG_USER_CHUNKS_SUPPORTED) @@ -1397,7 +1416,7 @@ struct png_struct_def     png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */  #endif -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED     int num_chunk_list;     png_bytep chunk_list;  #endif @@ -1451,21 +1470,21 @@ struct png_struct_def  /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */  #ifdef PNG_USER_MEM_SUPPORTED -   png_voidp mem_ptr;                /* user supplied struct for mem functions */ -   png_malloc_ptr malloc_fn;         /* function for allocating memory */ -   png_free_ptr free_fn;             /* function for freeing memory */ +   png_voidp mem_ptr;            /* user supplied struct for mem functions */ +   png_malloc_ptr malloc_fn;     /* function for allocating memory */ +   png_free_ptr free_fn;         /* function for freeing memory */  #endif  /* New member added in libpng-1.0.13 and 1.2.0 */ -   png_bytep big_row_buf;         /* buffer to save current (unfiltered) row */ +   png_bytep big_row_buf;        /* buffer to save current (unfiltered) row */  #if defined(PNG_READ_DITHER_SUPPORTED)  /* The following three members were added at version 1.0.14 and 1.2.4 */ -   png_bytep dither_sort;            /* working sort array */ -   png_bytep index_to_palette;       /* where the original index currently is */ -                                     /* in the palette */ -   png_bytep palette_to_index;       /* which original index points to this */ -                                     /* palette color */ +   png_bytep dither_sort;        /* working sort array */ +   png_bytep index_to_palette;   /* where the original index currently is */ +                                 /* in the palette */ +   png_bytep palette_to_index;   /* which original index points to this */ +                                 /* palette color */  #endif  /* New members added in libpng-1.0.16 and 1.2.6 */ @@ -1478,7 +1497,7 @@ struct png_struct_def  /* New member added in libpng-1.0.25 and 1.2.17 */  #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) -   /* storage for unknown chunk that the library doesn't recognize. */ +   /* Storage for unknown chunk that the library doesn't recognize. */     png_unknown_chunk unknown_chunk;  #endif @@ -1494,7 +1513,7 @@ struct png_struct_def  /* This triggers a compiler error in png.c, if png.c and png.h   * do not agree upon the version number.   */ -typedef png_structp version_1_2_37; +typedef png_structp version_1_2_39;  typedef png_struct FAR * FAR * png_structpp; @@ -1598,7 +1617,7 @@ extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,     png_infop info_ptr));  #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read the information before the actual image data. */ +/* Read the information before the actual image data. */  extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,     png_infop info_ptr));  #endif @@ -1611,11 +1630,11 @@ extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)  #if !defined(_WIN32_WCE)  /* "time.h" functions are not supported on WindowsCE */  #if defined(PNG_WRITE_tIME_SUPPORTED) -/* convert from a struct tm to png_time */ +/* Convert from a struct tm to png_time */  extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,     struct tm FAR * ttime)); -/* convert from time_t to png_time.  Uses gmtime() */ +/* Convert from time_t to png_time.  Uses gmtime() */  extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,     time_t ttime));  #endif /* PNG_WRITE_tIME_SUPPORTED */ @@ -1735,7 +1754,7 @@ extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,  #endif  #if defined(PNG_READ_16_TO_8_SUPPORTED) -/* strip the second byte of information from a 16-bit depth file. */ +/* Strip the second byte of information from a 16-bit depth file. */  extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));  #endif @@ -1771,74 +1790,74 @@ extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));  extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));  #endif -/* optional update palette with requested transformations */ +/* Optional update palette with requested transformations */  extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr)); -/* optional call to update the users info structure */ +/* Optional call to update the users info structure */  extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,     png_infop info_ptr));  #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read one or more rows of image data. */ +/* Read one or more rows of image data. */  extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,     png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));  #endif  #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read a row of data. */ +/* Read a row of data. */  extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,     png_bytep row,     png_bytep display_row));  #endif  #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read the whole image into memory at once. */ +/* Read the whole image into memory at once. */  extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,     png_bytepp image));  #endif -/* write a row of image data */ +/* Write a row of image data */  extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,     png_bytep row)); -/* write a few rows of image data */ +/* Write a few rows of image data */  extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr,     png_bytepp row, png_uint_32 num_rows)); -/* write the image data */ +/* Write the image data */  extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,     png_bytepp image)); -/* writes the end of the PNG file. */ +/* Writes the end of the PNG file. */  extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,     png_infop info_ptr));  #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read the end of the PNG file. */ +/* Read the end of the PNG file. */  extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,     png_infop info_ptr));  #endif -/* free any memory associated with the png_info_struct */ +/* Free any memory associated with the png_info_struct */  extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,     png_infopp info_ptr_ptr)); -/* free any memory associated with the png_struct and the png_info_structs */ +/* Free any memory associated with the png_struct and the png_info_structs */  extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp     png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); -/* free all memory used by the read (old method - NOT DLL EXPORTED) */ +/* Free all memory used by the read (old method - NOT DLL EXPORTED) */  extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,     png_infop end_info_ptr)); -/* free any memory associated with the png_struct and the png_info_structs */ +/* Free any memory associated with the png_struct and the png_info_structs */  extern PNG_EXPORT(void,png_destroy_write_struct)     PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); -/* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ +/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */  extern void png_write_destroy PNGARG((png_structp png_ptr)); -/* set the libpng method of handling chunk CRC errors */ +/* Set the libpng method of handling chunk CRC errors */  extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,     int crit_action, int ancil_action)); @@ -1866,7 +1885,7 @@ extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,   * header file (zlib.h) for an explination of the compression functions.   */ -/* set the filtering method(s) used by libpng.  Currently, the only valid +/* Set the filtering method(s) used by libpng.  Currently, the only valid   * value for "method" is 0.   */  extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method, @@ -2063,11 +2082,11 @@ extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr,     png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,     png_progressive_end_ptr end_fn)); -/* returns the user pointer associated with the push read functions */ +/* Returns the user pointer associated with the push read functions */  extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)     PNGARG((png_structp png_ptr)); -/* function to be called when data becomes available */ +/* Function to be called when data becomes available */  extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,     png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); @@ -2089,7 +2108,7 @@ extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,     png_uint_32 size));  #endif -/* frees a pointer allocated by png_malloc() */ +/* Frees a pointer allocated by png_malloc() */  extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));  #if defined(PNG_1_0_X) @@ -2106,11 +2125,12 @@ extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,     png_infop info_ptr, png_uint_32 free_me, int num));  #ifdef PNG_FREE_ME_SUPPORTED  /* Reassign responsibility for freeing existing data, whether allocated - * by libpng or by the application */ + * by libpng or by the application + */  extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,     png_infop info_ptr, int freer, png_uint_32 mask));  #endif -/* assignments for png_data_freer */ +/* Assignments for png_data_freer */  #define PNG_DESTROY_WILL_FREE_DATA 1  #define PNG_SET_WILL_FREE_DATA 1  #define PNG_USER_WILL_FREE_DATA 2 @@ -2194,11 +2214,13 @@ png_infop info_ptr));  #if defined(PNG_INFO_IMAGE_SUPPORTED)  /* Returns row_pointers, which is an array of pointers to scanlines that was -returned from png_read_png(). */ + * returned from png_read_png(). + */  extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr,  png_infop info_ptr));  /* Set row_pointers, which is an array of pointers to scanlines for use -by png_write_png(). */ + * by png_write_png(). + */  extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr,     png_infop info_ptr, png_bytepp row_pointers));  #endif @@ -2499,8 +2521,8 @@ extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,  #endif  #endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */ -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) -/* provide a list of chunks and how they are to be handled, if the built-in +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +/* Provide a list of chunks and how they are to be handled, if the built-in     handling or default unknown chunk handling is not desired.  Any chunks not     listed will be handled in the default manner.  The IHDR and IEND chunks     must not be listed. @@ -2511,6 +2533,10 @@ extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,  */  extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp     png_ptr, int keep, png_bytep chunk_list, int num_chunks)); +PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep +   chunk_name)); +#endif +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)  extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,     png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));  extern PNG_EXPORT(void, png_set_unknown_chunk_location) @@ -2518,14 +2544,11 @@ extern PNG_EXPORT(void, png_set_unknown_chunk_location)  extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp     png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));  #endif -#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED -PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep -   chunk_name)); -#endif  /* Png_free_data() will turn off the "valid" flag for anything it frees. -   If you need to turn it off for a chunk that your application has freed, -   you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */ + * If you need to turn it off for a chunk that your application has freed, + * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); + */  extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr,     png_infop info_ptr, int mask)); @@ -2570,8 +2593,9 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,  #endif /* PNG_DEBUG_FILE */  #if (PNG_DEBUG > 1) -/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on - * non-ISO compilers */ +/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on non-ISO + * compilers. + */  #  ifdef __STDC__  #    ifndef png_debug  #      define png_debug(l,m) \ @@ -2732,7 +2756,8 @@ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));  #endif /* PNG_ASSEMBLER_CODE_SUPPORTED */  /* Strip the prepended error numbers ("#nnn ") from error and warning - * messages before passing them to the error or warning handler. */ + * messages before passing them to the error or warning handler. + */  #ifdef PNG_ERROR_NUMBERS_SUPPORTED  extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp     png_ptr, png_uint_32 strip_mode)); @@ -2749,7 +2774,9 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp  #endif -/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ +/* Maintainer: Put new public prototypes here ^, in libpng.3, and in + * project defs + */  #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED  /* With these routines we avoid an integer divide, which will be slower on @@ -2778,7 +2805,7 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp                          (png_uint_32)(alpha)) + (png_uint_32)32768L);        \         (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } -#else  /* standard method using integer division */ +#else  /* Standard method using integer division */  #  define png_composite(composite, fg, alpha, bg)                            \       (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) +    \ @@ -2861,7 +2888,7 @@ extern PNG_EXPORT(void,png_save_uint_16)  #define PNG_HAVE_PNG_SIGNATURE    0x1000  #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ -/* flags for the transformations the PNG library does on the image data */ +/* Flags for the transformations the PNG library does on the image data */  #define PNG_BGR                0x0001  #define PNG_INTERLACE          0x0002  #define PNG_PACK               0x0004 @@ -2895,7 +2922,7 @@ extern PNG_EXPORT(void,png_save_uint_16)                         /*  0x20000000L  unused */                         /*  0x40000000L  unused */ -/* flags for png_create_struct */ +/* Flags for png_create_struct */  #define PNG_STRUCT_PNG   0x0001  #define PNG_STRUCT_INFO  0x0002 @@ -2905,7 +2932,7 @@ extern PNG_EXPORT(void,png_save_uint_16)  #define PNG_COST_SHIFT 3  #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) -/* flags for the png_ptr->flags rather than declaring a byte for each one */ +/* Flags for the png_ptr->flags rather than declaring a byte for each one */  #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY     0x0001  #define PNG_FLAG_ZLIB_CUSTOM_LEVEL        0x0002  #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL    0x0004 @@ -2947,7 +2974,7 @@ extern PNG_EXPORT(void,png_save_uint_16)  #define PNG_FLAG_CRC_MASK           (PNG_FLAG_CRC_ANCILLARY_MASK | \                                       PNG_FLAG_CRC_CRITICAL_MASK) -/* save typing and make code easier to understand */ +/* Save typing and make code easier to understand */  #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \     abs((int)((c1).green) - (int)((c2).green)) + \ @@ -2960,13 +2987,14 @@ extern PNG_EXPORT(void,png_save_uint_16)      (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) )  /* PNG_OUT_OF_RANGE returns true if value is outside the range -   ideal-delta..ideal+delta.  Each argument is evaluated twice. -   "ideal" and "delta" should be constants, normally simple -   integers, "value" a variable. Added to libpng-1.2.6 JB */ + * ideal-delta..ideal+delta.  Each argument is evaluated twice. + * "ideal" and "delta" should be constants, normally simple + * integers, "value" a variable. Added to libpng-1.2.6 JB + */  #define PNG_OUT_OF_RANGE(value, ideal, delta) \          ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) ) -/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ +/* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */  #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)  /* place to hold the signature string for a PNG file. */  #ifdef PNG_USE_GLOBAL_ARRAYS @@ -3087,7 +3115,8 @@ PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));  #endif  /* Next four functions are used internally as callbacks.  PNGAPI is required - * but not PNG_EXPORT.  PNGAPI added at libpng version 1.2.3. */ + * but not PNG_EXPORT.  PNGAPI added at libpng version 1.2.3. + */  PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,     png_bytep data, png_size_t length)); @@ -3152,10 +3181,10 @@ PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,  PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));  #endif -/* simple function to write the signature */ +/* Simple function to write the signature */  PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)); -/* write various chunks */ +/* Write various chunks */  /* Write the IHDR chunk, and update the png_struct with the necessary   * information. @@ -3307,12 +3336,12 @@ PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));  PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));  #endif -/* combine a row of data, dealing with alpha, etc. if requested */ +/* Combine a row of data, dealing with alpha, etc. if requested */  PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,     int mask));  #if defined(PNG_READ_INTERLACING_SUPPORTED) -/* expand an interlaced row */ +/* Expand an interlaced row */  /* OLD pre-1.0.9 interface:  PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,     png_bytep row, int pass, png_uint_32 transformations)); @@ -3323,12 +3352,12 @@ PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));  /* GRR TO DO (2.0 or whenever):  simplify other internal calling interfaces */  #if defined(PNG_WRITE_INTERLACING_SUPPORTED) -/* grab pixels out of a row for an interlaced pass */ +/* Grab pixels out of a row for an interlaced pass */  PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,     png_bytep row, int pass));  #endif -/* unfilter a row */ +/* Unfilter a row */  PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,     png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)); @@ -3339,16 +3368,16 @@ PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,  /* Write out the filtered row. */  PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,     png_bytep filtered_row)); -/* finish a row while reading, dealing with interlacing passes, etc. */ +/* Finish a row while reading, dealing with interlacing passes, etc. */  PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); -/* initialize the row buffers, etc. */ +/* Initialize the row buffers, etc. */  PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); -/* optional call to update the users info structure */ +/* Optional call to update the users info structure */  PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,     png_infop info_ptr)); -/* these are the functions that do the transformations */ +/* These are the functions that do the transformations */  #if defined(PNG_READ_FILLER_SUPPORTED)  PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,     png_bytep row, png_uint_32 filler, png_uint_32 flags)); @@ -3470,7 +3499,7 @@ PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,   * then calls the appropriate callback for the chunk if it is valid.   */ -/* decode the IHDR chunk */ +/* Decode the IHDR chunk */  PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,     png_uint_32 length));  PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, @@ -3569,7 +3598,7 @@ PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,  PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,     png_bytep chunk_name)); -/* handle the transformations for reading and writing */ +/* Handle the transformations for reading and writing */  PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));  PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); @@ -3672,6 +3701,14 @@ PNG_EXTERN int png_check_cHRM_fixed  PNGARG((png_structp png_ptr,     png_fixed_point int_blue_y));  #endif +#if defined(PNG_cHRM_SUPPORTED) +#if !defined(PNG_NO_CHECK_cHRM) +/* Added at libpng version 1.2.34 */ +PNG_EXTERN void png_64bit_product (long v1, long v2, unsigned long *hi_product, +   unsigned long *lo_product); +#endif +#endif +  /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */  #endif /* PNG_INTERNAL */ @@ -3681,5 +3718,5 @@ PNG_EXTERN int png_check_cHRM_fixed  PNGARG((png_structp png_ptr,  #endif  #endif /* PNG_VERSION_INFO_ONLY */ -/* do not put anything past this line */ +/* Do not put anything past this line */  #endif /* PNG_H */ diff --git a/src/libpng/pngconf.h b/src/libpng/pngconf.h index 145e8eb..35523d8 100644 --- a/src/libpng/pngconf.h +++ b/src/libpng/pngconf.h @@ -1,11 +1,14 @@  /* pngconf.h - machine configurable file for libpng   * - * libpng version 1.2.37 - June 4, 2009 - * For conditions of distribution and use, see copyright notice in png.h + * libpng version 1.2.39 - August 13, 2009   * Copyright (c) 1998-2009 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.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h   */  /* Any machine specific code is near the front of this file, so if you @@ -19,7 +22,7 @@  #define PNG_1_2_X -/*  +/*   * PNG_USER_CONFIG has to be defined on the compiler command line. This   * includes the resource compiler for Windows DLL configurations.   */ @@ -39,7 +42,7 @@  /*   * Added at libpng-1.2.8 - *   + *   * If you create a private DLL you need to define in "pngusr.h" the followings:   * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of   *        the DLL was built> @@ -50,8 +53,8 @@   *        number and must match your private DLL name>   *  e.g. // private DLL "libpng13gx.dll"   *       #define PNG_USER_DLLFNAME_POSTFIX "gx" - *  - * The following macros are also at your disposal if you want to complete the  + * + * The following macros are also at your disposal if you want to complete the   * DLL VERSIONINFO structure.   * - PNG_USER_VERSIONINFO_COMMENTS   * - PNG_USER_VERSIONINFO_COMPANYNAME @@ -147,9 +150,9 @@   * 'Cygwin' defines/defaults:   *   PNG_BUILD_DLL -- (ignored) building the dll   *   (no define)   -- (ignored) building an application, linking to the dll - *   PNG_STATIC    -- (ignored) building the static lib, or building an  + *   PNG_STATIC    -- (ignored) building the static lib, or building an   *                    application that links to the static lib. - *   ALL_STATIC    -- (ignored) building various static libs, or building an  + *   ALL_STATIC    -- (ignored) building various static libs, or building an   *                    application that links to the static libs.   * Thus,   * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and @@ -162,12 +165,12 @@   *   PNG_BUILD_DLL   *   PNG_STATIC   *   (nothing) == PNG_USE_DLL - *  + *   * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent - *   of auto-import in binutils, we no longer need to worry about  + *   of auto-import in binutils, we no longer need to worry about   *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,   *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes - *   to __declspec() stuff.  However, we DO need to worry about  + *   to __declspec() stuff.  However, we DO need to worry about   *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults   *   such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.   */ @@ -211,8 +214,8 @@  #        if !defined(PNG_DLL)  #          define PNG_DLL  #        endif -#      endif   -#    endif   +#      endif +#    endif  #  endif  #endif @@ -487,7 +490,7 @@   * iTXt support was added.  iTXt support was turned off by default through   * libpng-1.2.x, to support old apps that malloc the png_text structure   * instead of calling png_set_text() and letting libpng malloc it.  It - * was turned on by default in libpng-1.3.0. + * will be turned on by default in libpng-1.4.0.   */  #if defined(PNG_1_0_X) || defined (PNG_1_2_X) @@ -521,6 +524,7 @@  #  define PNG_NO_FREE_ME  #  define PNG_NO_READ_UNKNOWN_CHUNKS  #  define PNG_NO_WRITE_UNKNOWN_CHUNKS +#  define PNG_NO_HANDLE_AS_UNKNOWN  #  define PNG_NO_READ_USER_CHUNKS  #  define PNG_NO_READ_iCCP  #  define PNG_NO_WRITE_iCCP @@ -550,7 +554,7 @@  #  define PNG_FREE_ME_SUPPORTED  #endif -#if defined(PNG_READ_SUPPORTED) +#ifdef PNG_READ_SUPPORTED  #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \        !defined(PNG_NO_READ_TRANSFORMS) @@ -638,7 +642,7 @@  #endif /* PNG_READ_SUPPORTED */ -#if defined(PNG_WRITE_SUPPORTED) +#ifdef PNG_WRITE_SUPPORTED  # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \      !defined(PNG_NO_WRITE_TRANSFORMS) @@ -741,7 +745,7 @@  #  define PNG_EASY_ACCESS_SUPPORTED  #endif -/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0  +/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0   * and removed from version 1.2.20.  The following will be removed   * from libpng-1.4.0  */ @@ -940,14 +944,22 @@  #  define PNG_READ_zTXt_SUPPORTED  #  define PNG_zTXt_SUPPORTED  #endif +#ifndef PNG_NO_READ_OPT_PLTE +#  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ +#endif                      /* optional PLTE chunk in RGB and RGBA images */ +#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ +    defined(PNG_READ_zTXt_SUPPORTED) +#  define PNG_READ_TEXT_SUPPORTED +#  define PNG_TEXT_SUPPORTED +#endif + +#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ +  #ifndef PNG_NO_READ_UNKNOWN_CHUNKS  #  define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED  #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED  #    define PNG_UNKNOWN_CHUNKS_SUPPORTED  #  endif -#  ifndef PNG_NO_HANDLE_AS_UNKNOWN -#    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED -#  endif  #endif  #if !defined(PNG_NO_READ_USER_CHUNKS) && \       defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) @@ -960,17 +972,14 @@  #    undef PNG_NO_HANDLE_AS_UNKNOWN  #  endif  #endif -#ifndef PNG_NO_READ_OPT_PLTE -#  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ -#endif                      /* optional PLTE chunk in RGB and RGBA images */ -#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ -    defined(PNG_READ_zTXt_SUPPORTED) -#  define PNG_READ_TEXT_SUPPORTED -#  define PNG_TEXT_SUPPORTED -#endif -#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ +#ifndef PNG_NO_HANDLE_AS_UNKNOWN +#  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +#    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +#  endif +#endif +#ifdef PNG_WRITE_SUPPORTED  #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED  #ifdef PNG_NO_WRITE_TEXT @@ -1082,17 +1091,6 @@  #    define PNG_zTXt_SUPPORTED  #  endif  #endif -#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS -#  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED -#  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED -#    define PNG_UNKNOWN_CHUNKS_SUPPORTED -#  endif -#  ifndef PNG_NO_HANDLE_AS_UNKNOWN -#     ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED -#       define PNG_HANDLE_AS_UNKNOWN_SUPPORTED -#     endif -#  endif -#endif  #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \      defined(PNG_WRITE_zTXt_SUPPORTED)  #  define PNG_WRITE_TEXT_SUPPORTED @@ -1103,6 +1101,20 @@  #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ +#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS +#  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED +#  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED +#    define PNG_UNKNOWN_CHUNKS_SUPPORTED +#  endif +#endif + +#ifndef PNG_NO_HANDLE_AS_UNKNOWN +#  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +#    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +#  endif +#endif +#endif /* PNG_WRITE_SUPPORTED */ +  /* Turn this off to disable png_read_png() and   * png_write_png() and leave the row_pointers member   * out of the info structure. @@ -1248,7 +1260,7 @@ typedef char            FAR * FAR * FAR * png_charppp;  #if defined(PNG_1_0_X) || defined(PNG_1_2_X)  /* SPC -  Is this stuff deprecated? */ -/* It'll be removed as of libpng-1.3.0 - GR-P */ +/* It'll be removed as of libpng-1.4.0 - GR-P */  /* libpng typedefs for types in zlib. If zlib changes   * or another compression library is used, then change these.   * Eliminates need to change all the source files. @@ -1321,7 +1333,7 @@ typedef z_stream FAR *  png_zstreamp;  #  define PNGAPI __cdecl  #  undef PNG_IMPEXP  #  define PNG_IMPEXP -#endif   +#endif  /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",   * you may get warnings regarding the linkage of png_zalloc and png_zfree. diff --git a/src/libpng/pngerror.c b/src/libpng/pngerror.c index 71a2e53..d68416b 100644 --- a/src/libpng/pngerror.c +++ b/src/libpng/pngerror.c @@ -2,11 +2,14 @@  /* pngerror.c - stub functions for i/o and memory allocation   *   * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h   * Copyright (c) 1998-2009 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.)   * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + *   * This file provides a location for all error handling.  Users who   * need special error handling are expected to write replacement functions   * and use png_set_error_fn() to use those functions.  See the instructions diff --git a/src/libpng/pngget.c b/src/libpng/pngget.c index 0022d95..38e4f9e 100644 --- a/src/libpng/pngget.c +++ b/src/libpng/pngget.c @@ -2,10 +2,14 @@  /* pngget.c - retrieval of values from info struct   *   * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h   * Copyright (c) 1998-2009 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.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + *   */  #define PNG_INTERNAL @@ -934,6 +938,6 @@ png_get_user_height_max (png_structp png_ptr)      return (png_ptr? png_ptr->user_height_max : 0);  }  #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ -  +  #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff --git a/src/libpng/pngmem.c b/src/libpng/pngmem.c index d1999b6..e190cc3 100644 --- a/src/libpng/pngmem.c +++ b/src/libpng/pngmem.c @@ -2,11 +2,14 @@  /* pngmem.c - stub functions for memory allocation   *   * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h   * Copyright (c) 1998-2009 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.)   * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + *   * This file provides a location for all memory allocation.  Users who   * need special memory handling are expected to supply replacement   * functions for png_malloc() and png_free(), and to use diff --git a/src/libpng/pngpread.c b/src/libpng/pngpread.c index 9746c7a..7adb7b8 100644 --- a/src/libpng/pngpread.c +++ b/src/libpng/pngpread.c @@ -1,11 +1,14 @@  /* pngpread.c - read a png file in push mode   * - * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h + * Last changed in libpng 1.2.38 [July 16, 2009]   * Copyright (c) 1998-2009 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.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h   */  #define PNG_INTERNAL diff --git a/src/libpng/pngread.c b/src/libpng/pngread.c index 370ecba..a4cbb3e 100644 --- a/src/libpng/pngread.c +++ b/src/libpng/pngread.c @@ -2,11 +2,14 @@  /* pngread.c - read a PNG file   *   * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h   * Copyright (c) 1998-2009 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.)   * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + *   * This file contains routines that an application calls directly to   * read a PNG file or stream.   */ @@ -102,7 +105,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,     }     else          png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; -    +     if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)     { diff --git a/src/libpng/pngrio.c b/src/libpng/pngrio.c index 2c8e6a7..2267bca 100644 --- a/src/libpng/pngrio.c +++ b/src/libpng/pngrio.c @@ -2,11 +2,14 @@  /* pngrio.c - functions for data input   *   * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h   * Copyright (c) 1998-2009 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.)   * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + *   * This file provides a location for all input.  Users who need   * special handling are expected to write a function that has the same   * arguments as this and performs a similar function, but that possibly diff --git a/src/libpng/pngrtran.c b/src/libpng/pngrtran.c index af396df..d7e6b4a 100644 --- a/src/libpng/pngrtran.c +++ b/src/libpng/pngrtran.c @@ -1,12 +1,15 @@  /* pngrtran.c - transforms the data in a row for PNG readers   * - * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h + * Last changed in libpng 1.2.38 [July 16, 2009]   * Copyright (c) 1998-2009 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.)   * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + *   * This file contains functions optionally called by an application   * in order to tell libpng how to handle data when reading a PNG.   * Transformations that are used in both reading and writing are @@ -714,8 +717,8 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,  #endif  #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ -    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ -    defined(PNG_LEGACY_SUPPORTED) +    defined(PNG_LEGACY_SUPPORTED) || \ +    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)  void PNGAPI  png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr     read_user_transform_fn) @@ -1177,10 +1180,6 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)           {              if (png_ptr->transformations & PNG_EXPAND_tRNS)                info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; -#if 0 /* Removed from libpng-1.2.27 */ -            else -              info_ptr->color_type |= PNG_COLOR_MASK_COLOR; -#endif           }           if (info_ptr->bit_depth < 8)              info_ptr->bit_depth = 8; @@ -1374,12 +1373,12 @@ png_do_read_transformations(png_structp png_ptr)  #endif  /* From Andreas Dilger e-mail to png-implement, 26 March 1998: - *  + *   *   In most cases, the "simple transparency" should be done prior to doing   *   gray-to-RGB, or you will have to test 3x as many bytes to check if a   *   pixel is transparent.  You would also need to make sure that the   *   transparency information is upgraded to RGB. - *  + *   *   To summarize, the current flow is:   *   - Gray + simple transparency -> compare 1 or 2 gray bytes and composite   *                                   with background "in place" if transparent, @@ -4202,7 +4201,7 @@ png_build_gamma_table(png_structp png_ptr)       png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,          (png_uint_32)(num * png_sizeof(png_uint_16p))); -     png_memset(png_ptr->gamma_16_table, 0, num * png_sizeof(png_uint_16p));  +     png_memset(png_ptr->gamma_16_table, 0, num * png_sizeof(png_uint_16p));       if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))       { @@ -4264,7 +4263,7 @@ png_build_gamma_table(png_structp png_ptr)          png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,             (png_uint_32)(num * png_sizeof(png_uint_16p ))); -        png_memset(png_ptr->gamma_16_to_1, 0, num * png_sizeof(png_uint_16p));  +        png_memset(png_ptr->gamma_16_to_1, 0, num * png_sizeof(png_uint_16p));          for (i = 0; i < num; i++)          { @@ -4290,7 +4289,7 @@ png_build_gamma_table(png_structp png_ptr)          png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,             (png_uint_32)(num * png_sizeof(png_uint_16p)));          png_memset(png_ptr->gamma_16_from_1, 0, -           num * png_sizeof(png_uint_16p));  +           num * png_sizeof(png_uint_16p));          for (i = 0; i < num; i++)          { diff --git a/src/libpng/pngrutil.c b/src/libpng/pngrutil.c index ae1e3f7..f656dfb 100644 --- a/src/libpng/pngrutil.c +++ b/src/libpng/pngrutil.c @@ -1,12 +1,15 @@  /* pngrutil.c - utilities to read a PNG file   * - * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h + * Last changed in libpng 1.2.38 [July 16, 2009]   * Copyright (c) 1998-2009 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.)   * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + *   * This file contains routines that are only called from within   * libpng itself during the course of reading an image.   */ @@ -2251,7 +2254,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)     if (!(png_ptr->chunk_name[0] & 0x20))     { -#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) +#if defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)        if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=             PNG_HANDLE_CHUNK_ALWAYS  #if defined(PNG_READ_USER_CHUNKS_SUPPORTED) @@ -2263,8 +2266,11 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)     }  #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) -   if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) || -       (png_ptr->read_user_chunk_fn != NULL)) +   if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) +#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) +       || (png_ptr->read_user_chunk_fn != NULL) +#endif +        )     {  #ifdef PNG_MAX_MALLOC_64K         if (length > (png_uint_32)65535L) @@ -2275,7 +2281,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)         }  #endif         png_memcpy((png_charp)png_ptr->unknown_chunk.name, -                  (png_charp)png_ptr->chunk_name,  +                  (png_charp)png_ptr->chunk_name,                    png_sizeof(png_ptr->unknown_chunk.name));         png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1] = '\0';         png_ptr->unknown_chunk.size = (png_size_t)length; @@ -2298,8 +2304,10 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)            if (ret == 0)            {               if (!(png_ptr->chunk_name[0] & 0x20)) +#if defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)                  if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=                       PNG_HANDLE_CHUNK_ALWAYS) +#endif                     png_chunk_error(png_ptr, "unknown critical chunk");               png_set_unknown_chunks(png_ptr, info_ptr,                 &png_ptr->unknown_chunk, 1); diff --git a/src/libpng/pngset.c b/src/libpng/pngset.c index fa68a2d..3c110eb 100644 --- a/src/libpng/pngset.c +++ b/src/libpng/pngset.c @@ -1,12 +1,15 @@  /* pngset.c - storage of image information into info struct   * - * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h + * Last changed in libpng 1.2.39 [August 13, 2009]   * Copyright (c) 1998-2009 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.)   * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + *   * The functions here are used during reads to store data from the file   * into the info struct, and during writes to store application data   * into the info struct for writing into the file.  This abstracts the @@ -243,7 +246,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,     /* Check other values */     if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && -      bit_depth != 8 && bit_depth != 16) +       bit_depth != 8 && bit_depth != 16)        png_error(png_ptr, "Invalid bit depth in IHDR");     if (color_type < 0 || color_type == 1 || @@ -354,7 +357,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,     info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);     if (info_ptr->pcal_purpose == NULL)     { -       png_warning(png_ptr, "Insufficient memory for pCAL purpose."); +      png_warning(png_ptr, "Insufficient memory for pCAL purpose.");        return;     }     png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length); @@ -371,7 +374,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,     info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length);     if (info_ptr->pcal_units == NULL)     { -       png_warning(png_ptr, "Insufficient memory for pCAL units."); +      png_warning(png_ptr, "Insufficient memory for pCAL units.");        return;     }     png_memcpy(info_ptr->pcal_units, units, (png_size_t)length); @@ -380,7 +383,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,        (png_uint_32)((nparams + 1) * png_sizeof(png_charp)));     if (info_ptr->pcal_params == NULL)     { -       png_warning(png_ptr, "Insufficient memory for pCAL params."); +      png_warning(png_ptr, "Insufficient memory for pCAL params.");        return;     } @@ -394,8 +397,8 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,        info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length);        if (info_ptr->pcal_params[i] == NULL)        { -          png_warning(png_ptr, "Insufficient memory for pCAL parameter."); -          return; +         png_warning(png_ptr, "Insufficient memory for pCAL parameter."); +         return;        }        png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length);     } @@ -705,7 +708,8 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,  {     int i; -   png_debug1(1, "in %s storage function", (png_ptr->chunk_name[0] == '\0' ? +   png_debug1(1, "in %s storage function", ((png_ptr == NULL || +      png_ptr->chunk_name[0] == '\0') ?        "text" : (png_const_charp)png_ptr->chunk_name));     if (png_ptr == NULL || info_ptr == NULL || num_text == 0) @@ -1013,7 +1017,7 @@ png_set_unknown_chunks(png_structp png_ptr,     int i;     if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0) -       return; +      return;     np = (png_unknown_chunkp)png_malloc_warn(png_ptr,         (png_uint_32)((info_ptr->unknown_chunks_num + num_unknowns) * @@ -1035,8 +1039,8 @@ png_set_unknown_chunks(png_structp png_ptr,        png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i;        png_unknown_chunkp from = unknowns + i; -      png_memcpy((png_charp)to->name,  -                 (png_charp)from->name,  +      png_memcpy((png_charp)to->name, +                 (png_charp)from->name,                   png_sizeof(from->name));        to->name[png_sizeof(to->name)-1] = '\0';        to->size = from->size; diff --git a/src/libpng/pngtrans.c b/src/libpng/pngtrans.c index f221f54..6e1870c 100644 --- a/src/libpng/pngtrans.c +++ b/src/libpng/pngtrans.c @@ -2,10 +2,13 @@  /* pngtrans.c - transforms the data in a row (used by both readers and writers)   *   * Last changed in libpng 1.2.36 [May 14, 2009] - * For conditions of distribution and use, see copyright notice in png.h   * Copyright (c) 1998-2009 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.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h   */  #define PNG_INTERNAL @@ -634,8 +637,8 @@ png_do_bgr(png_row_infop row_info, png_bytep row)  #endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */  #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ -    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ -    defined(PNG_LEGACY_SUPPORTED) +    defined(PNG_LEGACY_SUPPORTED) || \ +    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)  void PNGAPI  png_set_user_transform_info(png_structp png_ptr, png_voidp     user_transform_ptr, int user_transform_depth, int user_transform_channels) diff --git a/src/libpng/pngwio.c b/src/libpng/pngwio.c index 740b71d..f77b2db 100644 --- a/src/libpng/pngwio.c +++ b/src/libpng/pngwio.c @@ -2,11 +2,14 @@  /* pngwio.c - functions for data output   *   * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h   * Copyright (c) 1998-2009 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.)   * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + *   * This file provides a location for all output.  Users who need   * special handling are expected to write functions that have the same   * arguments as these and perform similar functions, but that possibly diff --git a/src/libpng/pngwrite.c b/src/libpng/pngwrite.c index bd6263c..0987612 100644 --- a/src/libpng/pngwrite.c +++ b/src/libpng/pngwrite.c @@ -2,10 +2,13 @@  /* pngwrite.c - general routines to write a PNG file   *   * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h   * Copyright (c) 1998-2009 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.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h   */  /* Get internal access to png.h */ diff --git a/src/libpng/pngwtran.c b/src/libpng/pngwtran.c index ac56339..88a7d3c 100644 --- a/src/libpng/pngwtran.c +++ b/src/libpng/pngwtran.c @@ -2,10 +2,13 @@  /* pngwtran.c - transforms the data in a row for PNG writers   *   * Last changed in libpng 1.2.37 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h   * Copyright (c) 1998-2009 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.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h   */  #define PNG_INTERNAL diff --git a/src/libpng/pngwutil.c b/src/libpng/pngwutil.c index 22a83cc..aed280e 100644 --- a/src/libpng/pngwutil.c +++ b/src/libpng/pngwutil.c @@ -1,11 +1,14 @@  /* pngwutil.c - utilities to write a PNG file   * - * Last changed in libpng 1.2.36 [June 4, 2009] - * For conditions of distribution and use, see copyright notice in png.h + * Last changed in libpng 1.2.39 [August 13, 2009]   * Copyright (c) 1998-2009 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.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h   */  #define PNG_INTERNAL @@ -785,6 +788,14 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,            ((*( (png_bytep)profile + 2))<< 8) |            ((*( (png_bytep)profile + 3))    ); +   if (embedded_profile_len < 0) +   { +      png_warning(png_ptr, +        "Embedded profile length in iCCP chunk is negative"); +      png_free(png_ptr, new_name); +      return; +   } +     if (profile_len < embedded_profile_len)     {        png_warning(png_ptr, @@ -988,7 +999,7 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y,  #endif     {        /* Each value is saved in 1/100,000ths */ -     +        png_save_uint_32(buf, int_white_x);        png_save_uint_32(buf + 4, int_white_y); @@ -2116,9 +2127,12 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)     png_uint_32 mins, bpp;     png_byte filter_to_do = png_ptr->do_filter;     png_uint_32 row_bytes = row_info->rowbytes; -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED     int num_p_filters = (int)png_ptr->num_prev_filters; -#endif +#endif  + +   png_debug(1, "in png_write_find_filter"); +     png_debug(1, "in png_write_find_filter");     /* Find out how many bytes offset each pixel is */ diff --git a/src/lua5/imlua_image.c b/src/lua5/imlua_image.c index d823ac1..6d5ea2b 100644 --- a/src/lua5/imlua_image.c +++ b/src/lua5/imlua_image.c @@ -2,7 +2,7 @@   * \brief IM Lua 5 Binding   *   * See Copyright Notice in im_lib.h - * $Id: imlua_image.c,v 1.3 2009/08/18 02:23:33 scuri Exp $ + * $Id: imlua_image.c,v 1.4 2009/08/19 21:33:55 scuri Exp $   */  #include <string.h> @@ -12,6 +12,7 @@  #include "im.h"  #include "im_image.h"  #include "im_util.h" +#include "im_convert.h"  #include <lua.h>  #include <lauxlib.h> | 
