Compare commits

..

16 Commits

Author SHA1 Message Date
Glenn Randers-Pehrson
dd6ecbe688 [libpng16] Imported from libpng-1.6.0beta18.tar 2012-03-16 08:34:31 -05:00
John Bowler
aa816c4444 [libpng16] Added configuration support for benign errors and changed the read
default. Also changed some warnings in the iCCP and sRGB handling
from to benign errors. Configuration now makes read benign
errors warnings and write benign errors to errors by default (thus
changing the behavior on read).  The simplified API always forces
read benign errors to errors (regardless of the system default, unless
this is disabled in which case the simplified API can't be built.)
2012-03-16 07:39:49 -05:00
John Bowler
209b3e4b79 [libpng16] Added output flushing to aid debugging under Visual Studio.
This is necessary because the VS2010 output window otherwise simply loses
the error messages on error (they weren't flushed to the window before
the process exited, apparently!)
2012-03-16 07:14:01 -05:00
Glenn Randers-Pehrson
f2715a558a [libpng16] Revised example.c to put text strings in a temporary character array
instead of directly assigning string constants to png_textp members.
This avoids compiler warnings when -Wwrite-strings is enabled.
2012-03-15 19:52:03 -05:00
John Bowler
845ee6af72 [libpng16] Fixed a compiler warning under Cygwin (Windows-7, 32-bit system) 2012-03-10 21:05:19 -06:00
John Bowler
9ff37ea94f [libpng16] Fix an off-by-one error in the palette index checking function. 2012-03-10 20:03:06 -06:00
Glenn Randers-Pehrson
35f2e1768b [libpng16] In pngtest, treat benign errors as errors if "-strict" is present. 2012-03-10 19:42:03 -06:00
Glenn Randers-Pehrson
945cb1f9be [libpng16] Issue a png_benign_error() instead of png_warning() about bad
palette index.
2012-03-10 08:48:04 -06:00
Glenn Randers-Pehrson
71db131882 [libpng16] Bump version to 1.6.0beta18 2012-03-09 22:15:09 -06:00
Glenn Randers-Pehrson
bf7661f01b [libpng16] Imported from libpng-1.6.0beta17.tar 2012-03-09 22:15:01 -06:00
John Bowler
9066919600 [libpng16] If benign errors are disabled use maximum window on ancillary
inflate.  This works round a bug introduced in 1.5.4 where compressed ancillary
chunks could end up with a too-small windowBits value in the deflate
header.
2012-03-09 22:03:13 -06:00
John Bowler
1ffbe8c7c1 [libpng] Committed new contrib/libtests/makepng.c that was overlooked
in a recent patch.
2012-03-09 12:21:51 -06:00
Glenn Randers-Pehrson
8d0215928d [libpng16] Fixed manual assertion that all of our public macros begin with PNG_
Some such as PNGAPI begin with "PNG".
2012-03-09 12:18:18 -06:00
John Bowler
b5d0051dcb [libpng16] Deflate/inflate was reworked to move common zlib calls into single
functions [rw]util.c.  A new shared keyword check routine was also added
and the 'zbuf' is no longer allocated on progressive read.  It is now
possible to call png_inflate() incrementally.
2012-03-09 09:15:18 -06:00
Glenn Randers-Pehrson
6038b80277 [libpng16] Reject iCCP chunk after the first, even if the first one is invalid. 2012-03-08 10:40:07 -06:00
Glenn Randers-Pehrson
b57c1c9e6e [libpng16] Bump version to 1.6.0beta17 2012-03-05 21:35:40 -06:00
39 changed files with 1979 additions and 1616 deletions

View File

@@ -1,5 +1,5 @@
Libpng 1.6.0beta16 - March 6, 2012
Libpng 1.6.0beta18 - March 16, 2012
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@@ -9,20 +9,20 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
1.6.0beta16.tar.xz (LZMA-compressed, recommended)
1.6.0beta16.tar.gz
1.6.0beta16.tar.bz2
1.6.0beta18.tar.xz (LZMA-compressed, recommended)
1.6.0beta18.tar.gz
1.6.0beta18.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
lp160b16.7z (LZMA-compressed, recommended)
lp160b16.zip
lp160b18.7z (LZMA-compressed, recommended)
lp160b18.zip
Other information:
1.6.0beta16-README.txt
1.6.0beta16-LICENSE.txt
1.6.0beta18-README.txt
1.6.0beta18-LICENSE.txt
Changes since the last public release (1.5.7):
@@ -286,6 +286,38 @@ Version 1.6.0beta16 [March 6, 2012]
If the call to deflateInit2() is wrong a png_warning will be issued
(in fact this is harmless, but the PNG data produced may be sub-optimal).
Version 1.6.0beta17 [March 10, 2012]
Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition.
Reject all iCCP chunks after the first, even if the first one is invalid.
Deflate/inflate was reworked to move common zlib calls into single
functions [rw]util.c. A new shared keyword check routine was also added
and the 'zbuf' is no longer allocated on progressive read. It is now
possible to call png_inflate() incrementally.
If benign errors are disabled use maximum window on ancilliary inflate.
This works round a bug introduced in 1.5.4 where compressed ancillary
chunks could end up with a too-small windowBits value in the deflate
header.
Version 1.6.0beta18 [March 16, 2012]
Issue a png_benign_error() instead of png_warning() about bad palette index.
In pngtest, treat benign errors as errors if "-strict" is present.
Fixed an off-by-one error in the palette index checking function.
Fixed a compiler warning under Cygwin (Windows-7, 32-bit system)
Revised example.c to put text strings in a temporary character array
instead of directly assigning string constants to png_textp members.
This avoids compiler warnings when -Wwrite-strings is enabled.
Added output flushing to aid debugging under Visual Studio. Unfortunately
this is necessary because the VS2010 output window otherwise simply loses
the error messages on error (they weren't flushed to the window before
the process exited, apparently!)
Added configuration support for benign errors and changed the read
default. Also changed some warnings in the iCCP and sRGB handling
from to benign errors. Configuration now makes read benign
errors warnings and write benign errors to errors by default (thus
changing the behavior on read). The simplified API always forces
read errors to benign errors (regardless of the system default, unless
this is disabled in which case the simplified API can't be built.)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

34
CHANGES
View File

@@ -3889,7 +3889,7 @@ Version 1.6.0beta07 [January 28, 2012]
Freeze libtool files in the 'scripts' directory. This version of autogen.sh
attempts to dissuade people from running it when it is not, or should not,
be necessary. In fact, autogen.sh does not work when run in a libpng
directory extracted from atar distribution anymore. You must run it in
directory extracted from a tar distribution anymore. You must run it in
a GIT clone instead.
Added two images to contrib/pngsuite (1-bit and 2-bit transparent grayscale),
and renamed three whose names were inconsistent with those in
@@ -4037,6 +4037,38 @@ Version 1.6.0beta16 [March 6, 2012]
If the call to deflateInit2() is wrong a png_warning will be issued
(in fact this is harmless, but the PNG data produced may be sub-optimal).
Version 1.6.0beta17 [March 10, 2012]
Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition.
Reject all iCCP chunks after the first, even if the first one is invalid.
Deflate/inflate was reworked to move common zlib calls into single
functions [rw]util.c. A new shared keyword check routine was also added
and the 'zbuf' is no longer allocated on progressive read. It is now
possible to call png_inflate() incrementally.
If benign errors are disabled use maximum window on ancilliary inflate.
This works round a bug introduced in 1.5.4 where compressed ancillary
chunks could end up with a too-small windowBits value in the deflate
header.
Version 1.6.0beta18 [March 16, 2012]
Issue a png_benign_error() instead of png_warning() about bad palette index.
In pngtest, treat benign errors as errors if "-strict" is present.
Fixed an off-by-one error in the palette index checking function.
Fixed a compiler warning under Cygwin (Windows-7, 32-bit system)
Revised example.c to put text strings in a temporary character array
instead of directly assigning string constants to png_textp members.
This avoids compiler warnings when -Wwrite-strings is enabled.
Added output flushing to aid debugging under Visual Studio. Unfortunately
this is necessary because the VS2010 output window otherwise simply loses
the error messages on error (they weren't flushed to the window before
the process exited, apparently!)
Added configuration support for benign errors and changed the read
default. Also changed some warnings in the iCCP and sRGB handling
from to benign errors. Configuration now makes read benign
errors warnings and write benign errors to errors by default (thus
changing the behavior on read). The simplified API always forces
read errors to benign errors (regardless of the system default, unless
this is disabled in which case the simplified API can't be built.)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

View File

@@ -260,7 +260,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
# SET UP LINKS
if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 16.${PNGLIB_RELEASE}.1.6.0beta16
# VERSION 16.${PNGLIB_RELEASE}.1.6.0beta18
VERSION 16.${PNGLIB_RELEASE}.0
SOVERSION 16
CLEAN_DIRECT_OUTPUT 1)

View File

@@ -10,7 +10,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.6.0beta16, March 6, 2012, are
libpng versions 1.2.6, August 15, 2004, through 1.6.0beta18, March 16, 2012, are
Copyright (c) 2004, 2006-2011 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
@@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
March 6, 2012
March 16, 2012

2
README
View File

@@ -1,4 +1,4 @@
README for libpng version 1.6.0beta16 - March 6, 2012 (shared library 16.0)
README for libpng version 1.6.0beta18 - March 16, 2012 (shared library 16.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.

View File

@@ -18,7 +18,7 @@ AC_PREREQ([2.68])
dnl Version number stuff here:
AC_INIT([libpng],[1.6.0beta16],[png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng],[1.6.0beta18],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts])
# libpng does not follow GNU file name conventions (hence 'foreign')
@@ -37,7 +37,7 @@ dnl automake, so the following is not necessary (and is not defined anyway):
dnl AM_PREREQ([1.11.2])
dnl stop configure from automagically running automake
PNGLIB_VERSION=1.6.0beta16
PNGLIB_VERSION=1.6.0beta18
PNGLIB_MAJOR=1
PNGLIB_MINOR=6
PNGLIB_RELEASE=0

View File

@@ -68,6 +68,7 @@
*/
#define _ISOC99_SOURCE /* for strtoull */
#include <stddef.h> /* for offsetof */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -1071,15 +1072,24 @@ main(int argc, char **argv)
const char *arg = *++argv;
if (strcmp(arg, "--sRGB") == 0)
{
gamma = PNG_DEFAULT_sRGB;
continue;
}
else if (strcmp(arg, "--linear") == 0)
if (strcmp(arg, "--linear") == 0)
{
gamma = PNG_FP_1;
continue;
}
else if (strcmp(arg, "--1.8") == 0)
if (strcmp(arg, "--1.8") == 0)
{
gamma = PNG_GAMMA_MAC_18;
continue;
}
else if (argc >= 3 && strcmp(arg, "--insert") == 0)
if (argc >= 3 && strcmp(arg, "--insert") == 0)
{
png_const_charp what = *++argv;
png_charp param = *++argv;
@@ -1094,36 +1104,57 @@ main(int argc, char **argv)
*insert_ptr = new_insert;
insert_ptr = &new_insert->next;
}
continue;
}
else if (arg[0] == '-')
if (arg[0] == '-')
{
fprintf(stderr, "makepng: %s: invalid option\n", arg);
exit(1);
}
else if (strcmp(arg, "palette") == 0)
color_type = PNG_COLOR_TYPE_PALETTE;
else if (strncmp(arg, "gray", 4) == 0)
if (strcmp(arg, "palette") == 0)
{
color_type = PNG_COLOR_TYPE_GRAY;
if (strcmp(arg+4, "a") == 0 ||
color_type = PNG_COLOR_TYPE_PALETTE;
continue;
}
if (strncmp(arg, "gray", 4) == 0)
{
if (arg[5] == 0)
{
color_type = PNG_COLOR_TYPE_GRAY;
continue;
}
else if (strcmp(arg+4, "a") == 0 ||
strcmp(arg+4, "alpha") == 0 ||
strcmp(arg+4, "-alpha") == 0)
{
color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
continue;
}
}
else if (strncmp(arg, "rgb", 3) == 0)
if (strncmp(arg, "rgb", 3) == 0)
{
color_type = PNG_COLOR_TYPE_RGB;
if (strcmp(arg+3, "a") == 0 ||
if (arg[4] == 0)
{
color_type = PNG_COLOR_TYPE_RGB;
continue;
}
else if (strcmp(arg+3, "a") == 0 ||
strcmp(arg+3, "alpha") == 0 ||
strcmp(arg+3, "-alpha") == 0)
{
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
continue;
}
}
else if (color_type == 8)
if (color_type == 8)
{
color_type = atoi(arg);
if (color_type < 0 || color_type > 6 || color_type == 1 ||
@@ -1132,9 +1163,11 @@ main(int argc, char **argv)
fprintf(stderr, "makepng: %s: not a valid color type\n", arg);
exit(1);
}
continue;
}
else if (bit_depth == 32)
if (bit_depth == 32)
{
bit_depth = atoi(arg);
if (bit_depth <= 0 || bit_depth > 16 ||
@@ -1143,9 +1176,11 @@ main(int argc, char **argv)
fprintf(stderr, "makepng: %s: not a valid bit depth\n", arg);
exit(1);
}
continue;
}
else if (argc == 1) /* It's the file name */
if (argc == 1) /* It's the file name */
{
fp = fopen(arg, "wb");
if (fp == NULL)
@@ -1153,13 +1188,12 @@ main(int argc, char **argv)
fprintf(stderr, "%s: %s: could not open\n", arg, strerror(errno));
exit(1);
}
continue;
}
else
{
fprintf(stderr, "makepng: %s: unknown argument\n", arg);
exit(1);
}
fprintf(stderr, "makepng: %s: unknown argument\n", arg);
exit(1);
} /* argument while loop */
if (color_type == 8 || bit_depth == 32)

View File

@@ -2692,29 +2692,35 @@ compare_two_images(Image *a, Image *b, int via_linear,
/* Only check colormap entries that actually exist; */
png_const_bytep ppa, ppb;
int match;
png_byte in_use[256];
png_byte in_use[256], amax = 0, bmax = 0;
memset(in_use, 0, sizeof in_use);
ppa = rowa;
ppb = rowb;
/* Do this the slow way to accumulate the 'in_use' flags */
/* Do this the slow way to accumulate the 'in_use' flags, don't break out
* of the loop until the end; this validates the color-mapped data to
* ensure all pixels are valid color-map indexes.
*/
for (y=0, match=1; y<height && match; ++y, ppa += stridea, ppb += strideb)
{
png_uint_32 x;
for (x=0; x<width; ++x)
{
png_byte bval = ppb[x];
png_byte aval = ppa[x];
if (aval != ppb[x])
{
if (bval > bmax)
bmax = bval;
if (bval != aval)
match = 0;
break;
}
in_use[aval] = 1;
if (aval > amax)
amax = aval;
}
}
@@ -2743,8 +2749,9 @@ compare_two_images(Image *a, Image *b, int via_linear,
{
if ((a->opts & ACCUMULATE) == 0)
{
char pindex[4];
sprintf(pindex, "%lu", (unsigned long)y);
char pindex[9];
sprintf(pindex, "%lu[%lu]", (unsigned long)y,
(unsigned long)a->image.colormap_entries);
logerror(a, a->file_name, ": bad pixel index: ", pindex);
}
result = 0;
@@ -2754,8 +2761,9 @@ compare_two_images(Image *a, Image *b, int via_linear,
{
if ((a->opts & ACCUMULATE) == 0)
{
char pindex[4];
sprintf(pindex, "%lu", (unsigned long)y);
char pindex[9];
sprintf(pindex, "%lu[%lu]", (unsigned long)y,
(unsigned long)b->image.colormap_entries);
logerror(b, b->file_name, ": bad pixel index: ", pindex);
}
result = 0;
@@ -2780,8 +2788,30 @@ compare_two_images(Image *a, Image *b, int via_linear,
}
/* else the image buffers don't match pixel-wise so compare sample values
* instead.
* instead, but first validate that the pixel indexes are in range (but
* only if not accumulating, when the error is ignored.)
*/
else if ((a->opts & ACCUMULATE) == 0)
{
/* Check the original image first,
* TODO: deal with input images with bad pixel values?
*/
if (amax >= a->image.colormap_entries)
{
char pindex[9];
sprintf(pindex, "%d[%lu]", amax,
(unsigned long)a->image.colormap_entries);
return logerror(a, a->file_name, ": bad pixel index: ", pindex);
}
else if (bmax >= b->image.colormap_entries)
{
char pindex[9];
sprintf(pindex, "%d[%lu]", bmax,
(unsigned long)b->image.colormap_entries);
return logerror(b, b->file_name, ": bad pixel index: ", pindex);
}
}
}
/* We can directly compare pixel values without the need to use the read
@@ -3344,6 +3374,9 @@ test_one_file(const char *file_name, format_list *formats, png_uint_32 opts,
result = testimage(&image, opts, formats);
freeimage(&image);
/* Ensure that stderr is flushed into any log file */
fflush(stderr);
if (log_pass)
{
if (result)
@@ -3354,6 +3387,8 @@ test_one_file(const char *file_name, format_list *formats, png_uint_32 opts,
print_opts(opts);
printf(" %s\n", file_name);
/* stdout may not be line-buffered if it is piped to a file, so: */
fflush(stdout);
}
else if (!result)

View File

@@ -4653,8 +4653,8 @@ standard_check_text(png_const_structp pp, png_const_textp tp,
if (tp->text_length != strlen(text))
{
char buf[64];
sprintf(buf, "text length changed[%lu->%lu], ", strlen(text),
tp->text_length);
sprintf(buf, "text length changed[%lu->%lu], ",
(unsigned long)strlen(text), (unsigned long)tp->text_length);
pos = safecat(msg, sizeof msg, pos, buf);
}

View File

@@ -864,25 +864,38 @@ void write_png(char *file_name /* , ... other image information ... */)
png_set_gAMA(png_ptr, info_ptr, gamma);
/* Optionally write comments into the image */
text_ptr[0].key = "Title";
text_ptr[0].text = "Mona Lisa";
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[0].itxt_length = 0;
text_ptr[0].lang = NULL;
text_ptr[0].lang_key = NULL;
text_ptr[1].key = "Author";
text_ptr[1].text = "Leonardo DaVinci";
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[1].itxt_length = 0;
text_ptr[1].lang = NULL;
text_ptr[1].lang_key = NULL;
text_ptr[2].key = "Description";
text_ptr[2].text = "<long text>";
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
text_ptr[2].itxt_length = 0;
text_ptr[2].lang = NULL;
text_ptr[2].lang_key = NULL;
png_set_text(png_ptr, info_ptr, text_ptr, 3);
{
png_text text_ptr[3];
char key0[]="Title";
char text0[]="Mona Lisa";
text_ptr[0].key = key0;
text_ptr[0].text = text0;
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[0].itxt_length = 0;
text_ptr[0].lang = NULL;
text_ptr[0].lang_key = NULL;
char key1[]="Author";
char text1[]="Leonardo DaVinci";
text_ptr[1].key = key1;
text_ptr[1].text = text1;
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[1].itxt_length = 0;
text_ptr[1].lang = NULL;
text_ptr[1].lang_key = NULL;
char key2[]="Description";
char text2[]="<long text>";
text_ptr[2].key = key2;
text_ptr[2].text = text2;
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
text_ptr[2].itxt_length = 0;
text_ptr[2].lang = NULL;
text_ptr[2].lang_key = NULL;
png_set_text(write_ptr, write_info_ptr, text_ptr, 3);
}
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */

View File

@@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.0beta16 - March 6, 2012
libpng version 1.6.0beta18 - March 16, 2012
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.6.0beta16 - March 6, 2012
libpng versions 0.97, January 1998, through 1.6.0beta18 - March 16, 2012
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -4521,7 +4521,8 @@ From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
function) incorrectly returned a value of type png_uint_32.
Checking for invalid palette index on read or write was added at libpng
1.5.10. This is enabled by default but can be disabled in each png_ptr with
1.5.10. When an invalid index is found, libpng issues a benign error.
This is enabled by default but can be disabled in each png_ptr with
png_set_check_for_invalid_index(png_ptr, allowed);
@@ -4975,7 +4976,7 @@ above the comment that says
To avoid polluting the global namespace, the names of all exported
functions and variables begin with "png_", and all publicly visible C
preprocessor macros begin with "PNG_". We request that applications that
preprocessor macros begin with "PNG". We request that applications that
use libpng *not* begin any of their own symbols with either of these strings.
We put a space after each comma and after each semicolon
@@ -5002,13 +5003,13 @@ Other rules can be inferred by inspecting the libpng source.
XVI. Y2K Compliance in libpng
March 6, 2012
March 16, 2012
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.6.0beta16 are Y2K compliant. It is my belief that earlier
upward through 1.6.0beta18 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 that

View File

@@ -1,6 +1,6 @@
.TH LIBPNG 3 "March 6, 2012"
.TH LIBPNG 3 "March 16, 2012"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.0beta16
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.0beta18
.SH SYNOPSIS
\fI\fB
@@ -1007,7 +1007,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.0beta16 - March 6, 2012
libpng version 1.6.0beta18 - March 16, 2012
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -1018,7 +1018,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.6.0beta16 - March 6, 2012
libpng versions 0.97, January 1998, through 1.6.0beta18 - March 16, 2012
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -5529,7 +5529,8 @@ From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
function) incorrectly returned a value of type png_uint_32.
Checking for invalid palette index on read or write was added at libpng
1.5.10. This is enabled by default but can be disabled in each png_ptr with
1.5.10. When an invalid index is found, libpng issues a benign error.
This is enabled by default but can be disabled in each png_ptr with
png_set_check_for_invalid_index(png_ptr, allowed);
@@ -5983,7 +5984,7 @@ above the comment that says
To avoid polluting the global namespace, the names of all exported
functions and variables begin with "png_", and all publicly visible C
preprocessor macros begin with "PNG_". We request that applications that
preprocessor macros begin with "PNG". We request that applications that
use libpng *not* begin any of their own symbols with either of these strings.
We put a space after each comma and after each semicolon
@@ -6010,13 +6011,13 @@ Other rules can be inferred by inspecting the libpng source.
.SH XVI. Y2K Compliance in libpng
March 6, 2012
March 16, 2012
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.6.0beta16 are Y2K compliant. It is my belief that earlier
upward through 1.6.0beta18 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 that
@@ -6221,7 +6222,7 @@ the first widely used release:
1.5.7beta01-05 15 10507 15.so.15.7[.0]
1.5.7rc01-03 15 10507 15.so.15.7[.0]
1.5.7 15 10507 15.so.15.7[.0]
1.6.0beta01-16 16 10600 16.so.16.0[.0]
1.6.0beta01-18 16 10600 16.so.16.0[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
@@ -6278,7 +6279,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.6.0beta16 - March 6, 2012:
Libpng version 1.6.0beta18 - March 16, 2012:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -6301,7 +6302,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.6.0beta16, March 6, 2012, are
libpng versions 1.2.6, August 15, 2004, through 1.6.0beta18, March 16, 2012, are
Copyright (c) 2004,2006-2007 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
@@ -6400,7 +6401,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
March 6, 2012
March 16, 2012
.\" end of man page

View File

@@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "March 6, 2012"
.TH LIBPNGPF 3 "March 16, 2012"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.0beta16
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.0beta18
(private functions)
.SH SYNOPSIS
\fB#include \fI"pngpriv.h"

2
png.5
View File

@@ -1,4 +1,4 @@
.TH PNG 5 "March 6, 2012"
.TH PNG 5 "March 16, 2012"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

134
png.c
View File

@@ -14,7 +14,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_0beta16 Your_png_h_is_not_version_1_6_0beta16;
typedef png_libpng_version_1_6_0beta18 Your_png_h_is_not_version_1_6_0beta18;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@@ -283,41 +283,29 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
*/
if (png_user_version_check(&create_struct, user_png_ver))
{
/* TODO: delay initializing the zlib structure until it really is
* needed.
*/
/* Initialize zbuf - compression/decompression buffer */
create_struct.zbuf_size = PNG_ZBUF_SIZE;
create_struct.zbuf = png_voidcast(png_bytep,
png_malloc_warn(&create_struct, create_struct.zbuf_size));
png_structrp png_ptr = png_voidcast(png_structrp,
png_malloc_warn(&create_struct, sizeof *png_ptr));
/* Finally allocate the png_struct itself. */
if (create_struct.zbuf != NULL)
if (png_ptr != NULL)
{
png_structrp png_ptr = png_voidcast(png_structrp,
png_malloc_warn(&create_struct, sizeof *png_ptr));
/* png_ptr->zstream holds a back-pointer to the png_struct, so
* this can only be done now:
*/
create_struct.zstream.zalloc = png_zalloc;
create_struct.zstream.zfree = png_zfree;
create_struct.zstream.opaque = png_ptr;
if (png_ptr != NULL)
{
# ifdef PNG_SETJMP_SUPPORTED
/* Eliminate the local error handling: */
create_struct.jmp_buf_ptr = NULL;
create_struct.jmp_buf_size = 0;
create_struct.longjmp_fn = 0;
# endif
# ifdef PNG_SETJMP_SUPPORTED
/* Eliminate the local error handling: */
create_struct.jmp_buf_ptr = NULL;
create_struct.jmp_buf_size = 0;
create_struct.longjmp_fn = 0;
# endif
*png_ptr = create_struct;
*png_ptr = create_struct;
/* png_ptr->zstream holds a back-pointer to the png_struct, so
* this can only be done now:
*/
png_ptr->zstream.zalloc = png_zalloc;
png_ptr->zstream.zfree = png_zfree;
png_ptr->zstream.opaque = png_ptr;
/* This is the successful return point */
return png_ptr;
}
/* This is the successful return point */
return png_ptr;
}
}
}
@@ -325,15 +313,6 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
/* A longjmp because of a bug in the application storage allocator or a
* simple failure to allocate the png_struct.
*/
if (create_struct.zbuf != NULL)
{
png_bytep zbuf = create_struct.zbuf;
/* Ensure we don't keep on returning to this point: */
create_struct.zbuf = NULL;
png_free(&create_struct, zbuf);
}
return NULL;
}
@@ -768,13 +747,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.6.0beta16 - March 6, 2012" PNG_STRING_NEWLINE \
"libpng version 1.6.0beta18 - March 16, 2012" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2012 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
return "libpng version 1.6.0beta16 - March 6, 2012\
return "libpng version 1.6.0beta18 - March 16, 2012\
Copyright (c) 1998-2012 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@@ -867,6 +846,7 @@ png_reset_zstream(png_structrp png_ptr)
if (png_ptr == NULL)
return Z_STREAM_ERROR;
/* WARNING: this resets the window bits to the maximum! */
return (inflateReset(&png_ptr->zstream));
}
#endif /* PNG_READ_SUPPORTED */
@@ -882,6 +862,76 @@ png_access_version_number(void)
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* Ensure that png_ptr->zstream.msg holds some appropriate error message string.
* If it doesn't 'ret' is used to set it to something appropriate, even in cases
* like Z_OK or Z_STREAM_END where the error code is apparently a success code.
*/
void /* PRIVATE */
png_zstream_error(png_structrp png_ptr, int ret)
{
/* Translate 'ret' into an appropriate error string, priority is given to the
* one in zstream if set. This always returns a string, even in cases like
* Z_OK or Z_STREAM_END where the error code is a success code.
*/
if (png_ptr->zstream.msg == NULL) switch (ret)
{
default:
case Z_OK:
png_ptr->zstream.msg = PNGZ_MSG_CAST("unexpected zlib return code");
break;
case Z_STREAM_END:
/* Normal exit */
png_ptr->zstream.msg = PNGZ_MSG_CAST("unexpected end of LZ stream");
break;
case Z_NEED_DICT:
/* This means the deflate stream did not have a dictionary; this
* indicates a bogus PNG.
*/
png_ptr->zstream.msg = PNGZ_MSG_CAST("missing LZ dictionary");
break;
case Z_ERRNO:
/* gz APIs only: should not happen */
png_ptr->zstream.msg = PNGZ_MSG_CAST("zlib IO error");
break;
case Z_STREAM_ERROR:
/* internal libpng error */
png_ptr->zstream.msg = PNGZ_MSG_CAST("bad parameters to zlib");
break;
case Z_DATA_ERROR:
png_ptr->zstream.msg = PNGZ_MSG_CAST("damaged LZ stream");
break;
case Z_MEM_ERROR:
png_ptr->zstream.msg = PNGZ_MSG_CAST("insufficient memory");
break;
case Z_BUF_ERROR:
/* End of input or output; not a problem if the caller is doing
* incremental read or write.
*/
png_ptr->zstream.msg = PNGZ_MSG_CAST("truncated");
break;
case Z_VERSION_ERROR:
png_ptr->zstream.msg = PNGZ_MSG_CAST("unsupported zlib version");
break;
case PNG_UNEXPECTED_ZLIB_RETURN:
/* Compile errors here mean that zlib now uses the value co-opted in
* pngpriv.h for PNG_UNEXPECTED_ZLIB_RETURN; update the switch above
* and change pngpriv.h. Note that this message is "... return",
* whereas the default/Z_OK one is "... return code".
*/
png_ptr->zstream.msg = PNGZ_MSG_CAST("unexpected zlib return");
break;
}
}
/* png_convert_size: a PNGAPI but no longer in png.h, so deleted
* at libpng 1.5.5!
*/

24
png.h
View File

@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.6.0beta16 - March 6, 2012
* libpng version 1.6.0beta18 - March 16, 2012
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -11,7 +11,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.6.0beta16 - March 6, 2012: Glenn
* libpng versions 0.97, January 1998, through 1.6.0beta18 - March 16, 2012: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -166,7 +166,7 @@
* 1.5.7beta01-05 15 10507 15.so.15.7[.0]
* 1.5.7rc01-03 15 10507 15.so.15.7[.0]
* 1.5.7 15 10507 15.so.15.7[.0]
* 1.6.0beta01-16 16 10600 16.so.16.0[.0]
* 1.6.0beta01-18 16 10600 16.so.16.0[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -198,7 +198,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.6.0beta16, March 6, 2012, are
* libpng versions 1.2.6, August 15, 2004, through 1.6.0beta18, March 16, 2012, are
* Copyright (c) 2004, 2006-2012 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:
@@ -310,13 +310,13 @@
* Y2K compliance in libpng:
* =========================
*
* March 6, 2012
* March 16, 2012
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.6.0beta16 are Y2K compliant. It is my belief that
* upward through 1.6.0beta18 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant.
*
* Libpng only has two year fields. One is a 2-byte unsigned integer
@@ -374,9 +374,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.0beta16"
#define PNG_LIBPNG_VER_STRING "1.6.0beta18"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.6.0beta16 - March 6, 2012\n"
" libpng version 1.6.0beta18 - March 16, 2012\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
@@ -390,7 +390,7 @@
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
*/
#define PNG_LIBPNG_VER_BUILD 16
#define PNG_LIBPNG_VER_BUILD 18
/* Release Status */
#define PNG_LIBPNG_BUILD_ALPHA 1
@@ -520,7 +520,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
typedef char* png_libpng_version_1_6_0beta16;
typedef char* png_libpng_version_1_6_0beta18;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
@@ -1047,7 +1047,7 @@ PNG_EXPORTA(9, void, png_longjmp, (png_const_structrp png_ptr, int val),
#ifdef PNG_READ_SUPPORTED
/* Reset the compression stream */
PNG_EXPORT(10, int, png_reset_zstream, (png_structrp png_ptr));
PNG_EXPORTA(10, int, png_reset_zstream, (png_structrp png_ptr), PNG_DEPRECATED);
#endif
/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
@@ -2929,7 +2929,7 @@ typedef struct
(PNG_IMAGE_SAMPLE_SIZE((image).format) * (image).colormap_entries)
/* Return the size, in bytes, of the color-map of this image. If the image
* format is not a color-map format this will return a size sufficient for
* 256 entries in the given format; check PNG_IMAGE_FORMAT_FLAG_COLORMAP if
* 256 entries in the given format; check PNG_FORMAT_FLAG_COLORMAP if
* you don't want to allocate a color-map in this case.
*/

View File

@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.6.0beta16 - March 6, 2012
* libpng version 1.6.0beta18 - March 16, 2012
*
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -87,8 +87,8 @@
/* This controls optimization of the reading of 16 and 32 bit values
* from PNG files. It can be set on a per-app-file basis - it
* just changes whether a macro is used to the function is called.
* The library builder sets the default, if read functions are not
* just changes whether a macro is used when the function is called.
* The library builder sets the default; if read functions are not
* built into the library the macro implementation is forced on.
*/
#ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED

View File

@@ -1070,7 +1070,24 @@ png_get_user_chunk_ptr(png_const_structrp png_ptr)
png_size_t PNGAPI
png_get_compression_buffer_size(png_const_structrp png_ptr)
{
return (png_ptr ? png_ptr->zbuf_size : 0);
if (png_ptr == NULL)
return 0;
# ifdef PNG_WRITE_SUPPORTED
if (png_ptr->mode & PNG_IS_READ_STRUCT)
# endif
{
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
return png_ptr->IDAT_read_size;
# else
return PNG_IDAT_READ_SIZE;
# endif
}
# ifdef PNG_WRITE_SUPPORTED
else
return png_ptr->zbuffer_size;
# endif
}
#ifdef PNG_SET_USER_LIMITS_SUPPORTED

View File

@@ -838,7 +838,7 @@ png_push_read_IDAT(png_structrp png_ptr)
png_crc_finish(png_ptr, 0);
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
png_ptr->mode |= PNG_AFTER_IDAT;
png_ptr->flags &= ~PNG_FLAG_ZSTREAM_IN_USE;
png_ptr->zowner = 0;
}
}
@@ -894,7 +894,7 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
{
/* Terminate the decompression. */
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
png_ptr->flags &= ~PNG_FLAG_ZSTREAM_IN_USE;
png_ptr->zowner = 0;
/* This may be a truncated stream (missing or
* damaged end code). Treat that as a warning.
@@ -923,7 +923,7 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
/* Extra data. */
png_warning(png_ptr, "Extra compressed data in IDAT");
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
png_ptr->flags &= ~PNG_FLAG_ZSTREAM_IN_USE;
png_ptr->zowner = 0;
/* Do no more processing; skip the unprocessed
* input check below.

View File

@@ -466,6 +466,8 @@ typedef const png_uint_16p * png_const_uint_16pp;
#define PNG_BACKGROUND_IS_GRAY 0x800
#define PNG_HAVE_PNG_SIGNATURE 0x1000
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
#define PNG_HAVE_iCCP 0x4000
#define PNG_IS_READ_STRUCT 0x8000 /* Else is a write struct */
/* Flags for the transformations the PNG library does on the image data */
#define PNG_BGR 0x0001
@@ -511,9 +513,9 @@ typedef const png_uint_16p * png_const_uint_16pp;
/* Flags for the png_ptr->flags rather than declaring a byte for each one */
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */
#define PNG_FLAG_ZSTREAM_IN_USE 0x0004 /* Added to libpng-1.6.0 */
/* 0x0004 unused */
#define PNG_FLAG_ZSTREAM_ENDED 0x0008 /* Added to libpng-1.6.0 */
#define PNG_FLAG_ZSTREAM_CMF_FIXUP 0x0010 /* Added to libpng-1.6.0 */
/* 0x0010 unused */
/* 0x0020 unused */
#define PNG_FLAG_ROW_INIT 0x0040
#define PNG_FLAG_FILLER_AFTER 0x0080
@@ -550,18 +552,6 @@ typedef const png_uint_16p * png_const_uint_16pp;
#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
PNG_FLAG_CRC_CRITICAL_MASK)
/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
* can handle at once. This type need be no larger than 16 bits (so maximum of
* 65535), this define allows us to discover how big it is, but limited by the
* maximuum for png_size_t. The value can be overriden in a library build
* (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
* lower value (e.g. 255 works). A lower value may help memory usage (slightly)
* and may even improve performance on some systems (and degrade it on others.)
*/
#ifndef ZLIB_IO_MAX
# define ZLIB_IO_MAX ((uInt)-1)
#endif
/* Save typing and make code easier to understand */
#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
@@ -735,7 +725,18 @@ extern "C" {
*/
/* Zlib support */
PNG_INTERNAL_FUNCTION(void,png_inflate_claim,(png_structrp png_ptr),PNG_EMPTY);
#define PNG_UNEXPECTED_ZLIB_RETURN (-7)
PNG_INTERNAL_FUNCTION(void, png_zstream_error,(png_structrp png_ptr, int ret),
PNG_EMPTY);
/* Used by the zlib handling functions to ensure that z_stream::msg is always
* set before they return.
*/
#ifdef PNG_WRITE_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_free_buffer_list,(png_structrp png_ptr,
png_compression_bufferp *list),PNG_EMPTY);
/* Free the buffer list used by the compressed write code. */
#endif
#if defined PNG_FLOATING_POINT_SUPPORTED &&\
!defined PNG_FIXED_POINT_MACRO_SUPPORTED
@@ -850,15 +851,16 @@ PNG_INTERNAL_FUNCTION(void,png_flush,(png_structrp png_ptr),PNG_EMPTY);
/* Write the IHDR chunk, and update the png_struct with the necessary
* information.
*/
PNG_INTERNAL_FUNCTION(void,png_write_IHDR,(png_structrp png_ptr, png_uint_32 width,
png_uint_32 height, int bit_depth, int color_type, int compression_method,
int filter_method, int interlace_method),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_write_IHDR,(png_structrp png_ptr,
png_uint_32 width, png_uint_32 height, int bit_depth, int color_type,
int compression_method, int filter_method, int interlace_method),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_write_PLTE,(png_structrp png_ptr,
png_const_colorp palette, png_uint_32 num_pal),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_write_IDAT,(png_structrp png_ptr, png_bytep data,
png_size_t length),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_compress_IDAT,(png_structrp png_ptr,
png_const_bytep row_data, png_alloc_size_t row_data_length, int flush),
PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_write_IEND,(png_structrp png_ptr),PNG_EMPTY);
@@ -920,15 +922,9 @@ PNG_INTERNAL_FUNCTION(void,png_write_hIST,(png_structrp png_ptr,
#endif
/* Chunks that have keywords */
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
PNG_INTERNAL_FUNCTION(png_size_t,png_check_keyword,(png_structrp png_ptr,
png_const_charp key, png_charpp new_key),PNG_EMPTY);
#endif
#ifdef PNG_WRITE_tEXt_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr, png_const_charp key,
png_const_charp text, png_size_t text_len),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr,
png_const_charp key, png_const_charp text, png_size_t text_len),PNG_EMPTY);
#endif
#ifdef PNG_WRITE_zTXt_SUPPORTED
@@ -1053,8 +1049,24 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop row_in
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
png_row_infop row_info),PNG_EMPTY);
/* Finish a row while reading, dealing with interlacing passes, etc. */
PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),PNG_EMPTY);
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_read_IDAT_data,(png_structrp png_ptr,
png_bytep output, png_alloc_size_t avail_out),PNG_EMPTY);
/* Read 'avail_out' bytes of data from the IDAT stream. If the output buffer
* is NULL the function checks, instead, for the end of the stream. In this
* case a benign error will be issued if the stream end is not found or if
* extra data has to be consumed.
*/
PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr),
PNG_EMPTY);
/* This cleans up when the IDAT LZ stream does not end when the last image
* byte is read; there is still some pending input.
*/
PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
PNG_EMPTY);
/* Finish a row while reading, dealing with interlacing passes, etc. */
#endif
/* Initialize the row buffers, etc. */
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);

