diff -ru4NwbB libpng-1.5.4/Makefile.am libpng-1.5.5beta04/Makefile.am
--- libpng-1.5.4/Makefile.am 2011-07-07 06:24:55.914993260 -0500
+++ libpng-1.5.5beta04/Makefile.am 2011-07-29 12:22:36.474943375 -0500
@@ -96,9 +96,9 @@
$(PNGLIB_BASENAME)-config: libpng-config
cp libpng-config $@
scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
-scripts/symbols.out: png.h pngconf.h scripts/pnglibconf.h.prebuilt
+scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
libpng.sym: scripts/sym.out
rm -f $@
cp $? $@
@@ -107,9 +107,10 @@
cp $? $@
pnglibconf.h: pnglibconf.out
rm -f $@
cp $? $@
-scripts/pnglibconf.h.prebuilt:
+$(srcdir)/scripts/pnglibconf.h.prebuilt:
+ @echo "Attempting to build $@" >&2
@echo "This is a machine generated file, but if you want to make" >&2
@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
@exit 1
@@ -161,9 +162,9 @@
rm -f $@ dfn?.out
test -z "$(CPPFLAGS)"
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out\
- logunsupported=4 - ${srcdir}/scripts/pnglibconf.dfa 1>&2
+ logunsupported=1 - ${srcdir}/scripts/pnglibconf.dfa 1>&2
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
rm dfn1.out
mv dfn2.out $@
diff -ru4NwbB libpng-1.5.4/contrib/pngminus/makefile.std libpng-1.5.5beta04/contrib/pngminus/makefile.std
--- libpng-1.5.4/contrib/pngminus/makefile.std 2011-07-07 06:24:48.716051405 -0500
+++ libpng-1.5.5beta04/contrib/pngminus/makefile.std 2011-07-29 12:22:29.858956303 -0500
@@ -7,11 +7,11 @@
RM=rm -f
#PNGPATH = /usr/local
-#PNGINC = -I$(PNGPATH)/include/libpng12
-#PNGLIB = -L$(PNGPATH)/lib -lpng12
-#PNGLIBS = $(PNGPATH)/lib/libpng12.a
+#PNGINC = -I$(PNGPATH)/include/libpng15
+#PNGLIB = -L$(PNGPATH)/lib -lpng15
+#PNGLIBS = $(PNGPATH)/lib/libpng15.a
PNGINC = -I../..
PNGLIB = -L../.. -lpng
PNGLIBS = ../../libpng.a
@@ -22,11 +22,11 @@
ZINC = -I../../../zlib
ZLIB = -L../../../zlib -lz
ZLIBS = ../../../zlib/libz.a
-CFLAGS=-O3 $(PNGINC) $(ZINC)
-LDFLAGS=$(PNGLIB) $(ZLIB)
-LDFLAGSS=$(PNGLIBS) $(ZLIBS)
+CFLAGS=$(PNGINC) $(ZINC)
+LDLIBS=$(PNGLIB) $(ZLIB)
+LDLIBSS=$(PNGLIBS) $(ZLIBS)
C=.c
O=.o
L=.a
E=
@@ -39,21 +39,21 @@
png2pnm$(O): png2pnm$(C)
$(CC) -c $(CFLAGS) png2pnm$(C)
png2pnm$(E): png2pnm$(O)
- $(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS) -lm
+ $(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
png2pnm-static$(E): png2pnm$(O)
- $(LD) -o png2pnm-static$(E) png2pnm$(O) $(LDFLAGSS) -lm
+ $(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
pnm2png$(O): pnm2png$(C)
$(CC) -c $(CFLAGS) pnm2png$(C)
pnm2png$(E): pnm2png$(O)
- $(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS) -lm
+ $(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
pnm2png-static$(E): pnm2png$(O)
- $(LD) -o pnm2png-static$(E) pnm2png$(O) $(LDFLAGSS) -lm
+ $(LD) $(LDFLAGS) -o pnm2png-static$(E) pnm2png$(O) $(LDLIBSS) -lm
clean:
$(RM) png2pnm$(O)
$(RM) pnm2png$(O)
diff -ru4NwbB libpng-1.5.4/png.c libpng-1.5.5beta04/png.c
--- libpng-1.5.4/png.c 2011-07-07 06:24:48.277563190 -0500
+++ libpng-1.5.5beta04/png.c 2011-07-29 12:22:29.388555461 -0500
@@ -1,8 +1,8 @@
/* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.5.4 [July 7, 2011]
+ * Last changed in libpng 1.5.5 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 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.)
*
@@ -541,10 +541,10 @@
# ifdef PNG_STDIO_SUPPORTED
/* Initialize the default input/output functions for the PNG file. If you
* use your own read or write routines, you can call either png_set_read_fn()
* or png_set_write_fn() instead of png_init_io(). If you have defined
- * PNG_NO_STDIO, you must use a function of your own because "FILE *" isn't
- * necessarily available.
+ * PNG_NO_STDIO or otherwise disabled PNG_STDIO_SUPPORTED, you must use a
+ * function of your own because "FILE *" isn't necessarily available.
*/
void PNGAPI
png_init_io(png_structp png_ptr, png_FILE_p fp)
{
diff -ru4NwbB libpng-1.5.4/png.h libpng-1.5.5beta04/png.h
--- libpng-1.5.4/png.h 2011-07-07 06:24:48.226988784 -0500
+++ libpng-1.5.5beta04/png.h 2011-07-29 12:22:29.339977557 -0500
@@ -156,8 +156,9 @@
* 1.5.3 [omitted]
* 1.5.4beta01-08 15 10504 15.so.15.4[.0]
* 1.5.4rc01 15 10504 15.so.15.4[.0]
* 1.5.4 15 10504 15.so.15.4[.0]
+ * 1.5.5beta01-04 15 10505 15.so.15.5[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
* used for changes in backward compatibility, as it is intended. The
diff -ru4NwbB libpng-1.5.4/pngconf.h libpng-1.5.5beta04/pngconf.h
--- libpng-1.5.4/pngconf.h 2011-07-07 06:24:48.233989899 -0500
+++ libpng-1.5.5beta04/pngconf.h 2011-07-29 12:22:29.346887048 -0500
@@ -384,9 +384,9 @@
# ifndef PNG_NORETURN
# define PNG_NORETURN __declspec(noreturn)
# endif
# ifndef PNG_ALLOCATED
-# if (_MSC_VER >= 1400)
+# if defined(_MSC_VER) && (_MSC_VER >= 1300)
# define PNG_ALLOCATED __declspec(restrict)
# endif
# endif
diff -ru4NwbB libpng-1.5.4/pngrtran.c libpng-1.5.5beta04/pngrtran.c
--- libpng-1.5.4/pngrtran.c 2011-07-07 06:24:48.338363499 -0500
+++ libpng-1.5.5beta04/pngrtran.c 2011-07-29 12:22:29.448242049 -0500
@@ -3065,23 +3065,34 @@
#endif
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
/* Reduce RGB files to grayscale, with or without alpha
- * using the equation given in Poynton's ColorFAQ at
- * (THIS LINK IS DEAD June 2008)
- * New link:
- *
+ * using the equation given in Poynton's ColorFAQ of 1998-01-04 at
+ * (THIS LINK IS DEAD June 2008 but
+ * versions dated 1998 through November 2002 have been archived at
+ * http://web.archive.org/web/20000816232553/http://www.inforamp.net/
+ * ~poynton/notes/colour_and_gamma/ColorFAQ.txt )
* Charles Poynton poynton at poynton.com
*
* Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
*
- * We approximate this with
+ * which can be expressed with integers as
*
- * Y = 0.21268 * R + 0.7151 * G + 0.07217 * B
+ * Y = (6969 * R + 23434 * G + 2365 * B)/32768
+ *
+ * Poynton's current link (as of January 2003 through July 2011):
+ *
+ * has changed the numbers slightly:
+ *
+ * Y = 0.2126*R + 0.7152*G + 0.0722*B
*
* which can be expressed with integers as
*
- * Y = (6969 * R + 23434 * G + 2365 * B)/32768
+ * Y = (6966 * R + 23436 * G + 2366 * B)/32768
+ *
+ * We use the approximation
+ *
+ * Y = (6968 * R + 23434 * G + 2366 * B)/32768
*
* The calculation is to be done in a linear colorspace.
*
* Other integer coefficents can be used via png_set_rgb_to_gray().
diff -ru4NwbB libpng-1.5.4/pngrutil.c libpng-1.5.5beta04/pngrutil.c
--- libpng-1.5.4/pngrutil.c 2011-07-07 06:24:48.352709758 -0500
+++ libpng-1.5.5beta04/pngrutil.c 2011-07-29 12:22:29.462220691 -0500
@@ -1,8 +1,8 @@
/* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.5.4 [July 7, 2011]
+ * Last changed in libpng 1.5.5 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 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.)
*
@@ -457,9 +457,9 @@
#endif
{
/* Success (maybe) - really uncompress the chunk. */
png_size_t new_size = 0;
- png_charp text = png_malloc_warn(png_ptr,
+ png_charp text = (png_charp)png_malloc_warn(png_ptr,
prefix_size + expanded_size + 1);
if (text != NULL)
{
@@ -500,9 +500,9 @@
* data, reallocate the chunkdata to remove the potentially large
* amount of compressed data.
*/
{
- png_charp text = png_malloc_warn(png_ptr, prefix_size + 1);
+ png_charp text = (png_charp)png_malloc_warn(png_ptr, prefix_size + 1);
if (text != NULL)
{
if (prefix_size > 0)
diff -ru4NwbB libpng-1.5.4/pngvalid.c libpng-1.5.5beta04/pngvalid.c
--- libpng-1.5.4/pngvalid.c 2011-07-07 06:24:48.403347080 -0500
+++ libpng-1.5.5beta04/pngvalid.c 2011-07-29 12:22:29.511987827 -0500
@@ -1,8 +1,8 @@
/* pngvalid.c - validate libpng by constructing then reading png files.
*
- * Last changed in libpng 1.5.4 [July 7, 2011]
+ * Last changed in libpng 1.5.5 [(PENDING RELEASE)]
* Copyright (c) 2011 Glenn Randers-Pehrson
* Written by John Cunningham Bowler
*
* This code is released under the libpng license.
@@ -76,8 +76,17 @@
#endif
/***************************** EXCEPTION HANDLING *****************************/
#include "contrib/visupng/cexcept.h"
+
+#ifdef __cplusplus
+# define this not_the_cpp_this
+# define new not_the_cpp_new
+# define voidcast(type, value) static_cast(value)
+#else
+# define voidcast(type, value) (value)
+#endif /* __cplusplus */
+
struct png_store;
define_exception_type(struct png_store*);
/* The following are macros to reduce typing everywhere where the well known
@@ -142,9 +151,9 @@
static void
make_random_bytes(png_uint_32* seed, void* pv, size_t size)
{
png_uint_32 u0 = seed[0], u1 = seed[1];
- png_bytep bytes = /*no cast required*/pv;
+ png_bytep bytes = voidcast(png_bytep, pv);
/* There are thirty three bits, the next bit in the sequence is bit-33 XOR
* bit-20. The top 1 bit is in u1, the bottom 32 are in u0.
*/
@@ -630,9 +639,9 @@
if (ps->writepos != STORE_BUFFER_SIZE)
png_error(ps->pwrite, "invalid store call");
- pb = malloc(sizeof *pb);
+ pb = voidcast(png_store_buffer*, malloc(sizeof *pb));
if (pb == NULL)
png_error(ps->pwrite, "store new: OOM");
@@ -666,9 +675,9 @@
*/
static void
store_storefile(png_store *ps, png_uint_32 id)
{
- png_store_file *pf = malloc(sizeof *pf);
+ png_store_file *pf = voidcast(png_store_file*, malloc(sizeof *pf));
if (pf == NULL)
png_error(ps->pwrite, "storefile: OOM");
safecat(pf->name, sizeof pf->name, 0, ps->wname);
pf->id = id;
@@ -760,9 +769,9 @@
/* Functions to use as PNG callbacks. */
static void
store_error(png_structp pp, png_const_charp message) /* PNG_NORETURN */
{
- png_store *ps = png_get_error_ptr(pp);
+ png_store *ps = voidcast(png_store*, png_get_error_ptr(pp));
if (!ps->expect_error)
store_log(ps, pp, message, 1 /* error */);
@@ -775,9 +784,9 @@
static void
store_warning(png_structp pp, png_const_charp message)
{
- png_store *ps = png_get_error_ptr(pp);
+ png_store *ps = voidcast(png_store*, png_get_error_ptr(pp));
if (!ps->expect_warning)
store_log(ps, pp, message, 0 /* warning */);
else
@@ -837,9 +846,9 @@
store_image_free(ps, pp);
/* The buffer is deliberately mis-aligned. */
- image = malloc(cb+2);
+ image = voidcast(png_bytep, malloc(cb+2));
if (image == NULL)
{
/* Called from the startup - ignore the error for the moment. */
if (pp == NULL)
@@ -921,9 +930,9 @@
static void
store_write(png_structp pp, png_bytep pb, png_size_t st)
{
- png_store *ps = png_get_io_ptr(pp);
+ png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
if (ps->pwrite != pp)
png_error(pp, "store state damaged");
@@ -1041,9 +1050,9 @@
static void
store_read(png_structp pp, png_bytep pb, png_size_t st)
{
- png_store *ps = png_get_io_ptr(pp);
+ png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
if (ps == NULL || ps->pread != pp)
png_error(pp, "bad store read call");
@@ -1081,9 +1090,10 @@
/* This function can only return NULL if called with '0'! */
if (npalette > 0)
{
- ps->palette = malloc(npalette * sizeof *ps->palette);
+ ps->palette = voidcast(store_palette_entry*, malloc(npalette *
+ sizeof *ps->palette));
if (ps->palette == NULL)
png_error(ps->pwrite, "store new palette: OOM");
@@ -1228,10 +1238,11 @@
/* The memory callbacks: */
static png_voidp
store_malloc(png_structp pp, png_alloc_size_t cb)
{
- store_pool *pool = png_get_mem_ptr(pp);
- store_memory *new = malloc(cb + (sizeof *new) + (sizeof pool->mark));
+ store_pool *pool = voidcast(store_pool*, png_get_mem_ptr(pp));
+ store_memory *new = voidcast(store_memory*, malloc(cb + (sizeof *new) +
+ (sizeof pool->mark)));
if (new != NULL)
{
if (cb > pool->max)
@@ -1261,10 +1272,10 @@
static void
store_free(png_structp pp, png_voidp memory)
{
- store_pool *pool = png_get_mem_ptr(pp);
- store_memory *this = memory, **test;
+ store_pool *pool = voidcast(store_pool*, png_get_mem_ptr(pp));
+ store_memory *this = voidcast(store_memory*, memory), **test;
/* First check that this 'memory' really is valid memory - it must be in the
* pool list. If it is, use the shared memory_free function to free it.
*/
@@ -1482,19 +1493,21 @@
* modification, otherwise a png_modifier is functionally equivalent to a
* png_store. There is a special read function, set_modifier_for_read, which
* replaces set_store_for_read.
*/
+typedef enum modifier_state
+{
+ modifier_start, /* Initial value */
+ modifier_signature, /* Have a signature */
+ modifier_IHDR /* Have an IHDR */
+} modifier_state;
+
typedef struct png_modifier
{
png_store this; /* I am a png_store */
struct png_modification *modifications; /* Changes to make */
- enum modifier_state
- {
- modifier_start, /* Initial value */
- modifier_signature, /* Have a signature */
- modifier_IHDR /* Have an IHDR */
- } state; /* My state */
+ modifier_state state; /* My state */
/* Information from IHDR: */
png_byte bit_depth; /* From IHDR */
png_byte colour_type; /* From IHDR */
@@ -2071,9 +2084,9 @@
/* The callback: */
static void
modifier_read(png_structp pp, png_bytep pb, png_size_t st)
{
- png_modifier *pm = png_get_io_ptr(pp);
+ png_modifier *pm = voidcast(png_modifier*, png_get_io_ptr(pp));
if (pm == NULL || pm->this.pread != pp)
png_error(pp, "bad modifier_read call");
@@ -3710,9 +3723,10 @@
static void
standard_info(png_structp pp, png_infop pi)
{
- standard_display *dp = png_get_progressive_ptr(pp);
+ standard_display *dp = voidcast(standard_display*,
+ png_get_progressive_ptr(pp));
/* Call with nImages==1 because the progressive reader can only produce one
* image.
*/
@@ -3721,9 +3735,10 @@
static void
progressive_row(png_structp pp, png_bytep new_row, png_uint_32 y, int pass)
{
- PNG_CONST standard_display *dp = png_get_progressive_ptr(pp);
+ PNG_CONST standard_display *dp = voidcast(standard_display*,
+ png_get_progressive_ptr(pp));
/* When handling interlacing some rows will be absent in each pass, the
* callback still gets called, but with a NULL pointer. This is checked
* in the 'else' clause below. We need our own 'cbRow', but we can't call
@@ -3896,9 +3911,10 @@
static void
standard_end(png_structp pp, png_infop pi)
{
- standard_display *dp = png_get_progressive_ptr(pp);
+ standard_display *dp = voidcast(standard_display*,
+ png_get_progressive_ptr(pp));
UNUSED(pi)
/* Validate the image - progressive reading only produces one variant for
@@ -4656,9 +4672,10 @@
static void
transform_info(png_structp pp, png_infop pi)
{
- transform_info_imp(png_get_progressive_ptr(pp), pp, pi);
+ transform_info_imp(voidcast(transform_display*, png_get_progressive_ptr(pp)),
+ pp, pi);
}
static void
transform_range_check(png_structp pp, unsigned int r, unsigned int g,
@@ -4859,9 +4876,10 @@
static void
transform_end(png_structp pp, png_infop pi)
{
- transform_display *dp = png_get_progressive_ptr(pp);
+ transform_display *dp = voidcast(transform_display*,
+ png_get_progressive_ptr(pp));
transform_image_validate(dp, pp, pi);
}
@@ -6212,9 +6230,10 @@
static void
gamma_info(png_structp pp, png_infop pi)
{
- gamma_info_imp(png_get_progressive_ptr(pp), pp, pi);
+ gamma_info_imp(voidcast(gamma_display*, png_get_progressive_ptr(pp)), pp,
+ pi);
}
/* Validate a single component value - the routine gets the input and output
* sample values as unscaled PNG component values along with a cache of all the
@@ -7155,9 +7174,9 @@
static void
gamma_end(png_structp pp, png_infop pi)
{
- gamma_display *dp = png_get_progressive_ptr(pp);
+ gamma_display *dp = voidcast(gamma_display*, png_get_progressive_ptr(pp));
if (!dp->this.speed)
gamma_image_validate(dp, pp, pi);
}