diff -ru4NwbB libpng-1.5.4/Makefile.am libpng-1.5.5beta05/Makefile.am --- libpng-1.5.4/Makefile.am 2011-07-07 06:24:55.914993260 -0500 +++ libpng-1.5.5beta05/Makefile.am 2011-08-17 07:33:46.539331085 -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.5beta05/contrib/pngminus/makefile.std --- libpng-1.5.4/contrib/pngminus/makefile.std 2011-07-07 06:24:48.716051405 -0500 +++ libpng-1.5.5beta05/contrib/pngminus/makefile.std 2011-08-17 07:33:39.953294533 -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.5beta05/png.c --- libpng-1.5.4/png.c 2011-07-07 06:24:48.277563190 -0500 +++ libpng-1.5.5beta05/png.c 2011-08-17 07:33:39.516042030 -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.5beta05/png.h --- libpng-1.5.4/png.h 2011-07-07 06:24:48.226988784 -0500 +++ libpng-1.5.5beta05/png.h 2011-08-17 07:33:39.466643588 -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-05 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.5beta05/pngconf.h --- libpng-1.5.4/pngconf.h 2011-07-07 06:24:48.233989899 -0500 +++ libpng-1.5.5beta05/pngconf.h 2011-08-17 07:33:39.473567800 -0500 @@ -163,9 +163,11 @@ * PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to * 'type', compiler specific. * * PNG_DLL_EXPORT Set to the magic to use during a libpng build to - * make a symbol exported from the DLL. + * make a symbol exported from the DLL. Not used in the + * public header files; see pngpriv.h for how it is used + * in the libpng build. * * PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come * from a DLL - used to define PNG_IMPEXP when * PNG_USE_DLL is set. @@ -257,28 +259,17 @@ #ifndef PNGAPI # define PNGAPI PNGCAPI #endif -/* The default for PNG_IMPEXP depends on whether the library is - * being built or used. +/* PNG_IMPEXP may be set on the compilation system command line or (if not set) + * then in an internal header file when building the library, otherwise (when + * using the library) it is set here. */ #ifndef PNG_IMPEXP -# ifdef PNGLIB_BUILD - /* Building the library */ -# if (defined(DLL_EXPORT)/*from libtool*/ ||\ - defined(_WINDLL) || defined(_DLL) || defined(__DLL__) ||\ - defined(_USRDLL) ||\ - defined(PNG_BUILD_DLL)) && defined(PNG_DLL_EXPORT) - /* Building a DLL. */ -# define PNG_IMPEXP PNG_DLL_EXPORT -# endif /* DLL */ -# else - /* Using the library */ # if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT) /* This forces use of a DLL, disallowing static linking */ # define PNG_IMPEXP PNG_DLL_IMPORT # endif -# endif # ifndef PNG_IMPEXP # define PNG_IMPEXP # endif @@ -355,14 +346,8 @@ # endif # ifndef PNG_ALLOCATED # define PNG_ALLOCATED __attribute__((__malloc__)) # endif - - /* This specifically protects structure members that should only be - * accessed from within the library, therefore should be empty during - * a library build. - */ -# ifndef PNGLIB_BUILD # ifndef PNG_DEPRECATED # define PNG_DEPRECATED __attribute__((__deprecated__)) # endif # ifndef PNG_PRIVATE @@ -373,9 +358,8 @@ # define PNG_PRIVATE \ __attribute__((__deprecated__)) # endif # endif -# endif /* PNGLIB_BUILD */ # endif /* __GNUC__ */ # if defined(_MSC_VER) && (_MSC_VER >= 1300) # ifndef PNG_USE_RESULT @@ -384,25 +368,18 @@ # 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 - - /* This specifically protects structure members that should only be - * accessed from within the library, therefore should be empty during - * a library build. - */ -# ifndef PNGLIB_BUILD # ifndef PNG_DEPRECATED # define PNG_DEPRECATED __declspec(deprecated) # endif # ifndef PNG_PRIVATE # define PNG_PRIVATE __declspec(deprecated) # endif -# endif /* PNGLIB_BUILD */ # endif /* _MSC_VER */ #endif /* PNG_PEDANTIC_WARNINGS */ #ifndef PNG_DEPRECATED diff -ru4NwbB libpng-1.5.4/pngpriv.h libpng-1.5.5beta05/pngpriv.h --- libpng-1.5.4/pngpriv.h 2011-07-07 06:24:48.242719187 -0500 +++ libpng-1.5.5beta05/pngpriv.h 2011-08-17 07:33:39.482522844 -0500 @@ -5,9 +5,9 @@ * 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.) * - * Last changed in libpng 1.5.4 [July 7, 2011] + * Last changed in libpng 1.5.5 [(PENDING RELEASE)] * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h @@ -43,9 +43,10 @@ * error handler when all else fails. */ #include -#define PNGLIB_BUILD +#define PNGLIB_BUILD /*libpng is being built, not used*/ + #ifdef PNG_USER_CONFIG # include "pngusr.h" /* These should have been defined in pngusr.h */ # ifndef PNG_USER_PRIVATEBUILD @@ -54,12 +55,82 @@ # ifndef PNG_USER_DLLFNAME_POSTFIX # define PNG_USER_DLLFNAME_POSTFIX "Cb" # endif #endif + +/* Is this a build of a DLL where compilation of the object modules requires + * different preprocessor settings to those required for a simple library? If + * so PNG_BUILD_DLL must be set. + * + * If libpng is used inside a DLL but that DLL does not export the libpng APIs + * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a + * static library of libpng then link the DLL against that. + */ +#ifndef PNG_BUILD_DLL +# ifdef DLL_EXPORT + /* This is set by libtool when files are compiled for a DLL; libtool + * always compiles twice, even on systems where it isn't necessary. Set + * PNG_BUILD_DLL in case it is necessary: + */ +# define PNG_BUILD_DLL +# else +# ifdef _WINDLL + /* This is set by the Microsoft Visual Studio IDE in projects that + * build a DLL. It can't easily be removed from those projects (it + * isn't visible in the Visual Studio UI) so it is a fairly reliable + * indication that PNG_IMPEXP needs to be set to the DLL export + * attributes. + */ +# define PNG_BUILD_DLL +# else +# ifdef __DLL__ + /* This is set by the Borland C system when compiling for a DLL + * (as above.) + */ +# define PNG_BUILD_DLL +# else + /* Add additional compiler cases here. */ +# endif +# endif +# endif +#endif /* Setting PNG_BUILD_DLL if required */ + +/* See pngconf.h for more details: the builder of the library may set this on + * the command line to the right thing for the specific compilation system or it + * may be automagically set above (at present we know of no system where it does + * need to be set on the command line.) + * + * PNG_IMPEXP must be set here when building the library to prevent pngconf.h + * setting it to the "import" setting for a DLL build. + */ +#ifndef PNG_IMPEXP +# ifdef PNG_BUILD_DLL +# define PNG_IMPEXP PNG_DLL_EXPORT +# else + /* Not building a DLL, or the DLL doesn't require specific export + * definitions. + */ +# define PNG_IMPEXP +# endif +#endif + +/* No warnings for private or deprecated functions in the build: */ +#ifndef PNG_DEPRECATED +# define PNG_DEPRECATED +#endif +#ifndef PNG_PRIVATE +# define PNG_PRIVATE +#endif + #include "png.h" #include "pnginfo.h" #include "pngstruct.h" +/* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */ +#ifndef PNG_DLL_EXPORT +# define PNG_DLL_EXPORT +#endif + /* This is used for 16 bit gamma tables - only the top level pointers are const, * this could be changed: */ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; @@ -1077,8 +1148,32 @@ PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2, unsigned long *hi_product, unsigned long *lo_product)); #endif +#ifdef PNG_cHRM_SUPPORTED +/* Added at libpng version 1.5.5 */ +typedef struct png_xy +{ + png_fixed_point redx, redy; + png_fixed_point greenx, greeny; + png_fixed_point bluex, bluey; + png_fixed_point whitex, whitey; +} png_xy; + +typedef struct png_XYZ +{ + png_fixed_point redX, redY, redZ; + png_fixed_point greenX, greenY, greenZ; + png_fixed_point blueX, blueY, blueZ; +} png_XYZ; + +/* The conversion APIs return 0 on success, non-zero on a parameter error. */ +PNG_EXTERN int png_xy_from_XYZ PNGARG((png_xy *xy, png_XYZ XYZ)); +PNG_EXTERN int png_XYZ_from_xy PNGARG((png_XYZ *XYZ, png_xy xy)); +PNG_EXTERN int png_XYZ_from_xy_checked PNGARG((png_structp png_ptr, + png_XYZ *XYZ, png_xy xy)); +#endif + /* Added at libpng version 1.4.0 */ PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int interlace_type, int compression_type, diff -ru4NwbB libpng-1.5.4/pngrtran.c libpng-1.5.5beta05/pngrtran.c --- libpng-1.5.4/pngrtran.c 2011-07-07 06:24:48.338363499 -0500 +++ libpng-1.5.5beta05/pngrtran.c 2011-08-17 07:33:39.575924152 -0500 @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * 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.) * @@ -3065,23 +3065,39 @@ #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 = (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.21268 * R + 0.7151 * G + 0.07217 * B + * 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 + * + * Starting with libpng-1.5.4, if the image being converted has the + * sRGB chunk, then the sRGB numbers are used by default: + * + * Y = 0.33000*R + 0.60000*G + 0.06000*B * * 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.5beta05/pngrutil.c --- libpng-1.5.4/pngrutil.c 2011-07-07 06:24:48.352709758 -0500 +++ libpng-1.5.5beta05/pngrutil.c 2011-08-17 07:33:39.597183033 -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/pngset.c libpng-1.5.5beta05/pngset.c --- libpng-1.5.4/pngset.c 2011-07-07 06:24:48.360972928 -0500 +++ libpng-1.5.5beta05/pngset.c 2011-08-17 07:33:39.605295842 -0500 @@ -98,9 +98,9 @@ * occur. Since the fixed point representation is assymetrical it is * possible for 1/gamma to overflow the limit of 21474 and this means the * gamma value must be at least 5/100000 and hence at most 20000.0. For * safety the limits here are a little narrower. The values are 0.00016 to - * 6250.0, which are truely ridiculous gammma values (and will produce + * 6250.0, which are truly ridiculous gammma values (and will produce * displays that are all black or all white.) */ if (file_gamma < 16 || file_gamma > 625000000) png_warning(png_ptr, "Out of range gamma value ignored"); diff -ru4NwbB libpng-1.5.4/pngvalid.c libpng-1.5.5beta05/pngvalid.c --- libpng-1.5.4/pngvalid.c 2011-07-07 06:24:48.403347080 -0500 +++ libpng-1.5.5beta05/pngvalid.c 2011-08-17 07:33:39.647683100 -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"); @@ -2090,9 +2103,9 @@ pm->this.next == NULL) png_error(pp, "store state damaged (progressive)"); /* This is another Horowitz and Hill random noise generator. In this case - * the aim is to stress the progressive reader with truely horrible variable + * the aim is to stress the progressive reader with truly horrible variable * buffer sizes in the range 1..500, so a sequence of 9 bit random numbers * is generated. We could probably just count from 1 to 32767 and get as * good a result. */ @@ -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); } diff -ru4NwbB libpng-1.5.4/projects/vstudio/libpng/libpng.vcxproj libpng-1.5.5beta05/projects/vstudio/libpng/libpng.vcxproj --- libpng-1.5.4/projects/vstudio/libpng/libpng.vcxproj 2011-07-07 06:24:50.602473325 -0500 +++ libpng-1.5.5beta05/projects/vstudio/libpng/libpng.vcxproj 2011-08-17 07:33:41.804661491 -0500 @@ -117,9 +117,9 @@ false ProgramDatabase Disabled EnableFastChecks - WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true true false false @@ -174,9 +174,9 @@ ProgramDatabase MultiThreaded true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) false false pngpriv.h true diff -ru4NwbB libpng-1.5.4/projects/vstudio/pngvalid/pngvalid.vcxproj libpng-1.5.5beta05/projects/vstudio/pngvalid/pngvalid.vcxproj --- libpng-1.5.4/projects/vstudio/pngvalid/pngvalid.vcxproj 2011-07-07 06:24:50.622659908 -0500 +++ libpng-1.5.5beta05/projects/vstudio/pngvalid/pngvalid.vcxproj 2011-08-17 07:33:41.824598800 -0500 @@ -80,9 +80,9 @@ false ProgramDatabase Disabled EnableFastChecks - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;PNG_USE_DLL;%(PreprocessorDefinitions) $(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories) 4996;4127 false true @@ -145,9 +145,9 @@ ProgramDatabase Full false true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;PNG_USE_DLL;%(PreprocessorDefinitions) $(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories) 4996;4127 false true diff -ru4NwbB libpng-1.5.4/projects/vstudio/zlib/zlib.vcxproj libpng-1.5.5beta05/projects/vstudio/zlib/zlib.vcxproj --- libpng-1.5.4/projects/vstudio/zlib/zlib.vcxproj 2010-08-24 15:04:11.000000000 -0500 +++ libpng-1.5.5beta05/projects/vstudio/zlib/zlib.vcxproj 2011-08-16 19:34:41.840659000 -0500 @@ -83,9 +83,9 @@ true - WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) MultiThreadedDebug TurnOffAllWarnings ProgramDatabase Disabled @@ -98,9 +98,9 @@ - WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) TurnOffAllWarnings ProgramDatabase Disabled true @@ -155,9 +155,9 @@ - WIN32;NDEBUG;_WINDOWS;_USRDLL;DEBUGZLIB_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) Level3 ProgramDatabase