View File

@@ -48,6 +48,19 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
if (png_ptr != NULL)
{
png_ptr->mode = PNG_IS_READ_STRUCT;
/* Added in libpng-1.6.0; this can be used to detect a read structure if
* required (it will be zero in a write structure.)
*/
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
png_ptr->IDAT_read_size = PNG_IDAT_READ_SIZE;
# endif
# ifdef PNG_BENIGN_READ_ERRORS_SUPPORTED
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
# endif
/* TODO: delay this, it can be done in png_init_io (if the app doesn't
* do it itself) avoiding setting the default function if it is not
* required.
@@ -268,8 +281,6 @@ png_start_read_image(png_structrp png_ptr)
void PNGAPI
png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
{
int ret;
png_row_info row_info;
if (png_ptr == NULL)
@@ -423,56 +434,8 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
if (!(png_ptr->mode & PNG_HAVE_IDAT))
png_error(png_ptr, "Invalid attempt to read row data");
png_ptr->zstream.next_out = png_ptr->row_buf;
/* TODO: WARNING: BAD NEWS ALERT: this fails, terminally, if the row width is
* bigger than a uInt.
*/
png_ptr->zstream.avail_out = (uInt)(PNG_ROWBYTES(png_ptr->pixel_depth,
png_ptr->iwidth) + 1);
do
{
if (!(png_ptr->zstream.avail_in))
{
while (png_ptr->idat_size == 0)
{
png_crc_finish(png_ptr, 0);
png_ptr->idat_size = png_read_chunk_header(png_ptr);
if (png_ptr->chunk_name != png_IDAT)
png_error(png_ptr, "Not enough image data");
}
png_ptr->zstream.avail_in = png_ptr->zbuf_size;
png_ptr->zstream.next_in = png_ptr->zbuf;
if (png_ptr->zbuf_size > png_ptr->idat_size)
png_ptr->zstream.avail_in = (uInt)png_ptr->idat_size;
png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zstream.avail_in);
png_ptr->idat_size -= png_ptr->zstream.avail_in;
}
/* Use NO_FLUSH, not SYNC_FLUSH, here because we keep reading data until
* we have a row to process (so leave it to zlib to decide when to flush
* the output.)
*/
ret = inflate(&png_ptr->zstream, Z_NO_FLUSH);
if (ret == Z_STREAM_END)
{
if (png_ptr->zstream.avail_out || png_ptr->zstream.avail_in ||
png_ptr->idat_size)
png_benign_error(png_ptr, "Extra compressed data");
png_ptr->mode |= PNG_AFTER_IDAT;
/* Release the stream */
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
png_ptr->flags &= ~PNG_FLAG_ZSTREAM_IN_USE;
break;
}
if (ret != Z_OK)
png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg :
"Decompression error");
} while (png_ptr->zstream.avail_out);
/* Fill the row with IDAT data: */
png_read_IDAT_data(png_ptr, png_ptr->row_buf, row_info.rowbytes + 1);
if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE)
{
@@ -702,13 +665,16 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
if (png_ptr == NULL)
return;
png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */
/* If png_read_end is called in the middle of reading the rows there may
* still be pending IDAT data and an owned zstream. Deal with this here.
*/
png_read_finish_IDAT(png_ptr);
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
/* Report invalid palette index; added at libng-1.5.10 */
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
png_ptr->num_palette_max > png_ptr->num_palette)
png_warning(png_ptr, "Read palette index exceeding num_palette");
png_benign_error(png_ptr, "Read palette index exceeding num_palette");
#endif
do
@@ -851,10 +817,9 @@ png_read_destroy(png_structrp png_ptr)
png_destroy_gamma_table(png_ptr);
#endif
png_free(png_ptr, png_ptr->zbuf);
png_free(png_ptr, png_ptr->big_row_buf);
png_free(png_ptr, png_ptr->big_prev_row);
png_free(png_ptr, png_ptr->chunkdata);
png_free(png_ptr, png_ptr->read_buffer);
#ifdef PNG_READ_QUANTIZE_SUPPORTED
png_free(png_ptr, png_ptr->palette_lookup);
@@ -1125,6 +1090,7 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr,
/* Arguments to png_image_finish_read: */
/* Encoding of PNG data (used by the color-map code) */
/* TODO: change these, dang, ANSI-C reserves the 'E' namespace. */
# define E_NOTSET 0 /* File encoding not yet known */
# define E_sRGB 1 /* 8-bit encoded to sRGB gamma */
# define E_LINEAR 2 /* 16-bit linear: not encoded, NOT pre-multiplied! */
@@ -1277,6 +1243,7 @@ png_image_read_header(png_voidp argument)
png_structrp png_ptr = image->opaque->png_ptr;
png_inforp info_ptr = image->opaque->info_ptr;
png_set_benign_errors(png_ptr, 1/*warn*/);
png_read_info(png_ptr, info_ptr);
/* Do this the fast way; just read directly out of png_struct. */

