Files libpng-1.2.36/contrib/gregbook/toucan.png and libpng-1.2.37beta03/contrib/gregbook/toucan.png differ diff -ru4NwbB libpng-1.2.36/contrib/pngminim/decoder/README libpng-1.2.37beta03/contrib/pngminim/decoder/README --- libpng-1.2.36/contrib/pngminim/decoder/README 2007-07-14 02:29:16.000000000 -0500 +++ libpng-1.2.37beta03/contrib/pngminim/decoder/README 2009-05-20 06:03:58.060511000 -0500 @@ -1,6 +1,9 @@ This demonstrates the use of PNG_USER_CONFIG and pngusr.h -To build a minimal read-only decoder, run +To build a minimal read-only decoder with embedded libpng and zlib, run + gather.sh # to collect needed files from pngminus, libpng, and zlib - make -f makefile.std + make +If you prefer to use the shared libraries, go to contrib/pngminus +and build the png2pnm application there. diff -ru4NwbB libpng-1.2.36/contrib/pngminim/decoder/makefile libpng-1.2.37beta03/contrib/pngminim/decoder/makefile --- libpng-1.2.36/contrib/pngminim/decoder/makefile 1969-12-31 18:00:00.000000000 -0600 +++ libpng-1.2.37beta03/contrib/pngminim/decoder/makefile 2007-12-07 18:08:31.000000000 -0600 @@ -0,0 +1,44 @@ +# Makefile for PngMinus (pngm2pnm) +# Linux / Unix + +#CC=cc +CC=gcc +LD=$(CC) + +RM=rm -f + +CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \ + -DdeflateParams\(a,b,c\)=Z_OK -I. -O1 + +C=.c +O=.o +L=.a +E= + +ZOBJS = adler32$(O) crc32$(O) gzio$(O) \ + infback$(O) inffast$(O) inflate$(O) inftrees$(O) \ + trees$(O) uncompr$(O) zutil$(O) + +OBJS = pngm2pnm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ + pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \ + pngset$(O) pngtrans$(O) $(ZOBJS) + +# implicit make rules ------------------------------------------------------- + +.c$(O): png.h pngconf.h pngusr.h zlib.h + $(CC) -c $(CFLAGS) $< + +# dependencies + +all: pngm2pnm$(E) + +pngm2pnm$(E): $(OBJS) + $(LD) -o pngm2pnm$(E) $(OBJS) + strip pngm2pnm$(E) + +clean: + $(RM) pngm2pnm$(O) + $(RM) pngm2pnm$(E) + $(RM) $(OBJS) + +# End of makefile for pngm2pnm diff -ru4NwbB libpng-1.2.36/contrib/pngminim/decoder/makefile.std libpng-1.2.37beta03/contrib/pngminim/decoder/makefile.std --- libpng-1.2.36/contrib/pngminim/decoder/makefile.std 2007-12-07 18:08:31.000000000 -0600 +++ libpng-1.2.37beta03/contrib/pngminim/decoder/makefile.std 1969-12-31 18:00:00.000000000 -0600 @@ -1,44 +0,0 @@ -# Makefile for PngMinus (pngm2pnm) -# Linux / Unix - -#CC=cc -CC=gcc -LD=$(CC) - -RM=rm -f - -CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \ - -DdeflateParams\(a,b,c\)=Z_OK -I. -O1 - -C=.c -O=.o -L=.a -E= - -ZOBJS = adler32$(O) crc32$(O) gzio$(O) \ - infback$(O) inffast$(O) inflate$(O) inftrees$(O) \ - trees$(O) uncompr$(O) zutil$(O) - -OBJS = pngm2pnm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ - pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \ - pngset$(O) pngtrans$(O) $(ZOBJS) - -# implicit make rules ------------------------------------------------------- - -.c$(O): png.h pngconf.h pngusr.h zlib.h - $(CC) -c $(CFLAGS) $< - -# dependencies - -all: pngm2pnm$(E) - -pngm2pnm$(E): $(OBJS) - $(LD) -o pngm2pnm$(E) $(OBJS) - strip pngm2pnm$(E) - -clean: - $(RM) pngm2pnm$(O) - $(RM) pngm2pnm$(E) - $(RM) $(OBJS) - -# End of makefile for pngm2pnm diff -ru4NwbB libpng-1.2.36/contrib/pngminim/decoder/pngusr.h libpng-1.2.37beta03/contrib/pngminim/decoder/pngusr.h --- libpng-1.2.36/contrib/pngminim/decoder/pngusr.h 2009-03-24 11:47:00.236362000 -0500 +++ libpng-1.2.37beta03/contrib/pngminim/decoder/pngusr.h 2009-05-18 14:26:02.270270000 -0500 @@ -43,8 +43,9 @@ #define PNG_NO_READ_pHYs #define PNG_NO_READ_sBIT #define PNG_NO_READ_sCAL #define PNG_NO_READ_sPLT +#define PNG_NO_READ_sRGB #define PNG_NO_READ_TEXT #define PNG_NO_READ_tIME #define PNG_NO_READ_UNKNOWN_CHUNKS #define PNG_NO_READ_USER_CHUNKS diff -ru4NwbB libpng-1.2.36/contrib/pngminim/encoder/README libpng-1.2.37beta03/contrib/pngminim/encoder/README --- libpng-1.2.36/contrib/pngminim/encoder/README 2007-07-14 02:28:44.000000000 -0500 +++ libpng-1.2.37beta03/contrib/pngminim/encoder/README 2009-05-20 06:04:37.366738000 -0500 @@ -1,6 +1,9 @@ This demonstrates the use of PNG_USER_CONFIG and pngusr.h -To build a minimal write-only encoder, run +To build a minimal write-only decoder with embedded libpng and zlib, run + gather.sh # to collect needed files from pngminus, libpng, and zlib - make -f makefile.std + make +If you prefer to use the shared libraries, go to contrib/pngminus +and build the pnm2png application there. diff -ru4NwbB libpng-1.2.36/contrib/pngminim/encoder/makefile libpng-1.2.37beta03/contrib/pngminim/encoder/makefile --- libpng-1.2.36/contrib/pngminim/encoder/makefile 1969-12-31 18:00:00.000000000 -0600 +++ libpng-1.2.37beta03/contrib/pngminim/encoder/makefile 2007-12-07 18:08:44.000000000 -0600 @@ -0,0 +1,43 @@ +# Makefile for PngMinus (pnm2pngm) +# Linux / Unix + +#CC=cc +CC=gcc +LD=$(CC) + +RM=rm -f + +CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1 + +C=.c +O=.o +L=.a +E= + +ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) gzio$(O) \ + dummy_inflate$(O) \ + trees$(O) uncompr$(O) zutil$(O) + +OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ + pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \ + pngwtran$(O) pngwutil$(O) $(ZOBJS) + +# implicit make rules ------------------------------------------------------- + +.c$(O): png.h pngconf.h pngusr.h zlib.h + $(CC) -c $(CFLAGS) $< + +# dependencies + +all: pnm2pngm$(E) + +pnm2pngm$(E): $(OBJS) + $(LD) -o pnm2pngm$(E) $(OBJS) + strip pnm2pngm$(E) + +clean: + $(RM) pnm2pngm$(O) + $(RM) pnm2pngm$(E) + $(RM) $(OBJS) + +# End of makefile for pnm2pngm diff -ru4NwbB libpng-1.2.36/contrib/pngminim/encoder/makefile.std libpng-1.2.37beta03/contrib/pngminim/encoder/makefile.std --- libpng-1.2.36/contrib/pngminim/encoder/makefile.std 2007-12-07 18:08:44.000000000 -0600 +++ libpng-1.2.37beta03/contrib/pngminim/encoder/makefile.std 1969-12-31 18:00:00.000000000 -0600 @@ -1,43 +0,0 @@ -# Makefile for PngMinus (pnm2pngm) -# Linux / Unix - -#CC=cc -CC=gcc -LD=$(CC) - -RM=rm -f - -CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1 - -C=.c -O=.o -L=.a -E= - -ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) gzio$(O) \ - dummy_inflate$(O) \ - trees$(O) uncompr$(O) zutil$(O) - -OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ - pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \ - pngwtran$(O) pngwutil$(O) $(ZOBJS) - -# implicit make rules ------------------------------------------------------- - -.c$(O): png.h pngconf.h pngusr.h zlib.h - $(CC) -c $(CFLAGS) $< - -# dependencies - -all: pnm2pngm$(E) - -pnm2pngm$(E): $(OBJS) - $(LD) -o pnm2pngm$(E) $(OBJS) - strip pnm2pngm$(E) - -clean: - $(RM) pnm2pngm$(O) - $(RM) pnm2pngm$(E) - $(RM) $(OBJS) - -# End of makefile for pnm2pngm diff -ru4NwbB libpng-1.2.36/contrib/pngminim/encoder/pngusr.h libpng-1.2.37beta03/contrib/pngminim/encoder/pngusr.h --- libpng-1.2.36/contrib/pngminim/encoder/pngusr.h 2009-03-20 08:13:44.702495000 -0500 +++ libpng-1.2.37beta03/contrib/pngminim/encoder/pngusr.h 2009-05-18 14:31:05.548005000 -0500 @@ -32,17 +32,17 @@ #define PNG_NO_WRITE_USER_TRANSFORM #define PNG_NO_WRITE_bKGD #define PNG_NO_WRITE_cHRM #define PNG_NO_WRITE_gAMA -#define PNG_NO_WRITE_sRGB #define PNG_NO_WRITE_hIST #define PNG_NO_WRITE_iCCP #define PNG_NO_WRITE_oFFs #define PNG_NO_WRITE_pCAL #define PNG_NO_WRITE_pHYs #define PNG_NO_WRITE_sBIT #define PNG_NO_WRITE_sCAL #define PNG_NO_WRITE_sPLT +#define PNG_NO_WRITE_sRGB #define PNG_NO_WRITE_TEXT #define PNG_NO_WRITE_tIME #define PNG_NO_WRITE_UNKNOWN_CHUNKS #define PNG_NO_WRITE_USER_CHUNKS diff -ru4NwbB libpng-1.2.36/contrib/pngminim/preader/README libpng-1.2.37beta03/contrib/pngminim/preader/README --- libpng-1.2.36/contrib/pngminim/preader/README 1969-12-31 18:00:00.000000000 -0600 +++ libpng-1.2.37beta03/contrib/pngminim/preader/README 2009-05-20 06:06:06.268464000 -0500 @@ -0,0 +1,14 @@ +This demonstrates the use of PNG_USER_CONFIG and pngusr.h + +To build a minimal read-only progressive decoder embedded libpng and +zlib and with your system's X library, run + + gather.sh # to collect needed files from gregbook, libpng, and zlib + +Edit makefile if required, to find your X library and include files, +then + + make + +If you prefer to use the shared libraries, go to contrib/gregbook +and build the rpng2-x application there. diff -ru4NwbB libpng-1.2.36/contrib/pngminim/preader/gather.sh libpng-1.2.37beta03/contrib/pngminim/preader/gather.sh --- libpng-1.2.36/contrib/pngminim/preader/gather.sh 1969-12-31 18:00:00.000000000 -0600 +++ libpng-1.2.37beta03/contrib/pngminim/preader/gather.sh 2009-05-18 12:42:38.841511000 -0500 @@ -0,0 +1,9 @@ +cp ../../gregbook/rpng2-x.c ../../gregbook/readpng2.[ch] . +cp ../../gregbook/COPYING ../../gregbook/LICENSE . +cp ../../../*.h . +cp ../../../*.c . +rm example.c pnggccrd.c pngvcrd.c pngtest.c pngw*.c +# change the following 2 lines if zlib is somewhere else +cp ../../../../zlib/*.h . +cp ../../../../zlib/*.c . +rm minigzip.c example.c compress.c deflate.c diff -ru4NwbB libpng-1.2.36/contrib/pngminim/preader/makefile libpng-1.2.37beta03/contrib/pngminim/preader/makefile --- libpng-1.2.36/contrib/pngminim/preader/makefile 1969-12-31 18:00:00.000000000 -0600 +++ libpng-1.2.37beta03/contrib/pngminim/preader/makefile 2009-05-18 14:21:08.274009000 -0500 @@ -0,0 +1,60 @@ +# Makefile for PngMinus (rpng2) +# Linux / Unix + +#CC=cc +CC=gcc +LD=$(CC) + +RM=rm -f + +#XINC = -I/usr/include # old-style, stock X distributions +#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX) + +#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows) +#XLIB = -L/usr/openwin/lib -lX11 + +XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.) +XLIB = -L/usr/X11R6/lib -lX11 +#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64 + +#XINC = -I/usr/local/include # FreeBSD +#XLIB = -L/usr/local/lib -lX11 + +#LIBS = $(XLIB) +LIBS = $(XLIB) -lm #platforms that need libm + +CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \ + -DdeflateParams\(a,b,c\)=Z_OK -I. $(XINC) -O1 + +C=.c +O=.o +L=.a +E= + +ZOBJS = adler32$(O) crc32$(O) gzio$(O) \ + infback$(O) inffast$(O) inflate$(O) inftrees$(O) \ + trees$(O) uncompr$(O) zutil$(O) + +OBJS = rpng2-x$(O) readpng2$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ + pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \ + pngset$(O) pngtrans$(O) $(ZOBJS) + +# implicit make rules ------------------------------------------------------- + +.c$(O): png.h pngconf.h readpng2.h pngusr.h zlib.h + $(CC) -c $(CFLAGS) $< + +# dependencies + +all: rpng2-x$(E) + +rpng2-x$(E): $(OBJS) + $(LD) -o rpng2-x$(E) $(OBJS) $(LIBS) + strip rpng2-x$(E) + +clean: + $(RM) rpng2-x$(O) + $(RM) rpng2-x$(E) + $(RM) $(OBJS) + +# End of makefile for rpng2-x diff -ru4NwbB libpng-1.2.36/contrib/pngminim/preader/pngusr.h libpng-1.2.37beta03/contrib/pngminim/preader/pngusr.h --- libpng-1.2.36/contrib/pngminim/preader/pngusr.h 1969-12-31 18:00:00.000000000 -0600 +++ libpng-1.2.37beta03/contrib/pngminim/preader/pngusr.h 2009-05-18 14:31:56.558134000 -0500 @@ -0,0 +1,62 @@ +/* minrdpngconf.h: headers to make a minimal png-read-only library + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 2007 Glenn Randers-Pehrson + * Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson + */ + +#ifndef MINRDPNGCONF_H +#define MINRDPNGCONF_H + +#define PNG_NO_GLOBAL_ARRAYS + +#define PNG_NO_WARNINGS +#define png_warning(s1,s2) "" +#define png_chunk_warning(s1,s2) "" +#define PNG_NO_ERROR_TEXT +#define png_error(s1,s2) png_err(s1) +#define png_chunk_error(s1,s2) png_err(s1) + +#define PNG_NO_ASSEMBLER_CODE +#define PNG_NO_OPTIMIZED_CODE +#define PNG_NO_READ_DITHER +#define PNG_NO_READ_INVERT +#define PNG_NO_READ_SHIFT +#define PNG_NO_READ_PACK +#define PNG_NO_READ_PACKSWAP +#define PNG_NO_READ_FILLER +#define PNG_NO_READ_SWAP_ALPHA +#define PNG_NO_READ_INVERT_ALPHA +#define PNG_NO_READ_RGB_TO_GRAY +#define PNG_NO_READ_USER_TRANSFORM +#define PNG_NO_READ_cHRM +#define PNG_NO_READ_hIST +#define PNG_NO_READ_iCCP +#define PNG_NO_READ_pCAL +#define PNG_NO_READ_pHYs +#define PNG_NO_READ_sBIT +#define PNG_NO_READ_sCAL +#define PNG_NO_READ_sPLT +#define PNG_NO_READ_TEXT +#define PNG_NO_READ_tIME +#define PNG_NO_READ_UNKNOWN_CHUNKS +#define PNG_NO_READ_USER_CHUNKS +#define PNG_NO_READ_EMPTY_PLTE +#define PNG_NO_READ_OPT_PLTE +#define PNG_NO_READ_STRIP_ALPHA +#define PNG_NO_READ_oFFs +#define PNG_NO_WARN_UNINITIALIZED_ROW + +#define PNG_NO_WRITE_SUPPORTED + +#define PNG_NO_INFO_IMAGE +#define PNG_NO_USER_MEM +#define PNG_NO_FIXED_POINT_SUPPORTED +#define PNG_NO_MNG_FEATURES +#define PNG_NO_USER_TRANSFORM_PTR +#define PNG_NO_HANDLE_AS_UNKNOWN +#define PNG_NO_CONSOLE_IO +#define PNG_NO_ZALLOC_ZERO +#define PNG_NO_ERROR_NUMBERS +#define PNG_NO_EASY_ACCESS + +#endif /* MINRDPNGCONF_H */ diff -ru4NwbB libpng-1.2.36/example.c libpng-1.2.37beta03/example.c --- libpng-1.2.36/example.c 2009-05-07 16:51:54.517796798 -0500 +++ libpng-1.2.37beta03/example.c 2009-05-20 12:43:36.900406571 -0500 @@ -1,9 +1,9 @@ #if 0 /* in case someone actually tries to compile this */ /* example.c - an example of using libpng - * Last changed in libpng 1.2.36 [May 7, 2009] + * Last changed in libpng 1.2.37 [May 20, 2009] * This file has been placed in the public domain by the authors. * Maintained 1998-2009 Glenn Randers-Pehrson * Maintained 1996, 1997 Andreas Dilger) * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -90,16 +90,17 @@ FILE *fp; if ((fp = fopen(file_name, "rb")) == NULL) return (ERROR); + #else no_open_file /* prototype 2 */ -void read_png(FILE *fp, unsigned int sig_read) /* file is already open */ +void read_png(FILE *fp, unsigned int sig_read) /* File is already open */ { png_structp png_ptr; png_infop info_ptr; png_uint_32 width, height; int bit_depth, color_type, interlace_type; -#endif no_open_file /* only use one prototype! */ +#endif no_open_file /* Only use one prototype! */ /* Create and initialize the png_struct with the desired error handler * functions. If you want to use the default stderr and longjump method, * you can supply NULL for the last three parameters. We also supply the @@ -180,9 +182,9 @@ * transformations only work on specific types of images, and many * are mutually exclusive. */ - /* tell libpng to strip 16 bit/color files down to 8 bits/color */ + /* Tell libpng to strip 16 bit/color files down to 8 bits/color */ png_set_strip_16(png_ptr); /* Strip alpha bytes from the input data without combining with the * background (not recommended). @@ -227,12 +229,13 @@ else png_set_background(png_ptr, &my_background, PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); - /* Some suggestions as to how to get a screen gamma value */ - - /* Note that screen gamma is the display_exponent, which includes - * the CRT_exponent and any correction for viewing conditions */ + /* Some suggestions as to how to get a screen gamma value + * + * Note that screen gamma is the display_exponent, which includes + * the CRT_exponent and any correction for viewing conditions + */ if (/* We have a user-defined screen gamma value */) { screen_gamma = user-defined screen_gamma; } @@ -243,9 +246,9 @@ } /* If we don't have another value */ else { - screen_gamma = 2.2; /* A good guess for a PC monitors in a dimly + screen_gamma = 2.2; /* A good guess for a PC monitor in a dimly lit room */ screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */ } @@ -276,9 +279,9 @@ int num_palette; png_colorp palette; /* This reduces the image to the application supplied palette */ - if (/* we have our own palette */) + if (/* We have our own palette */) { /* An array of colors to which the image should be dithered */ png_color std_color_cube[MAX_SCREEN_COLORS]; @@ -296,31 +299,31 @@ max_screen_colors, histogram, 0); } } - /* invert monochrome files to have 0 as white and 1 as black */ + /* Invert monochrome files to have 0 as white and 1 as black */ png_set_invert_mono(png_ptr); /* If you want to shift the pixel values from the range [0,255] or * [0,65535] to the original [0,7] or [0,31], or whatever range the * colors were originally in: */ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT)) { - png_color_8p sig_bit; + png_color_8p sig_bit_p; - png_get_sBIT(png_ptr, info_ptr, &sig_bit); - png_set_shift(png_ptr, sig_bit); + png_get_sBIT(png_ptr, info_ptr, &sig_bit_p); + png_set_shift(png_ptr, sig_bit_p); } - /* flip the RGB pixels to BGR (or RGBA to BGRA) */ + /* Flip the RGB pixels to BGR (or RGBA to BGRA) */ if (color_type & PNG_COLOR_MASK_COLOR) png_set_bgr(png_ptr); - /* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ + /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ png_set_swap_alpha(png_ptr); - /* swap bytes of 16 bit files to least significant byte first */ + /* Swap bytes of 16 bit files to least significant byte first */ png_set_swap(png_ptr); /* Add filler (or alpha) byte (before/after each RGB triplet) */ png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER); @@ -373,34 +376,33 @@ number_of_rows); #else no_sparkle /* Read the image using the "rectangle" effect */ png_read_rows(png_ptr, png_bytepp_NULL, &row_pointers[y], number_of_rows); -#endif no_sparkle /* use only one of these two methods */ +#endif no_sparkle /* Use only one of these two methods */ } - /* if you want to display the image after every pass, do - so here */ -#endif no_single /* use only one of these two methods */ + /* If you want to display the image after every pass, do so here */ +#endif no_single /* Use only one of these two methods */ } -#endif no_entire /* use only one of these two methods */ +#endif no_entire /* Use only one of these two methods */ - /* read rest of file, and get additional chunks in info_ptr - REQUIRED */ + /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ png_read_end(png_ptr, info_ptr); #endif hilevel /* At this point you have read the entire image */ - /* clean up after the read, and free any memory allocated - REQUIRED */ + /* Clean up after the read, and free any memory allocated - REQUIRED */ png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); - /* close the file */ + /* Close the file */ fclose(fp); - /* that's it */ + /* That's it */ return (OK); } -/* progressively read a file */ +/* Progressively read a file */ int initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr) { @@ -463,9 +465,9 @@ } /* This one's new also. Simply give it chunks of data as * they arrive from the data stream (in order, of course). - * On Segmented machines, don't give it any more than 64K. + * On segmented machines, don't give it any more than 64K. * The library seems to run fine with sizes of 4K, although * you can give it much less if necessary (I assume you can * give it chunks of 1 byte, but I haven't tried with less * than 256 bytes yet). When this function returns, you may @@ -477,9 +479,9 @@ } info_callback(png_structp png_ptr, png_infop info) { -/* do any setup here, including setting any of the transformations + /* Do any setup here, including setting any of the transformations * mentioned in the Reading PNG files section. For now, you _must_ * call either png_start_read_image() or png_read_update_info() * after all the transformations are set (even if you don't set * any). You may start getting rows before png_process_data() @@ -498,9 +500,9 @@ * In this function you will receive a pointer to new row data from * libpng called new_row that is to replace a corresponding row (of * the same data format) in a buffer allocated by your application. * - * The new row data pointer new_row may be NULL, indicating there is + * The new row data pointer "new_row" may be NULL, indicating there is * no new data to be replaced (in cases of interlace loading). * * If new_row is not NULL then you need to call * png_progressive_combine_row() to replace the corresponding row as @@ -545,9 +548,9 @@ } end_callback(png_structp png_ptr, png_infop info) { -/* this function is called when the whole image has been read, + /* This function is called when the whole image has been read, * including any chunks after the image (up to and including * the IEND). You will usually have the same info chunk as you * had in the header, although some data may have been added * to the comments and time fields. @@ -556,17 +559,17 @@ * marks the image as finished. */ } -/* write a png file */ +/* Write a png file */ void write_png(char *file_name /* , ... other image information ... */) { FILE *fp; png_structp png_ptr; png_infop info_ptr; png_colorp palette; - /* open the file */ + /* Open the file */ fp = fopen(file_name, "wb"); if (fp == NULL) return (ERROR); @@ -605,25 +608,29 @@ return (ERROR); } /* One of the following I/O initialization functions is REQUIRED */ + #ifdef streams /* I/O initialization method 1 */ - /* set up the output control if you are using standard C streams */ + /* Set up the output control if you are using standard C streams */ png_init_io(png_ptr, fp); + #else no_streams /* I/O initialization method 2 */ /* If you are using replacement write functions, instead of calling - * png_init_io() here you would call */ + * png_init_io() here you would call + */ png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn, user_IO_flush_function); /* where user_io_ptr is a structure you want available to the callbacks */ -#endif no_streams /* only use one initialization method */ +#endif no_streams /* Only use one initialization method */ #ifdef hilevel /* This is the easy way. Use it if you already have all the - * image info living info in the structure. You could "|" many + * image info living in the structure. You could "|" many * PNG_TRANSFORM flags into the png_transforms integer here. */ png_write_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL); + #else /* This is the hard way */ /* Set the image information here. Width and height are up to 2^31, @@ -636,27 +643,29 @@ */ png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???, PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - /* set the palette if there is one. REQUIRED for indexed-color images */ + /* Set the palette if there is one. REQUIRED for indexed-color images */ palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color)); - /* ... set palette colors ... */ + /* ... Set palette colors ... */ png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH); /* You must not free palette here, because png_set_PLTE only makes a link to - the palette that you malloced. Wait until you are about to destroy - the png structure. */ + * the palette that you malloced. Wait until you are about to destroy + * the png structure. + */ - /* optional significant bit chunk */ - /* if we are dealing with a grayscale image then */ + /* Optional significant bit (sBIT) chunk */ + png_color_8 sig_bit; + /* If we are dealing with a grayscale image then */ sig_bit.gray = true_bit_depth; - /* otherwise, if we are dealing with a color image then */ + /* Otherwise, if we are dealing with a color image then */ sig_bit.red = true_red_bit_depth; sig_bit.green = true_green_bit_depth; sig_bit.blue = true_blue_bit_depth; - /* if the image has an alpha channel then */ + /* If the image has an alpha channel then */ sig_bit.alpha = true_alpha_bit_depth; - png_set_sBIT(png_ptr, info_ptr, sig_bit); + png_set_sBIT(png_ptr, info_ptr, &sig_bit); /* Optional gamma chunk is strongly suggested if you have any guess * as to the correct gamma of the image. @@ -679,11 +688,14 @@ text_ptr[2].lang = NULL; #endif png_set_text(png_ptr, info_ptr, text_ptr, 3); - /* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */ - /* note that if sRGB is present the gAMA and cHRM chunks must be ignored - * on read and must be written in accordance with the sRGB profile */ + /* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */ + + /* Note that if sRGB is present the gAMA and cHRM chunks must be ignored + * on read and, if your application chooses to write them, they must + * be written in accordance with the sRGB profile + */ /* Write the file header information. REQUIRED */ png_write_info(png_ptr, info_ptr); @@ -703,41 +715,41 @@ * PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again * at the end. */ - /* set up the transformations you want. Note that these are + /* Set up the transformations you want. Note that these are * all optional. Only call them if you want them. */ - /* invert monochrome pixels */ + /* Invert monochrome pixels */ png_set_invert_mono(png_ptr); /* Shift the pixels up to a legal bit depth and fill in * as appropriate to correctly scale the image. */ png_set_shift(png_ptr, &sig_bit); - /* pack pixels into bytes */ + /* Pack pixels into bytes */ png_set_packing(png_ptr); - /* swap location of alpha bytes from ARGB to RGBA */ + /* Swap location of alpha bytes from ARGB to RGBA */ png_set_swap_alpha(png_ptr); /* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into * RGB (4 channels -> 3 channels). The second parameter is not used. */ png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); - /* flip BGR pixels to RGB */ + /* Flip BGR pixels to RGB */ png_set_bgr(png_ptr); - /* swap bytes of 16-bit files to most significant byte first */ + /* Swap bytes of 16-bit files to most significant byte first */ png_set_swap(png_ptr); - /* swap bits of 1, 2, 4 bit packed pixel formats */ + /* Swap bits of 1, 2, 4 bit packed pixel formats */ png_set_packswap(png_ptr); - /* turn on interlace handling if you are not using png_write_image() */ + /* Turn on interlace handling if you are not using png_write_image() */ if (interlacing) number_passes = png_set_interlace_handling(png_ptr); else number_passes = 1; @@ -756,14 +768,16 @@ for (k = 0; k < height; k++) row_pointers[k] = image + k*width*bytes_per_pixel; /* One of the following output methods is REQUIRED */ -#ifdef entire /* write out the entire image data in one call */ + +#ifdef entire /* Write out the entire image data in one call */ png_write_image(png_ptr, row_pointers); - /* the other way to write the image - deal with interlacing */ + /* The other way to write the image - deal with interlacing */ + +#else no_entire /* Write out the image data by one or more scanlines */ -#else no_entire /* write out the image data by one or more scanlines */ /* The number of passes is either 1 for non-interlaced images, * or 7 for interlaced images. */ for (pass = 0; pass < number_passes; pass++) @@ -774,12 +788,12 @@ /* If you are only writing one row at a time, this works */ for (y = 0; y < height; y++) png_write_rows(png_ptr, &row_pointers[y], 1); } -#endif no_entire /* use only one output method */ +#endif no_entire /* Use only one output method */ /* You can write optional chunks like tEXt, zTXt, and tIME at the end - * as well. Shouldn't be necessary in 1.1.0 and up as all the public + * as well. Shouldn't be necessary in 1.2.0 and up as all the public * chunks are supported and you can use png_set_unknown_chunks() to * register unknown chunks into the info structure to be written out. */ @@ -787,28 +801,35 @@ png_write_end(png_ptr, info_ptr); #endif hilevel /* If you png_malloced a palette, free it here (don't free info_ptr->palette, - as recommended in versions 1.0.5m and earlier of this example; if - libpng mallocs info_ptr->palette, libpng will free it). If you - allocated it with malloc() instead of png_malloc(), use free() instead - of png_free(). */ + * as recommended in versions 1.0.5m and earlier of this example; if + * libpng mallocs info_ptr->palette, libpng will free it). If you + * allocated it with malloc() instead of png_malloc(), use free() instead + * of png_free(). + */ png_free(png_ptr, palette); palette = NULL; /* Similarly, if you png_malloced any data that you passed in with - png_set_something(), such as a hist or trans array, free it here, - when you can be sure that libpng is through with it. */ + * png_set_something(), such as a hist or trans array, free it here, + * when you can be sure that libpng is through with it. + */ png_free(png_ptr, trans); trans = NULL; + /* Whenever you use png_free() it is a good idea to set the pointer to + * NULL in case your application inadvertently tries to png_free() it + * again. When png_free() sees a NULL it returns without action, thus + * avoiding the double-free security problem. + */ - /* clean up after the write, and free any memory allocated */ + /* Clean up after the write, and free any memory allocated */ png_destroy_write_struct(&png_ptr, &info_ptr); - /* close the file */ + /* Close the file */ fclose(fp); - /* that's it */ + /* That's it */ return (OK); } #endif /* if 0 */ diff -ru4NwbB libpng-1.2.36/png.c libpng-1.2.37beta03/png.c --- libpng-1.2.36/png.c 2009-05-07 11:05:31.414862511 -0500 +++ libpng-1.2.37beta03/png.c 2009-05-20 12:43:36.907551891 -0500 @@ -1,10 +1,10 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -52,20 +52,20 @@ PNG_tRNS; PNG_zTXt; #ifdef PNG_READ_SUPPORTED -/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ +/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ -/* start of interlace block */ +/* Start of interlace block */ PNG_CONST int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; -/* offset to next interlace block */ +/* Offset to next interlace block */ PNG_CONST int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; -/* start of interlace block in the y direction */ +/* Start of interlace block in the y direction */ PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; -/* offset to next interlace block in the y direction */ +/* Offset to next interlace block in the y direction */ PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; /* Height of interlace block. This is not currently used - if you need * it, uncomment it here and in png.h @@ -91,9 +91,10 @@ #ifdef PNG_READ_SUPPORTED void PNGAPI png_set_sig_bytes(png_structp png_ptr, int num_bytes) { - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_debug(1, "in png_set_sig_bytes"); if (num_bytes > 8) png_error(png_ptr, "Too many bytes for PNG signature."); @@ -152,9 +153,10 @@ png_structp p=(png_structp)png_ptr; png_uint_32 save_flags=p->flags; png_uint_32 num_bytes; - if (png_ptr == NULL) return (NULL); + if (png_ptr == NULL) + return (NULL); if (items > PNG_UINT_32_MAX/size) { png_warning (p, "Potential overflow in png_zalloc()"); return (NULL); @@ -182,9 +184,9 @@ #endif return ((voidpf)ptr); } -/* function to free memory for zlib */ +/* Function to free memory for zlib */ #ifdef PNG_1_0_X void PNGAPI #else void /* private */ @@ -240,9 +242,10 @@ { png_infop info_ptr; png_debug(1, "in png_create_info_struct"); - if (png_ptr == NULL) return (NULL); + if (png_ptr == NULL) + return (NULL); #ifdef PNG_USER_MEM_SUPPORTED info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO, png_ptr->malloc_fn, png_ptr->mem_ptr); #else @@ -262,9 +265,10 @@ void PNGAPI png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr) { png_infop info_ptr = NULL; - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_debug(1, "in png_destroy_info_struct"); if (info_ptr_ptr != NULL) info_ptr = *info_ptr_ptr; @@ -301,9 +305,10 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size) { png_infop info_ptr = *ptr_ptr; - if (info_ptr == NULL) return; + if (info_ptr == NULL) + return; png_debug(1, "in png_info_init_3"); if (png_sizeof(png_info) > png_info_struct_size) @@ -312,9 +317,9 @@ info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO); *ptr_ptr = info_ptr; } - /* set everything to 0 */ + /* Set everything to 0 */ png_memset(info_ptr, 0, png_sizeof(png_info)); } #ifdef PNG_FREE_ME_SUPPORTED @@ -343,9 +348,9 @@ if (png_ptr == NULL || info_ptr == NULL) return; #if defined(PNG_TEXT_SUPPORTED) -/* free text item num or (if num == -1) all text items */ + /* Free text item num or (if num == -1) all text items */ #ifdef PNG_FREE_ME_SUPPORTED if ((mask & PNG_FREE_TEXT) & info_ptr->free_me) #else if (mask & PNG_FREE_TEXT) @@ -371,9 +376,9 @@ } #endif #if defined(PNG_tRNS_SUPPORTED) -/* free any tRNS entry */ + /* Free any tRNS entry */ #ifdef PNG_FREE_ME_SUPPORTED if ((mask & PNG_FREE_TRNS) & info_ptr->free_me) #else if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS)) @@ -388,9 +393,9 @@ } #endif #if defined(PNG_sCAL_SUPPORTED) -/* free any sCAL entry */ + /* Free any sCAL entry */ #ifdef PNG_FREE_ME_SUPPORTED if ((mask & PNG_FREE_SCAL) & info_ptr->free_me) #else if (mask & PNG_FREE_SCAL) @@ -406,9 +411,9 @@ } #endif #if defined(PNG_pCAL_SUPPORTED) -/* free any pCAL entry */ + /* Free any pCAL entry */ #ifdef PNG_FREE_ME_SUPPORTED if ((mask & PNG_FREE_PCAL) & info_ptr->free_me) #else if (mask & PNG_FREE_PCAL) @@ -433,9 +438,9 @@ } #endif #if defined(PNG_iCCP_SUPPORTED) -/* free any iCCP entry */ + /* Free any iCCP entry */ #ifdef PNG_FREE_ME_SUPPORTED if ((mask & PNG_FREE_ICCP) & info_ptr->free_me) #else if (mask & PNG_FREE_ICCP) @@ -449,9 +454,9 @@ } #endif #if defined(PNG_sPLT_SUPPORTED) -/* free a given sPLT entry, or (if num == -1) all sPLT entries */ + /* Free a given sPLT entry, or (if num == -1) all sPLT entries */ #ifdef PNG_FREE_ME_SUPPORTED if ((mask & PNG_FREE_SPLT) & info_ptr->free_me) #else if (mask & PNG_FREE_SPLT) @@ -522,9 +527,9 @@ } #endif #if defined(PNG_hIST_SUPPORTED) -/* free any hIST entry */ + /* Free any hIST entry */ #ifdef PNG_FREE_ME_SUPPORTED if ((mask & PNG_FREE_HIST) & info_ptr->free_me) #else if ((mask & PNG_FREE_HIST) && (png_ptr->flags & PNG_FLAG_FREE_HIST)) @@ -538,9 +543,9 @@ #endif } #endif -/* free any PLTE entry that was internally allocated */ + /* Free any PLTE entry that was internally allocated */ #ifdef PNG_FREE_ME_SUPPORTED if ((mask & PNG_FREE_PLTE) & info_ptr->free_me) #else if ((mask & PNG_FREE_PLTE) && (png_ptr->flags & PNG_FLAG_FREE_PLTE)) @@ -555,9 +560,9 @@ info_ptr->num_palette = 0; } #if defined(PNG_INFO_IMAGE_SUPPORTED) -/* free any image bits attached to the info structure */ + /* Free any image bits attached to the info structure */ #ifdef PNG_FREE_ME_SUPPORTED if ((mask & PNG_FREE_ROWS) & info_ptr->free_me) #else if (mask & PNG_FREE_ROWS) @@ -616,9 +621,10 @@ */ png_voidp PNGAPI png_get_io_ptr(png_structp png_ptr) { - if (png_ptr == NULL) return (NULL); + if (png_ptr == NULL) + return (NULL); return (png_ptr->io_ptr); } #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) @@ -632,9 +638,10 @@ void PNGAPI png_init_io(png_structp png_ptr, png_FILE_p fp) { png_debug(1, "in png_init_io"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->io_ptr = (png_voidp)fp; } #endif @@ -648,9 +655,10 @@ static PNG_CONST char short_months[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - if (png_ptr == NULL) return (NULL); + if (png_ptr == NULL) + return (NULL); if (png_ptr->time_buffer == NULL) { png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29* png_sizeof(char))); @@ -692,11 +700,11 @@ png_charp PNGAPI png_get_copyright(png_structp png_ptr) { - png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */ + png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ return ((png_charp) "\n libpng version 1.2.37beta03 - May 20, 2009\n\ - Copyright (c) 1998-2008 Glenn Randers-Pehrson\n\ + Copyright (c) 1998-2009 Glenn Randers-Pehrson\n\ Copyright (c) 1996-1997 Andreas Dilger\n\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); } @@ -711,25 +719,25 @@ png_charp PNGAPI png_get_libpng_ver(png_structp png_ptr) { /* Version of *.c files used when building libpng */ - png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */ + png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ return ((png_charp) PNG_LIBPNG_VER_STRING); } png_charp PNGAPI png_get_header_ver(png_structp png_ptr) { /* Version of *.h files used when building libpng */ - png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */ + png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ return ((png_charp) PNG_LIBPNG_VER_STRING); } png_charp PNGAPI png_get_header_version(png_structp png_ptr) { /* Returns longer string containing both version and date */ - png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */ + png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ return ((png_charp) PNG_HEADER_VERSION_STRING #ifndef PNG_READ_SUPPORTED " (NO READ SUPPORT)" #endif @@ -740,9 +748,9 @@ #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED int PNGAPI png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name) { - /* check chunk_name and return "keep" value if it's on the list, else 0 */ + /* Check chunk_name and return "keep" value if it's on the list, else 0 */ int i; png_bytep p; if (png_ptr == NULL || chunk_name == NULL || png_ptr->num_chunk_list<=0) return 0; @@ -757,9 +765,10 @@ /* This function, added to libpng-1.0.6g, is untested. */ int PNGAPI png_reset_zstream(png_structp png_ptr) { - if (png_ptr == NULL) return Z_STREAM_ERROR; + if (png_ptr == NULL) + return Z_STREAM_ERROR; return (inflateReset(&png_ptr->zstream)); } #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ @@ -773,13 +782,13 @@ #if defined(PNG_READ_SUPPORTED) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) #if !defined(PNG_1_0_X) -/* this function was added to libpng 1.2.0 */ +/* This function was added to libpng 1.2.0 */ int PNGAPI png_mmx_support(void) { - /* obsolete, to be removed from libpng-1.4.0 */ + /* Obsolete, to be removed from libpng-1.4.0 */ return -1; } #endif /* PNG_1_0_X */ #endif /* PNG_READ_SUPPORTED && PNG_ASSEMBLER_CODE_SUPPORTED */ @@ -801,20 +810,20 @@ #if defined(PNG_cHRM_SUPPORTED) #if !defined(PNG_NO_CHECK_cHRM) /* - Multiply two 32-bit numbers, V1 and V2, using 32-bit - arithmetic, to produce a 64 bit result in the HI/LO words. - - A B - x C D - ------ - AD || BD -AC || CB || 0 - - where A and B are the high and low 16-bit words of V1, - C and D are the 16-bit words of V2, AD is the product of - A and D, and X || Y is (X << 16) + Y. + * Multiply two 32-bit numbers, V1 and V2, using 32-bit + * arithmetic, to produce a 64 bit result in the HI/LO words. + * + * A B + * x C D + * ------ + * AD || BD + * AC || CB || 0 + * + * where A and B are the high and low 16-bit words of V1, + * C and D are the 16-bit words of V2, AD is the product of + * A and D, and X || Y is (X << 16) + Y. */ void png_64bit_product (long v1, long v2, unsigned long *hi_product, unsigned long *lo_product) diff -ru4NwbB libpng-1.2.36/png.h libpng-1.2.37beta03/png.h --- libpng-1.2.36/png.h 2009-05-07 11:05:31.275827271 -0500 +++ libpng-1.2.37beta03/png.h 2009-05-20 12:43:36.884574306 -0500 @@ -225,8 +225,9 @@ * 1.2.36beta01-05 13 10236 12.so.0.36[.0] * 1.2.36rc01 13 10236 12.so.0.36[.0] * 1.0.44 10 10044 10.so.0.44[.0] * 1.2.36 13 10236 12.so.0.36[.0] + * 1.2.37beta01-03 13 10237 12.so.0.37[.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.2.36/pngerror.c libpng-1.2.37beta03/pngerror.c --- libpng-1.2.36/pngerror.c 2009-05-07 16:52:07.806340717 -0500 +++ libpng-1.2.37beta03/pngerror.c 2009-05-20 12:43:36.912975325 -0500 @@ -1,8 +1,8 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.2.36 [May 7, 2009] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -233,12 +233,14 @@ error_number, error_message + offset + 1); fprintf(stderr, PNG_STRING_NEWLINE); } else + { fprintf(stderr, "libpng error: %s, offset=%d", error_message, offset); fprintf(stderr, PNG_STRING_NEWLINE); } + } else #endif { fprintf(stderr, "libpng error: %s", error_message); @@ -262,9 +264,9 @@ #else PNG_ABORT(); #endif #ifdef PNG_NO_CONSOLE_IO - error_message = error_message; /* make compiler happy */ + error_message = error_message; /* Make compiler happy */ #endif } #ifndef PNG_NO_WARNINGS @@ -308,11 +310,11 @@ fprintf(stderr, "libpng warning: %s", warning_message); fprintf(stderr, PNG_STRING_NEWLINE); } #else - warning_message = warning_message; /* make compiler happy */ + warning_message = warning_message; /* Make compiler happy */ #endif - png_ptr = png_ptr; /* make compiler happy */ + png_ptr = png_ptr; /* Make compiler happy */ } #endif /* PNG_NO_WARNINGS */ /* This function is called when the application wants to use another method diff -ru4NwbB libpng-1.2.36/pngget.c libpng-1.2.37beta03/pngget.c --- libpng-1.2.36/pngget.c 2009-05-07 11:05:31.495569772 -0500 +++ libpng-1.2.37beta03/pngget.c 2009-05-20 12:43:36.924788839 -0500 @@ -1,10 +1,10 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.2.30 [August 15, 2008] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -41,76 +44,69 @@ } #endif #ifdef PNG_EASY_ACCESS_SUPPORTED -/* easy access to info, added in libpng-0.99 */ +/* Easy access to info, added in libpng-0.99 */ png_uint_32 PNGAPI png_get_image_width(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) - { return info_ptr->width; - } + return (0); } png_uint_32 PNGAPI png_get_image_height(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) - { return info_ptr->height; - } + return (0); } png_byte PNGAPI png_get_bit_depth(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) - { return info_ptr->bit_depth; - } + return (0); } png_byte PNGAPI png_get_color_type(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) - { return info_ptr->color_type; - } + return (0); } png_byte PNGAPI png_get_filter_type(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) - { return info_ptr->filter_type; - } + return (0); } png_byte PNGAPI png_get_interlace_type(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) - { return info_ptr->interlace_type; - } + return (0); } png_byte PNGAPI png_get_compression_type(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) - { return info_ptr->compression_type; - } + return (0); } png_uint_32 PNGAPI @@ -494,10 +509,11 @@ { png_debug1(1, "in %s retrieval function", "iCCP"); *name = info_ptr->iccp_name; *profile = info_ptr->iccp_profile; - /* compression_type is a dummy so the API won't have to change - if we introduce multiple compression types later. */ + /* Compression_type is a dummy so the API won't have to change + * if we introduce multiple compression types later. + */ *proflen = (int)info_ptr->iccp_proflen; *compression_type = (int)info_ptr->iccp_compression; return (PNG_INFO_iCCP); } @@ -549,23 +565,30 @@ *height = info_ptr->height; *bit_depth = info_ptr->bit_depth; if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16) png_error(png_ptr, "Invalid bit depth"); + *color_type = info_ptr->color_type; + if (info_ptr->color_type > 6) png_error(png_ptr, "Invalid color type"); + if (compression_type != NULL) *compression_type = info_ptr->compression_type; + if (filter_type != NULL) *filter_type = info_ptr->filter_type; + if (interlace_type != NULL) *interlace_type = info_ptr->interlace_type; - /* check for potential overflow of rowbytes */ + /* Check for potential overflow of rowbytes */ if (*width == 0 || *width > PNG_UINT_31_MAX) png_error(png_ptr, "Invalid image width"); + if (*height == 0 || *height > PNG_UINT_31_MAX) png_error(png_ptr, "Invalid image height"); + if (info_ptr->width > (PNG_UINT_32_MAX >> 3) /* 8-byte RGBA pixels */ - 64 /* bigrowbuf hack */ - 1 /* filter byte */ @@ -835,49 +867,49 @@ #endif #ifdef PNG_ASSEMBLER_CODE_SUPPORTED #ifndef PNG_1_0_X -/* this function was added to libpng 1.2.0 and should exist by default */ +/* This function was added to libpng 1.2.0 and should exist by default */ png_uint_32 PNGAPI png_get_asm_flags (png_structp png_ptr) { - /* obsolete, to be removed from libpng-1.4.0 */ + /* Obsolete, to be removed from libpng-1.4.0 */ return (png_ptr? 0L: 0L); } -/* this function was added to libpng 1.2.0 and should exist by default */ +/* This function was added to libpng 1.2.0 and should exist by default */ png_uint_32 PNGAPI png_get_asm_flagmask (int flag_select) { - /* obsolete, to be removed from libpng-1.4.0 */ + /* Obsolete, to be removed from libpng-1.4.0 */ flag_select=flag_select; return 0L; } /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */ -/* this function was added to libpng 1.2.0 */ +/* This function was added to libpng 1.2.0 */ png_uint_32 PNGAPI png_get_mmx_flagmask (int flag_select, int *compilerID) { - /* obsolete, to be removed from libpng-1.4.0 */ + /* Obsolete, to be removed from libpng-1.4.0 */ flag_select=flag_select; *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */ return 0L; } -/* this function was added to libpng 1.2.0 */ +/* This function was added to libpng 1.2.0 */ png_byte PNGAPI png_get_mmx_bitdepth_threshold (png_structp png_ptr) { - /* obsolete, to be removed from libpng-1.4.0 */ + /* Obsolete, to be removed from libpng-1.4.0 */ return (png_ptr? 0: 0); } -/* this function was added to libpng 1.2.0 */ +/* This function was added to libpng 1.2.0 */ png_uint_32 PNGAPI png_get_mmx_rowbytes_threshold (png_structp png_ptr) { - /* obsolete, to be removed from libpng-1.4.0 */ + /* Obsolete, to be removed from libpng-1.4.0 */ return (png_ptr? 0L: 0L); } #endif /* ?PNG_1_0_X */ #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ diff -ru4NwbB libpng-1.2.36/pngmem.c libpng-1.2.37beta03/pngmem.c --- libpng-1.2.36/pngmem.c 2009-05-07 11:05:31.525334904 -0500 +++ libpng-1.2.37beta03/pngmem.c 2009-05-20 12:43:36.930936216 -0500 @@ -1,10 +1,10 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.2.30 [August 15, 2008] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * This file provides a location for all memory allocation. Users who @@ -19,9 +19,9 @@ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) /* Borland DOS special memory handler */ #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) -/* if you change this, be sure to change the one in png.h also */ +/* If you change this, be sure to change the one in png.h also */ /* Allocate memory for a png_struct. The malloc and memset can be replaced by a single call to calloc() if this is thought to improve performance. */ png_voidp /* PRIVATE */ @@ -153,9 +153,9 @@ else if (size == (png_uint_32)65536L) { if (png_ptr->offset_table == NULL) { - /* try to see if we need to do any of this fancy stuff */ + /* Try to see if we need to do any of this fancy stuff */ ret = farmalloc(size); if (ret == NULL || ((png_size_t)ret & 0xffff)) { int num_blocks; @@ -268,12 +268,12 @@ return (ret); } -/* free a pointer allocated by png_malloc(). In the default - configuration, png_ptr is not used, but is passed in case it - is needed. If ptr is NULL, return without taking any action. */ - +/* Free a pointer allocated by png_malloc(). In the default + * configuration, png_ptr is not used, but is passed in case it + * is needed. If ptr is NULL, return without taking any action. + */ void PNGAPI png_free(png_structp png_ptr, png_voidp ptr) { if (png_ptr == NULL || ptr == NULL) @@ -284,17 +284,19 @@ { (*(png_ptr->free_fn))(png_ptr, ptr); return; } - else png_free_default(png_ptr, ptr); + else + png_free_default(png_ptr, ptr); } void PNGAPI png_free_default(png_structp png_ptr, png_voidp ptr) { #endif /* PNG_USER_MEM_SUPPORTED */ - if (png_ptr == NULL || ptr == NULL) return; + if (png_ptr == NULL || ptr == NULL) + return; if (png_ptr->offset_table != NULL) { int i; @@ -419,12 +421,13 @@ } } /* Allocate memory. For reasonable files, size should never exceed - 64K. However, zlib may allocate more then 64K if you don't tell - it not to. See zconf.h and png.h for more information. zlib does - need to allocate exactly 64K, so whatever you call here must - have the ability to do that. */ + * 64K. However, zlib may allocate more then 64K if you don't tell + * it not to. See zconf.h and png.h for more information. zlib does + * need to allocate exactly 64K, so whatever you call here must + * have the ability to do that. + */ png_voidp PNGAPI png_malloc(png_structp png_ptr, png_uint_32 size) @@ -493,9 +496,10 @@ return (ret); } /* Free a pointer allocated by png_malloc(). If ptr is NULL, return - without taking any action. */ + * without taking any action. + */ void PNGAPI png_free(png_structp png_ptr, png_voidp ptr) { if (png_ptr == NULL || ptr == NULL) @@ -506,9 +510,10 @@ { (*(png_ptr->free_fn))(png_ptr, ptr); return; } - else png_free_default(png_ptr, ptr); + else + png_free_default(png_ptr, ptr); } void PNGAPI png_free_default(png_structp png_ptr, png_voidp ptr) { @@ -542,9 +547,10 @@ png_malloc_warn(png_structp png_ptr, png_uint_32 size) { png_voidp ptr; png_uint_32 save_flags; - if (png_ptr == NULL) return (NULL); + if (png_ptr == NULL) + return (NULL); save_flags = png_ptr->flags; png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK; ptr = (png_voidp)png_malloc((png_structp)png_ptr, size); @@ -602,9 +608,10 @@ */ png_voidp PNGAPI png_get_mem_ptr(png_structp png_ptr) { - if (png_ptr == NULL) return (NULL); + if (png_ptr == NULL) + return (NULL); return ((png_voidp)png_ptr->mem_ptr); } #endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff -ru4NwbB libpng-1.2.36/pngpread.c libpng-1.2.37beta03/pngpread.c --- libpng-1.2.36/pngpread.c 2009-05-07 11:05:31.587745330 -0500 +++ libpng-1.2.37beta03/pngpread.c 2009-05-20 12:43:36.938893423 -0500 @@ -1,19 +1,19 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.2.32 [September 18, 2008] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ #define PNG_INTERNAL #include "png.h" #ifdef PNG_PROGRESSIVE_READ_SUPPORTED -/* push model modes */ +/* Push model modes */ #define PNG_READ_SIG_MODE 0 #define PNG_READ_CHUNK_MODE 1 #define PNG_READ_IDAT_MODE 2 #define PNG_SKIP_MODE 3 @@ -26,9 +26,11 @@ void PNGAPI png_process_data(png_structp png_ptr, png_infop info_ptr, png_bytep buffer, png_size_t buffer_size) { - if (png_ptr == NULL || info_ptr == NULL) return; + if (png_ptr == NULL || info_ptr == NULL) + return; + png_push_restore_buffer(png_ptr, buffer, buffer_size); while (png_ptr->buffer_size) { @@ -41,9 +43,11 @@ */ void /* PRIVATE */ png_process_some_data(png_structp png_ptr, png_infop info_ptr) { - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; + switch (png_ptr->process_mode) { case PNG_READ_SIG_MODE: { @@ -564,9 +624,11 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) { png_bytep ptr; - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; + ptr = buffer; if (png_ptr->save_buffer_size) { png_size_t save_size; @@ -696,9 +760,10 @@ if (png_ptr->idat_size < (png_uint_32)png_ptr->save_buffer_size) { save_size = (png_size_t)png_ptr->idat_size; - /* check for overflow */ + + /* Check for overflow */ if ((png_uint_32)save_size != png_ptr->idat_size) png_error(png_ptr, "save_size overflowed in pngpread"); } else @@ -718,9 +785,10 @@ if (png_ptr->idat_size < (png_uint_32)png_ptr->current_buffer_size) { save_size = (png_size_t)png_ptr->idat_size; - /* check for overflow */ + + /* Check for overflow */ if ((png_uint_32)save_size != png_ptr->idat_size) png_error(png_ptr, "save_size overflowed in pngpread"); } else @@ -828,9 +899,9 @@ if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) png_do_read_transformations(png_ptr); #if defined(PNG_READ_INTERLACING_SUPPORTED) - /* blow up interlaced rows to full size */ + /* Blow up interlaced rows to full size */ if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) { if (png_ptr->pass < 6) /* old interface (pre-1.0.9): @@ -846,11 +917,12 @@ int i; for (i = 0; i < 8 && png_ptr->pass == 0; i++) { png_push_have_row(png_ptr, png_ptr->row_buf + 1); - png_read_push_finish_row(png_ptr); /* updates png_ptr->pass */ + png_read_push_finish_row(png_ptr); /* Updates png_ptr->pass */ } - if (png_ptr->pass == 2) /* pass 1 might be empty */ + + if (png_ptr->pass == 2) /* Pass 1 might be empty */ { for (i = 0; i < 4 && png_ptr->pass == 2; i++) { png_push_have_row(png_ptr, png_bytep_NULL); @@ -879,9 +955,10 @@ { png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_read_push_finish_row(png_ptr); } - if (png_ptr->pass == 2) /* skip top 4 generated rows */ + + if (png_ptr->pass == 2) /* Skip top 4 generated rows */ { for (i = 0; i < 4 && png_ptr->pass == 2; i++) { png_push_have_row(png_ptr, png_bytep_NULL); @@ -902,9 +983,10 @@ { png_push_have_row(png_ptr, png_bytep_NULL); png_read_push_finish_row(png_ptr); } - if (png_ptr->pass == 4) /* pass 3 might be empty */ + + if (png_ptr->pass == 4) /* Pass 3 might be empty */ { for (i = 0; i < 2 && png_ptr->pass == 4; i++) { png_push_have_row(png_ptr, png_bytep_NULL); @@ -920,9 +1005,10 @@ { png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_read_push_finish_row(png_ptr); } - if (png_ptr->pass == 4) /* skip top two generated rows */ + + if (png_ptr->pass == 4) /* Skip top two generated rows */ { for (i = 0; i < 2 && png_ptr->pass == 4; i++) { png_push_have_row(png_ptr, png_bytep_NULL); @@ -943,9 +1033,10 @@ { png_push_have_row(png_ptr, png_bytep_NULL); png_read_push_finish_row(png_ptr); } - if (png_ptr->pass == 6) /* pass 5 might be empty */ + + if (png_ptr->pass == 6) /* Pass 5 might be empty */ { png_push_have_row(png_ptr, png_bytep_NULL); png_read_push_finish_row(png_ptr); } @@ -958,9 +1052,10 @@ { png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_read_push_finish_row(png_ptr); } - if (png_ptr->pass == 6) /* skip top generated row */ + + if (png_ptr->pass == 6) /* Skip top generated row */ { png_push_have_row(png_ptr, png_bytep_NULL); png_read_push_finish_row(png_ptr); } @@ -988,20 +1086,20 @@ void /* PRIVATE */ png_read_push_finish_row(png_structp png_ptr) { #ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - /* start of interlace block */ + /* Start of interlace block */ PNG_CONST int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; - /* offset to next interlace block */ + /* Offset to next interlace block */ PNG_CONST int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; - /* start of interlace block in the y direction */ + /* Start of interlace block in the y direction */ PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; - /* offset to next interlace block in the y direction */ + /* Offset to next interlace block in the y direction */ PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; /* Height of interlace block. This is not currently used - if you need * it, uncomment it here and in png.h @@ -1012,8 +1110,9 @@ png_ptr->row_number++; if (png_ptr->row_number < png_ptr->num_rows) return; +#if defined(PNG_READ_INTERLACING_SUPPORTED) if (png_ptr->interlaced) { png_ptr->row_number = 0; png_memset_check(png_ptr, png_ptr->prev_row, 0, @@ -1048,8 +1148,9 @@ png_pass_yinc[png_ptr->pass]; } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); } +#endif /* PNG_READ_INTERLACING_SUPPORTED */ } #if defined(PNG_READ_tEXt_SUPPORTED) void /* PRIVATE */ @@ -1058,9 +1159,9 @@ { if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) { png_error(png_ptr, "Out of place tEXt"); - info_ptr = info_ptr; /* to quiet some compiler warnings */ + info_ptr = info_ptr; /* To quiet some compiler warnings */ } #ifdef PNG_MAX_MALLOC_64K png_ptr->skip_length = 0; /* This may not be necessary */ @@ -1119,9 +1222,9 @@ key = png_ptr->current_text; for (text = key; *text; text++) - /* empty loop */ ; + /* Empty loop */ ; if (text < key + png_ptr->current_text_size) text++; @@ -1154,9 +1257,9 @@ { if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) { png_error(png_ptr, "Out of place zTXt"); - info_ptr = info_ptr; /* to quiet some compiler warnings */ + info_ptr = info_ptr; /* To quiet some compiler warnings */ } #ifdef PNG_MAX_MALLOC_64K /* We can't handle zTXt chunks > 64K, since we don't have enough space @@ -1213,9 +1318,9 @@ key = png_ptr->current_text; for (text = key; *text; text++) - /* empty loop */ ; + /* Empty loop */ ; /* zTXt can't have zero text */ if (text >= key + png_ptr->current_text_size) { @@ -1225,9 +1330,9 @@ } text++; - if (*text != PNG_TEXT_COMPRESSION_zTXt) /* check compression byte */ + if (*text != PNG_TEXT_COMPRESSION_zTXt) /* Check compression byte */ { png_ptr->current_text = NULL; png_free(png_ptr, key); return; @@ -1346,9 +1458,9 @@ { if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) { png_error(png_ptr, "Out of place iTXt"); - info_ptr = info_ptr; /* to quiet some compiler warnings */ + info_ptr = info_ptr; /* To quiet some compiler warnings */ } #ifdef PNG_MAX_MALLOC_64K png_ptr->skip_length = 0; /* This may not be necessary */ @@ -1411,25 +1525,27 @@ key = png_ptr->current_text; for (lang = key; *lang; lang++) - /* empty loop */ ; + /* Empty loop */ ; if (lang < key + png_ptr->current_text_size - 3) lang++; comp_flag = *lang++; - lang++; /* skip comp_type, always zero */ + lang++; /* Skip comp_type, always zero */ for (lang_key = lang; *lang_key; lang_key++) - /* empty loop */ ; - lang_key++; /* skip NUL separator */ + /* Empty loop */ ; + + lang_key++; /* Skip NUL separator */ text=lang_key; + if (lang_key < key + png_ptr->current_text_size - 1) { for (; *text; text++) - /* empty loop */ ; + /* Empty loop */ ; } if (text < key + png_ptr->current_text_size) text++; @@ -1476,9 +1593,9 @@ ) #endif png_chunk_error(png_ptr, "unknown critical chunk"); - info_ptr = info_ptr; /* to quiet some compiler warnings */ + info_ptr = info_ptr; /* To quiet some compiler warnings */ } #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) @@ -1505,17 +1624,20 @@ png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, (png_uint_32)length); png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); } + #if defined(PNG_READ_USER_CHUNKS_SUPPORTED) if (png_ptr->read_user_chunk_fn != NULL) { - /* callback to user unknown chunk handler */ + /* Callback to user unknown chunk handler */ int ret; ret = (*(png_ptr->read_user_chunk_fn)) (png_ptr, &png_ptr->unknown_chunk); + if (ret < 0) png_chunk_error(png_ptr, "error in user chunk"); + if (ret == 0) { if (!(png_ptr->chunk_name[0] & 0x20)) if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != @@ -1566,9 +1690,11 @@ #ifdef PNG_USE_LOCAL_ARRAYS PNG_CONST int FARDATA png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; #endif - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; + if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */ png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]); } @@ -1576,9 +1702,11 @@ png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn) { - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; + png_ptr->info_fn = info_fn; png_ptr->row_fn = row_fn; png_ptr->end_fn = end_fn; @@ -1587,8 +1715,10 @@ png_voidp PNGAPI png_get_progressive_ptr(png_structp png_ptr) { - if (png_ptr == NULL) return (NULL); + if (png_ptr == NULL) + return (NULL); + return png_ptr->io_ptr; } #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ diff -ru4NwbB libpng-1.2.36/pngread.c libpng-1.2.37beta03/pngread.c --- libpng-1.2.36/pngread.c 2009-05-07 11:05:31.648389045 -0500 +++ libpng-1.2.37beta03/pngread.c 2009-05-20 12:43:36.947018914 -0500 @@ -1,8 +1,8 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.2.35 [February 14, 2009] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -56,9 +56,9 @@ #endif if (png_ptr == NULL) return (NULL); - /* added at libpng-1.2.6 */ + /* Added at libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED png_ptr->user_width_max=PNG_USER_WIDTH_MAX; png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; #endif @@ -136,9 +136,9 @@ "Incompatible libpng version in application and library"); } } - /* initialize zbuf - compression buffer */ + /* Initialize zbuf - compression buffer */ png_ptr->zbuf_size = PNG_ZBUF_SIZE; png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size); png_ptr->zstream.zalloc = png_zalloc; @@ -265,9 +265,9 @@ png_debug(1, "in png_read_init_3"); #ifdef PNG_SETJMP_SUPPORTED - /* save jump buffer and error functions */ + /* Save jump buffer and error functions */ png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf)); #endif if (png_sizeof(png_struct) > png_struct_size) @@ -276,23 +276,23 @@ *ptr_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); png_ptr = *ptr_ptr; } - /* reset all variables to 0 */ + /* Reset all variables to 0 */ png_memset(png_ptr, 0, png_sizeof(png_struct)); #ifdef PNG_SETJMP_SUPPORTED - /* restore jump buffer */ + /* Restore jump buffer */ png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf)); #endif - /* added at libpng-1.2.6 */ + /* Added at libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED png_ptr->user_width_max=PNG_USER_WIDTH_MAX; png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; #endif - /* initialize zbuf - compression buffer */ + /* Initialize zbuf - compression buffer */ png_ptr->zbuf_size = PNG_ZBUF_SIZE; png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size); png_ptr->zstream.zalloc = png_zalloc; @@ -325,9 +325,10 @@ */ void PNGAPI png_read_info(png_structp png_ptr, png_infop info_ptr) { - if (png_ptr == NULL || info_ptr == NULL) return; + if (png_ptr == NULL || info_ptr == NULL) + return; png_debug(1, "in png_read_info"); /* If we haven't checked all of the PNG signature bytes, do so now. */ if (png_ptr->sig_bytes < 8) { @@ -528,14 +529,15 @@ } } #endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ -/* optional call to update the users info_ptr structure */ +/* Optional call to update the users info_ptr structure */ void PNGAPI png_read_update_info(png_structp png_ptr, png_infop info_ptr) { png_debug(1, "in png_read_update_info"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) png_read_start_row(png_ptr); else png_warning(png_ptr, @@ -552,9 +554,10 @@ void PNGAPI png_start_read_image(png_structp png_ptr) { png_debug(1, "in png_start_read_image"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) png_read_start_row(png_ptr); } #endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ @@ -569,16 +572,17 @@ 0xff}; PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; #endif int ret; - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_debug2(1, "in png_read_row (row %lu, pass %d)", png_ptr->row_number, png_ptr->pass); if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) png_read_start_row(png_ptr); if (png_ptr->row_number == 0 && png_ptr->pass == 0) { - /* check for transforms that have been set but were defined out */ + /* Check for transforms that have been set but were defined out */ #if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED) if (png_ptr->transformations & PNG_INVERT_MONO) png_warning(png_ptr, "PNG_READ_INVERT_SUPPORTED is not defined."); #endif @@ -608,9 +612,9 @@ #endif } #if defined(PNG_READ_INTERLACING_SUPPORTED) - /* if interlaced and we do not need a new row, combine row and return */ + /* If interlaced and we do not need a new row, combine row and return */ if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) { switch (png_ptr->pass) { @@ -755,16 +759,16 @@ if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) png_do_read_transformations(png_ptr); #if defined(PNG_READ_INTERLACING_SUPPORTED) - /* blow up interlaced rows to full size */ + /* Blow up interlaced rows to full size */ if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) { if (png_ptr->pass < 6) -/* old interface (pre-1.0.9): - png_do_read_interlace(&(png_ptr->row_info), - png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); + /* Old interface (pre-1.0.9): + * png_do_read_interlace(&(png_ptr->row_info), + * png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); */ png_do_read_interlace(png_ptr); if (dsp_row != NULL) @@ -822,9 +826,10 @@ png_bytepp rp; png_bytepp dp; png_debug(1, "in png_read_rows"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; rp = row; dp = display_row; if (rp != NULL && dp != NULL) for (i = 0; i < num_rows; i++) @@ -871,9 +876,10 @@ int pass, j; png_bytepp rp; png_debug(1, "in png_read_image"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; #ifdef PNG_READ_INTERLACING_SUPPORTED pass = png_set_interlace_handling(png_ptr); #else @@ -907,9 +913,10 @@ void PNGAPI png_read_end(png_structp png_ptr, png_infop info_ptr) { png_debug(1, "in png_read_end"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */ do { @@ -1074,9 +1081,9 @@ } while (!(png_ptr->mode & PNG_HAVE_IEND)); } #endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ -/* free all memory used by the read */ +/* Free all memory used by the read */ void PNGAPI png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr) { @@ -1146,9 +1153,9 @@ *png_ptr_ptr = NULL; } } -/* free all memory used by the read (old method) */ +/* Free all memory used by the read (old method) */ void /* PRIVATE */ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr) { #ifdef PNG_SETJMP_SUPPORTED @@ -1295,9 +1302,10 @@ void PNGAPI png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn) { - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->read_row_fn = read_row_fn; } @@ -1309,11 +1317,12 @@ voidp params) { int row; - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) - /* invert the alpha channel from opacity to transparency + /* Invert the alpha channel from opacity to transparency */ if (transforms & PNG_TRANSFORM_INVERT_ALPHA) png_set_invert_alpha(png_ptr); #endif @@ -1327,9 +1336,9 @@ /* -------------- image transformations start here ------------------- */ #if defined(PNG_READ_16_TO_8_SUPPORTED) - /* tell libpng to strip 16 bit/color files down to 8 bits per color + /* Tell libpng to strip 16 bit/color files down to 8 bits per color. */ if (transforms & PNG_TRANSFORM_STRIP_16) png_set_strip_16(png_ptr); #endif @@ -1374,9 +1383,9 @@ /* We don't handle background color or gamma transformation or dithering. */ #if defined(PNG_READ_INVERT_SUPPORTED) - /* invert monochrome files to have 0 as white and 1 as black + /* Invert monochrome files to have 0 as white and 1 as black */ if (transforms & PNG_TRANSFORM_INVERT_MONO) png_set_invert_mono(png_ptr); #endif @@ -1396,23 +1405,23 @@ } #endif #if defined(PNG_READ_BGR_SUPPORTED) - /* flip the RGB pixels to BGR (or RGBA to BGRA) + /* Flip the RGB pixels to BGR (or RGBA to BGRA) */ if (transforms & PNG_TRANSFORM_BGR) png_set_bgr(png_ptr); #endif #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) - /* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) + /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ if (transforms & PNG_TRANSFORM_SWAP_ALPHA) png_set_swap_alpha(png_ptr); #endif #if defined(PNG_READ_SWAP_SUPPORTED) - /* swap bytes of 16 bit files to least significant byte first + /* Swap bytes of 16 bit files to least significant byte first */ if (transforms & PNG_TRANSFORM_SWAP_ENDIAN) png_set_swap(png_ptr); #endif @@ -1446,12 +1455,12 @@ png_read_image(png_ptr, info_ptr->row_pointers); info_ptr->valid |= PNG_INFO_IDAT; - /* read rest of file, and get additional chunks in info_ptr - REQUIRED */ + /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ png_read_end(png_ptr, info_ptr); - transforms = transforms; /* quiet compiler warnings */ + transforms = transforms; /* Quiet compiler warnings */ params = params; } #endif /* PNG_INFO_IMAGE_SUPPORTED */ diff -ru4NwbB libpng-1.2.36/pngrio.c libpng-1.2.37beta03/pngrio.c --- libpng-1.2.36/pngrio.c 2009-05-07 16:52:11.765969246 -0500 +++ libpng-1.2.37beta03/pngrio.c 2009-05-20 12:43:36.951971679 -0500 @@ -1,8 +1,8 @@ /* pngrio.c - functions for data input * - * Last changed in libpng 1.2.36 [May 7, 2009] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -19,12 +19,13 @@ #include "png.h" #if defined(PNG_READ_SUPPORTED) /* Read the data from whatever input you are using. The default routine - reads from a file pointer. Note that this routine sometimes gets called - with very small lengths, so you should implement some kind of simple - buffering if you are using unbuffered reads. This should never be asked - to read more then 64K on a 16 bit machine. */ + * reads from a file pointer. Note that this routine sometimes gets called + * with very small lengths, so you should implement some kind of simple + * buffering if you are using unbuffered reads. This should never be asked + * to read more then 64K on a 16 bit machine. + */ void /* PRIVATE */ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { png_debug1(4, "reading %d bytes", (int)length); @@ -35,18 +36,20 @@ } #if !defined(PNG_NO_STDIO) /* This is the function that does the actual reading of data. If you are - not reading from a standard C stream, you should create a replacement - read_data function and use it at run time with png_set_read_fn(), rather - than changing the library. */ + * not reading from a standard C stream, you should create a replacement + * read_data function and use it at run time with png_set_read_fn(), rather + * than changing the library. + */ #ifndef USE_FAR_KEYWORD void PNGAPI png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { png_size_t check; - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; /* fread() returns 0 on error, so it is OK to store this in a png_size_t * instead of an int, which is what fread() actually returns. */ #if defined(_WIN32_WCE) @@ -60,9 +63,9 @@ if (check != length) png_error(png_ptr, "Read Error"); } #else -/* this is the model-independent version. Since the standard I/O library +/* This is the model-independent version. Since the standard I/O library can't handle far buffers in the medium and small models, we have to copy the data. */ @@ -75,9 +78,10 @@ int check; png_byte *n_data; png_FILE_p io_ptr; - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; /* Check if data really is near. If so, use usual code. */ n_data = (png_byte *)CVT_PTR_NOCHECK(data); io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); if ((png_bytep)n_data == data) @@ -120,27 +124,29 @@ #endif #endif /* This function allows the application to supply a new input function - for libpng if standard C streams aren't being used. - - This function takes as its arguments: - png_ptr - pointer to a png input data structure - io_ptr - pointer to user supplied structure containing info about - the input functions. May be NULL. - read_data_fn - pointer to a new input function that takes as its - arguments a pointer to a png_struct, a pointer to - a location where input data can be stored, and a 32-bit - unsigned int that is the number of bytes to be read. - To exit and output any fatal error messages the new write - function should call png_error(png_ptr, "Error msg"). - May be NULL, in which case libpng's default function will - be used. */ + * for libpng if standard C streams aren't being used. + * + * This function takes as its arguments: + * png_ptr - pointer to a png input data structure + * io_ptr - pointer to user supplied structure containing info about + * the input functions. May be NULL. + * read_data_fn - pointer to a new input function that takes as its + * arguments a pointer to a png_struct, a pointer to + * a location where input data can be stored, and a 32-bit + * unsigned int that is the number of bytes to be read. + * To exit and output any fatal error messages the new write + * function should call png_error(png_ptr, "Error msg"). + * May be NULL, in which case libpng's default function will + * be used. + */ void PNGAPI png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn) { - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->io_ptr = io_ptr; #if !defined(PNG_NO_STDIO) if (read_data_fn != NULL) diff -ru4NwbB libpng-1.2.36/pngrtran.c libpng-1.2.37beta03/pngrtran.c --- libpng-1.2.36/pngrtran.c 2009-05-07 11:05:31.831599145 -0500 +++ libpng-1.2.37beta03/pngrtran.c 2009-05-20 12:43:36.966626357 -0500 @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.2.35 [February 14, 2009] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -22,50 +22,60 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action) { png_debug(1, "in png_set_crc_action"); /* Tell libpng how we react to CRC errors in critical chunks */ - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; switch (crit_action) { - case PNG_CRC_NO_CHANGE: /* leave setting as is */ + case PNG_CRC_NO_CHANGE: /* Leave setting as is */ break; - case PNG_CRC_WARN_USE: /* warn/use data */ + + case PNG_CRC_WARN_USE: /* Warn/use data */ png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE; break; - case PNG_CRC_QUIET_USE: /* quiet/use data */ + + case PNG_CRC_QUIET_USE: /* Quiet/use data */ png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE | PNG_FLAG_CRC_CRITICAL_IGNORE; break; - case PNG_CRC_WARN_DISCARD: /* not a valid action for critical data */ + + case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */ png_warning(png_ptr, "Can't discard critical data on CRC error."); - case PNG_CRC_ERROR_QUIT: /* error/quit */ + case PNG_CRC_ERROR_QUIT: /* Error/quit */ + case PNG_CRC_DEFAULT: default: png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; break; } switch (ancil_action) { - case PNG_CRC_NO_CHANGE: /* leave setting as is */ + case PNG_CRC_NO_CHANGE: /* Leave setting as is */ break; - case PNG_CRC_WARN_USE: /* warn/use data */ + + case PNG_CRC_WARN_USE: /* Warn/use data */ png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE; break; - case PNG_CRC_QUIET_USE: /* quiet/use data */ + + case PNG_CRC_QUIET_USE: /* Quiet/use data */ png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN; break; - case PNG_CRC_ERROR_QUIT: /* error/quit */ + + case PNG_CRC_ERROR_QUIT: /* Error/quit */ png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_NOWARN; break; - case PNG_CRC_WARN_DISCARD: /* warn/discard data */ + + case PNG_CRC_WARN_DISCARD: /* Warn/discard data */ + case PNG_CRC_DEFAULT: default: png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; break; @@ -73,16 +83,17 @@ } #if defined(PNG_READ_BACKGROUND_SUPPORTED) && \ defined(PNG_FLOATING_POINT_SUPPORTED) -/* handle alpha and tRNS via a background color */ +/* Handle alpha and tRNS via a background color */ void PNGAPI png_set_background(png_structp png_ptr, png_color_16p background_color, int background_gamma_code, int need_expand, double background_gamma) { png_debug(1, "in png_set_background"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN) { png_warning(png_ptr, "Application must supply a known background gamma"); return; @@ -97,14 +108,15 @@ } #endif #if defined(PNG_READ_16_TO_8_SUPPORTED) -/* strip 16 bit depth files to 8 bit depth */ +/* Strip 16 bit depth files to 8 bit depth */ void PNGAPI png_set_strip_16(png_structp png_ptr) { png_debug(1, "in png_set_strip_16"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= PNG_16_TO_8; } #endif @@ -112,9 +124,10 @@ void PNGAPI png_set_strip_alpha(png_structp png_ptr) { png_debug(1, "in png_set_strip_alpha"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; } #endif @@ -142,9 +155,10 @@ int num_palette, int maximum_colors, png_uint_16p histogram, int full_dither) { png_debug(1, "in png_set_dither"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= PNG_DITHER; if (!full_dither) { @@ -160,29 +174,31 @@ { if (histogram != NULL) { /* This is easy enough, just throw out the least used colors. - Perhaps not the best solution, but good enough. */ + * Perhaps not the best solution, but good enough. + */ int i; - /* initialize an array to sort colors */ + /* Initialize an array to sort colors */ png_ptr->dither_sort = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_palette * png_sizeof(png_byte))); - /* initialize the dither_sort array */ + /* Initialize the dither_sort array */ for (i = 0; i < num_palette; i++) png_ptr->dither_sort[i] = (png_byte)i; /* Find the least used palette entries by starting a - bubble sort, and running it until we have sorted - out enough colors. Note that we don't care about - sorting all the colors, just finding which are - least used. */ + * bubble sort, and running it until we have sorted + * out enough colors. Note that we don't care about + * sorting all the colors, just finding which are + * least used. + */ for (i = num_palette - 1; i >= maximum_colors; i--) { - int done; /* to stop early if the list is pre-sorted */ + int done; /* To stop early if the list is pre-sorted */ int j; done = 1; for (j = 0; j < i; j++) @@ -201,15 +217,16 @@ if (done) break; } - /* swap the palette around, and set up a table, if necessary */ + /* Swap the palette around, and set up a table, if necessary */ if (full_dither) { int j = num_palette; - /* put all the useful colors within the max, but don't - move the others */ + /* Put all the useful colors within the max, but don't + * move the others. + */ for (i = 0; i < maximum_colors; i++) { if ((int)png_ptr->dither_sort[i] >= maximum_colors) { @@ -223,13 +240,14 @@ else { int j = num_palette; - /* move all the used colors inside the max limit, and - develop a translation table */ + /* Move all the used colors inside the max limit, and + * develop a translation table. + */ for (i = 0; i < maximum_colors; i++) { - /* only move the colors we need to */ + /* Only move the colors we need to */ if ((int)png_ptr->dither_sort[i] >= maximum_colors) { png_color tmp_color; @@ -239,22 +257,22 @@ tmp_color = palette[j]; palette[j] = palette[i]; palette[i] = tmp_color; - /* indicate where the color went */ + /* Indicate where the color went */ png_ptr->dither_index[j] = (png_byte)i; png_ptr->dither_index[i] = (png_byte)j; } } - /* find closest color for those colors we are not using */ + /* Find closest color for those colors we are not using */ for (i = 0; i < num_palette; i++) { if ((int)png_ptr->dither_index[i] >= maximum_colors) { int min_d, k, min_k, d_index; - /* find the closest color to one we threw out */ + /* Find the closest color to one we threw out */ d_index = png_ptr->dither_index[i]; min_d = PNG_COLOR_DIST(palette[d_index], palette[0]); for (k = 1, min_k = 0; k < maximum_colors; k++) { @@ -267,9 +285,9 @@ min_d = d; min_k = k; } } - /* point to closest color */ + /* Point to closest color */ png_ptr->dither_index[i] = (png_byte)min_k; } } } @@ -278,14 +296,14 @@ } else { /* This is much harder to do simply (and quickly). Perhaps - we need to go through a median cut routine, but those - don't always behave themselves with only a few colors - as input. So we will just find the closest two colors, - and throw out one of them (chosen somewhat randomly). - [We don't understand this at all, so if someone wants to - work on improving it, be our guest - AED, GRP] + * we need to go through a median cut routine, but those + * don't always behave themselves with only a few colors + * as input. So we will just find the closest two colors, + * and throw out one of them (chosen somewhat randomly). + * [We don't understand this at all, so if someone wants to + * work on improving it, be our guest - AED, GRP] */ int i; int max_d; int num_new_palette; @@ -293,15 +311,15 @@ png_dsortpp hash; t = NULL; - /* initialize palette index arrays */ + /* Initialize palette index arrays */ png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_palette * png_sizeof(png_byte))); png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_palette * png_sizeof(png_byte))); - /* initialize the sort array */ + /* Initialize the sort array */ for (i = 0; i < num_palette; i++) { png_ptr->index_to_palette[i] = (png_byte)i; png_ptr->palette_to_index[i] = (png_byte)i; @@ -312,15 +330,15 @@ png_memset(hash, 0, 769 * png_sizeof(png_dsortp)); num_new_palette = num_palette; - /* initial wild guess at how far apart the farthest pixel - pair we will be eliminating will be. Larger - numbers mean more areas will be allocated, Smaller - numbers run the risk of not saving enough data, and - having to do this all over again. - - I have not done extensive checking on this number. + /* Initial wild guess at how far apart the farthest pixel + * pair we will be eliminating will be. Larger + * numbers mean more areas will be allocated, Smaller + * numbers run the risk of not saving enough data, and + * having to do this all over again. + * + * I have not done extensive checking on this number. */ max_d = 96; while (num_new_palette > maximum_colors) @@ -522,9 +540,10 @@ void PNGAPI png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma) { png_debug(1, "in png_set_gamma"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) || (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) || (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)) png_ptr->transformations |= PNG_GAMMA; @@ -541,9 +560,10 @@ void PNGAPI png_set_expand(png_structp png_ptr) { png_debug(1, "in png_set_expand"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->flags &= ~PNG_FLAG_ROW_INIT; } @@ -568,9 +588,10 @@ void PNGAPI png_set_palette_to_rgb(png_structp png_ptr) { png_debug(1, "in png_set_palette_to_rgb"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->flags &= ~PNG_FLAG_ROW_INIT; } @@ -579,9 +600,10 @@ void PNGAPI png_set_expand_gray_1_2_4_to_8(png_structp png_ptr) { png_debug(1, "in png_set_expand_gray_1_2_4_to_8"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= PNG_EXPAND; png_ptr->flags &= ~PNG_FLAG_ROW_INIT; } #endif @@ -592,9 +614,10 @@ void PNGAPI png_set_gray_1_2_4_to_8(png_structp png_ptr) { png_debug(1, "in png_set_gray_1_2_4_to_8"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); } #endif @@ -630,9 +653,10 @@ double green) { int red_fixed = (int)((float)red*100000.0 + 0.5); int green_fixed = (int)((float)green*100000.0 + 0.5); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed); } #endif @@ -640,9 +664,10 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, png_fixed_point red, png_fixed_point green) { png_debug(1, "in png_set_rgb_to_gray"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; switch(error_action) { case 1: png_ptr->transformations |= PNG_RGB_TO_GRAY; break; @@ -693,9 +720,10 @@ png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr read_user_transform_fn) { png_debug(1, "in png_set_read_user_transform_fn"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) png_ptr->transformations |= PNG_USER_TRANSFORM; png_ptr->read_user_transform_fn = read_user_transform_fn; #endif @@ -726,10 +754,11 @@ #if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED) #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) /* Detect gray background and attempt to enable optimization - * for gray --> RGB case */ - /* Note: if PNG_BACKGROUND_EXPAND is set and color_type is either RGB or + * for gray --> RGB case + * + * Note: if PNG_BACKGROUND_EXPAND is set and color_type is either RGB or * RGB_ALPHA (in which case need_expand is superfluous anyway), the * background color might actually be gray yet not be flagged as such. * This is not a problem for the current code, which uses * PNG_BACKGROUND_IS_GRAY only to decide when to do the @@ -754,9 +783,9 @@ (png_ptr->transformations & PNG_EXPAND)) { if (!(color_type & PNG_COLOR_MASK_COLOR)) /* i.e., GRAY or GRAY_ALPHA */ { - /* expand background and tRNS chunks */ + /* Expand background and tRNS chunks */ switch (png_ptr->bit_depth) { case 1: png_ptr->background.gray *= (png_uint_16)0xff; @@ -813,10 +846,11 @@ #if defined(PNG_READ_EXPAND_SUPPORTED) if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) #endif { - /* invert the alpha channel (in tRNS) unless the pixels are - going to be expanded, in which case leave it for later */ + /* Invert the alpha channel (in tRNS) unless the pixels are + * going to be expanded, in which case leave it for later + */ int i, istop; istop=(int)png_ptr->num_trans; for (i=0; itrans[i] = (png_byte)(255 - png_ptr->trans[i]); @@ -841,9 +875,9 @@ k=0; for (i=0; inum_trans; i++) { if (png_ptr->trans[i] != 0 && png_ptr->trans[i] != 0xff) - k=1; /* partial transparency is present */ + k=1; /* Partial transparency is present */ } if (k == 0) png_ptr->transformations &= ~PNG_GAMMA; } @@ -856,10 +890,9 @@ if (png_ptr->transformations & PNG_BACKGROUND) { if (color_type == PNG_COLOR_TYPE_PALETTE) { - /* could skip if no transparency and - */ + /* Could skip if no transparency */ png_color back, back_1; png_colorp palette = png_ptr->palette; int num_palette = png_ptr->num_palette; int i; @@ -1019,9 +1056,9 @@ } } } else - /* transformation does not include PNG_BACKGROUND */ + /* Transformation does not include PNG_BACKGROUND */ #endif /* PNG_READ_BACKGROUND_SUPPORTED */ if (color_type == PNG_COLOR_TYPE_PALETTE) { png_colorp palette = png_ptr->palette; @@ -1226,9 +1263,9 @@ ((info_ptr->color_type == PNG_COLOR_TYPE_RGB) || (info_ptr->color_type == PNG_COLOR_TYPE_GRAY))) { info_ptr->channels++; - /* if adding a true alpha channel not just filler */ + /* If adding a true alpha channel not just filler */ #if !defined(PNG_1_0_X) if (png_ptr->transformations & PNG_ADD_ALPHA) info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; #endif @@ -1281,9 +1318,10 @@ #ifdef PNG_WARN_UNINITIALIZED_ROW if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) /* Application has failed to call either png_read_start_image() * or png_read_update_info() after setting transforms that expand - * pixels. This check added to libpng-1.2.19 */ + * pixels. This check added to libpng-1.2.19 + */ #if (PNG_WARN_UNINITIALIZED_ROW==1) png_error(png_ptr, "Uninitialized row"); #else png_warning(png_ptr, "Uninitialized row"); @@ -1334,41 +1372,43 @@ } } #endif -/* -From Andreas Dilger e-mail to png-implement, 26 March 1998: - - In most cases, the "simple transparency" should be done prior to doing - gray-to-RGB, or you will have to test 3x as many bytes to check if a - pixel is transparent. You would also need to make sure that the - transparency information is upgraded to RGB. - - To summarize, the current flow is: - - Gray + simple transparency -> compare 1 or 2 gray bytes and composite - with background "in place" if transparent, - convert to RGB if necessary - - Gray + alpha -> composite with gray background and remove alpha bytes, - convert to RGB if necessary - - To support RGB backgrounds for gray images we need: - - Gray + simple transparency -> convert to RGB + simple transparency, compare - 3 or 6 bytes and composite with background - "in place" if transparent (3x compare/pixel - compared to doing composite with gray bkgrnd) - - Gray + alpha -> convert to RGB + alpha, composite with background and - remove alpha bytes (3x float operations/pixel - compared with composite on gray background) - - Greg's change will do this. The reason it wasn't done before is for - performance, as this increases the per-pixel operations. If we would check - in advance if the background was gray or RGB, and position the gray-to-RGB - transform appropriately, then it would save a lot of work/time. +/* From Andreas Dilger e-mail to png-implement, 26 March 1998: + * + * In most cases, the "simple transparency" should be done prior to doing + * gray-to-RGB, or you will have to test 3x as many bytes to check if a + * pixel is transparent. You would also need to make sure that the + * transparency information is upgraded to RGB. + * + * To summarize, the current flow is: + * - Gray + simple transparency -> compare 1 or 2 gray bytes and composite + * with background "in place" if transparent, + * convert to RGB if necessary + * - Gray + alpha -> composite with gray background and remove alpha bytes, + * convert to RGB if necessary + * + * To support RGB backgrounds for gray images we need: + * - Gray + simple transparency -> convert to RGB + simple transparency, + * compare 3 or 6 bytes and composite with + * background "in place" if transparent + * (3x compare/pixel compared to doing + * composite with gray bkgrnd) + * - Gray + alpha -> convert to RGB + alpha, composite with background and + * remove alpha bytes (3x float + * operations/pixel compared with composite + * on gray background) + * + * Greg's change will do this. The reason it wasn't done before is for + * performance, as this increases the per-pixel operations. If we would check + * in advance if the background was gray or RGB, and position the gray-to-RGB + * transform appropriately, then it would save a lot of work/time. */ #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) - /* if gray -> RGB, do so now only if background is non-gray; else do later - * for performance reasons */ + /* If gray -> RGB, do so now only if background is non-gray; else do later + * for performance reasons + */ if ((png_ptr->transformations & PNG_GRAY_TO_RGB) && !(png_ptr->mode & PNG_BACKGROUND_IS_GRAY)) png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif @@ -1443,9 +1483,9 @@ png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) - /* if gray -> RGB, do so now only if we did not do so above */ + /* If gray -> RGB, do so now only if we did not do so above */ if ((png_ptr->transformations & PNG_GRAY_TO_RGB) && (png_ptr->mode & PNG_BACKGROUND_IS_GRAY)) png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif @@ -1474,9 +1514,9 @@ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) if (png_ptr->transformations & PNG_USER_TRANSFORM) { if (png_ptr->read_user_transform_fn != NULL) - (*(png_ptr->read_user_transform_fn)) /* user read transform function */ + (*(png_ptr->read_user_transform_fn)) /* User read transform function */ (png_ptr, /* png_ptr */ &(png_ptr->row_info), /* row_info: */ /* png_uint_32 width; width of row */ /* png_uint_32 rowbytes; number of bytes in row */ @@ -1701,9 +1746,9 @@ } #endif #if defined(PNG_READ_16_TO_8_SUPPORTED) -/* chop rows of bit depth 16 down to 8 */ +/* Chop rows of bit depth 16 down to 8 */ void /* PRIVATE */ png_do_chop(png_row_infop row_info, png_bytep row) { png_debug(1, "in png_do_chop"); @@ -1725,16 +1770,19 @@ * value, rather than a simple low-byte truncation. * * What the ideal calculation should be: * *dp = (((((png_uint_32)(*sp) << 8) | - * (png_uint_32)(*(sp + 1))) * 255 + 127) / (png_uint_32)65535L; + * (png_uint_32)(*(sp + 1))) * 255 + 127) + * / (png_uint_32)65535L; * * GRR: no, I think this is what it really should be: * *dp = (((((png_uint_32)(*sp) << 8) | - * (png_uint_32)(*(sp + 1))) + 128L) / (png_uint_32)257L; + * (png_uint_32)(*(sp + 1))) + 128L) + * / (png_uint_32)257L; * * GRR: here's the exact calculation with shifts: - * temp = (((png_uint_32)(*sp) << 8) | (png_uint_32)(*(sp + 1))) + 128L; + * temp = (((png_uint_32)(*sp) << 8) | + * (png_uint_32)(*(sp + 1))) + 128L; * *dp = (temp - (temp >> 8)) >> 8; * * Approximate calculation with shift/add instead of multiply/divide: * *dp = ((((png_uint_32)(*sp) << 8) | @@ -2122,9 +2170,9 @@ } #endif #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) -/* expand grayscale files to RGB, with or without alpha */ +/* Expand grayscale files to RGB, with or without alpha */ void /* PRIVATE */ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) { png_uint_32 i; @@ -2205,9 +2253,9 @@ } #endif #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) -/* reduce RGB files to grayscale, with or without alpha +/* 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: * @@ -2672,9 +2724,9 @@ png_ptr->trans[i], back.blue); } } } - else /* assume grayscale palette (what else could it be?) */ + else /* Assume grayscale palette (what else could it be?) */ { int i; for (i = 0; i < num_palette; i++) @@ -2905,9 +2961,9 @@ v = (png_uint_16)(((*sp) << 8) + *(sp + 1)); if (v == trans_values->gray) { - /* background is already in screen gamma */ + /* Background is already in screen gamma */ *sp = (png_byte)((background->gray >> 8) & 0xff); *(sp + 1) = (png_byte)(background->gray & 0xff); } else @@ -2995,9 +3052,9 @@ png_uint_16 b = (png_uint_16)(((*(sp+4)) << 8) + *(sp+5)); if (r == trans_values->red && g == trans_values->green && b == trans_values->blue) { - /* background is already in screen gamma */ + /* Background is already in screen gamma */ *sp = (png_byte)((background->red >> 8) & 0xff); *(sp + 1) = (png_byte)(background->red & 0xff); *(sp + 2) = (png_byte)((background->green >> 8) & 0xff); *(sp + 3) = (png_byte)(background->green & 0xff); @@ -3062,9 +3120,9 @@ *dp = gamma_table[*sp]; } else if (a == 0) { - /* background is already in screen gamma */ + /* Background is already in screen gamma */ *dp = (png_byte)background->gray; } else { @@ -3129,9 +3187,9 @@ #else else #endif { - /* background is already in screen gamma */ + /* Background is already in screen gamma */ *dp = (png_byte)((background->gray >> 8) & 0xff); *(dp + 1) = (png_byte)(background->gray & 0xff); } #if defined(PNG_READ_GAMMA_SUPPORTED) @@ -3206,9 +3265,9 @@ *(dp + 2) = gamma_table[*(sp + 2)]; } else if (a == 0) { - /* background is already in screen gamma */ + /* Background is already in screen gamma */ *dp = (png_byte)background->red; *(dp + 1) = (png_byte)background->green; *(dp + 2) = (png_byte)background->blue; } @@ -3287,9 +3346,9 @@ *(dp + 5) = (png_byte)(v & 0xff); } else if (a == 0) { - /* background is already in screen gamma */ + /* Background is already in screen gamma */ *dp = (png_byte)((background->red >> 8) & 0xff); *(dp + 1) = (png_byte)(background->red & 0xff); *(dp + 2) = (png_byte)((background->green >> 8) & 0xff); *(dp + 3) = (png_byte)(background->green & 0xff); @@ -3942,14 +4015,14 @@ r = *sp++; g = *sp++; b = *sp++; - /* this looks real messy, but the compiler will reduce - it down to a reasonable formula. For example, with - 5 bits per color, we get: - p = (((r >> 3) & 0x1f) << 10) | - (((g >> 3) & 0x1f) << 5) | - ((b >> 3) & 0x1f); + /* This looks real messy, but the compiler will reduce + * it down to a reasonable formula. For example, with + * 5 bits per color, we get: + * p = (((r >> 3) & 0x1f) << 10) | + * (((g >> 3) & 0x1f) << 5) | + * ((b >> 3) & 0x1f); */ p = (((r >> (8 - PNG_DITHER_RED_BITS)) & ((1 << PNG_DITHER_RED_BITS) - 1)) << (PNG_DITHER_GREEN_BITS + PNG_DITHER_BLUE_BITS)) | @@ -4063,10 +4137,11 @@ (png_uint_32)256); if (png_ptr->screen_gamma > 0.000001) g = 1.0 / png_ptr->screen_gamma; + else - g = png_ptr->gamma; /* probably doing rgb_to_gray */ + g = png_ptr->gamma; /* Probably doing rgb_to_gray */ for (i = 0; i < 256; i++) { png_ptr->gamma_from_1[i] = (png_byte)(pow((double)i / 255.0, @@ -4202,10 +4282,11 @@ } if (png_ptr->screen_gamma > 0.000001) g = 1.0 / png_ptr->screen_gamma; + else - g = png_ptr->gamma; /* probably doing rgb_to_gray */ + g = png_ptr->gamma; /* Probably doing rgb_to_gray */ png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr, (png_uint_32)(num * png_sizeof(png_uint_16p))); png_memset(png_ptr->gamma_16_from_1, 0, @@ -4233,9 +4315,9 @@ /* To do: install integer version of png_build_gamma_table here */ #endif #if defined(PNG_MNG_FEATURES_SUPPORTED) -/* undoes intrapixel differencing */ +/* Undoes intrapixel differencing */ void /* PRIVATE */ png_do_read_intrapixel(png_row_infop row_info, png_bytep row) { png_debug(1, "in png_do_read_intrapixel"); diff -ru4NwbB libpng-1.2.36/pngrutil.c libpng-1.2.37beta03/pngrutil.c --- libpng-1.2.36/pngrutil.c 2009-05-07 16:52:14.828794760 -0500 +++ libpng-1.2.37beta03/pngrutil.c 2009-05-20 12:43:36.979275695 -0500 @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.2.36 [May 7, 2009] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -20,9 +20,9 @@ #endif #ifdef PNG_FLOATING_POINT_SUPPORTED # if defined(WIN32_WCE_OLD) -/* strtod() function is not supported on WindowsCE */ +/* The strtod() function is not supported on WindowsCE */ __inline double png_strtod(png_structp png_ptr, PNG_CONST char *nptr, char **endptr) { double result = 0; int len; @@ -75,9 +75,10 @@ } /* Grab a signed 32-bit integer from a buffer in big-endian format. The * data is stored in the PNG file in two's complement format, and it is - * assumed that the machine format for signed integers is the same. */ + * assumed that the machine format for signed integers is the same. + */ png_int_32 PNGAPI png_get_int_32(png_bytep buf) { png_int_32 i = ((png_int_32)(*buf) << 24) + @@ -107,23 +108,23 @@ { png_byte buf[8]; png_uint_32 length; - /* read the length and the chunk name */ + /* Read the length and the chunk name */ png_read_data(png_ptr, buf, 8); length = png_get_uint_31(png_ptr, buf); - /* put the chunk name into png_ptr->chunk_name */ + /* Put the chunk name into png_ptr->chunk_name */ png_memcpy(png_ptr->chunk_name, buf + 4, 4); png_debug2(0, "Reading %s chunk, length = %lu", png_ptr->chunk_name, length); - /* reset the crc and run it over the chunk name */ + /* Reset the crc and run it over the chunk name */ png_reset_crc(png_ptr); png_calculate_crc(png_ptr, png_ptr->chunk_name, 4); - /* check to see if chunk name is valid */ + /* Check to see if chunk name is valid */ png_check_chunk_name(png_ptr, png_ptr->chunk_name); return length; } @@ -131,17 +132,19 @@ /* Read data, and (optionally) run it through the CRC. */ void /* PRIVATE */ png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length) { - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_read_data(png_ptr, buf, length); png_calculate_crc(png_ptr, buf, length); } /* Optionally skip data and then check the CRC. Depending on whether we - are reading a ancillary or critical chunk, and how the program has set - things up, we may calculate the CRC on the data and print a message. - Returns '1' if there was a CRC error, '0' otherwise. */ + * are reading a ancillary or critical chunk, and how the program has set + * things up, we may calculate the CRC on the data and print a message. + * Returns '1' if there was a CRC error, '0' otherwise. + */ int /* PRIVATE */ png_crc_finish(png_structp png_ptr, png_uint_32 skip) { png_size_t i; @@ -175,9 +178,10 @@ return (0); } /* Compare the CRC stored in the PNG file with that calculated by libpng from - the data it has read thus far. */ + * the data it has read thus far. + */ int /* PRIVATE */ png_crc_error(png_structp png_ptr) { png_byte crc_bytes[4]; @@ -382,9 +389,9 @@ } } #endif -/* read and check the IDHR chunk */ +/* Read and check the IDHR chunk */ void /* PRIVATE */ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_byte buf[13]; @@ -396,9 +403,9 @@ if (png_ptr->mode & PNG_HAVE_IHDR) png_error(png_ptr, "Out of place IHDR"); - /* check the length */ + /* Check the length */ if (length != 13) png_error(png_ptr, "Invalid IHDR chunk"); png_ptr->mode |= PNG_HAVE_IHDR; @@ -413,9 +420,9 @@ compression_type = buf[10]; filter_type = buf[11]; interlace_type = buf[12]; - /* set internal variables */ + /* Set internal variables */ png_ptr->width = width; png_ptr->height = height; png_ptr->bit_depth = (png_byte)bit_depth; png_ptr->interlaced = (png_byte)interlace_type; @@ -424,9 +431,9 @@ png_ptr->filter_type = (png_byte)filter_type; #endif png_ptr->compression_type = (png_byte)compression_type; - /* find number of channels */ + /* Find number of channels */ switch (png_ptr->color_type) { case PNG_COLOR_TYPE_GRAY: case PNG_COLOR_TYPE_PALETTE: @@ -442,9 +452,9 @@ png_ptr->channels = 4; break; } - /* set up other useful info */ + /* Set up other useful info */ png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth * png_ptr->channels); png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width); png_debug1(3, "bit_depth = %d", png_ptr->bit_depth); @@ -453,9 +463,9 @@ png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, color_type, interlace_type, compression_type, filter_type); } -/* read and check the palette */ +/* Read and check the palette */ void /* PRIVATE */ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_color palette[PNG_MAX_PALETTE_LENGTH]; @@ -525,19 +538,20 @@ { png_byte buf[3]; png_crc_read(png_ptr, buf, 3); - /* don't depend upon png_color being any order */ + /* Don't depend upon png_color being any order */ palette[i].red = buf[0]; palette[i].green = buf[1]; palette[i].blue = buf[2]; } #endif /* If we actually NEED the PLTE chunk (ie for a paletted image), we do - whatever the normal CRC configuration tells us. However, if we - have an RGB image, the PLTE can be considered ancillary, so - we will act as though it is. */ + * whatever the normal CRC configuration tells us. However, if we + * have an RGB image, the PLTE can be considered ancillary, so + * we will act as though it is. + */ #if !defined(PNG_READ_OPT_PLTE_SUPPORTED) if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) #endif { @@ -610,9 +624,9 @@ png_warning(png_ptr, "Incorrect IEND chunk length"); } png_crc_finish(png_ptr, length); - info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */ + info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */ } #if defined(PNG_READ_gAMA_SUPPORTED) void /* PRIVATE */ @@ -660,9 +674,9 @@ if (png_crc_finish(png_ptr, 0)) return; igamma = (png_fixed_point)png_get_uint_32(buf); - /* check for zero gamma */ + /* Check for zero gamma */ if (igamma == 0) { png_warning(png_ptr, "Ignoring gAMA chunk with gamma=0"); @@ -924,9 +938,9 @@ if (png_crc_finish(png_ptr, 0)) return; intent = buf[0]; - /* check for bad intent */ + /* Check for bad intent */ if (intent >= PNG_sRGB_INTENT_LAST) { png_warning(png_ptr, "Unknown sRGB intent"); return; @@ -1039,23 +1053,24 @@ png_ptr->chunkdata[slength] = 0x00; for (profile = png_ptr->chunkdata; *profile; profile++) - /* empty loop to find end of name */ ; + /* Empty loop to find end of name */ ; ++profile; - /* there should be at least one zero (the compression type byte) - following the separator, and we should be on it */ + /* There should be at least one zero (the compression type byte) + * following the separator, and we should be on it + */ if ( profile >= png_ptr->chunkdata + slength - 1) { png_free(png_ptr, png_ptr->chunkdata); png_ptr->chunkdata = NULL; png_warning(png_ptr, "Malformed iCCP chunk"); return; } - /* compression_type should always be zero */ + /* Compression_type should always be zero */ compression_type = *profile++; if (compression_type) { png_warning(png_ptr, "Ignoring nonzero compression type in iCCP chunk"); @@ -1151,12 +1166,12 @@ png_ptr->chunkdata[slength] = 0x00; for (entry_start = (png_bytep)png_ptr->chunkdata; *entry_start; entry_start++) - /* empty loop to find end of name */ ; + /* Empty loop to find end of name */ ; ++entry_start; - /* a sample depth should follow the separator, and we should be on it */ + /* A sample depth should follow the separator, and we should be on it */ if (entry_start > (png_bytep)png_ptr->chunkdata + slength - 2) { png_free(png_ptr, png_ptr->chunkdata); png_ptr->chunkdata = NULL; @@ -1167,9 +1182,9 @@ new_palette.depth = *entry_start++; entry_size = (new_palette.depth == 8 ? 6 : 10); data_length = (slength - (entry_start - (png_bytep)png_ptr->chunkdata)); - /* integrity-check the data length */ + /* Integrity-check the data length */ if (data_length % entry_size) { png_free(png_ptr, png_ptr->chunkdata); png_ptr->chunkdata = NULL; @@ -1235,9 +1250,9 @@ pp->frequency = png_get_uint_16(entry_start); entry_start += 2; } #endif - /* discard all chunk data except the name and stash that */ + /* Discard all chunk data except the name and stash that */ new_palette.name = png_ptr->chunkdata; png_set_sPLT(png_ptr, info_ptr, &new_palette, 1); @@ -1571,9 +1586,9 @@ } #endif #if defined(PNG_READ_pCAL_SUPPORTED) -/* read the pCAL chunk (described in the PNG Extensions document) */ +/* Read the pCAL chunk (described in the PNG Extensions document) */ void /* PRIVATE */ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_int_32 X0, X1; @@ -1618,13 +1633,13 @@ png_ptr->chunkdata = NULL; return; } - png_ptr->chunkdata[slength] = 0x00; /* null terminate the last string */ + png_ptr->chunkdata[slength] = 0x00; /* Null terminate the last string */ png_debug(3, "Finding end of pCAL purpose string"); for (buf = png_ptr->chunkdata; *buf; buf++) - /* empty loop */ ; + /* Empty loop */ ; endptr = png_ptr->chunkdata + slength; /* We need to have at least 12 bytes after the purpose string @@ -1705,9 +1720,9 @@ } #endif #if defined(PNG_READ_sCAL_SUPPORTED) -/* read the sCAL chunk */ +/* Read the sCAL chunk */ void /* PRIVATE */ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_charp ep; @@ -1755,11 +1770,11 @@ png_ptr->chunkdata = NULL; return; } - png_ptr->chunkdata[slength] = 0x00; /* null terminate the last string */ + png_ptr->chunkdata[slength] = 0x00; /* Null terminate the last string */ - ep = png_ptr->chunkdata + 1; /* skip unit byte */ + ep = png_ptr->chunkdata + 1; /* Skip unit byte */ #ifdef PNG_FLOATING_POINT_SUPPORTED width = png_strtod(png_ptr, ep, &vp); if (*vp) @@ -1779,9 +1794,9 @@ #endif #endif for (ep = png_ptr->chunkdata; *ep; ep++) - /* empty loop */ ; + /* Empty loop */ ; ep++; if (png_ptr->chunkdata + slength < ep) { @@ -1943,9 +1958,9 @@ key[slength] = 0x00; for (text = key; *text; text++) - /* empty loop to find end of key */ ; + /* Empty loop to find end of key */ ; if (text != key + slength) text++; @@ -1978,9 +1993,9 @@ } #endif #if defined(PNG_READ_zTXt_SUPPORTED) -/* note: this does not correctly handle chunks that are > 64K under DOS */ +/* Note: this does not correctly handle chunks that are > 64K under DOS */ void /* PRIVATE */ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_textp text_ptr; @@ -2027,9 +2042,9 @@ png_ptr->chunkdata[slength] = 0x00; for (text = png_ptr->chunkdata; *text; text++) - /* empty loop */ ; + /* Empty loop */ ; /* zTXt must have some text after the chunkdataword */ if (text >= png_ptr->chunkdata + slength - 2) { @@ -2045,9 +2060,9 @@ { png_warning(png_ptr, "Unknown compression type in zTXt chunk"); comp_type = PNG_TEXT_COMPRESSION_zTXt; } - text++; /* skip the compression_method byte */ + text++; /* Skip the compression_method byte */ } prefix_len = text - png_ptr->chunkdata; png_decompress_chunk(png_ptr, comp_type, @@ -2082,9 +2097,9 @@ } #endif #if defined(PNG_READ_iTXt_SUPPORTED) -/* note: this does not correctly handle chunks that are > 64K under DOS */ +/* Note: this does not correctly handle chunks that are > 64K under DOS */ void /* PRIVATE */ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_textp text_ptr; @@ -2132,14 +2147,15 @@ png_ptr->chunkdata[slength] = 0x00; for (lang = png_ptr->chunkdata; *lang; lang++) - /* empty loop */ ; - lang++; /* skip NUL separator */ + /* Empty loop */ ; + lang++; /* Skip NUL separator */ /* iTXt must have a language tag (possibly empty), two compression bytes, - translated keyword (possibly empty), and possibly some text after the - keyword */ + * translated keyword (possibly empty), and possibly some text after the + * keyword + */ if (lang >= png_ptr->chunkdata + slength - 3) { png_warning(png_ptr, "Truncated iTXt chunk"); @@ -2153,10 +2169,10 @@ comp_type = *lang++; } for (lang_key = lang; *lang_key; lang_key++) - /* empty loop */ ; - lang_key++; /* skip NUL separator */ + /* Empty loop */ ; + lang_key++; /* Skip NUL separator */ if (lang_key >= png_ptr->chunkdata + slength) { png_warning(png_ptr, "Truncated iTXt chunk"); @@ -2165,10 +2181,10 @@ return; } for (text = lang_key; *text; text++) - /* empty loop */ ; - text++; /* skip NUL separator */ + /* Empty loop */ ; + text++; /* Skip NUL separator */ if (text >= png_ptr->chunkdata + slength) { png_warning(png_ptr, "Malformed iTXt chunk"); png_free(png_ptr, png_ptr->chunkdata); @@ -2228,9 +2244,9 @@ { #ifdef PNG_USE_LOCAL_ARRAYS PNG_CONST PNG_IDAT; #endif - if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) /* not an IDAT */ + if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) /* Not an IDAT */ png_ptr->mode |= PNG_AFTER_IDAT; } if (!(png_ptr->chunk_name[0] & 0x20)) @@ -2272,9 +2288,9 @@ } #if defined(PNG_READ_USER_CHUNKS_SUPPORTED) if (png_ptr->read_user_chunk_fn != NULL) { - /* callback to user unknown chunk handler */ + /* Callback to user unknown chunk handler */ int ret; ret = (*(png_ptr->read_user_chunk_fn)) (png_ptr, &png_ptr->unknown_chunk); if (ret < 0) @@ -2301,9 +2317,9 @@ png_crc_finish(png_ptr, skip); #if !defined(PNG_READ_USER_CHUNKS_SUPPORTED) - info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */ + info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */ #endif } /* This function is called to verify that a chunk name is valid. @@ -2549,10 +2565,10 @@ png_bytep row = png_ptr->row_buf + 1; int pass = png_ptr->pass; png_uint_32 transformations = png_ptr->transformations; #ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - /* offset to next interlace block */ + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + /* Offset to next interlace block */ PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; #endif png_debug(1, "in png_do_read_interlace"); @@ -2758,9 +2774,9 @@ row_info->width = final_width; row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width); } #if !defined(PNG_READ_PACKSWAP_SUPPORTED) - transformations = transformations; /* silence compiler warning */ + transformations = transformations; /* Silence compiler warning */ #endif } #endif /* PNG_READ_INTERLACING_SUPPORTED */ @@ -2842,9 +2858,9 @@ *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); rp++; } - for (i = 0; i < istop; i++) /* use leftover rp,pp */ + for (i = 0; i < istop; i++) /* Use leftover rp,pp */ { int a, b, c, pa, pb, pc, p; a = *lp++; @@ -2886,25 +2902,26 @@ break; } } +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED void /* PRIVATE */ png_read_finish_row(png_structp png_ptr) { #ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_READ_INTERLACING_SUPPORTED - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - /* start of interlace block */ + /* Start of interlace block */ PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; - /* offset to next interlace block */ + /* Offset to next interlace block */ PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; - /* start of interlace block in the y direction */ + /* Start of interlace block in the y direction */ PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; - /* offset to next interlace block in the y direction */ + /* Offset to next interlace block in the y direction */ PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; #endif /* PNG_READ_INTERLACING_SUPPORTED */ #endif @@ -3017,26 +3034,27 @@ inflateReset(&png_ptr->zstream); png_ptr->mode |= PNG_AFTER_IDAT; } +#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ void /* PRIVATE */ png_read_start_row(png_structp png_ptr) { #ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_READ_INTERLACING_SUPPORTED - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - /* start of interlace block */ + /* Start of interlace block */ PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; - /* offset to next interlace block */ + /* Offset to next interlace block */ PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; - /* start of interlace block in the y direction */ + /* Start of interlace block in the y direction */ PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; - /* offset to next interlace block in the y direction */ + /* Offset to next interlace block in the y direction */ PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; #endif #endif @@ -3171,13 +3189,15 @@ max_pixel_depth=user_pixel_depth; } #endif - /* align the width on the next larger 8 pixels. Mainly used - for interlacing */ + /* Align the width on the next larger 8 pixels. Mainly used + * for interlacing + */ row_bytes = ((png_ptr->width + 7) & ~((png_uint_32)7)); - /* calculate the maximum bytes needed, adding a byte and a pixel - for safety's sake */ + /* Calculate the maximum bytes needed, adding a byte and a pixel + * for safety's sake + */ row_bytes = PNG_ROWBYTES(max_pixel_depth, row_bytes) + 1 + ((max_pixel_depth + 7) >> 3); #ifdef PNG_MAX_MALLOC_64K if (row_bytes > (png_uint_32)65536L) @@ -3188,29 +3208,30 @@ { png_free(png_ptr, png_ptr->big_row_buf); png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes + 64); if (png_ptr->interlaced) - png_memset(png_ptr->big_row_buf, 0, png_ptr->rowbytes + 64); + png_memset(png_ptr->big_row_buf, 0, row_bytes + 64); png_ptr->row_buf = png_ptr->big_row_buf + 32; png_ptr->old_big_row_buf_size = row_bytes + 64; } #ifdef PNG_MAX_MALLOC_64K - if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L) + if ((png_uint_32)row_bytes + 1 > (png_uint_32)65536L) png_error(png_ptr, "This image requires a row greater than 64KB"); #endif - if ((png_uint_32)png_ptr->rowbytes > (png_uint_32)(PNG_SIZE_MAX - 1)) + if ((png_uint_32)row_bytes > (png_uint_32)(PNG_SIZE_MAX - 1)) png_error(png_ptr, "Row has too many bytes to allocate in memory."); - if (png_ptr->rowbytes+1 > png_ptr->old_prev_row_size) + if (row_bytes + 1 > png_ptr->old_prev_row_size) { png_free(png_ptr, png_ptr->prev_row); png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)( - png_ptr->rowbytes + 1)); - png_ptr->old_prev_row_size = png_ptr->rowbytes+1; + row_bytes + 1)); + png_memset_check(png_ptr, png_ptr->prev_row, 0, row_bytes + 1); + png_ptr->old_prev_row_size = row_bytes + 1; } - png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1); + png_ptr->rowbytes = row_bytes; png_debug1(3, "width = %lu,", png_ptr->width); png_debug1(3, "height = %lu,", png_ptr->height); png_debug1(3, "iwidth = %lu,", png_ptr->iwidth); diff -ru4NwbB libpng-1.2.36/pngset.c libpng-1.2.37beta03/pngset.c --- libpng-1.2.36/pngset.c 2009-05-07 16:52:18.776692494 -0500 +++ libpng-1.2.37beta03/pngset.c 2009-05-20 12:43:36.987180167 -0500 @@ -1,8 +1,8 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.2.36 [May 7, 2009] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -186,10 +186,11 @@ #ifdef PNG_FREE_ME_SUPPORTED png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0); #endif - /* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in version - 1.2.1 */ + /* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in + * version 1.2.1 + */ png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr, (png_uint_32)(PNG_MAX_PALETTE_LENGTH * png_sizeof(png_uint_16))); if (png_ptr->hist == NULL) { @@ -219,9 +220,9 @@ png_debug1(1, "in %s storage function", "IHDR"); if (png_ptr == NULL || info_ptr == NULL) return; - /* check for width and height valid values */ + /* Check for width and height valid values */ if (width == 0 || height == 0) png_error(png_ptr, "Image width or height is zero in IHDR"); #ifdef PNG_SET_USER_LIMITS_SUPPORTED if (width > png_ptr->user_width_max || height > png_ptr->user_height_max) @@ -239,9 +240,9 @@ - 7*8 /* rounding of width to multiple of 8 pixels */ - 8) /* extra max_pixel_depth pad */ png_warning(png_ptr, "Width is too large for libpng to process pixels"); - /* check other values */ + /* Check other values */ if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && bit_depth != 8 && bit_depth != 16) png_error(png_ptr, "Invalid bit depth in IHDR"); @@ -305,9 +306,9 @@ if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) info_ptr->channels++; info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth); - /* check for potential overflow */ + /* Check for potential overflow */ if (width > (PNG_UINT_32_MAX >> 3) /* 8-byte RGBA pixels */ - 64 /* bigrowbuf hack */ - 1 /* filter byte */ @@ -515,10 +516,11 @@ png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0); #endif /* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead - of num_palette entries, - in case of an invalid PNG file that has too-large sample values. */ + * of num_palette entries, in case of an invalid PNG file that has + * too-large sample values. + */ png_ptr->palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color)); png_memset(png_ptr->palette, 0, PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color)); @@ -766,9 +768,9 @@ } else #ifdef PNG_iTXt_SUPPORTED { - /* set iTXt data */ + /* Set iTXt data */ if (text_ptr[i].lang != NULL) lang_len = png_strlen(text_ptr[i].lang); else lang_len = 0; @@ -809,10 +811,9 @@ (png_uint_32) (key_len + lang_len + lang_key_len + text_length + 4), (int)textp->key); - png_memcpy(textp->key, text_ptr[i].key, - (png_size_t)(key_len)); + png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len)); *(textp->key + key_len) = '\0'; #ifdef PNG_iTXt_SUPPORTED if (text_ptr[i].compression > 0) { @@ -1038,9 +1039,9 @@ (png_charp)from->name, png_sizeof(from->name)); to->name[png_sizeof(to->name)-1] = '\0'; to->size = from->size; - /* note our location in the read or write sequence */ + /* Note our location in the read or write sequence */ to->location = (png_byte)(png_ptr->mode & 0xff); if (from->size == 0) to->data=NULL; @@ -1207,9 +1208,9 @@ #ifndef PNG_1_0_X #ifdef PNG_ASSEMBLER_CODE_SUPPORTED -/* function was added to libpng 1.2.0 and should always exist by default */ +/* Function was added to libpng 1.2.0 and should always exist by default */ void PNGAPI png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags) { /* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */ @@ -1217,9 +1218,9 @@ png_ptr->asm_flags = 0; asm_flags = asm_flags; /* Quiet the compiler */ } -/* this function was added to libpng 1.2.0 */ +/* This function was added to libpng 1.2.0 */ void PNGAPI png_set_mmx_thresholds (png_structp png_ptr, png_byte mmx_bitdepth_threshold, png_uint_32 mmx_rowbytes_threshold) @@ -1233,18 +1234,19 @@ } #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED -/* this function was added to libpng 1.2.6 */ +/* This function was added to libpng 1.2.6 */ void PNGAPI png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max) { /* Images with dimensions larger than these limits will be * rejected by png_set_IHDR(). To accept any PNG datastream * regardless of dimensions, set both limits to 0x7ffffffL. */ - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->user_width_max = user_width_max; png_ptr->user_height_max = user_height_max; } #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ diff -ru4NwbB libpng-1.2.36/pngtest.c libpng-1.2.37beta03/pngtest.c --- libpng-1.2.36/pngtest.c 2009-05-07 16:52:22.186727355 -0500 +++ libpng-1.2.37beta03/pngtest.c 2009-05-20 12:43:36.995810722 -0500 @@ -1,8 +1,8 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.2.36 [May 7, 2009] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -64,9 +64,9 @@ # define PNG_DEBUG 0 #endif #if !PNG_DEBUG -# define SINGLE_ROWBUF_ALLOC /* makes buffer overruns easier to nail */ +# define SINGLE_ROWBUF_ALLOC /* Makes buffer overruns easier to nail */ #endif /* Turn on CPU timing #define PNGTEST_TIMING @@ -94,11 +94,11 @@ #ifdef __TURBOC__ #include #endif -/* defined so I can write to a file on gui/windowing platforms */ +/* Defined so I can write to a file on gui/windowing platforms */ /* #define STDERR stderr */ -#define STDERR stdout /* for DOS */ +#define STDERR stdout /* For DOS */ /* In case a system header (e.g., on AIX) defined jmpbuf */ #ifdef jmpbuf # undef jmpbuf @@ -108,9 +108,9 @@ #ifndef png_jmpbuf # define png_jmpbuf(png_ptr) png_ptr->jmpbuf #endif -/* example of using row callbacks to make a simple progress meter */ +/* Example of using row callbacks to make a simple progress meter */ static int status_pass = 1; static int status_dots_requested = 0; static int status_dots = 1; @@ -124,9 +124,10 @@ PNGAPI #endif read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) { - if (png_ptr == NULL || row_number > PNG_UINT_31_MAX) return; + if (png_ptr == NULL || row_number > PNG_UINT_31_MAX) + return; if (status_pass != pass) { fprintf(stdout, "\n Pass %d: ", pass); status_pass = pass; @@ -151,17 +152,19 @@ PNGAPI #endif write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) { - if (png_ptr == NULL || row_number > PNG_UINT_31_MAX || pass > 7) return; + if (png_ptr == NULL || row_number > PNG_UINT_31_MAX || pass > 7) + return; fprintf(stdout, "w"); } #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) /* Example of using user transform callback (we don't transform anything, - but merely examine the row filters. We set this to 256 rather than - 5 in case illegal filter values are present.) */ + * but merely examine the row filters. We set this to 256 rather than + * 5 in case illegal filter values are present.) + */ static png_uint_32 filters_used[256]; void #ifdef PNG_1_0_X PNGAPI @@ -178,10 +181,11 @@ } #endif #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) -/* example of using user transform callback (we don't transform anything, - but merely count the zero samples) */ +/* Example of using user transform callback (we don't transform anything, + * but merely count the zero samples) + */ static png_uint_32 zero_samples; void @@ -197,19 +201,18 @@ { png_bytep dp = data; if (png_ptr == NULL)return; - /* contents of row_info: + /* Contents of row_info: * png_uint_32 width width of row * png_uint_32 rowbytes number of bytes in row * png_byte color_type color type of pixels * png_byte bit_depth bit depth of samples * png_byte channels number of channels (1-4) * png_byte pixel_depth bits per pixel (depth*channels) */ - - /* counts the number of zero samples (or zero pixels if color_type is 3 */ + /* Counts the number of zero samples (or zero pixels if color_type is 3 */ if (row_info->color_type == 0 || row_info->color_type == 3) { int pos = 0; @@ -217,43 +220,47 @@ for (n = 0, nstop=row_info->width; nbit_depth == 1) { - if (((*dp << pos++ ) & 0x80) == 0) zero_samples++; + if (((*dp << pos++ ) & 0x80) == 0) + zero_samples++; if (pos == 8) { pos = 0; dp++; } } if (row_info->bit_depth == 2) { - if (((*dp << (pos+=2)) & 0xc0) == 0) zero_samples++; + if (((*dp << (pos+=2)) & 0xc0) == 0) + zero_samples++; if (pos == 8) { pos = 0; dp++; } } if (row_info->bit_depth == 4) { - if (((*dp << (pos+=4)) & 0xf0) == 0) zero_samples++; + if (((*dp << (pos+=4)) & 0xf0) == 0) + zero_samples++; if (pos == 8) { pos = 0; dp++; } } if (row_info->bit_depth == 8) - if (*dp++ == 0) zero_samples++; + if (*dp++ == 0) + zero_samples++; if (row_info->bit_depth == 16) { if ((*dp | *(dp+1)) == 0) zero_samples++; dp+=2; } } } - else /* other color types */ + else /* Other color types */ { png_uint_32 n, nstop; int channel; int color_channels = row_info->channels; @@ -263,9 +270,10 @@ { for (channel = 0; channel < color_channels; channel++) { if (row_info->bit_depth == 8) - if (*dp++ == 0) zero_samples++; + if (*dp++ == 0) + zero_samples++; if (row_info->bit_depth == 16) { if ((*dp | *(dp+1)) == 0) zero_samples++; dp+=2; @@ -273,9 +281,10 @@ } if (row_info->color_type > 3) { dp++; - if (row_info->bit_depth == 16)dp++; + if (row_info->bit_depth == 16) + dp++; } } } } @@ -284,14 +293,15 @@ static int wrote_question = 0; #if defined(PNG_NO_STDIO) /* START of code to validate stdio-free compilation */ -/* These copies of the default read/write functions come from pngrio.c and */ -/* pngwio.c. They allow "don't include stdio" testing of the library. */ -/* This is the function that does the actual reading of data. If you are - not reading from a standard C stream, you should create a replacement - read_data function and use it at run time with png_set_read_fn(), rather - than changing the library. */ +/* These copies of the default read/write functions come from pngrio.c and + * pngwio.c. They allow "don't include stdio" testing of the library. + * This is the function that does the actual reading of data. If you are + * not reading from a standard C stream, you should create a replacement + * read_data function and use it at run time with png_set_read_fn(), rather + * than changing the library. + */ #ifndef USE_FAR_KEYWORD static void pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length) @@ -308,9 +318,9 @@ png_error(png_ptr, "Read Error!"); } } #else -/* this is the model-independent version. Since the standard I/O library +/* This is the model-independent version. Since the standard I/O library can't handle far buffers in the medium and small models, we have to copy the data. */ @@ -340,9 +350,9 @@ do { read = MIN(NEAR_BUF_SIZE, remaining); READFILE(io_ptr, buf, 1, err); - png_memcpy(data, buf, read); /* copy far buffer to near buffer */ + png_memcpy(data, buf, read); /* Copy far buffer to near buffer */ if (err != read) break; else check += err; @@ -351,27 +361,26 @@ } while (remaining != 0); } if (check != length) - { png_error(png_ptr, "read Error"); } -} #endif /* USE_FAR_KEYWORD */ #if defined(PNG_WRITE_FLUSH_SUPPORTED) static void pngtest_flush(png_structp png_ptr) { /* Do nothing; fflush() is said to be just a waste of energy. */ - png_ptr = png_ptr; /* stifle compiler warning */ + png_ptr = png_ptr; /* Stifle compiler warning */ } #endif /* This is the function that does the actual writing of data. If you are - not writing to a standard C stream, you should create a replacement - write_data function and use it at run time with png_set_write_fn(), rather - than changing the library. */ + * not writing to a standard C stream, you should create a replacement + * write_data function and use it at run time with png_set_write_fn(), rather + * than changing the library. + */ #ifndef USE_FAR_KEYWORD static void pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length) { @@ -383,9 +392,9 @@ png_error(png_ptr, "Write Error"); } } #else -/* this is the model-independent version. Since the standard I/O library +/* This is the model-independent version. Since the standard I/O library can't handle far buffers in the medium and small models, we have to copy the data. */ @@ -414,9 +423,9 @@ remaining = length; do { written = MIN(NEAR_BUF_SIZE, remaining); - png_memcpy(buf, data, written); /* copy far buffer to near buffer */ + png_memcpy(buf, data, written); /* Copy far buffer to near buffer */ WRITEFILE(io_ptr, buf, written, err); if (err != written) break; else @@ -456,24 +465,26 @@ pngtest_error(png_structp png_ptr, png_const_charp message) { pngtest_warning(png_ptr, message); /* We can return because png_error calls the default handler, which is - * actually OK in this case. */ + * actually OK in this case. + */ } #endif /* PNG_NO_STDIO */ /* END of code to validate stdio-free compilation */ /* START of code to validate memory allocation and deallocation */ #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG /* Allocate memory. For reasonable files, size should never exceed - 64K. However, zlib may allocate more then 64K if you don't tell - it not to. See zconf.h and png.h for more information. zlib does - need to allocate exactly 64K, so whatever you call here must - have the ability to do that. - - This piece of code can be compiled to validate max 64K allocations - by setting MAXSEG_64K in zlib zconf.h *or* PNG_MAX_MALLOC_64K. */ + * 64K. However, zlib may allocate more then 64K if you don't tell + * it not to. See zconf.h and png.h for more information. zlib does + * need to allocate exactly 64K, so whatever you call here must + * have the ability to do that. + * + * This piece of code can be compiled to validate max 64K allocations + * by setting MAXSEG_64K in zlib zconf.h *or* PNG_MAX_MALLOC_64K. + */ typedef struct memory_information { png_uint_32 size; png_voidp pointer; @@ -494,9 +505,10 @@ png_debug_malloc(png_structp png_ptr, png_uint_32 size) { /* png_malloc has already tested for NULL; png_create_struct calls - png_debug_malloc directly, with png_ptr == NULL which is OK */ + * png_debug_malloc directly, with png_ptr == NULL which is OK + */ if (size == 0) return (NULL); @@ -591,9 +603,9 @@ /* Demonstration of user chunk support of the sTER and vpAg chunks */ #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) -/* (sTER is a public chunk not yet understood by libpng. vpAg is a private +/* (sTER is a public chunk not yet known by libpng. vpAg is a private chunk used in ImageMagick to store "virtual page" size). */ static png_uint_32 user_chunk_data[4]; @@ -608,14 +620,14 @@ { png_uint_32 *my_user_chunk_data; - /* Return one of the following: */ - /* return (-n); chunk had an error */ - /* return (0); did not recognize */ - /* return (n); success */ - - /* The unknown chunk structure contains the chunk data: + /* Return one of the following: + * return (-n); chunk had an error + * return (0); did not recognize + * return (n); success + * + * The unknown chunk structure contains the chunk data: * png_byte name[5]; * png_byte *data; * png_size_t size; * @@ -905,12 +918,10 @@ { png_fixed_point gamma; if (png_get_gAMA_fixed(read_ptr, read_info_ptr, &gamma)) - { png_set_gAMA_fixed(write_ptr, write_info_ptr, gamma); } - } #endif #else /* Use floating point versions */ #if defined(PNG_FLOATING_POINT_SUPPORTED) #if defined(PNG_cHRM_SUPPORTED) @@ -929,15 +940,13 @@ { double gamma; if (png_get_gAMA(read_ptr, read_info_ptr, &gamma)) - { png_set_gAMA(write_ptr, write_info_ptr, gamma); } - } #endif -#endif /* floating point */ -#endif /* fixed point */ +#endif /* Floating point */ +#endif /* Fixed point */ #if defined(PNG_iCCP_SUPPORTED) { png_charp name; png_charp profile; @@ -956,22 +965,18 @@ { int intent; if (png_get_sRGB(read_ptr, read_info_ptr, &intent)) - { png_set_sRGB(write_ptr, write_info_ptr, intent); } - } #endif { png_colorp palette; int num_palette; if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette)) - { png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette); } - } #if defined(PNG_bKGD_SUPPORTED) { png_color_16p background; @@ -985,12 +990,10 @@ { png_uint_16p hist; if (png_get_hIST(read_ptr, read_info_ptr, &hist)) - { png_set_hIST(write_ptr, write_info_ptr, hist); } - } #endif #if defined(PNG_oFFs_SUPPORTED) { png_int_32 offset_x, offset_y; @@ -1023,22 +1026,18 @@ png_uint_32 res_x, res_y; int unit_type; if (png_get_pHYs(read_ptr, read_info_ptr, &res_x, &res_y, &unit_type)) - { png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type); } - } #endif #if defined(PNG_sBIT_SUPPORTED) { png_color_8p sig_bit; if (png_get_sBIT(read_ptr, read_info_ptr, &sig_bit)) - { png_set_sBIT(write_ptr, write_info_ptr, sig_bit); } - } #endif #if defined(PNG_sCAL_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED { @@ -1085,11 +1084,12 @@ if (png_get_tIME(read_ptr, read_info_ptr, &mod_time)) { png_set_tIME(write_ptr, write_info_ptr, mod_time); #if defined(PNG_TIME_RFC1123_SUPPORTED) - /* we have to use png_memcpy instead of "=" because the string - pointed to by png_convert_to_rfc1123() gets free'ed before - we use it */ + /* We have to use png_memcpy instead of "=" because the string + * pointed to by png_convert_to_rfc1123() gets free'ed before + * we use it. + */ png_memcpy(tIME_string, png_convert_to_rfc1123(read_ptr, mod_time), png_sizeof(tIME_string)); tIME_string[png_sizeof(tIME_string) - 1] = '\0'; @@ -1129,11 +1129,12 @@ { png_size_t i; png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns, num_unknowns); - /* copy the locations from the read_info_ptr. The automatically - generated locations in write_info_ptr are wrong because we - haven't written anything yet */ + /* Copy the locations from the read_info_ptr. The automatically + * generated locations in write_info_ptr are wrong because we + * haven't written anything yet. + */ for (i = 0; i < (png_size_t)num_unknowns; i++) png_set_unknown_chunk_location(write_ptr, write_info_ptr, i, unknowns[i].location); } @@ -1143,9 +1144,9 @@ #ifdef PNG_WRITE_SUPPORTED png_debug(0, "Writing info struct"); /* If we wanted, we could write info in two steps: - png_write_info_before_PLTE(write_ptr, write_info_ptr); + * png_write_info_before_PLTE(write_ptr, write_info_ptr); */ png_write_info(write_ptr, write_info_ptr); #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) @@ -1271,9 +1272,9 @@ if (png_get_tIME(read_ptr, end_info_ptr, &mod_time)) { png_set_tIME(write_ptr, write_end_info_ptr, mod_time); #if defined(PNG_TIME_RFC1123_SUPPORTED) - /* we have to use png_memcpy instead of "=" because the string + /* We have to use png_memcpy instead of "=" because the string pointed to by png_convert_to_rfc1123() gets free'ed before we use it */ png_memcpy(tIME_string, png_convert_to_rfc1123(read_ptr, mod_time), @@ -1294,11 +1295,12 @@ { png_size_t i; png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns, num_unknowns); - /* copy the locations from the read_info_ptr. The automatically - generated locations in write_end_info_ptr are wrong because we - haven't written the end_info yet */ + /* Copy the locations from the read_info_ptr. The automatically + * generated locations in write_end_info_ptr are wrong because we + * haven't written the end_info yet. + */ for (i = 0; i < (png_size_t)num_unknowns; i++) png_set_unknown_chunk_location(write_ptr, write_end_info_ptr, i, unknowns[i].location); } @@ -1419,9 +1421,9 @@ return (0); } -/* input and output filenames */ +/* Input and output filenames */ #ifdef RISCOS static PNG_CONST char *inname = "pngtest/png"; static PNG_CONST char *outname = "pngout/png"; #else @@ -1448,11 +1450,12 @@ fprintf(STDERR, " sizeof(png_struct)=%ld, sizeof(png_info)=%ld\n", (long)png_sizeof(png_struct), (long)png_sizeof(png_info)); /* Do some consistency checking on the memory allocation settings, I'm - not sure this matters, but it is nice to know, the first of these - tests should be impossible because of the way the macros are set - in pngconf.h */ + * not sure this matters, but it is nice to know, the first of these + * tests should be impossible because of the way the macros are set + * in pngconf.h + */ #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) fprintf(STDERR, " NOTE: Zlib compiled for max 64k, libpng not\n"); #endif /* I think the following can happen. */ diff -ru4NwbB libpng-1.2.36/pngtrans.c libpng-1.2.37beta03/pngtrans.c --- libpng-1.2.36/pngtrans.c 2009-05-07 11:05:32.097573460 -0500 +++ libpng-1.2.37beta03/pngtrans.c 2009-05-20 12:43:37.002404896 -0500 @@ -1,10 +1,10 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.2.30 [August 15, 2008] + * Last changed in libpng 1.2.36 [May 14, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -12,37 +12,40 @@ #include "png.h" #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) -/* turn on BGR-to-RGB mapping */ +/* Turn on BGR-to-RGB mapping */ void PNGAPI png_set_bgr(png_structp png_ptr) { png_debug(1, "in png_set_bgr"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= PNG_BGR; } #endif #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) -/* turn on 16 bit byte swapping */ +/* Turn on 16 bit byte swapping */ void PNGAPI png_set_swap(png_structp png_ptr) { png_debug(1, "in png_set_swap"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; if (png_ptr->bit_depth == 16) png_ptr->transformations |= PNG_SWAP_BYTES; } #endif #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) -/* turn on pixel packing */ +/* Turn on pixel packing */ void PNGAPI png_set_packing(png_structp png_ptr) { png_debug(1, "in png_set_packing"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; if (png_ptr->bit_depth < 8) { png_ptr->transformations |= PNG_PACK; png_ptr->usr_bit_depth = 8; @@ -50,14 +53,15 @@ } #endif #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) -/* turn on packed pixel swapping */ +/* Turn on packed pixel swapping */ void PNGAPI png_set_packswap(png_structp png_ptr) { png_debug(1, "in png_set_packswap"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; if (png_ptr->bit_depth < 8) png_ptr->transformations |= PNG_PACKSWAP; } #endif @@ -66,9 +70,10 @@ void PNGAPI png_set_shift(png_structp png_ptr, png_color_8p true_bits) { png_debug(1, "in png_set_shift"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= PNG_SHIFT; png_ptr->shift = *true_bits; } #endif @@ -98,9 +103,10 @@ void PNGAPI png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc) { png_debug(1, "in png_set_filler"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= PNG_FILLER; png_ptr->filler = (png_byte)filler; if (filler_loc == PNG_FILLER_AFTER) png_ptr->flags |= PNG_FLAG_FILLER_AFTER; @@ -131,9 +137,10 @@ void PNGAPI png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc) { png_debug(1, "in png_set_add_alpha"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_set_filler(png_ptr, filler, filler_loc); png_ptr->transformations |= PNG_ADD_ALPHA; } #endif @@ -145,9 +152,10 @@ void PNGAPI png_set_swap_alpha(png_structp png_ptr) { png_debug(1, "in png_set_swap_alpha"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= PNG_SWAP_ALPHA; } #endif @@ -156,9 +164,10 @@ void PNGAPI png_set_invert_alpha(png_structp png_ptr) { png_debug(1, "in png_set_invert_alpha"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= PNG_INVERT_ALPHA; } #endif @@ -166,13 +175,14 @@ void PNGAPI png_set_invert_mono(png_structp png_ptr) { png_debug(1, "in png_set_invert_mono"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_ptr->transformations |= PNG_INVERT_MONO; } -/* invert monochrome grayscale data */ +/* Invert monochrome grayscale data */ void /* PRIVATE */ png_do_invert(png_row_infop row_info, png_bytep row) { png_debug(1, "in png_do_invert"); @@ -225,9 +235,9 @@ } #endif #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) -/* swaps byte order on 16 bit depth images */ +/* Swaps byte order on 16 bit depth images */ void /* PRIVATE */ png_do_swap(png_row_infop row_info, png_bytep row) { png_debug(1, "in png_do_swap"); @@ -356,9 +366,9 @@ 0x0F, 0x1F, 0x2F, 0x3F, 0x4F, 0x5F, 0x6F, 0x7F, 0x8F, 0x9F, 0xAF, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF }; -/* swaps pixel packing order within bytes */ +/* Swaps pixel packing order within bytes */ void /* PRIVATE */ png_do_packswap(png_row_infop row_info, png_bytep row) { png_debug(1, "in png_do_packswap"); @@ -388,9 +398,9 @@ #endif /* PNG_READ_PACKSWAP_SUPPORTED or PNG_WRITE_PACKSWAP_SUPPORTED */ #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ defined(PNG_READ_STRIP_ALPHA_SUPPORTED) -/* remove filler or alpha byte(s) */ +/* Remove filler or alpha byte(s) */ void /* PRIVATE */ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags) { png_debug(1, "in png_do_strip_filler"); @@ -546,9 +556,9 @@ } #endif #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) -/* swaps red and blue bytes within a pixel */ +/* Swaps red and blue bytes within a pixel */ void /* PRIVATE */ png_do_bgr(png_row_infop row_info, png_bytep row) { png_debug(1, "in png_do_bgr"); @@ -630,9 +640,10 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp user_transform_ptr, int user_transform_depth, int user_transform_channels) { png_debug(1, "in png_set_user_transform_info"); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) png_ptr->user_transform_ptr = user_transform_ptr; png_ptr->user_transform_depth = (png_byte)user_transform_depth; png_ptr->user_transform_channels = (png_byte)user_transform_channels; @@ -651,9 +662,10 @@ */ png_voidp PNGAPI png_get_user_transform_ptr(png_structp png_ptr) { - if (png_ptr == NULL) return (NULL); + if (png_ptr == NULL) + return (NULL); #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) return ((png_voidp)png_ptr->user_transform_ptr); #else return (NULL); diff -ru4NwbB libpng-1.2.36/pngwio.c libpng-1.2.37beta03/pngwio.c --- libpng-1.2.36/pngwio.c 2009-05-07 16:52:25.345325113 -0500 +++ libpng-1.2.37beta03/pngwio.c 2009-05-20 12:43:37.012052728 -0500 @@ -1,8 +1,8 @@ /* pngwio.c - functions for data output * - * Last changed in libpng 1.2.36 [May 7, 2009] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -19,12 +19,13 @@ #include "png.h" #ifdef PNG_WRITE_SUPPORTED /* Write the data to whatever output you are using. The default routine - writes to a file pointer. Note that this routine sometimes gets called - with very small lengths, so you should implement some kind of simple - buffering if you are using unbuffered writes. This should never be asked - to write more than 64K on a 16 bit machine. */ + * writes to a file pointer. Note that this routine sometimes gets called + * with very small lengths, so you should implement some kind of simple + * buffering if you are using unbuffered writes. This should never be asked + * to write more than 64K on a 16 bit machine. + */ void /* PRIVATE */ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length) { @@ -35,11 +36,12 @@ } #if !defined(PNG_NO_STDIO) /* This is the function that does the actual writing of data. If you are - not writing to a standard C stream, you should create a replacement - write_data function and use it at run time with png_set_write_fn(), rather - than changing the library. */ + * not writing to a standard C stream, you should create a replacement + * write_data function and use it at run time with png_set_write_fn(), rather + * than changing the library. + */ #ifndef USE_FAR_KEYWORD void PNGAPI png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) { @@ -55,11 +57,11 @@ if (check != length) png_error(png_ptr, "Write Error"); } #else -/* this is the model-independent version. Since the standard I/O library - can't handle far buffers in the medium and small models, we have to copy - the data. +/* This is the model-independent version. Since the standard I/O library + * can't handle far buffers in the medium and small models, we have to copy + * the data. */ #define NEAR_BUF_SIZE 1024 #define MIN(a,b) (a <= b ? a : b) @@ -92,9 +94,9 @@ remaining = length; do { written = MIN(NEAR_BUF_SIZE, remaining); - png_memcpy(buf, data, written); /* copy far buffer to near buffer */ + png_memcpy(buf, data, written); /* Copy far buffer to near buffer */ #if defined(_WIN32_WCE) if ( !WriteFile(io_ptr, buf, written, &err, NULL) ) err = 0; #else @@ -116,10 +120,11 @@ #endif #endif /* This function is called to output any data pending writing (normally - to disk). After png_flush is called, there should be no data pending - writing in any buffers. */ + * to disk). After png_flush is called, there should be no data pending + * writing in any buffers. + */ #if defined(PNG_WRITE_FLUSH_SUPPORTED) void /* PRIVATE */ png_flush(png_structp png_ptr) { @@ -133,9 +138,10 @@ { #if !defined(_WIN32_WCE) png_FILE_p io_ptr; #endif - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; #if !defined(_WIN32_WCE) io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); fflush(io_ptr); #endif @@ -143,40 +149,43 @@ #endif #endif /* This function allows the application to supply new output functions for - libpng if standard C streams aren't being used. - - This function takes as its arguments: - png_ptr - pointer to a png output data structure - io_ptr - pointer to user supplied structure containing info about - the output functions. May be NULL. - write_data_fn - pointer to a new output function that takes as its - arguments a pointer to a png_struct, a pointer to - data to be written, and a 32-bit unsigned int that is - the number of bytes to be written. The new write - function should call png_error(png_ptr, "Error msg") - to exit and output any fatal error messages. May be - NULL, in which case libpng's default function will - be used. - flush_data_fn - pointer to a new flush function that takes as its - arguments a pointer to a png_struct. After a call to - the flush function, there should be no data in any buffers - or pending transmission. If the output method doesn't do - any buffering of ouput, a function prototype must still be - supplied although it doesn't have to do anything. If - PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile - time, output_flush_fn will be ignored, although it must be - supplied for compatibility. May be NULL, in which case - libpng's default function will be used, if - PNG_WRITE_FLUSH_SUPPORTED is defined. This is not - a good idea if io_ptr does not point to a standard - *FILE structure. */ + * libpng if standard C streams aren't being used. + * + * This function takes as its arguments: + * png_ptr - pointer to a png output data structure + * io_ptr - pointer to user supplied structure containing info about + * the output functions. May be NULL. + * write_data_fn - pointer to a new output function that takes as its + * arguments a pointer to a png_struct, a pointer to + * data to be written, and a 32-bit unsigned int that is + * the number of bytes to be written. The new write + * function should call png_error(png_ptr, "Error msg") + * to exit and output any fatal error messages. May be + * NULL, in which case libpng's default function will + * be used. + * flush_data_fn - pointer to a new flush function that takes as its + * arguments a pointer to a png_struct. After a call to + * the flush function, there should be no data in any buffers + * or pending transmission. If the output method doesn't do + * any buffering of ouput, a function prototype must still be + * supplied although it doesn't have to do anything. If + * PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile + * time, output_flush_fn will be ignored, although it must be + * supplied for compatibility. May be NULL, in which case + * libpng's default function will be used, if + * PNG_WRITE_FLUSH_SUPPORTED is defined. This is not + * a good idea if io_ptr does not point to a standard + * *FILE structure. + */ void PNGAPI png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn) { - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; + png_ptr->io_ptr = io_ptr; #if !defined(PNG_NO_STDIO) if (write_data_fn != NULL) diff -ru4NwbB libpng-1.2.36/pngwrite.c libpng-1.2.37beta03/pngwrite.c --- libpng-1.2.36/pngwrite.c 2009-05-07 11:05:32.185201138 -0500 +++ libpng-1.2.37beta03/pngwrite.c 2009-05-20 12:43:37.020178583 -0500 @@ -1,15 +1,15 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ -/* get internal access to png.h */ +/* Get internal access to png.h */ #define PNG_INTERNAL #include "png.h" #ifdef PNG_WRITE_SUPPORTED @@ -29,27 +29,28 @@ if (png_ptr == NULL || info_ptr == NULL) return; if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) { - png_write_sig(png_ptr); /* write PNG signature */ + png_write_sig(png_ptr); /* Write PNG signature */ #if defined(PNG_MNG_FEATURES_SUPPORTED) if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted)) { png_warning(png_ptr, "MNG features are not allowed in a PNG datastream"); png_ptr->mng_features_permitted=0; } #endif - /* write IHDR information. */ + /* Write IHDR information. */ png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type, info_ptr->filter_type, #if defined(PNG_WRITE_INTERLACING_SUPPORTED) info_ptr->interlace_type); #else 0); #endif - /* the rest of these check to see if the valid field has the appropriate - flag set, and if it does, writes the chunk. */ + /* The rest of these check to see if the valid field has the appropriate + * flag set, and if it does, writes the chunk. + */ #if defined(PNG_WRITE_gAMA_SUPPORTED) if (info_ptr->valid & PNG_INFO_gAMA) { # ifdef PNG_FLOATING_POINT_SUPPORTED @@ -146,9 +147,9 @@ #if defined(PNG_WRITE_tRNS_SUPPORTED) if (info_ptr->valid & PNG_INFO_tRNS) { #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) - /* invert the alpha channel (in tRNS) */ + /* Invert the alpha channel (in tRNS) */ if ((png_ptr->transformations & PNG_INVERT_ALPHA) && info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { int j; @@ -178,51 +179,58 @@ png_write_pCAL(png_ptr, info_ptr->pcal_purpose, info_ptr->pcal_X0, info_ptr->pcal_X1, info_ptr->pcal_type, info_ptr->pcal_nparams, info_ptr->pcal_units, info_ptr->pcal_params); #endif -#if defined(PNG_WRITE_sCAL_SUPPORTED) + +#if defined(PNG_sCAL_SUPPORTED) if (info_ptr->valid & PNG_INFO_sCAL) +#if defined(PNG_WRITE_sCAL_SUPPORTED) #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) png_write_sCAL(png_ptr, (int)info_ptr->scal_unit, info_ptr->scal_pixel_width, info_ptr->scal_pixel_height); -#else +#else /* !FLOATING_POINT */ #ifdef PNG_FIXED_POINT_SUPPORTED png_write_sCAL_s(png_ptr, (int)info_ptr->scal_unit, info_ptr->scal_s_width, info_ptr->scal_s_height); -#else +#endif /* FIXED_POINT */ +#endif /* FLOATING_POINT */ +#else /* !WRITE_sCAL */ png_warning(png_ptr, "png_write_sCAL not supported; sCAL chunk not written."); -#endif -#endif -#endif +#endif /* WRITE_sCAL */ +#endif /* sCAL */ + #if defined(PNG_WRITE_pHYs_SUPPORTED) if (info_ptr->valid & PNG_INFO_pHYs) png_write_pHYs(png_ptr, info_ptr->x_pixels_per_unit, info_ptr->y_pixels_per_unit, info_ptr->phys_unit_type); -#endif +#endif /* pHYs */ + #if defined(PNG_WRITE_tIME_SUPPORTED) if (info_ptr->valid & PNG_INFO_tIME) { png_write_tIME(png_ptr, &(info_ptr->mod_time)); png_ptr->mode |= PNG_WROTE_tIME; } -#endif +#endif /* tIME */ + #if defined(PNG_WRITE_sPLT_SUPPORTED) if (info_ptr->valid & PNG_INFO_sPLT) for (i = 0; i < (int)info_ptr->splt_palettes_num; i++) png_write_sPLT(png_ptr, info_ptr->splt_palettes + i); -#endif +#endif /* sPLT */ + #if defined(PNG_WRITE_TEXT_SUPPORTED) /* Check to see if we need to write text chunks */ for (i = 0; i < info_ptr->num_text; i++) { png_debug2(2, "Writing header text chunk %d, type %d", i, info_ptr->text[i].compression); - /* an internationalized chunk? */ + /* An internationalized chunk? */ if (info_ptr->text[i].compression > 0) { #if defined(PNG_WRITE_iTXt_SUPPORTED) - /* write international chunk */ + /* Write international chunk */ png_write_iTXt(png_ptr, info_ptr->text[i].compression, info_ptr->text[i].key, info_ptr->text[i].lang, @@ -237,9 +245,9 @@ /* If we want a compressed text chunk */ else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_zTXt) { #if defined(PNG_WRITE_zTXt_SUPPORTED) - /* write compressed chunk */ + /* Write compressed chunk */ png_write_zTXt(png_ptr, info_ptr->text[i].key, info_ptr->text[i].text, 0, info_ptr->text[i].compression); #else @@ -250,20 +258,22 @@ } else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) { #if defined(PNG_WRITE_tEXt_SUPPORTED) - /* write uncompressed chunk */ + /* Write uncompressed chunk */ png_write_tEXt(png_ptr, info_ptr->text[i].key, info_ptr->text[i].text, 0); + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; #else + /* Can't get here */ png_warning(png_ptr, "Unable to write uncompressed text"); #endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; } } -#endif +#endif /* tEXt */ + #if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) if (info_ptr->unknown_chunks_num) { png_unknown_chunk *up; @@ -301,31 +311,31 @@ return; if (!(png_ptr->mode & PNG_HAVE_IDAT)) png_error(png_ptr, "No IDATs written into file"); - /* see if user wants us to write information chunks */ + /* See if user wants us to write information chunks */ if (info_ptr != NULL) { #if defined(PNG_WRITE_TEXT_SUPPORTED) - int i; /* local index variable */ + int i; /* Local index variable */ #endif #if defined(PNG_WRITE_tIME_SUPPORTED) - /* check to see if user has supplied a time chunk */ + /* Check to see if user has supplied a time chunk */ if ((info_ptr->valid & PNG_INFO_tIME) && !(png_ptr->mode & PNG_WROTE_tIME)) png_write_tIME(png_ptr, &(info_ptr->mod_time)); #endif #if defined(PNG_WRITE_TEXT_SUPPORTED) - /* loop through comment chunks */ + /* Loop through comment chunks */ for (i = 0; i < info_ptr->num_text; i++) { png_debug2(2, "Writing trailer text chunk %d, type %d", i, info_ptr->text[i].compression); - /* an internationalized chunk? */ + /* An internationalized chunk? */ if (info_ptr->text[i].compression > 0) { #if defined(PNG_WRITE_iTXt_SUPPORTED) - /* write international chunk */ + /* Write international chunk */ png_write_iTXt(png_ptr, info_ptr->text[i].compression, info_ptr->text[i].key, info_ptr->text[i].lang, @@ -339,9 +349,9 @@ } else if (info_ptr->text[i].compression >= PNG_TEXT_COMPRESSION_zTXt) { #if defined(PNG_WRITE_zTXt_SUPPORTED) - /* write compressed chunk */ + /* Write compressed chunk */ png_write_zTXt(png_ptr, info_ptr->text[i].key, info_ptr->text[i].text, 0, info_ptr->text[i].compression); #else @@ -352,9 +362,9 @@ } else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) { #if defined(PNG_WRITE_tEXt_SUPPORTED) - /* write uncompressed chunk */ + /* Write uncompressed chunk */ png_write_tEXt(png_ptr, info_ptr->text[i].key, info_ptr->text[i].text, 0); #else png_warning(png_ptr, "Unable to write uncompressed text"); @@ -390,9 +400,9 @@ } png_ptr->mode |= PNG_AFTER_IDAT; - /* write end of PNG file */ + /* Write end of PNG file */ png_write_IEND(png_ptr); /* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03, * and restored again in libpng-1.2.30, may cause some applications that * do not set png_ptr->output_flush_fn to crash. If your application @@ -470,9 +480,9 @@ #endif /* PNG_USER_MEM_SUPPORTED */ if (png_ptr == NULL) return (NULL); - /* added at libpng-1.2.6 */ + /* Added at libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED png_ptr->user_width_max=PNG_USER_WIDTH_MAX; png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; #endif @@ -541,9 +551,9 @@ "Incompatible libpng version in application and library"); } } - /* initialize zbuf - compression buffer */ + /* Initialize zbuf - compression buffer */ png_ptr->zbuf_size = PNG_ZBUF_SIZE; png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size); @@ -635,9 +645,9 @@ png_size_t png_struct_size) { png_structp png_ptr=*ptr_ptr; #ifdef PNG_SETJMP_SUPPORTED - jmp_buf tmp_jmp; /* to save current jump buffer */ + jmp_buf tmp_jmp; /* To save current jump buffer */ #endif int i = 0; @@ -661,9 +671,9 @@ png_debug(1, "in png_write_init_3"); #ifdef PNG_SETJMP_SUPPORTED - /* save jump buffer and error functions */ + /* Save jump buffer and error functions */ png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf)); #endif if (png_sizeof(png_struct) > png_struct_size) @@ -672,26 +682,26 @@ png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); *ptr_ptr = png_ptr; } - /* reset all variables to 0 */ + /* Reset all variables to 0 */ png_memset(png_ptr, 0, png_sizeof(png_struct)); - /* added at libpng-1.2.6 */ + /* Added at libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED png_ptr->user_width_max=PNG_USER_WIDTH_MAX; png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; #endif #ifdef PNG_SETJMP_SUPPORTED - /* restore jump buffer */ + /* Restore jump buffer */ png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf)); #endif png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL, png_flush_ptr_NULL); - /* initialize zbuf - compression buffer */ + /* Initialize zbuf - compression buffer */ png_ptr->zbuf_size = PNG_ZBUF_SIZE; png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size); @@ -709,17 +719,17 @@ void PNGAPI png_write_rows(png_structp png_ptr, png_bytepp row, png_uint_32 num_rows) { - png_uint_32 i; /* row counter */ - png_bytepp rp; /* row pointer */ + png_uint_32 i; /* Row counter */ + png_bytepp rp; /* Row pointer */ png_debug(1, "in png_write_rows"); if (png_ptr == NULL) return; - /* loop through the rows */ + /* Loop through the rows */ for (i = 0, rp = row; i < num_rows; i++, rp++) { png_write_row(png_ptr, *rp); } @@ -730,52 +740,53 @@ */ void PNGAPI png_write_image(png_structp png_ptr, png_bytepp image) { - png_uint_32 i; /* row index */ - int pass, num_pass; /* pass variables */ - png_bytepp rp; /* points to current row */ + png_uint_32 i; /* Row index */ + int pass, num_pass; /* Pass variables */ + png_bytepp rp; /* Points to current row */ if (png_ptr == NULL) return; png_debug(1, "in png_write_image"); #if defined(PNG_WRITE_INTERLACING_SUPPORTED) - /* intialize interlace handling. If image is not interlaced, - this will set pass to 1 */ + /* Initialize interlace handling. If image is not interlaced, + * this will set pass to 1 + */ num_pass = png_set_interlace_handling(png_ptr); #else num_pass = 1; #endif - /* loop through passes */ + /* Loop through passes */ for (pass = 0; pass < num_pass; pass++) { - /* loop through image */ + /* Loop through image */ for (i = 0, rp = image; i < png_ptr->height; i++, rp++) { png_write_row(png_ptr, *rp); } } } -/* called by user to write a row of image data */ +/* Called by user to write a row of image data */ void PNGAPI png_write_row(png_structp png_ptr, png_bytep row) { if (png_ptr == NULL) return; png_debug2(1, "in png_write_row (row %ld, pass %d)", png_ptr->row_number, png_ptr->pass); - /* initialize transformations and other stuff if first time */ + /* Initialize transformations and other stuff if first time */ if (png_ptr->row_number == 0 && png_ptr->pass == 0) { - /* make sure we wrote the header info */ + /* Make sure we wrote the header info */ if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) png_error(png_ptr, "png_write_info was never called before png_write_row."); - /* check for transforms that have been set but were defined out */ + /* Check for transforms that have been set but were defined out */ #if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED) if (png_ptr->transformations & PNG_INVERT_MONO) png_warning(png_ptr, "PNG_WRITE_INVERT_SUPPORTED is not defined."); #endif @@ -807,9 +818,9 @@ png_write_start_row(png_ptr); } #if defined(PNG_WRITE_INTERLACING_SUPPORTED) - /* if interlaced and not interested in row, return */ + /* If interlaced and not interested in row, return */ if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) { switch (png_ptr->pass) { @@ -865,9 +876,9 @@ } } #endif - /* set up row info for transformations */ + /* Set up row info for transformations */ png_ptr->row_info.color_type = png_ptr->color_type; png_ptr->row_info.width = png_ptr->usr_width; png_ptr->row_info.channels = png_ptr->usr_channels; png_ptr->row_info.bit_depth = png_ptr->usr_bit_depth; @@ -888,24 +899,24 @@ png_memcpy_check(png_ptr, png_ptr->row_buf + 1, row, png_ptr->row_info.rowbytes); #if defined(PNG_WRITE_INTERLACING_SUPPORTED) - /* handle interlacing */ + /* Handle interlacing */ if (png_ptr->interlaced && png_ptr->pass < 6 && (png_ptr->transformations & PNG_INTERLACE)) { png_do_write_interlace(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr->pass); - /* this should always get caught above, but still ... */ + /* This should always get caught above, but still ... */ if (!(png_ptr->row_info.width)) { png_write_finish_row(png_ptr); return; } } #endif - /* handle other transformations */ + /* Handle other transformations */ if (png_ptr->transformations) png_do_write_transformations(png_ptr); #if defined(PNG_MNG_FEATURES_SUPPORTED) @@ -943,9 +954,9 @@ return; png_ptr->flush_dist = (nrows < 0 ? 0 : nrows); } -/* flush the current output buffers now */ +/* Flush the current output buffers now */ void PNGAPI png_write_flush(png_structp png_ptr) { int wrote_IDAT; @@ -960,13 +971,13 @@ do { int ret; - /* compress the data */ + /* Compress the data */ ret = deflate(&png_ptr->zstream, Z_SYNC_FLUSH); wrote_IDAT = 0; - /* check for compression errors */ + /* Check for compression errors */ if (ret != Z_OK) { if (png_ptr->zstream.msg != NULL) png_error(png_ptr, png_ptr->zstream.msg); @@ -975,9 +986,9 @@ } if (!(png_ptr->zstream.avail_out)) { - /* write the IDAT and reset the zlib output buffer */ + /* Write the IDAT and reset the zlib output buffer */ png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; @@ -987,9 +998,9 @@ /* 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 */ + /* 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_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; @@ -998,9 +1009,9 @@ png_flush(png_ptr); } #endif /* PNG_WRITE_FLUSH_SUPPORTED */ -/* free all memory used by the write */ +/* Free all memory used by the write */ void PNGAPI png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr) { png_structp png_ptr = NULL; @@ -1074,9 +1085,9 @@ void /* PRIVATE */ png_write_destroy(png_structp png_ptr) { #ifdef PNG_SETJMP_SUPPORTED - jmp_buf tmp_jmp; /* save jump buffer */ + jmp_buf tmp_jmp; /* Save jump buffer */ #endif png_error_ptr error_fn; png_error_ptr warning_fn; png_voidp error_ptr; @@ -1084,12 +1095,12 @@ png_free_ptr free_fn; #endif png_debug(1, "in png_write_destroy"); - /* free any memory zlib uses */ + /* Free any memory zlib uses */ deflateEnd(&png_ptr->zstream); - /* free our memory. png_free checks NULL for us. */ + /* Free our memory. png_free checks NULL for us. */ png_free(png_ptr, png_ptr->zbuf); png_free(png_ptr, png_ptr->row_buf); #ifndef PNG_NO_WRITE_FILTER png_free(png_ptr, png_ptr->prev_row); @@ -1111,9 +1122,9 @@ png_free(png_ptr, png_ptr->inv_filter_costs); #endif #ifdef PNG_SETJMP_SUPPORTED - /* reset structure */ + /* Reset structure */ png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf)); #endif error_fn = png_ptr->error_fn; @@ -1414,9 +1425,9 @@ png_warning(png_ptr, "Only compression windows <= 32k supported by PNG"); else if (window_bits < 8) png_warning(png_ptr, "Only compression windows >= 256 supported by PNG"); #ifndef WBITS_8_OK - /* avoid libpng bug with 256-byte windows */ + /* Avoid libpng bug with 256-byte windows */ if (window_bits == 8) { png_warning(png_ptr, "Compression window is being reset to 512"); window_bits=9; @@ -1467,9 +1478,9 @@ { if (png_ptr == NULL || info_ptr == NULL) return; #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) - /* invert the alpha channel from opacity to transparency */ + /* Invert the alpha channel from opacity to transparency */ if (transforms & PNG_TRANSFORM_INVERT_ALPHA) png_set_invert_alpha(png_ptr); #endif @@ -1478,9 +1489,9 @@ /* ------ these transformations don't touch the info structure ------- */ #if defined(PNG_WRITE_INVERT_SUPPORTED) - /* invert monochrome pixels */ + /* Invert monochrome pixels */ if (transforms & PNG_TRANSFORM_INVERT_MONO) png_set_invert_mono(png_ptr); #endif @@ -1493,15 +1504,15 @@ png_set_shift(png_ptr, &info_ptr->sig_bit); #endif #if defined(PNG_WRITE_PACK_SUPPORTED) - /* pack pixels into bytes */ + /* Pack pixels into bytes */ if (transforms & PNG_TRANSFORM_PACKING) png_set_packing(png_ptr); #endif #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) - /* swap location of alpha bytes from ARGB to RGBA */ + /* Swap location of alpha bytes from ARGB to RGBA */ if (transforms & PNG_TRANSFORM_SWAP_ALPHA) png_set_swap_alpha(png_ptr); #endif @@ -1513,35 +1524,35 @@ png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); #endif #if defined(PNG_WRITE_BGR_SUPPORTED) - /* flip BGR pixels to RGB */ + /* Flip BGR pixels to RGB */ if (transforms & PNG_TRANSFORM_BGR) png_set_bgr(png_ptr); #endif #if defined(PNG_WRITE_SWAP_SUPPORTED) - /* swap bytes of 16-bit files to most significant byte first */ + /* Swap bytes of 16-bit files to most significant byte first */ if (transforms & PNG_TRANSFORM_SWAP_ENDIAN) png_set_swap(png_ptr); #endif #if defined(PNG_WRITE_PACKSWAP_SUPPORTED) - /* swap bits of 1, 2, 4 bit packed pixel formats */ + /* Swap bits of 1, 2, 4 bit packed pixel formats */ if (transforms & PNG_TRANSFORM_PACKSWAP) png_set_packswap(png_ptr); #endif /* ----------------------- end of transformations ------------------- */ - /* write the bits */ + /* Write the bits */ if (info_ptr->valid & PNG_INFO_IDAT) png_write_image(png_ptr, info_ptr->row_pointers); /* It is REQUIRED to call this to finish writing the rest of the file */ png_write_end(png_ptr, info_ptr); - transforms = transforms; /* quiet compiler warnings */ + transforms = transforms; /* Quiet compiler warnings */ params = params; } #endif #endif /* PNG_WRITE_SUPPORTED */ diff -ru4NwbB libpng-1.2.36/pngwtran.c libpng-1.2.37beta03/pngwtran.c --- libpng-1.2.36/pngwtran.c 2009-05-07 11:05:32.211326265 -0500 +++ libpng-1.2.37beta03/pngwtran.c 2009-05-20 12:43:37.026315176 -0500 @@ -1,10 +1,10 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.2.9 April 14, 2006 + * Last changed in libpng 1.2.37 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2006 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -25,9 +25,9 @@ #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) if (png_ptr->transformations & PNG_USER_TRANSFORM) if (png_ptr->write_user_transform_fn != NULL) - (*(png_ptr->write_user_transform_fn)) /* user write transform function */ + (*(png_ptr->write_user_transform_fn)) /* User write transform function */ (png_ptr, /* png_ptr */ &(png_ptr->row_info), /* row_info: */ /* png_uint_32 width; width of row */ /* png_uint_32 rowbytes; number of bytes in row */ @@ -247,9 +247,9 @@ shift_dec[channels] = bit_depth->alpha; channels++; } - /* with low row depths, could only be grayscale, so one channel */ + /* With low row depths, could only be grayscale, so one channel */ if (row_info->bit_depth < 8) { png_bytep bp = row; png_uint_32 i; @@ -438,9 +438,9 @@ png_uint_32 i; png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { - /* does nothing + /* Does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); */ @@ -456,9 +456,9 @@ png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { - /* does nothing + /* Does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); @@ -494,9 +494,9 @@ png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { - /* does nothing + /* Does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); */ sp+=2; dp = sp; @@ -509,9 +509,9 @@ } #endif #if defined(PNG_MNG_FEATURES_SUPPORTED) -/* undoes intrapixel differencing */ +/* Undoes intrapixel differencing */ void /* PRIVATE */ png_do_write_intrapixel(png_row_infop row_info, png_bytep row) { png_debug(1, "in png_do_write_intrapixel"); diff -ru4NwbB libpng-1.2.36/pngwutil.c libpng-1.2.37beta03/pngwutil.c --- libpng-1.2.36/pngwutil.c 2009-05-07 16:52:28.397274228 -0500 +++ libpng-1.2.37beta03/pngwutil.c 2009-05-20 12:43:37.036856167 -0500 @@ -1,8 +1,8 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.2.36 [May 7, 2009] + * Last changed in libpng 1.2.36 [May 20, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -59,9 +59,9 @@ png_write_sig(png_structp png_ptr) { png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; - /* write the rest of the 8 byte signature */ + /* Write the rest of the 8 byte signature */ png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes], (png_size_t)(8 - png_ptr->sig_bytes)); if (png_ptr->sig_bytes < 3) png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE; @@ -79,9 +79,10 @@ void PNGAPI png_write_chunk(png_structp png_ptr, png_bytep chunk_name, png_bytep data, png_size_t length) { - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; png_write_chunk_start(png_ptr, chunk_name, (png_uint_32)length); png_write_chunk_data(png_ptr, data, (png_size_t)length); png_write_chunk_end(png_ptr); } @@ -97,17 +98,18 @@ png_byte buf[8]; png_debug2(0, "Writing %s chunk, length = %lu", chunk_name, (unsigned long)length); - if (png_ptr == NULL) return; + if (png_ptr == NULL) + return; - /* write the length and the chunk name */ + /* Write the length and the chunk name */ png_save_uint_32(buf, length); png_memcpy(buf + 4, chunk_name, 4); png_write_data(png_ptr, buf, (png_size_t)8); - /* put the chunk name into png_ptr->chunk_name */ + /* Put the chunk name into png_ptr->chunk_name */ png_memcpy(png_ptr->chunk_name, chunk_name, 4); - /* reset the crc and run it over the chunk name */ + /* Reset the crc and run it over the chunk name */ png_reset_crc(png_ptr); png_calculate_crc(png_ptr, chunk_name, (png_size_t)4); } @@ -118,14 +120,15 @@ */ void PNGAPI png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length) { - /* write the data, and run the CRC over it */ - if (png_ptr == NULL) return; + /* Write the data, and run the CRC over it */ + if (png_ptr == NULL) + return; if (data != NULL && length > 0) { png_write_data(png_ptr, data, length); - /* update the CRC after writing the data, + /* Update the CRC after writing the data, * in case that the user I/O routine alters it. */ png_calculate_crc(png_ptr, data, length); } @@ -138,32 +141,31 @@ png_byte buf[4]; if (png_ptr == NULL) return; - /* write the crc in a single operation */ + /* Write the crc in a single operation */ png_save_uint_32(buf, png_ptr->crc); png_write_data(png_ptr, buf, (png_size_t)4); } #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED) -/* - * This pair of functions encapsulates the operation of (a) compressing a +/* This pair of functions encapsulates the operation of (a) compressing a * text string, and (b) issuing it later as a series of chunk data writes. * The compression_state structure is shared context for these functions * set up by the caller in order to make the whole mess thread-safe. */ typedef struct { - char *input; /* the uncompressed input data */ - int input_len; /* its length */ - int num_output_ptr; /* number of output pointers used */ - int max_output_ptr; /* size of output_ptr */ - png_charpp output_ptr; /* array of pointers to output */ + char *input; /* The uncompressed input data */ + int input_len; /* Its length */ + int num_output_ptr; /* Number of output pointers used */ + int max_output_ptr; /* Size of output_ptr */ + png_charpp output_ptr; /* Array of pointers to output */ } compression_state; -/* compress given text into storage in the png_ptr structure */ +/* Compress given text into storage in the png_ptr structure */ static int /* PRIVATE */ png_text_compress(png_structp png_ptr, png_charp text, png_size_t text_len, int compression, compression_state *comp) @@ -175,9 +177,9 @@ comp->output_ptr = NULL; comp->input = NULL; comp->input_len = 0; - /* we may just want to pass the text right through */ + /* We may just want to pass the text right through */ if (compression == PNG_TEXT_COMPRESSION_NONE) { comp->input = text; comp->input_len = text_len; @@ -209,31 +211,31 @@ * data, or if the input string is incredibly large (although this * wouldn't cause a failure, just a slowdown due to swapping). */ - /* set up the compression buffers */ + /* Set up the compression buffers */ png_ptr->zstream.avail_in = (uInt)text_len; png_ptr->zstream.next_in = (Bytef *)text; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; png_ptr->zstream.next_out = (Bytef *)png_ptr->zbuf; - /* this is the same compression loop as in png_write_row() */ + /* This is the same compression loop as in png_write_row() */ do { - /* compress the data */ + /* Compress the data */ ret = deflate(&png_ptr->zstream, Z_NO_FLUSH); if (ret != Z_OK) { - /* error */ + /* Error */ if (png_ptr->zstream.msg != NULL) png_error(png_ptr, png_ptr->zstream.msg); else png_error(png_ptr, "zlib error"); } - /* check to see if we need more room */ + /* Check to see if we need more room */ if (!(png_ptr->zstream.avail_out)) { - /* make sure the output array has room */ + /* Make sure the output array has room */ if (comp->num_output_ptr >= comp->max_output_ptr) { int old_max; @@ -256,9 +258,9 @@ (png_uint_32) (comp->max_output_ptr * png_sizeof(png_charp))); } - /* save the data */ + /* Save the data */ comp->output_ptr[comp->num_output_ptr] = (png_charp)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size); png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf, @@ -268,23 +270,23 @@ /* and reset the buffer */ png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; png_ptr->zstream.next_out = png_ptr->zbuf; } - /* continue until we don't have any more to compress */ + /* Continue until we don't have any more to compress */ } while (png_ptr->zstream.avail_in); - /* finish the compression */ + /* Finish the compression */ do { - /* tell zlib we are finished */ + /* Tell zlib we are finished */ ret = deflate(&png_ptr->zstream, Z_FINISH); if (ret == Z_OK) { - /* check to see if we need more room */ + /* Check to see if we need more room */ if (!(png_ptr->zstream.avail_out)) { - /* check to make sure our output array has room */ + /* Check to make sure our output array has room */ if (comp->num_output_ptr >= comp->max_output_ptr) { int old_max; @@ -308,9 +310,9 @@ (png_uint_32)(comp->max_output_ptr * png_sizeof(png_charp))); } - /* save off the data */ + /* Save the data */ comp->output_ptr[comp->num_output_ptr] = (png_charp)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size); png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf, @@ -323,39 +325,39 @@ } } else if (ret != Z_STREAM_END) { - /* we got an error */ + /* We got an error */ if (png_ptr->zstream.msg != NULL) png_error(png_ptr, png_ptr->zstream.msg); else png_error(png_ptr, "zlib error"); } } while (ret != Z_STREAM_END); - /* text length is number of buffers plus last buffer */ + /* Text length is number of buffers plus last buffer */ text_len = png_ptr->zbuf_size * comp->num_output_ptr; if (png_ptr->zstream.avail_out < png_ptr->zbuf_size) text_len += png_ptr->zbuf_size - (png_size_t)png_ptr->zstream.avail_out; return((int)text_len); } -/* ship the compressed text out via chunk writes */ +/* Ship the compressed text out via chunk writes */ static void /* PRIVATE */ png_write_compressed_data_out(png_structp png_ptr, compression_state *comp) { int i; - /* handle the no-compression case */ + /* Handle the no-compression case */ if (comp->input) { png_write_chunk_data(png_ptr, (png_bytep)comp->input, (png_size_t)comp->input_len); return; } - /* write saved output buffers, if any */ + /* Write saved output buffers, if any */ for (i = 0; i < comp->num_output_ptr; i++) { png_write_chunk_data(png_ptr, (png_bytep)comp->output_ptr[i], (png_size_t)png_ptr->zbuf_size); @@ -364,14 +366,14 @@ } if (comp->max_output_ptr != 0) png_free(png_ptr, comp->output_ptr); comp->output_ptr=NULL; - /* write anything left in zbuf */ + /* Write anything left in zbuf */ if (png_ptr->zstream.avail_out < (png_uint_32)png_ptr->zbuf_size) png_write_chunk_data(png_ptr, png_ptr->zbuf, (png_size_t)(png_ptr->zbuf_size - png_ptr->zstream.avail_out)); - /* reset zlib for another zTXt/iTXt or image data */ + /* Reset zlib for another zTXt/iTXt or image data */ deflateReset(&png_ptr->zstream); png_ptr->zstream.data_type = Z_BINARY; } #endif @@ -389,9 +391,9 @@ PNG_IHDR; #endif int ret; - png_byte buf[13]; /* buffer to store the IHDR info */ + png_byte buf[13]; /* Buffer to store the IHDR info */ png_debug(1, "in png_write_IHDR"); /* Check that we have valid input data from the application info */ switch (color_type) @@ -475,9 +477,9 @@ #else interlace_type=PNG_INTERLACE_NONE; #endif - /* save off the relevent information */ + /* Save the relevent information */ png_ptr->bit_depth = (png_byte)bit_depth; png_ptr->color_type = (png_byte)color_type; png_ptr->interlaced = (png_byte)interlace_type; #if defined(PNG_MNG_FEATURES_SUPPORTED) @@ -488,26 +490,26 @@ png_ptr->height = height; png_ptr->pixel_depth = (png_byte)(bit_depth * png_ptr->channels); png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width); - /* set the usr info, so any transformations can modify it */ + /* Set the usr info, so any transformations can modify it */ png_ptr->usr_width = png_ptr->width; png_ptr->usr_bit_depth = png_ptr->bit_depth; png_ptr->usr_channels = png_ptr->channels; - /* pack the header information into the buffer */ + /* Pack the header information into the buffer */ png_save_uint_32(buf, width); png_save_uint_32(buf + 4, height); buf[8] = (png_byte)bit_depth; buf[9] = (png_byte)color_type; buf[10] = (png_byte)compression_type; buf[11] = (png_byte)filter_type; buf[12] = (png_byte)interlace_type; - /* write the chunk */ + /* Write the chunk */ png_write_chunk(png_ptr, (png_bytep)png_IHDR, buf, (png_size_t)13); - /* initialize zlib with PNG info */ + /* Initialize zlib with PNG info */ png_ptr->zstream.zalloc = png_zalloc; png_ptr->zstream.zfree = png_zfree; png_ptr->zstream.opaque = (voidpf)png_ptr; if (!(png_ptr->do_filter)) @@ -548,15 +550,15 @@ } png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; /* libpng is not interested in zstream.data_type */ - /* set it to a predefined value, to avoid its evaluation inside zlib */ + /* Set it to a predefined value, to avoid its evaluation inside zlib */ png_ptr->zstream.data_type = Z_BINARY; png_ptr->mode = PNG_HAVE_IHDR; } -/* write the palette. We are careful not to trust png_color to be in the +/* Write the palette. We are careful not to trust png_color to be in the * correct order for PNG, so people can redefine it to any convenient * structure. */ void /* PRIVATE */ @@ -621,9 +623,9 @@ png_write_chunk_end(png_ptr); png_ptr->mode |= PNG_HAVE_PLTE; } -/* write an IDAT chunk */ +/* Write an IDAT chunk */ void /* PRIVATE */ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) { #ifdef PNG_USE_LOCAL_ARRAYS @@ -638,11 +640,13 @@ { unsigned int z_cmf = data[0]; /* zlib compression method and flags */ if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70) { - /* Avoid memory underflows and multiplication overflows. */ - /* The conditions below are practically always satisfied; - however, they still must be checked. */ + /* Avoid memory underflows and multiplication overflows. + * + * The conditions below are practically always satisfied; + * however, they still must be checked. + */ if (length >= 2 && png_ptr->height < 16384 && png_ptr->width < 16384) { png_uint_32 uncompressed_idat_size = png_ptr->height * @@ -673,9 +677,9 @@ png_write_chunk(png_ptr, (png_bytep)png_IDAT, data, length); png_ptr->mode |= PNG_HAVE_IDAT; } -/* write an IEND chunk */ +/* Write an IEND chunk */ void /* PRIVATE */ png_write_IEND(png_structp png_ptr) { #ifdef PNG_USE_LOCAL_ARRAYS @@ -687,9 +691,9 @@ png_ptr->mode |= PNG_HAVE_IEND; } #if defined(PNG_WRITE_gAMA_SUPPORTED) -/* write a gAMA chunk */ +/* Write a gAMA chunk */ #ifdef PNG_FLOATING_POINT_SUPPORTED void /* PRIVATE */ png_write_gAMA(png_structp png_ptr, double file_gamma) { @@ -723,9 +727,9 @@ #endif #endif #if defined(PNG_WRITE_sRGB_SUPPORTED) -/* write a sRGB chunk */ +/* Write a sRGB chunk */ void /* PRIVATE */ png_write_sRGB(png_structp png_ptr, int srgb_intent) { #ifdef PNG_USE_LOCAL_ARRAYS @@ -742,9 +746,9 @@ } #endif #if defined(PNG_WRITE_iCCP_SUPPORTED) -/* write an iCCP chunk */ +/* Write an iCCP chunk */ void /* PRIVATE */ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type, png_charp profile, int profile_len) { @@ -799,9 +803,9 @@ if (profile_len) profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len, PNG_COMPRESSION_TYPE_BASE, &comp); - /* make sure we include the NULL after the name and the compression type */ + /* Make sure we include the NULL after the name and the compression type */ png_write_chunk_start(png_ptr, (png_bytep)png_iCCP, (png_uint_32)(name_len + profile_len + 2)); new_name[name_len + 1] = 0x00; png_write_chunk_data(png_ptr, (png_bytep)new_name, @@ -815,9 +819,9 @@ } #endif #if defined(PNG_WRITE_sPLT_SUPPORTED) -/* write a sPLT chunk */ +/* Write a sPLT chunk */ void /* PRIVATE */ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette) { #ifdef PNG_USE_LOCAL_ARRAYS @@ -833,20 +837,19 @@ int i; #endif png_debug(1, "in png_write_sPLT"); - if ((name_len = png_check_keyword(png_ptr, - spalette->name, &new_name))==0) + if ((name_len = png_check_keyword(png_ptr,spalette->name, &new_name))==0) return; - /* make sure we include the NULL after the name */ + /* Make sure we include the NULL after the name */ png_write_chunk_start(png_ptr, (png_bytep)png_sPLT, (png_uint_32)(name_len + 2 + palette_size)); png_write_chunk_data(png_ptr, (png_bytep)new_name, (png_size_t)(name_len + 1)); png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, (png_size_t)1); - /* loop through each palette entry, writing appropriately */ + /* Loop through each palette entry, writing appropriately */ #ifndef PNG_NO_POINTER_INDEXING for (ep = spalette->entries; epentries + spalette->nentries; ep++) { if (spalette->depth == 8) @@ -896,9 +899,9 @@ } #endif #if defined(PNG_WRITE_sBIT_SUPPORTED) -/* write the sBIT chunk */ +/* Write the sBIT chunk */ void /* PRIVATE */ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type) { #ifdef PNG_USE_LOCAL_ARRAYS @@ -907,9 +910,9 @@ png_byte buf[4]; png_size_t size; png_debug(1, "in png_write_sBIT"); - /* make sure we don't depend upon the order of PNG_COLOR_8 */ + /* Make sure we don't depend upon the order of PNG_COLOR_8 */ if (color_type & PNG_COLOR_MASK_COLOR) { png_byte maxbits; @@ -952,9 +955,9 @@ } #endif #if defined(PNG_WRITE_cHRM_SUPPORTED) -/* write the cHRM chunk */ +/* Write the cHRM chunk */ #ifdef PNG_FLOATING_POINT_SUPPORTED void /* PRIVATE */ png_write_cHRM(png_structp png_ptr, double white_x, double white_y, double red_x, double red_y, double green_x, double green_y, @@ -983,9 +986,9 @@ if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y)) #endif { - /* each value is saved in 1/100,000ths */ + /* Each value is saved in 1/100,000ths */ png_save_uint_32(buf, int_white_x); png_save_uint_32(buf + 4, int_white_y); @@ -1014,9 +1017,9 @@ #endif png_byte buf[32]; png_debug(1, "in png_write_cHRM"); - /* each value is saved in 1/100,000ths */ + /* Each value is saved in 1/100,000ths */ #if !defined(PNG_NO_CHECK_cHRM) if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y)) #endif @@ -1039,9 +1042,9 @@ #endif #endif #if defined(PNG_WRITE_tRNS_SUPPORTED) -/* write the tRNS chunk */ +/* Write the tRNS chunk */ void /* PRIVATE */ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, int num_trans, int color_type) { @@ -1057,15 +1060,15 @@ { png_warning(png_ptr, "Invalid number of transparent colors specified"); return; } - /* write the chunk out as it is */ + /* Write the chunk out as it is */ png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans, (png_size_t)num_trans); } else if (color_type == PNG_COLOR_TYPE_GRAY) { - /* one 16 bit value */ + /* One 16 bit value */ if (tran->gray >= (1 << png_ptr->bit_depth)) { png_warning(png_ptr, "Ignoring attempt to write tRNS chunk out-of-range for bit_depth"); @@ -1075,9 +1078,9 @@ png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)2); } else if (color_type == PNG_COLOR_TYPE_RGB) { - /* three 16 bit values */ + /* Three 16 bit values */ png_save_uint_16(buf, tran->red); png_save_uint_16(buf + 2, tran->green); png_save_uint_16(buf + 4, tran->blue); if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4])) @@ -1095,9 +1098,9 @@ } #endif #if defined(PNG_WRITE_bKGD_SUPPORTED) -/* write the background chunk */ +/* Write the background chunk */ void /* PRIVATE */ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) { #ifdef PNG_USE_LOCAL_ARRAYS @@ -1148,9 +1151,9 @@ } #endif #if defined(PNG_WRITE_hIST_SUPPORTED) -/* write the histogram */ +/* Write the histogram */ void /* PRIVATE */ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist) { #ifdef PNG_USE_LOCAL_ARRAYS @@ -1310,9 +1313,9 @@ } #endif #if defined(PNG_WRITE_tEXt_SUPPORTED) -/* write a tEXt chunk */ +/* Write a tEXt chunk */ void /* PRIVATE */ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text, png_size_t text_len) { @@ -1330,9 +1333,9 @@ text_len = 0; else text_len = png_strlen(text); - /* make sure we include the 0 after the key */ + /* Make sure we include the 0 after the key */ png_write_chunk_start(png_ptr, (png_bytep)png_tEXt, (png_uint_32)(key_len + text_len + 1)); /* * We leave it to the application to meet PNG-1.0 requirements on the @@ -1350,9 +1353,9 @@ } #endif #if defined(PNG_WRITE_zTXt_SUPPORTED) -/* write a compressed text chunk */ +/* Write a compressed text chunk */ void /* PRIVATE */ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text, png_size_t text_len, int compression) { @@ -1386,33 +1389,33 @@ } text_len = png_strlen(text); - /* compute the compressed data; do it now for the length */ + /* Compute the compressed data; do it now for the length */ text_len = png_text_compress(png_ptr, text, text_len, compression, &comp); - /* write start of chunk */ + /* Write start of chunk */ png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32)(key_len+text_len + 2)); - /* write key */ + /* Write key */ png_write_chunk_data(png_ptr, (png_bytep)new_key, (png_size_t)(key_len + 1)); png_free(png_ptr, new_key); buf[0] = (png_byte)compression; - /* write compression */ + /* Write compression */ png_write_chunk_data(png_ptr, (png_bytep)buf, (png_size_t)1); - /* write the compressed data */ + /* Write the compressed data */ png_write_compressed_data_out(png_ptr, &comp); - /* close the chunk */ + /* Close the chunk */ png_write_chunk_end(png_ptr); } #endif #if defined(PNG_WRITE_iTXt_SUPPORTED) -/* write an iTXt chunk */ +/* Write an iTXt chunk */ void /* PRIVATE */ png_write_iTXt(png_structp png_ptr, int compression, png_charp key, png_charp lang, png_charp lang_key, png_charp text) { @@ -1451,14 +1454,14 @@ text_len = 0; else text_len = png_strlen(text); - /* compute the compressed data; do it now for the length */ + /* Compute the compressed data; do it now for the length */ text_len = png_text_compress(png_ptr, text, text_len, compression-2, &comp); - /* make sure we include the compression flag, the compression byte, + /* Make sure we include the compression flag, the compression byte, * and the NULs after the key, lang, and lang_key parts */ png_write_chunk_start(png_ptr, (png_bytep)png_iTXt, (png_uint_32)( @@ -1467,24 +1470,23 @@ + lang_len + lang_key_len + text_len)); - /* - * We leave it to the application to meet PNG-1.0 requirements on the + /* We leave it to the application to meet PNG-1.0 requirements on the * contents of the text. PNG-1.0 through PNG-1.2 discourage the use of * any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them. * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG. */ png_write_chunk_data(png_ptr, (png_bytep)new_key, (png_size_t)(key_len + 1)); - /* set the compression flag */ + /* Set the compression flag */ if (compression == PNG_ITXT_COMPRESSION_NONE || \ compression == PNG_TEXT_COMPRESSION_NONE) cbuf[0] = 0; else /* compression == PNG_ITXT_COMPRESSION_zTXt */ cbuf[0] = 1; - /* set the compression method */ + /* Set the compression method */ cbuf[1] = 0; png_write_chunk_data(png_ptr, cbuf, (png_size_t)2); cbuf[0] = 0; @@ -1500,9 +1502,9 @@ } #endif #if defined(PNG_WRITE_oFFs_SUPPORTED) -/* write the oFFs chunk */ +/* Write the oFFs chunk */ void /* PRIVATE */ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset, int unit_type) { @@ -1522,9 +1524,9 @@ png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9); } #endif #if defined(PNG_WRITE_pCAL_SUPPORTED) -/* write the pCAL chunk (described in the PNG extensions document) */ +/* Write the pCAL chunk (described in the PNG extensions document) */ void /* PRIVATE */ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, png_charp units, png_charpp params) { @@ -1584,9 +1586,9 @@ } #endif #if defined(PNG_WRITE_sCAL_SUPPORTED) -/* write the sCAL chunk */ +/* Write the sCAL chunk */ #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) void /* PRIVATE */ png_write_sCAL(png_structp png_ptr, int unit, double width, double height) { @@ -1647,10 +1649,10 @@ return; } buf[0] = (png_byte)unit; - png_memcpy(buf + 1, width, wlen + 1); /* append the '\0' here */ - png_memcpy(buf + wlen + 2, height, hlen); /* do NOT append the '\0' here */ + png_memcpy(buf + 1, width, wlen + 1); /* Append the '\0' here */ + png_memcpy(buf + wlen + 2, height, hlen); /* Do NOT append the '\0' here */ png_debug1(3, "sCAL total length = %u", (unsigned int)total_len); png_write_chunk(png_ptr, (png_bytep)png_sCAL, buf, total_len); } @@ -1658,9 +1660,9 @@ #endif #endif #if defined(PNG_WRITE_pHYs_SUPPORTED) -/* write the pHYs chunk */ +/* Write the pHYs chunk */ void /* PRIVATE */ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, int unit_type) @@ -1713,26 +1715,26 @@ png_write_chunk(png_ptr, (png_bytep)png_tIME, buf, (png_size_t)7); } #endif -/* initializes the row writing capability of libpng */ +/* Initializes the row writing capability of libpng */ void /* PRIVATE */ png_write_start_row(png_structp png_ptr) { #ifdef PNG_WRITE_INTERLACING_SUPPORTED #ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - /* start of interlace block */ + /* Start of interlace block */ int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; - /* offset to next interlace block */ + /* Offset to next interlace block */ int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; - /* start of interlace block in the y direction */ + /* Start of interlace block in the y direction */ int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; - /* offset to next interlace block in the y direction */ + /* Offset to next interlace block in the y direction */ int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; #endif #endif @@ -1741,15 +1743,15 @@ png_debug(1, "in png_write_start_row"); buf_size = (png_size_t)(PNG_ROWBYTES( png_ptr->usr_channels*png_ptr->usr_bit_depth, png_ptr->width) + 1); - /* set up row buffer */ + /* Set up row buffer */ png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size); png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE; #ifndef PNG_NO_WRITE_FILTER - /* set up filtering buffer, if using this filter */ + /* Set up filtering buffer, if using this filter */ if (png_ptr->do_filter & PNG_FILTER_SUB) { png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)(png_ptr->rowbytes + 1)); @@ -1758,9 +1760,9 @@ /* We only need to keep the previous row if we are using one of these. */ if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) { - /* set up previous row buffer */ + /* Set up previous row buffer */ png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size); png_memset(png_ptr->prev_row, 0, buf_size); @@ -1787,9 +1789,9 @@ } #endif /* PNG_NO_WRITE_FILTER */ #ifdef PNG_WRITE_INTERLACING_SUPPORTED - /* if interlaced, we need to set up width and height of pass */ + /* If interlaced, we need to set up width and height of pass */ if (png_ptr->interlaced) { if (!(png_ptr->transformations & PNG_INTERLACE)) { @@ -1819,36 +1821,36 @@ png_write_finish_row(png_structp png_ptr) { #ifdef PNG_WRITE_INTERLACING_SUPPORTED #ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - /* start of interlace block */ + /* Start of interlace block */ int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; - /* offset to next interlace block */ + /* Offset to next interlace block */ int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; - /* start of interlace block in the y direction */ + /* Start of interlace block in the y direction */ int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; - /* offset to next interlace block in the y direction */ + /* Offset to next interlace block in the y direction */ int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; #endif #endif int ret; png_debug(1, "in png_write_finish_row"); - /* next row */ + /* Next row */ png_ptr->row_number++; - /* see if we are done */ + /* See if we are done */ if (png_ptr->row_number < png_ptr->num_rows) return; #ifdef PNG_WRITE_INTERLACING_SUPPORTED - /* if interlaced, go to next pass */ + /* If interlaced, go to next pass */ if (png_ptr->interlaced) { png_ptr->row_number = 0; if (png_ptr->transformations & PNG_INTERLACE) @@ -1856,9 +1858,9 @@ png_ptr->pass++; } else { - /* loop until we find a non-zero width or height pass */ + /* Loop until we find a non-zero width or height pass */ do { png_ptr->pass++; if (png_ptr->pass >= 7) @@ -1876,9 +1878,9 @@ } while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0); } - /* reset the row above the image for the next pass */ + /* Reset the row above the image for the next pass */ if (png_ptr->pass < 7) { if (png_ptr->prev_row != NULL) png_memset(png_ptr->prev_row, 0, @@ -1888,18 +1890,18 @@ } } #endif - /* if we get here, we've just written the last row, so we need + /* If we get here, we've just written the last row, so we need to flush the compressor */ do { - /* tell the compressor we are done */ + /* Tell the compressor we are done */ ret = deflate(&png_ptr->zstream, Z_FINISH); - /* check for an error */ + /* Check for an error */ if (ret == Z_OK) { - /* check to see if we need more room */ + /* Check to see if we need more room */ if (!(png_ptr->zstream.avail_out)) { png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); png_ptr->zstream.next_out = png_ptr->zbuf; @@ -1914,9 +1916,9 @@ png_error(png_ptr, "zlib error"); } } while (ret != Z_STREAM_END); - /* write any extra space */ + /* Write any extra space */ if (png_ptr->zstream.avail_out < png_ptr->zbuf_size) { png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size - png_ptr->zstream.avail_out); @@ -1937,26 +1939,26 @@ void /* PRIVATE */ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) { #ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - /* start of interlace block */ + /* Start of interlace block */ int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; - /* offset to next interlace block */ + /* Offset to next interlace block */ int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; #endif png_debug(1, "in png_do_write_interlace"); - /* we don't have to do anything on the last pass (6) */ + /* We don't have to do anything on the last pass (6) */ #if defined(PNG_USELESS_TESTS_SUPPORTED) if (row != NULL && row_info != NULL && pass < 6) #else if (pass < 6) #endif { - /* each pixel depth is handled separately */ + /* Each pixel depth is handled separately */ switch (row_info->pixel_depth) { case 1: { @@ -2065,29 +2067,29 @@ png_uint_32 i; png_uint_32 row_width = row_info->width; png_size_t pixel_bytes; - /* start at the beginning */ + /* Start at the beginning */ dp = row; - /* find out how many bytes each pixel takes up */ + /* Find out how many bytes each pixel takes up */ pixel_bytes = (row_info->pixel_depth >> 3); - /* loop through the row, only looking at the pixels that + /* Loop through the row, only looking at the pixels that matter */ for (i = png_pass_start[pass]; i < row_width; i += png_pass_inc[pass]) { - /* find out where the original pixel is */ + /* Find out where the original pixel is */ sp = row + (png_size_t)i * pixel_bytes; - /* move the pixel */ + /* Move the pixel */ if (dp != sp) png_memcpy(dp, sp, pixel_bytes); - /* next pixel */ + /* Next pixel */ dp += pixel_bytes; } break; } } - /* set new row width */ + /* Set new row width */ row_info->width = (row_info->width + png_pass_inc[pass] - 1 - png_pass_start[pass]) / png_pass_inc[pass]; @@ -2118,9 +2120,9 @@ int num_p_filters = (int)png_ptr->num_prev_filters; #endif png_debug(1, "in png_write_find_filter"); - /* find out how many bytes offset each pixel is */ + /* Find out how many bytes offset each pixel is */ bpp = (row_info->pixel_depth + 7) >> 3; prev_row = png_ptr->prev_row; #endif @@ -2205,11 +2207,11 @@ #endif mins = sum; } - /* sub filter */ + /* Sub filter */ if (filter_to_do == PNG_FILTER_SUB) - /* it's the only filter so no testing is needed */ + /* It's the only filter so no testing is needed */ { png_bytep rp, lp, dp; png_uint_32 i; for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp; @@ -2322,9 +2324,9 @@ best_row = png_ptr->sub_row; } } - /* up filter */ + /* Up filter */ if (filter_to_do == PNG_FILTER_UP) { png_bytep rp, dp, pp; png_uint_32 i; @@ -2425,9 +2427,9 @@ best_row = png_ptr->up_row; } } - /* avg filter */ + /* Avg filter */ if (filter_to_do == PNG_FILTER_AVG) { png_bytep rp, dp, pp, lp; png_uint_32 i; @@ -2728,40 +2730,40 @@ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) { png_debug(1, "in png_write_filtered_row"); png_debug1(2, "filter = %d", filtered_row[0]); - /* set up the zlib input buffer */ + /* Set up the zlib input buffer */ png_ptr->zstream.next_in = filtered_row; png_ptr->zstream.avail_in = (uInt)png_ptr->row_info.rowbytes + 1; - /* repeat until we have compressed all the data */ + /* Repeat until we have compressed all the data */ do { - int ret; /* return of zlib */ + int ret; /* Return of zlib */ - /* compress the data */ + /* Compress the data */ ret = deflate(&png_ptr->zstream, Z_NO_FLUSH); - /* check for compression errors */ + /* 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"); } - /* see if it is time to write another IDAT */ + /* See if it is time to write another IDAT */ if (!(png_ptr->zstream.avail_out)) { - /* write the IDAT and reset the zlib output buffer */ + /* Write the IDAT and reset the zlib output buffer */ png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; } - /* repeat until all data has been compressed */ + /* Repeat until all data has been compressed */ } while (png_ptr->zstream.avail_in); - /* swap the current and previous rows */ + /* Swap the current and previous rows */ if (png_ptr->prev_row != NULL) { png_bytep tptr; @@ -2769,9 +2771,9 @@ png_ptr->prev_row = png_ptr->row_buf; png_ptr->row_buf = tptr; } - /* finish row - updates counters and flushes zlib if last row */ + /* Finish row - updates counters and flushes zlib if last row */ png_write_finish_row(png_ptr); #if defined(PNG_WRITE_FLUSH_SUPPORTED) png_ptr->flush_rows++; diff -ru4NwbB libpng-1.2.36/scripts/CMakeLists.txt libpng-1.2.37beta03/scripts/CMakeLists.txt --- libpng-1.2.36/scripts/CMakeLists.txt 2009-05-07 11:05:35.005839376 -0500 +++ libpng-1.2.37beta03/scripts/CMakeLists.txt 2009-05-20 12:43:38.474923899 -0500 @@ -168,11 +168,11 @@ ${PNG_BINARY_DIR}/${PNGLIB_NAME}-config) # SET UP LINKS set_target_properties(${PNG_LIB_NAME} PROPERTIES -# VERSION 0.${PNGLIB_RELEASE}.1.2.37beta03 - VERSION 0.${PNGLIB_RELEASE}.0 - SOVERSION 0 +# VERSION %SONUM%.${PNGLIB_RELEASE}.1.2.37beta03 + VERSION %SONUM%.${PNGLIB_RELEASE}.0 + SOVERSION %SONUM% CLEAN_DIRECT_OUTPUT 1) if(NOT WIN32) # that's uncool on win32 - it overwrites our static import lib... set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES diff -ru4NwbB libpng-1.2.36/scripts/descrip.mms libpng-1.2.37beta03/scripts/descrip.mms --- libpng-1.2.36/scripts/descrip.mms 2001-01-05 18:22:09.000000000 -0600 +++ libpng-1.2.37beta03/scripts/descrip.mms 2009-05-02 06:37:23.002659000 -0500 @@ -28,9 +28,9 @@ test : pngtest.exe run pngtest clean : - delete *.obj;*,*.exe;* + delete *.obj;*,*.exe; # Other dependencies. png.obj : png.h, pngconf.h @@ -43,10 +43,10 @@ pngerror.obj : png.h, pngconf.h pngmem.obj : png.h, pngconf.h pngrio.obj : png.h, pngconf.h pngwio.obj : png.h, pngconf.h -pngtest.obj : png.h, pngconf.h pngtrans.obj : png.h, pngconf.h pngwrite.obj : png.h, pngconf.h pngwtran.obj : png.h, pngconf.h pngwutil.obj : png.h, pngconf.h +pngtest.obj : png.h, pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.32sunu libpng-1.2.37beta03/scripts/makefile.32sunu --- libpng-1.2.36/scripts/makefile.32sunu 2009-05-07 11:05:35.077420172 -0500 +++ libpng-1.2.37beta03/scripts/makefile.32sunu 2009-05-20 12:43:38.501190825 -0500 @@ -6,9 +6,9 @@ # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME=libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff -ru4NwbB libpng-1.2.36/scripts/makefile.64sunu libpng-1.2.37beta03/scripts/makefile.64sunu --- libpng-1.2.36/scripts/makefile.64sunu 2009-05-07 11:05:35.116146913 -0500 +++ libpng-1.2.37beta03/scripts/makefile.64sunu 2009-05-20 12:43:38.510819661 -0500 @@ -6,9 +6,9 @@ # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME=libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff -ru4NwbB libpng-1.2.36/scripts/makefile.aix libpng-1.2.37beta03/scripts/makefile.aix --- libpng-1.2.36/scripts/makefile.aix 2009-05-07 11:05:35.140525730 -0500 +++ libpng-1.2.37beta03/scripts/makefile.aix 2009-05-20 12:43:38.519724850 -0500 @@ -1,6 +1,6 @@ # makefile for libpng using gcc (generic, static library) -# Copyright (C) 2002, 2006, 2008 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006-2009 Glenn Randers-Pehrson # Copyright (C) 2000 Cosmin Truta # Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc) # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # For conditions of distribution and use, see copyright notice in png.h @@ -18,9 +18,9 @@ RM_F = rm -f LN_SF = ln -f -s LIBNAME=libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) prefix=/usr/local @@ -103,11 +103,11 @@ pngrio$(O): png.h pngconf.h pngrtran$(O): png.h pngconf.h pngrutil$(O): png.h pngconf.h pngset$(O): png.h pngconf.h -pngtest$(O): png.h pngconf.h pngtrans$(O): png.h pngconf.h pngwio$(O): png.h pngconf.h pngwrite$(O): png.h pngconf.h pngwtran$(O): png.h pngconf.h pngwutil$(O): png.h pngconf.h +pngtest$(O): png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.bc32 libpng-1.2.37beta03/scripts/makefile.bc32 --- libpng-1.2.36/scripts/makefile.bc32 2006-02-05 16:50:00.000000000 -0600 +++ libpng-1.2.37beta03/scripts/makefile.bc32 2009-05-02 08:08:28.610912000 -0500 @@ -110,27 +106,26 @@ test: pngtest.exe pngtest - ## Minor Targets -png.obj: png.c -pngerror.obj: pngerror.c -pngget.obj: pngget.c -pngmem.obj: pngmem.c -pngpread.obj: pngpread.c -pngread.obj: pngread.c -pngrio.obj: pngrio.c -pngrtran.obj: pngrtran.c -pngrutil.obj: pngrutil.c -pngset.obj: pngset.c -pngtrans.obj: pngtrans.c -pngwio.obj: pngwio.c -pngwrite.obj: pngwrite.c -pngwtran.obj: pngwtran.c -pngwutil.obj: pngwutil.c - +png.obj: png.c png.h pngconf.h +pngerror.obj: pngerror.c png.h pngconf.h +pngget.obj: pngget.c png.h pngconf.h +pngmem.obj: pngmem.c png.h pngconf.h +pngpread.obj: pngpread.c png.h pngconf.h +pngread.obj: pngread.c png.h pngconf.h +pngrio.obj: pngrio.c png.h pngconf.h +pngrtran.obj: pngrtran.c png.h pngconf.h +pngrutil.obj: pngrutil.c png.h pngconf.h +pngset.obj: pngset.c png.h pngconf.h +pngtrans.obj: pngtrans.c png.h pngconf.h +pngwio.obj: pngwio.c png.h pngconf.h +pngwrite.obj: pngwrite.c png.h pngconf.h +pngwtran.obj: pngwtran.c png.h pngconf.h +pngwutil.obj: pngwutil.c png.h pngconf.h +pngtest.obj: pngtest.c png.h pngconf.h $(LIBNAME): $(OBJS) -del $(LIBNAME) $(LIB) $(LIBNAME) @&&| diff -ru4NwbB libpng-1.2.36/scripts/makefile.beos libpng-1.2.37beta03/scripts/makefile.beos --- libpng-1.2.36/scripts/makefile.beos 2009-05-07 11:05:35.177653415 -0500 +++ libpng-1.2.37beta03/scripts/makefile.beos 2009-05-20 12:43:38.529256915 -0500 @@ -6,9 +6,9 @@ # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME=libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff -ru4NwbB libpng-1.2.36/scripts/makefile.bor libpng-1.2.37beta03/scripts/makefile.bor --- libpng-1.2.36/scripts/makefile.bor 2000-03-16 16:45:03.000000000 -0600 +++ libpng-1.2.37beta03/scripts/makefile.bor 2009-05-02 10:51:41.712455000 -0500 @@ -115,27 +114,25 @@ test: pngtest$(MODEL).exe pngtest$(MODEL) - ## Minor Targets -png.obj: png.c -pngerror.obj: pngerror.c -pngget.obj: pngget.c -pngmem.obj: pngmem.c -pngpread.obj: pngpread.c -pngread.obj: pngread.c -pngrio.obj: pngrio.c -pngrtran.obj: pngrtran.c -pngrutil.obj: pngrutil.c -pngset.obj: pngset.c -pngtrans.obj: pngtrans.c -pngwio.obj: pngwio.c -pngwrite.obj: pngwrite.c -pngwtran.obj: pngwtran.c -pngwutil.obj: pngwutil.c - +png.obj: png.c png.h pngconf.h +pngerror.obj: pngerror.c png.h pngconf.h +pngget.obj: pngget.c png.h pngconf.h +pngmem.obj: pngmem.c png.h pngconf.h +pngpread.obj: pngpread.c png.h pngconf.h +pngread.obj: pngread.c png.h pngconf.h +pngrio.obj: pngrio.c png.h pngconf.h +pngrtran.obj: pngrtran.c png.h pngconf.h +pngrutil.obj: pngrutil.c png.h pngconf.h +pngset.obj: pngset.c png.h pngconf.h +pngtrans.obj: pngtrans.c png.h pngconf.h +pngwio.obj: pngwio.c png.h pngconf.h +pngwrite.obj: pngwrite.c png.h pngconf.h +pngwtran.obj: pngwtran.c png.h pngconf.h +pngwutil.obj: pngwutil.c png.h pngconf.h $(LIBNAME): $(OBJS) -del $(LIBNAME) $(LIB) $(LIBNAME) @&&| diff -ru4NwbB libpng-1.2.36/scripts/makefile.cygwin libpng-1.2.37beta03/scripts/makefile.cygwin --- libpng-1.2.36/scripts/makefile.cygwin 2009-05-07 11:05:35.222456194 -0500 +++ libpng-1.2.37beta03/scripts/makefile.cygwin 2009-05-20 12:43:38.540743892 -0500 @@ -71,9 +71,9 @@ -W -Wall -O3 $(ALIGN) -funroll-loops -DPNG_NO_MMX_CODE \ -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% CYGDLL = %N% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) @@ -175,9 +175,9 @@ pngtest.pic.o: pngtest.c $(CC) $(CFLAGS) -c $< -o $@ -pngtest.o: pngtest.c +pngtest.o: pngtest.c png.h pngconf.h $(CC) $(CFLAGS) -c $< -o $@ test: test-static test-shared diff -ru4NwbB libpng-1.2.36/scripts/makefile.darwin libpng-1.2.37beta03/scripts/makefile.darwin --- libpng-1.2.36/scripts/makefile.darwin 2009-05-07 11:05:35.258629342 -0500 +++ libpng-1.2.37beta03/scripts/makefile.darwin 2009-05-20 12:43:38.551441092 -0500 @@ -17,9 +17,9 @@ ZLIBINC=../zlib # Library name: LIBNAME = libpng%N% -PNGMAJ = 12 +PNGMAJ = %N% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff -ru4NwbB libpng-1.2.36/scripts/makefile.dec libpng-1.2.37beta03/scripts/makefile.dec --- libpng-1.2.36/scripts/makefile.dec 2009-05-07 11:05:35.292373406 -0500 +++ libpng-1.2.37beta03/scripts/makefile.dec 2009-05-20 12:43:38.560958904 -0500 @@ -3,9 +3,9 @@ # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # For conditions of distribution and use, see copyright notice in png.h # Library name: -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) LIBNAME = libpng%N% @@ -204,11 +204,11 @@ pngget.o: png.h pngconf.h pngread.o: png.h pngconf.h pngrtran.o: png.h pngconf.h pngrutil.o: png.h pngconf.h -pngtest.o: png.h pngconf.h pngtrans.o: png.h pngconf.h pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h pngpread.o: png.h pngconf.h +pngtest.o: png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.dj2 libpng-1.2.37beta03/scripts/makefile.dj2 --- libpng-1.2.36/scripts/makefile.dj2 2002-04-19 18:53:16.000000000 -0500 +++ libpng-1.2.37beta03/scripts/makefile.dj2 2009-05-02 07:08:52.252064000 -0500 @@ -1,6 +1,6 @@ # DJGPP (DOS gcc) makefile for libpng -# Copyright (C) 2002 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006, 2009 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # For conditions of distribution and use, see copyright notice in png.h # where make install will put libpng.a and png.h @@ -46,10 +46,10 @@ pngread.o: png.h pngconf.h pngpread.o: png.h pngconf.h pngrtran.o: png.h pngconf.h pngrutil.o: png.h pngconf.h -pngtest.o: png.h pngconf.h pngtrans.o: png.h pngconf.h pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h +pngtest.o: png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.elf libpng-1.2.37beta03/scripts/makefile.elf --- libpng-1.2.36/scripts/makefile.elf 2009-05-07 11:05:35.331377881 -0500 +++ libpng-1.2.37beta03/scripts/makefile.elf 2009-05-20 12:43:38.570817505 -0500 @@ -11,9 +11,9 @@ # * versioned symbols # Library name: LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff -ru4NwbB libpng-1.2.36/scripts/makefile.freebsd libpng-1.2.37beta03/scripts/makefile.freebsd --- libpng-1.2.36/scripts/makefile.freebsd 2007-06-20 17:10:26.000000000 -0500 +++ libpng-1.2.37beta03/scripts/makefile.freebsd 2009-05-20 12:43:38.318393221 -0500 @@ -1,6 +1,6 @@ # makefile for libpng under FreeBSD -# Copyright (C) 2002, 2007 Glenn Randers-Pehrson and Andrey A. Chernov +# Copyright (C) 2002, 2007, 2009 Glenn Randers-Pehrson and Andrey A. Chernov # For conditions of distribution and use, see copyright notice in png.h PREFIX?= /usr/local SHLIB_VER?= 5 diff -ru4NwbB libpng-1.2.36/scripts/makefile.gcc libpng-1.2.37beta03/scripts/makefile.gcc --- libpng-1.2.36/scripts/makefile.gcc 2008-08-02 07:20:59.000000000 -0500 +++ libpng-1.2.37beta03/scripts/makefile.gcc 2009-05-02 07:47:42.552494000 -0500 @@ -70,11 +70,11 @@ pngrio$(O): png.h pngconf.h pngrtran$(O): png.h pngconf.h pngrutil$(O): png.h pngconf.h pngset$(O): png.h pngconf.h -pngtest$(O): png.h pngconf.h pngtrans$(O): png.h pngconf.h pngwio$(O): png.h pngconf.h pngwrite$(O): png.h pngconf.h pngwtran$(O): png.h pngconf.h pngwutil$(O): png.h pngconf.h +pngtest$(O): png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.gcmmx libpng-1.2.37beta03/scripts/makefile.gcmmx --- libpng-1.2.36/scripts/makefile.gcmmx 2009-05-07 11:05:35.371605209 -0500 +++ libpng-1.2.37beta03/scripts/makefile.gcmmx 2009-05-20 12:43:38.580609755 -0500 @@ -12,9 +12,9 @@ # the background! Context switches between MMX and FPU are expensive. # Library name: LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff -ru4NwbB libpng-1.2.36/scripts/makefile.hp64 libpng-1.2.37beta03/scripts/makefile.hp64 --- libpng-1.2.36/scripts/makefile.hp64 2009-05-07 11:05:35.407502147 -0500 +++ libpng-1.2.37beta03/scripts/makefile.hp64 2009-05-20 12:43:38.590077766 -0500 @@ -1,6 +1,6 @@ # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product. -# Copyright (C) 1999-2002 Glenn Randers-Pehrson +# Copyright (C) 1999-2002, 2006, 2009 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42 # contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard # For conditions of distribution and use, see copyright notice in png.h @@ -16,9 +16,9 @@ # SHAREDLIB=libz.sl # Library name: LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -226,10 +226,11 @@ pngget.o: png.h pngconf.h pngread.o: png.h pngconf.h pngrtran.o: png.h pngconf.h pngrutil.o: png.h pngconf.h -pngtest.o: png.h pngconf.h pngtrans.o: png.h pngconf.h pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h pngpread.o: png.h pngconf.h + +pngtest.o: png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.hpgcc libpng-1.2.37beta03/scripts/makefile.hpgcc --- libpng-1.2.36/scripts/makefile.hpgcc 2009-05-07 11:05:35.444122831 -0500 +++ libpng-1.2.37beta03/scripts/makefile.hpgcc 2009-05-20 12:43:38.599741349 -0500 @@ -6,9 +6,9 @@ # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff -ru4NwbB libpng-1.2.36/scripts/makefile.hpux libpng-1.2.37beta03/scripts/makefile.hpux --- libpng-1.2.36/scripts/makefile.hpux 2009-05-07 11:05:35.479516593 -0500 +++ libpng-1.2.37beta03/scripts/makefile.hpux 2009-05-20 12:43:38.610782806 -0500 @@ -16,9 +16,9 @@ # SHAREDLIB=libz.sl # Library name: LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -223,10 +223,11 @@ pngget.o: png.h pngconf.h pngread.o: png.h pngconf.h pngrtran.o: png.h pngconf.h pngrutil.o: png.h pngconf.h -pngtest.o: png.h pngconf.h pngtrans.o: png.h pngconf.h pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h pngpread.o: png.h pngconf.h + +pngtest.o: png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.ibmc libpng-1.2.37beta03/scripts/makefile.ibmc --- libpng-1.2.36/scripts/makefile.ibmc 2001-06-11 08:06:30.000000000 -0500 +++ libpng-1.2.37beta03/scripts/makefile.ibmc 2009-05-02 07:49:25.491276000 -0500 @@ -1,6 +1,7 @@ # Makefile for libpng (static) # IBM C version 3.x for Win32 and OS/2 +# Copyright (C) 2006 Glenn Randers-Pehrson # Copyright (C) 2000 Cosmin Truta # For conditions of distribution and use, see copyright notice in png.h # Notes: # Derived from makefile.std @@ -62,10 +63,11 @@ pngrio$(O): png.h pngconf.h pngrtran$(O): png.h pngconf.h pngrutil$(O): png.h pngconf.h pngset$(O): png.h pngconf.h -pngtest$(O): png.h pngconf.h pngtrans$(O): png.h pngconf.h pngwio$(O): png.h pngconf.h pngwrite$(O): png.h pngconf.h pngwtran$(O): png.h pngconf.h pngwutil$(O): png.h pngconf.h + +pngtest$(O): png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.intel libpng-1.2.37beta03/scripts/makefile.intel --- libpng-1.2.36/scripts/makefile.intel 2007-09-01 09:31:06.000000000 -0500 +++ libpng-1.2.37beta03/scripts/makefile.intel 2009-05-02 07:55:10.402399000 -0500 @@ -1,13 +1,15 @@ # Makefile for libpng # Microsoft Visual C++ with Intel C/C++ Compiler 4.0 and later +# Copyright (C) 2006 Glenn Randers-Pehrson # Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is # copyright 1995 Guy Eric Schalnat, Group 42, Inc. # For conditions of distribution and use, see copyright notice in png.h # To use, do "nmake /f scripts\makefile.intel" +# ------------------- Intel C/C++ Compiler 4.0 and later ------------------- # Where the zlib library and include files are located ZLIBLIB=..\zlib ZLIBINC=..\zlib @@ -72,11 +73,8 @@ pngwio$(O): png.h pngconf.h $(CC) $(CFLAGS) $*.c $(ERRFILE) -pngtest$(O): png.h pngconf.h - $(CC) $(CFLAGS) $*.c $(ERRFILE) - pngtrans$(O): png.h pngconf.h $(CC) $(CFLAGS) $*.c $(ERRFILE) pngwrite$(O): png.h pngconf.h @@ -94,8 +92,11 @@ pngtest.exe: pngtest.obj libpng.lib $(LD) $(LDFLAGS) /OUT:pngtest.exe pngtest.obj libpng.lib $(ZLIBLIB)\zlib.lib +pngtest$(O): png.h pngconf.h + $(CC) $(CFLAGS) $*.c $(ERRFILE) + test: pngtest.exe pngtest.exe diff -ru4NwbB libpng-1.2.36/scripts/makefile.knr libpng-1.2.37beta03/scripts/makefile.knr --- libpng-1.2.36/scripts/makefile.knr 2006-02-25 06:37:26.000000000 -0600 +++ libpng-1.2.37beta03/scripts/makefile.knr 2009-05-02 07:07:06.451133000 -0500 @@ -1,6 +1,6 @@ # makefile for libpng -# Copyright (C) 2002 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006, 2009 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # For conditions of distribution and use, see copyright notice in png.h # This makefile requires the file ansi2knr.c, which you can get @@ -57,9 +57,9 @@ test: pngtest ./pngtest -install: libpng.a +install: libpng.a png.h pngconf.h -@mkdir $(DESTDIR)$(INCPATH) -@mkdir $(DESTDIR)$(INCPATH)/libpng -@mkdir $(DESTDIR)$(LIBPATH) -@rm -f $(DESTDIR)$(INCPATH)/png.h @@ -91,9 +91,10 @@ pngread.o: png.h pngconf.h pngpread.o: png.h pngconf.h pngrtran.o: png.h pngconf.h pngrutil.o: png.h pngconf.h -pngtest.o: png.h pngconf.h pngtrans.o: png.h pngconf.h pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h + +pngtest.o: png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.linux libpng-1.2.37beta03/scripts/makefile.linux --- libpng-1.2.36/scripts/makefile.linux 2009-05-07 11:05:35.517470776 -0500 +++ libpng-1.2.37beta03/scripts/makefile.linux 2009-05-20 12:43:38.621890164 -0500 @@ -5,9 +5,9 @@ # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff -ru4NwbB libpng-1.2.36/scripts/makefile.mingw libpng-1.2.37beta03/scripts/makefile.mingw --- libpng-1.2.36/scripts/makefile.mingw 2009-05-07 11:05:35.566497753 -0500 +++ libpng-1.2.37beta03/scripts/makefile.mingw 2009-05-20 12:43:38.633175815 -0500 @@ -71,9 +71,9 @@ -W -Wall -O3 $(ALIGN) -funroll-loops -DPNG_NO_MMX_CODE \ -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% MINGDLL = %N% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) diff -ru4NwbB libpng-1.2.36/scripts/makefile.mips libpng-1.2.37beta03/scripts/makefile.mips --- libpng-1.2.36/scripts/makefile.mips 2006-02-25 06:37:32.000000000 -0600 +++ libpng-1.2.37beta03/scripts/makefile.mips 2009-05-02 05:29:55.009730000 -0500 @@ -75,9 +75,10 @@ pngread.o: png.h pngconf.h pngpread.o: png.h pngconf.h pngrtran.o: png.h pngconf.h pngrutil.o: png.h pngconf.h -pngtest.o: png.h pngconf.h pngtrans.o: png.h pngconf.h pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h + +pngtest.o: png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.msc libpng-1.2.37beta03/scripts/makefile.msc --- libpng-1.2.36/scripts/makefile.msc 2001-01-05 18:24:59.000000000 -0600 +++ libpng-1.2.37beta03/scripts/makefile.msc 2009-05-02 06:57:28.494695000 -0500 @@ -1,6 +1,7 @@ # makefile for libpng # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. +# Copyright (C) 2006, 2009 Glenn Randers-Pehrson # For conditions of distribution and use, see copyright notice in png.h # Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib # -------- Microsoft C 5.1 and later, does not use assembler code -------- @@ -54,11 +55,8 @@ pngwio$(O): png.h pngconf.h $(CC) -c $(CFLAGS) $*.c $(ERRFILE) -pngtest$(O): png.h pngconf.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - pngtrans$(O): png.h pngconf.h $(CC) -c $(CFLAGS) $*.c $(ERRFILE) pngwrite$(O): png.h pngconf.h @@ -75,8 +73,11 @@ lib libpng $(OBJS1); lib libpng $(OBJS2); lib libpng $(OBJS3); +pngtest$(O): png.h pngconf.h + $(CC) -c $(CFLAGS) $*.c $(ERRFILE) + pngtest.exe: pngtest.obj libpng.lib $(LD) $(LDFLAGS) pngtest.obj,,,libpng.lib ..\zlib\zlib.lib ; test: pngtest.exe diff -ru4NwbB libpng-1.2.36/scripts/makefile.ne12bsd libpng-1.2.37beta03/scripts/makefile.ne12bsd --- libpng-1.2.36/scripts/makefile.ne12bsd 2009-05-07 11:05:35.586465610 -0500 +++ libpng-1.2.37beta03/scripts/makefile.ne12bsd 2009-05-20 12:43:38.643182418 -0500 @@ -1,9 +1,9 @@ # makefile for libpng for NetBSD for the standard # make obj && make depend && make && make test # make includes && make install # Copyright (C) 2002 Patrick R.L. Welche -# Copyright (C) 2007 Glenn Randers-Pehrson +# Copyright (C) 2007, 2009 Glenn Randers-Pehrson # For conditions of distribution and use, see copyright notice in png.h # You should also run makefile.netbsd @@ -11,9 +11,9 @@ LIBDIR= ${LOCALBASE}/lib MANDIR= ${LOCALBASE}/man INCSDIR=${LOCALBASE}/include/libpng%N% -LIB= png12 +LIB= png%N% SHLIB_MAJOR= 0 SHLIB_MINOR= 1.2.37beta03 SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ @@ -22,9 +22,10 @@ MAN= libpng.3 libpngpf.3 png.5 CPPFLAGS+=-I${.CURDIR} -# something like this for mmx assembler, but it core dumps for me at the moment +# We should be able to do something like this instead of the manual +# uncommenting, but it core dumps for me at the moment: # .if ${MACHINE_ARCH} == "i386" # CPPFLAGS+=-DPNG_THREAD_UNSAFE_OK # MKLINT= no # .else diff -ru4NwbB libpng-1.2.36/scripts/makefile.netbsd libpng-1.2.37beta03/scripts/makefile.netbsd --- libpng-1.2.36/scripts/makefile.netbsd 2009-05-07 11:05:35.605892719 -0500 +++ libpng-1.2.37beta03/scripts/makefile.netbsd 2009-05-20 12:43:38.653030691 -0500 @@ -1,9 +1,9 @@ # makefile for libpng for NetBSD for the standard # make obj && make depend && make && make test # make includes && make install # Copyright (C) 2002 Patrick R.L. Welche -# Copyright (C) 2007 Glenn Randers-Pehrson +# Copyright (C) 2007, 2009 Glenn Randers-Pehrson # For conditions of distribution and use, see copyright notice in png.h # You should also run makefile.ne0bsd @@ -22,9 +22,10 @@ MAN= libpng.3 libpngpf.3 png.5 CPPFLAGS+=-I${.CURDIR} -# something like this for mmx assembler, but it core dumps for me at the moment +# We should be able to do something like this instead of the manual +# uncommenting, but it core dumps for me at the moment: # .if ${MACHINE_ARCH} == "i386" # CPPFLAGS+=-DPNG_THREAD_UNSAFE_OK # MKLINT= no # .else diff -ru4NwbB libpng-1.2.36/scripts/makefile.nommx libpng-1.2.37beta03/scripts/makefile.nommx --- libpng-1.2.36/scripts/makefile.nommx 2009-05-07 11:05:35.643285812 -0500 +++ libpng-1.2.37beta03/scripts/makefile.nommx 2009-05-20 12:43:38.664382911 -0500 @@ -5,9 +5,9 @@ # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -232,21 +232,21 @@ chmod a-w *.[ch35] $(DOCS) scripts/* # DO NOT DELETE THIS LINE -- make depend depends on it. -png.o png.pic.o: png.h pngconf.h -pngerror.o pngerror.pic.o: png.h pngconf.h -pngrio.o pngrio.pic.o: png.h pngconf.h -pngwio.o pngwio.pic.o: png.h pngconf.h -pngmem.o pngmem.pic.o: png.h pngconf.h -pngset.o pngset.pic.o: png.h pngconf.h -pngget.o pngget.pic.o: png.h pngconf.h -pngread.o pngread.pic.o: png.h pngconf.h -pngrtran.o pngrtran.pic.o: png.h pngconf.h -pngrutil.o pngrutil.pic.o: png.h pngconf.h -pngtrans.o pngtrans.pic.o: png.h pngconf.h -pngwrite.o pngwrite.pic.o: png.h pngconf.h -pngwtran.o pngwtran.pic.o: png.h pngconf.h -pngwutil.o pngwutil.pic.o: png.h pngconf.h -pngpread.o pngpread.pic.o: png.h pngconf.h +png.o png.pic.o: png.h pngconf.h png.c +pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c +pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c +pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c +pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.c +pngset.o pngset.pic.o: png.h pngconf.h pngset.c +pngget.o pngget.pic.o: png.h pngconf.h pngget.c +pngread.o pngread.pic.o: png.h pngconf.h pngread.c +pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c +pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c +pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c +pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c +pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c +pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c +pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c -pngtest.o: png.h pngconf.h +pngtest.o: png.h pngconf.h pngtest.c diff -ru4NwbB libpng-1.2.36/scripts/makefile.sco libpng-1.2.37beta03/scripts/makefile.sco --- libpng-1.2.36/scripts/makefile.sco 2009-05-07 11:05:35.710547306 -0500 +++ libpng-1.2.37beta03/scripts/makefile.sco 2009-05-20 12:43:38.685675403 -0500 @@ -7,9 +7,9 @@ # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff -ru4NwbB libpng-1.2.36/scripts/makefile.sggcc libpng-1.2.37beta03/scripts/makefile.sggcc --- libpng-1.2.36/scripts/makefile.sggcc 2009-05-07 11:05:35.746660561 -0500 +++ libpng-1.2.37beta03/scripts/makefile.sggcc 2009-05-20 12:43:38.696559695 -0500 @@ -4,9 +4,9 @@ # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME=libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -211,12 +211,10 @@ -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` ./pngtesti pngtest.png clean: - $(RM_F) libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \ - $(LIBSO) $(LIBSOMAJ)* \ - $(OLDSOVER) \ - so_locations + $(RM_F) libpng.a pngtest pngtesti pngout.png libpng.pc \ + so_locations libpng-config $(LIBSO) $(LIBSOMAJ)* $(OLDSOVER) DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO writelock: chmod a-w *.[ch35] $(DOCS) scripts/* @@ -232,11 +230,11 @@ pngget.o: png.h pngconf.h pngread.o: png.h pngconf.h pngrtran.o: png.h pngconf.h pngrutil.o: png.h pngconf.h -pngtest.o: png.h pngconf.h pngtrans.o: png.h pngconf.h pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h pngpread.o: png.h pngconf.h +pngtest.o: png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.sgi libpng-1.2.37beta03/scripts/makefile.sgi --- libpng-1.2.36/scripts/makefile.sgi 2009-05-07 11:05:35.783019670 -0500 +++ libpng-1.2.37beta03/scripts/makefile.sgi 2009-05-20 12:43:38.707584752 -0500 @@ -4,9 +4,9 @@ # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME=libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -235,11 +235,11 @@ pngget.o: png.h pngconf.h pngread.o: png.h pngconf.h pngrtran.o: png.h pngconf.h pngrutil.o: png.h pngconf.h -pngtest.o: png.h pngconf.h pngtrans.o: png.h pngconf.h pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h pngpread.o: png.h pngconf.h +pngtest.o: png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.so9 libpng-1.2.37beta03/scripts/makefile.so9 --- libpng-1.2.36/scripts/makefile.so9 2009-05-07 11:05:35.823450009 -0500 +++ libpng-1.2.37beta03/scripts/makefile.so9 2009-05-20 12:43:38.717185085 -0500 @@ -6,9 +6,9 @@ # Copyright (C) 1996-1997 Andreas Dilger # For conditions of distribution and use, see copyright notice in png.h # Library name: -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) LIBNAME = libpng%N% diff -ru4NwbB libpng-1.2.36/scripts/makefile.solaris libpng-1.2.37beta03/scripts/makefile.solaris --- libpng-1.2.36/scripts/makefile.solaris 2009-05-07 11:05:35.863017950 -0500 +++ libpng-1.2.37beta03/scripts/makefile.solaris 2009-05-20 12:43:38.728373447 -0500 @@ -6,9 +6,9 @@ # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -42,10 +42,9 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ -Wmissing-declarations -Wtraditional -Wcast-align \ -Wstrict-prototypes -Wmissing-prototypes #-Wconversion -CFLAGS=-I$(ZLIBINC) -W -Wall -O \ - -DPNG_NO_MMX_CODE; \ +CFLAGS=-I$(ZLIBINC) -W -Wall -O -DPNG_NO_MMX_CODE; \ # $(WARNMORE) -g -DPNG_DEBUG=5 LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng%N% -lz -lm INCPATH=$(prefix)/include diff -ru4NwbB libpng-1.2.36/scripts/makefile.solaris-x86 libpng-1.2.37beta03/scripts/makefile.solaris-x86 --- libpng-1.2.36/scripts/makefile.solaris-x86 2009-05-07 11:05:35.912167987 -0500 +++ libpng-1.2.37beta03/scripts/makefile.solaris-x86 2009-05-20 12:43:38.737902217 -0500 @@ -6,9 +6,9 @@ # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME = libpng%N% -PNGMAJ = 0 +PNGMAJ = %SONUM% PNGMIN = 1.2.37beta03 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff -ru4NwbB libpng-1.2.36/scripts/makefile.std libpng-1.2.37beta03/scripts/makefile.std --- libpng-1.2.36/scripts/makefile.std 2006-03-06 11:06:28.000000000 -0600 +++ libpng-1.2.37beta03/scripts/makefile.std 2009-05-02 05:23:52.763211000 -0500 @@ -82,11 +82,11 @@ pngget.o: png.h pngconf.h pngread.o: png.h pngconf.h pngrtran.o: png.h pngconf.h pngrutil.o: png.h pngconf.h -pngtest.o: png.h pngconf.h pngtrans.o: png.h pngconf.h pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h pngpread.o: png.h pngconf.h +pngtest.o: png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.sunos libpng-1.2.37beta03/scripts/makefile.sunos --- libpng-1.2.36/scripts/makefile.sunos 2006-03-08 12:34:28.000000000 -0600 +++ libpng-1.2.37beta03/scripts/makefile.sunos 2009-05-02 05:31:09.828282000 -0500 @@ -87,11 +87,11 @@ pngget.o: png.h pngconf.h pngread.o: png.h pngconf.h pngrtran.o: png.h pngconf.h pngrutil.o: png.h pngconf.h -pngtest.o: png.h pngconf.h pngtrans.o: png.h pngconf.h pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h pngpread.o: png.h pngconf.h +pngtest.o: png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/makefile.vcawin32 libpng-1.2.37beta03/scripts/makefile.vcawin32 --- libpng-1.2.36/scripts/makefile.vcawin32 2007-09-01 09:32:54.000000000 -0500 +++ libpng-1.2.37beta03/scripts/makefile.vcawin32 2009-05-20 12:43:38.422093526 -0500 @@ -1,18 +1,19 @@ # makefile for libpng +# Copyright (C) 2006,2009 Glenn Randers-Pehrson # Copyright (C) 1998 Tim Wegner # For conditions of distribution and use, see copyright notice in png.h # Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib # To use, do "nmake /f scripts\makefile.vcawin32" -# -------- Microsoft Visual C++ 5.0 and later, uses assembler code -------- +# -------- Microsoft Visual C++ 2.0 and later, no assembler code -------- # If you don't want to use assembler (MMX) code, use makefile.vcwin32 instead. # Compiler, linker, librarian, and other tools CC = cl LD = link AR = lib -CFLAGS = -DPNG_USE_PNGVCRD -nologo -MD -O2 -W3 -I..\zlib +CFLAGS = -nologo -DPNG_USE_PNGVCRD -MD -O2 -W3 -I..\zlib LDFLAGS = -nologo ARFLAGS = -nologo RM = del @@ -63,11 +64,8 @@ pngwio$(O): png.h pngconf.h $(CC) -c $(CFLAGS) $*.c $(ERRFILE) -pngtest$(O): png.h pngconf.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - pngtrans$(O): png.h pngconf.h $(CC) -c $(CFLAGS) $*.c $(ERRFILE) pngwrite$(O): png.h pngconf.h @@ -82,8 +80,11 @@ libpng.lib: $(OBJS) -$(RM) $@ $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(ERRFILE) +pngtest$(O): png.h pngconf.h + $(CC) -c $(CFLAGS) $*.c $(ERRFILE) + pngtest.exe: pngtest$(O) libpng.lib $(LD) $(LDFLAGS) -out:$@ pngtest$(O) libpng.lib ..\zlib\zlib.lib $(ERRFILE) test: pngtest.exe diff -ru4NwbB libpng-1.2.36/scripts/makefile.vcwin32 libpng-1.2.37beta03/scripts/makefile.vcwin32 --- libpng-1.2.36/scripts/makefile.vcwin32 2007-06-19 14:08:25.000000000 -0500 +++ libpng-1.2.37beta03/scripts/makefile.vcwin32 2009-05-20 12:43:38.430475134 -0500 @@ -1,6 +1,7 @@ # makefile for libpng # Copyright (C) 1998 Tim Wegner +# Copyright (C) 2006,2009 Glenn Randers-Pehrson # For conditions of distribution and use, see copyright notice in png.h # Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib # To use, do "nmake /f scripts\makefile.vcwin32" @@ -63,11 +64,8 @@ pngwio$(O): png.h pngconf.h $(CC) -c $(CFLAGS) $*.c $(ERRFILE) -pngtest$(O): png.h pngconf.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - pngtrans$(O): png.h pngconf.h $(CC) -c $(CFLAGS) $*.c $(ERRFILE) pngwrite$(O): png.h pngconf.h @@ -82,8 +80,11 @@ libpng.lib: $(OBJS) -$(RM) $@ $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(ERRFILE) +pngtest$(O): png.h pngconf.h + $(CC) -c $(CFLAGS) $*.c $(ERRFILE) + pngtest.exe: pngtest$(O) libpng.lib $(LD) $(LDFLAGS) -out:$@ pngtest$(O) libpng.lib ..\zlib\zlib.lib $(ERRFILE) test: pngtest.exe diff -ru4NwbB libpng-1.2.36/scripts/makevms.com libpng-1.2.37beta03/scripts/makevms.com --- libpng-1.2.36/scripts/makevms.com 2001-01-12 13:12:19.000000000 -0600 +++ libpng-1.2.37beta03/scripts/makevms.com 2009-05-02 05:28:28.713098000 -0500 @@ -54,10 +54,8 @@ $ then $ dele pngtest.obj;* $ CALL MAKE png.OBJ "cc ''CCOPT' png" - png.c png.h pngconf.h -$ CALL MAKE pngpread.OBJ "cc ''CCOPT' pngpread" - - pngpread.c png.h pngconf.h $ CALL MAKE pngset.OBJ "cc ''CCOPT' pngset" - pngset.c png.h pngconf.h $ CALL MAKE pngget.OBJ "cc ''CCOPT' pngget" - pngget.c png.h pngconf.h diff -ru4NwbB libpng-1.2.36/scripts/pngw32.def libpng-1.2.37beta03/scripts/pngw32.def --- libpng-1.2.36/scripts/pngw32.def 2009-05-07 11:05:35.983818694 -0500 +++ libpng-1.2.37beta03/scripts/pngw32.def 2009-05-20 12:43:38.759676377 -0500 @@ -188,8 +188,9 @@ png_set_invalid @173 ; Added at version 1.0.12 ; For compatibility with 1.0.7-1.0.11 ; png_info_init @174 +; png_read_init_3, png_info_init_3, and png_write_init_3 are deprecated. png_read_init_3 @175 png_write_init_3 @176 png_info_init_3 @177 png_destroy_struct @178