1193
pngrutil.c

File diff suppressed because it is too large Load Diff

View File

@@ -1231,26 +1231,51 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
if (png_ptr == NULL)
return;
png_free(png_ptr, png_ptr->zbuf);
if (size == 0 || size > PNG_UINT_31_MAX)
png_error(png_ptr, "invalid compression buffer size");
if (size > ZLIB_IO_MAX)
{
png_warning(png_ptr, "Attempt to set buffer size beyond max ignored");
png_ptr->zbuf_size = ZLIB_IO_MAX;
size = ZLIB_IO_MAX; /* must fit */
}
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
if (png_ptr->mode & PNG_IS_READ_STRUCT)
{
png_ptr->IDAT_read_size = (png_uint_32)size; /* checked above */
return;
}
# endif
else
png_ptr->zbuf_size = (uInt)size;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
/* The following ensures a relatively safe failure if this gets called while
* the buffer is actually in use.
*/
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = 0;
png_ptr->zstream.avail_in = 0;
# ifdef PNG_WRITE_SUPPORTED
if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
{
if (png_ptr->zowner != 0)
{
png_warning(png_ptr,
"Compression buffer size cannot be changed because it is in use");
return;
}
if (size > ZLIB_IO_MAX)
{
png_warning(png_ptr,
"Compression buffer size limited to system maximum");
size = ZLIB_IO_MAX; /* must fit */
}
else if (size < 6)
{
/* Deflate will potentially go into an infinite loop on a SYNC_FLUSH
* if this is permitted.
*/
png_warning(png_ptr,
"Compression buffer size cannot be reduced below 6");
return;
}
if (png_ptr->zbuffer_size != size)
{
png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
png_ptr->zbuffer_size = (uInt)size;
}
}
# endif
}
void PNGAPI
@@ -1303,6 +1328,12 @@ png_set_benign_errors(png_structrp png_ptr, int allowed)
{
png_debug(1, "in png_set_benign_errors");
/* If allowed is 1, png_benign_error() is treated as a warning.
*
* If allowed is 0, png_benign_error() is treated as an error (which
* is the default behavior if png_set_benign_errors() is not called).
*/
if (allowed)
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
@@ -1318,7 +1349,7 @@ png_set_check_for_invalid_index(png_structrp png_ptr, int allowed)
{
png_debug(1, "in png_set_check_for_invalid_index");
if (allowed)
if (allowed > 0)
png_ptr->num_palette_max = 0;
else

View File

@@ -24,7 +24,50 @@
* in this structure and is required for decompressing the LZ compressed
* data in PNG files.
*/
#ifndef ZLIB_CONST
/* We must ensure that zlib uses 'const' in declarations. */
# define ZLIB_CONST
#endif
#include "zlib.h"
#ifdef const
/* zlib.h sometimes #defines const to nothing, undo this. */
# undef const
#endif
/* zlib.h has mediocre z_const use before 1.2.6, this stuff is for compatibility
* with older builds.
*/
#if ZLIB_VERNUM < 0x1260
# define PNGZ_MSG_CAST(s) png_constcast(char*,s)
# define PNGZ_INPUT_CAST(b) png_constcast(png_bytep,b)
#else
# define PNGZ_MSG_CAST(s) (s)
# define PNGZ_INPUT_CAST(b) (b)
#endif
/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
* can handle at once. This type need be no larger than 16 bits (so maximum of
* 65535), this define allows us to discover how big it is, but limited by the
* maximuum for png_size_t. The value can be overriden in a library build
* (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
* lower value (e.g. 255 works). A lower value may help memory usage (slightly)
* and may even improve performance on some systems (and degrade it on others.)
*/
#ifndef ZLIB_IO_MAX
# define ZLIB_IO_MAX ((uInt)-1)
#endif
#ifdef PNG_WRITE_SUPPORTED
/* The type of a compression buffer list used by the write code. */
typedef struct png_compression_buffer
{
struct png_compression_buffer *next;
png_byte output[1]; /* actually zbuf_size */
} png_compression_buffer, *png_compression_bufferp;
#define PNG_COMPRESSION_BUFFER_SIZE(pp)\
(offsetof(png_compression_buffer, output) + (pp)->zbuffer_size)
#endif
struct png_struct_def
{
@@ -65,11 +108,13 @@ struct png_struct_def
png_uint_32 flags; /* flags indicating various things to libpng */
png_uint_32 transformations; /* which transformations to perform */
z_stream zstream; /* decompression structure */
png_bytep zbuf; /* buffer for zlib */
uInt zbuf_size; /* size of zbuf */
png_uint_32 zowner; /* ID (chunk type) of zstream owner, 0 if none */
z_stream zstream; /* decompression structure */
#ifdef PNG_WRITE_SUPPORTED
png_compression_bufferp zbuffer_list; /* Created on demand during write */
uInt zbuffer_size; /* size of the actual buffer */
int zlib_level; /* holds zlib compression level */
int zlib_method; /* holds zlib compression method */
int zlib_window_bits; /* holds zlib compression window bits */
@@ -341,8 +386,14 @@ struct png_struct_def
/* New member added in libpng-1.2.26 */
png_size_t old_big_row_buf_size;
#ifdef PNG_READ_SUPPORTED
/* New member added in libpng-1.2.30 */
png_charp chunkdata; /* buffer for reading chunk data */
png_bytep read_buffer; /* buffer for reading chunk data */
png_alloc_size_t read_buffer_size; /* current size of the buffer */
#endif
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
uInt IDAT_read_size; /* limit on read buffer size for IDAT */
#endif
#ifdef PNG_IO_STATE_SUPPORTED
/* New member added in libpng-1.4.0 */

View File

@@ -745,6 +745,17 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
#endif
if (strict)
{
/* Treat png_benign_error() as errors on read */
png_set_benign_errors(read_ptr, 0);
/* Treat them as errors on write */
png_set_benign_errors(write_ptr, 0);
/* if strict is not set, then both are treated as warnings. */
}
pngtest_debug("Initializing input and output streams");
#ifdef PNG_STDIO_SUPPORTED
png_init_io(read_ptr, fpin);
@@ -1012,7 +1023,16 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text);
if (verbose)
printf("\n Text compression=%d\n", text_ptr->compression);
{
int i;
printf("\n");
for (i=0; i<num_text; i++)
{
printf(" Text compression[%d]=%d\n",
i, text_ptr[i].compression);
}
}
png_set_text(write_ptr, write_info_ptr, text_ptr, num_text);
}
@@ -1207,6 +1227,19 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_text(read_ptr, end_info_ptr, &text_ptr, &num_text) > 0)
{
pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text);
if (verbose)
{
int i;
printf("\n");
for (i=0; i<num_text; i++)
{
printf(" Text compression[%d]=%d\n",
i, text_ptr[i].compression);
}
}
png_set_text(write_ptr, write_end_info_ptr, text_ptr, num_text);
}
}
@@ -1659,4 +1692,4 @@ main(int argc, char *argv[])
}
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_0beta16 Your_png_h_is_not_version_1_6_0beta16;
typedef png_libpng_version_1_6_0beta18 Your_png_h_is_not_version_1_6_0beta18;

View File

@@ -635,7 +635,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
* forms produced on either GCC or MSVC.
*/
int padding = (-row_info->pixel_depth * row_info->width) & 7;
png_bytep rp = png_ptr->row_buf + 1 + row_info->rowbytes;
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
switch (row_info->bit_depth)
{

View File

@@ -310,7 +310,7 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
if (png_ptr->num_palette_max > png_ptr->num_palette)
png_warning(png_ptr, "Wrote palette index exceeding num_palette");
png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
#endif
/* See if user wants us to write information chunks */
@@ -475,6 +475,8 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
/* Set the zlib control values to defaults; they can be overridden by the
* application after the struct has been created.
*/
png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
png_ptr->zlib_strategy = Z_FILTERED; /* may be overridden if no filters */
png_ptr->zlib_level = Z_DEFAULT_COMPRESSION;
png_ptr->zlib_mem_level = 8;
@@ -489,6 +491,15 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
png_ptr->zlib_text_method = 8;
#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
/* This is a highly dubious configuration option; by default it is off, but
* it may be appropriate for private builds that are testing extensions not
* conformant to the current specification, or of applications that must not
* fail to write at all costs!
*/
# ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
# endif
if (png_ptr != NULL)
{
/* TODO: delay this, it can be done in png_init_io() (if the app doesn't
@@ -784,8 +795,6 @@ png_set_flush(png_structrp png_ptr, int nrows)
void PNGAPI
png_write_flush(png_structrp png_ptr)
{
int wrote_IDAT;
png_debug(1, "in png_write_flush");
if (png_ptr == NULL)
@@ -795,39 +804,7 @@ png_write_flush(png_structrp png_ptr)
if (png_ptr->row_number >= png_ptr->num_rows)
return;
do
{
int ret;
/* Compress the data */
ret = deflate(&png_ptr->zstream, Z_SYNC_FLUSH);
wrote_IDAT = 0;
/* Check for compression errors */
if (ret != Z_OK)
{
if (png_ptr->zstream.msg != NULL)
png_error(png_ptr, png_ptr->zstream.msg);
else
png_error(png_ptr, "zlib error");
}
if (!(png_ptr->zstream.avail_out))
{
/* Write the IDAT and reset the zlib output buffer */
png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
wrote_IDAT = 1;
}
} while (wrote_IDAT == 1);
/* If there is any data left to be output, write it into a new IDAT */
if (png_ptr->zbuf_size != png_ptr->zstream.avail_out)
{
/* Write the IDAT and reset the zlib output buffer */
png_write_IDAT(png_ptr, png_ptr->zbuf,
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
}
png_compress_IDAT(png_ptr, NULL, 0, Z_SYNC_FLUSH);
png_ptr->flush_rows = 0;
png_flush(png_ptr);
}
@@ -848,7 +825,7 @@ png_write_destroy(png_structrp png_ptr)
deflateEnd(&png_ptr->zstream);
/* Free our memory. png_free checks NULL for us. */
png_free(png_ptr, png_ptr->zbuf);
png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
png_free(png_ptr, png_ptr->row_buf);
#ifdef PNG_WRITE_FILTER_SUPPORTED
png_free(png_ptr, png_ptr->prev_row);
@@ -2014,6 +1991,11 @@ png_image_write_main(png_voidp argument)
int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA) != 0;
int write_16bit = linear && !colormap && !display->convert_to_8bit;
# ifdef PNG_BENIGN_ERRORS_SUPPORTED
/* Make sure we error out on any bad situation */
png_set_benign_errors(png_ptr, 0/*error*/);
# endif
/* Default the 'row_stride' parameter if required. */
if (display->row_stride == 0)
display->row_stride = PNG_IMAGE_ROW_STRIDE(*image);

1417
pngwutil.c

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
VisualStudio instructions
libpng version 1.6.0beta16 - March 6, 2012
libpng version 1.6.0beta18 - March 16, 2012
Copyright (c) 1998-2010 Glenn Randers-Pehrson

View File

@@ -2,7 +2,7 @@
<!--
* zlib.props - location of zlib source
*
* libpng version 1.6.0beta16 - March 6, 2012
* libpng version 1.6.0beta18 - March 16, 2012
*
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
*

View File

@@ -1,9 +1,9 @@
Makefiles for libpng version 1.6.0beta16 - March 6, 2012
Makefiles for libpng version 1.6.0beta18 - March 16, 2012
pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile
(gcc, creates libpng16.so.16.1.6.0beta16)
(gcc, creates libpng16.so.16.1.6.0beta18)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
@@ -20,7 +20,7 @@ pnglibconf.h.prebuilt => Stores configuration settings
makefile.dec => DEC Alpha UNIX makefile
makefile.dj2 => DJGPP 2 makefile
makefile.elf => Linux/ELF makefile symbol versioning,
(gcc, creates libpng16.so.16.1.6.0beta16)
(gcc, creates libpng16.so.16.1.6.0beta18)
makefile.freebsd => FreeBSD makefile
makefile.gcc => Generic gcc makefile
makefile.hpgcc => HPUX makefile using gcc
@@ -35,12 +35,12 @@ pnglibconf.h.prebuilt => Stores configuration settings
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.sggcc => Silicon Graphics (gcc,
creates libpng16.so.16.1.6.0beta16)
creates libpng16.so.16.1.6.0beta18)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng16.so.16.1.6.0beta16)
creates libpng16.so.16.1.6.0beta18)
makefile.so9 => Solaris 9 makefile (gcc,
creates libpng16.so.16.1.6.0beta16)
creates libpng16.so.16.1.6.0beta18)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.sunos => Sun makefile
makefile.32sunu => Sun Ultra 32-bit makefile

View File

@@ -11,7 +11,7 @@
# Modeled after libxml-config.
version=1.6.0beta16
version=1.6.0beta18
prefix=""
libdir=""
libs=""

View File

@@ -5,6 +5,6 @@ includedir=@includedir@/libpng16
Name: libpng
Description: Loads and saves PNG files
Version: 1.6.0beta16
Version: 1.6.0beta18
Libs: -L${libdir} -lpng16
Cflags: -I${includedir}

View File

@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng16
LIB= png16
SHLIB_MAJOR= 0
SHLIB_MINOR= 1.6.0beta16
SHLIB_MINOR= 1.6.0beta18
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
LIB= png
SHLIB_MAJOR= 16
SHLIB_MINOR= 1.6.0beta16
SHLIB_MINOR= 1.6.0beta18
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 16
SHLIB_MINOR= 1.6.0beta16
SHLIB_MINOR= 1.6.0beta18
LIB= png
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \

View File

@@ -186,10 +186,36 @@ option READ_INT_FUNCTIONS requires READ
option WRITE_INT_FUNCTIONS disabled
option WRITE enables WRITE_INT_FUNCTIONS
# Generic options - affect both read and write.
# Error controls
#
# WARNINGS: normally on, if off no warnings are generated
# ERROR_TEXT: normally on, if off errors happen but there is no message
# ERROR_NUMBERS: unimplemented feature, therefore disabled
# BENIGN_ERRORS: support for just issuing warnings for recoverable errors
#
# BENIGN_READ_ERRORS:
# By default recoverable errors on read should just generate warnings,
# generally safe but PNG files that don't conform to the specification will
# be accepted if a meaningful result can be produced.
#
# BENIGN_WRITE_ERRORS:
# By default recoverable errors on write should just generate warnings,
# not generally safe because this allows the application to write invalid
# PNG files. Applications should enable this themselves; it's useful
# because it means that a failure to write an ancilliary chunk can often be
# ignored.
option WARNINGS
option ERROR_TEXT
option ERROR_NUMBERS disabled
option BENIGN_ERRORS
option BENIGN_WRITE_ERRORS requires BENIGN_ERRORS disabled
option BENIGN_READ_ERRORS requires BENIGN_ERRORS
# Generic options - affect both read and write.
option MNG_FEATURES
# Arithmetic options, the first is the big switch that chooses between internal
@@ -200,10 +226,6 @@ option FLOATING_ARITHMETIC
option FLOATING_POINT enables ok_math
option FIXED_POINT enables ok_math
# Added at libpng version 1.4.0
option ERROR_TEXT
# The following is always on (defined empty)
setting CALLOC_SUPPORTED default
@@ -230,10 +252,6 @@ option TIME_RFC1123
option SETJMP
= NO_SETJMP SETJMP_NOT_SUPPORTED
# For the moment this is disabled (no code support):
option ERROR_NUMBERS disabled
# If this is disabled it is not possible for apps to get the
# values from the 'info' structure, this effectively removes
# quite a lot of the READ API.
@@ -516,6 +534,30 @@ setting sCAL_PRECISION default 5
setting ZBUF_SIZE default 8192
# This is the size of the decompression buffer used when counting or checking
# the decompressed size of an LZ stream from a compressed ancilliary chunk; the
# decompressed data is never used so a different size may be optimal. This size
# was determined using contrib/libtests/timepng.c with compressed zTXt data
# around 11MByte in size. Slight speed improvements (up to about 14% in
# timepng) can be achieved by very large increases (to 32kbyte) on regular data,
# but highly compressible data shows only around 2% improvement. The size is
# chosen to minimize the effects of DoS attacks based on using very large
# amounts of highly compressible data.
setting INFLATE_BUF_SIZE default 1024
# This is the maximum amount of IDAT data that the sequential reader will
# process at one time. The setting does not affect the size of IDAT chunks
# read, just the amount read at once. Neither does it affect the progressive
# reader, which processes just the amount of data the application gives it.
# The sequential reader is currently unable to process more than one IDAT at
# once - it has to read and process each one in turn. There is no point setting
# this to a value larger than the IDAT chunks typically encountered (it would
# just waste memory) but there may be some point in reducing it below the value
# of ZBUF_SIZE (the size of IDAT chunks written by libpng.)
setting IDAT_READ_SIZE default PNG_ZBUF_SIZE
# Ancillary chunks
chunk bKGD
chunk cHRM
@@ -598,6 +640,7 @@ option WRITE_CHECK_FOR_INVALID_INDEX requires WRITE CHECK_FOR_INVALID_INDEX
# Simplified API options (added at libpng-1.6.0)
# Read:
option SIMPLIFIED_READ requires SEQUENTIAL_READ READ_TRANSFORMS SETJMP
option SIMPLIFIED_READ requires BENIGN_ERRORS
option SIMPLIFIED_READ enables READ_EXPAND READ_16BIT READ_EXPAND_16
option SIMPLIFIED_READ enables READ_SCALE_16_TO_8 READ_RGB_TO_GRAY
option SIMPLIFIED_READ enables READ_ALPHA_MODE READ_BACKGROUND READ_STRIP_ALPHA

View File

@@ -3,7 +3,7 @@
/* pnglibconf.h - library build configuration */
/* Libpng 1.6.0beta16 - March 6, 2012 */
/* Libpng 1.6.0beta18 - March 16, 2012 */
/* Copyright (c) 1998-2012 Glenn Randers-Pehrson */
@@ -26,6 +26,8 @@
#define PNG_COST_SHIFT 3
#define PNG_DEFAULT_READ_MACROS 1
#define PNG_GAMMA_THRESHOLD_FIXED 5000
#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
#define PNG_INFLATE_BUF_SIZE 1024
#define PNG_MAX_GAMMA_8 11
#define PNG_QUANTIZE_BLUE_BITS 5
#define PNG_QUANTIZE_GREEN_BITS 5
@@ -38,6 +40,8 @@
#define PNG_16BIT_SUPPORTED
#define PNG_ALIGN_MEMORY_SUPPORTED
#define PNG_BENIGN_ERRORS_SUPPORTED
#define PNG_BENIGN_READ_ERRORS_SUPPORTED
/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/
#define PNG_bKGD_SUPPORTED
#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
#define PNG_CHECK_cHRM_SUPPORTED
@@ -118,6 +122,7 @@
#define PNG_READ_USER_CHUNKS_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_zTXt_SUPPORTED
/*#undef PNG_SAFE_LIMITS_SUPPORTED*/
#define PNG_SAVE_INT_32_SUPPORTED
#define PNG_sBIT_SUPPORTED
#define PNG_sCAL_SUPPORTED

View File

@@ -5,7 +5,7 @@
LIBRARY
EXPORTS
;Version 1.6.0beta16
;Version 1.6.0beta18
png_access_version_number @1
png_set_sig_bytes @2
png_sig_cmp @3