diff --git a/ANNOUNCE b/ANNOUNCE index c366e8e28..c1e80eb67 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.0.6e - April 10, 2000 +Libpng 1.0.6f - April 14, 2000 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -15,7 +15,7 @@ version 1.0.6d [April 8, 2000] Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file Added a check for info_ptr->free_me&PNG_FREE_TEXT when free'ing text in png.c Simplify png_sig_bytes() function to remove use of non-ISO-C strdup(). -version 1.0.6e [April 10, 2000] +version 1.0.6f [April 14, 2000] Added png_data_freer() function. In the code that checks for over-length tRNS chunks, added check of info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann) diff --git a/CHANGES b/CHANGES index aca90850a..8a4be2df2 100644 --- a/CHANGES +++ b/CHANGES @@ -669,7 +669,7 @@ version 1.0.6d [April 7, 2000] Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file Added a check for info_ptr->free_me&PNG_FREE_TEXT when free'ing text in png.c Simplify png_sig_bytes() function to remove use of non-ISO-C strdup(). -version 1.0.6e [April 10, 2000] +version 1.0.6e [April 9, 2000] Added png_data_freer() function. In the code that checks for over-length tRNS chunks, added check of info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann) @@ -680,6 +680,13 @@ version 1.0.6e [April 10, 2000] is defined. Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c and mentioned the purposes of the two macros in libpng.txt/libpng.3. +version 1.0.6f [April 14, 2000] + Revised png_set_iCCP() and png_set_rows() to avoid prematurely freeing data. + Add checks in png_set_text() for NULL members of the input text structure. + Revised libpng.txt/libpng.3. + Removed superfluous prototype for png_set_itxt from png.h + Removed "else" from pngread.c, after png_error(), and changed "0" to "length". + Changed several png_errors about malformed ancillary chunks to png_warnings. Send comments/corrections/commendations to png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu diff --git a/INSTALL b/INSTALL index 9ae03524d..d065df937 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ -Installing libpng version 1.0.6e - April 10, 2000 +Installing libpng version 1.0.6f - April 14, 2000 Before installing libpng, you must first install zlib. zlib can usually be found wherever you got libpng. zlib can be @@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the version of zlib that's installed. You can rename the directories that you downloaded (they -might be called "libpng-1.0.6e" or "lpng106" and "zlib-1.1.3" +might be called "libpng-1.0.6f" or "lpng106" and "zlib-1.1.3" or "zlib113") so that you have directories called "zlib" and "libpng". Your directory structure should look like this: @@ -47,8 +47,8 @@ The files that are presently available in the scripts directory include makefile.std => Generic UNIX makefile (cc, creates static libpng.a) - makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6e) - makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6e, + makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6f) + makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6f, uses assembler code tuned for Intel MMX platform) makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.knr => Archaic UNIX Makefile that converts files with @@ -59,9 +59,9 @@ include makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static) libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) - makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6e) + makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6f) makefile.sunos => Sun makefile - makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6e) + makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6f) makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.mips => MIPS makefile makefile.acorn => Acorn makefile diff --git a/LICENSE b/LICENSE index 4915ddaf8..c474ec34c 100644 --- a/LICENSE +++ b/LICENSE @@ -5,7 +5,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. Copyright (c) 1996, 1997 Andreas Dilger (libpng versions 0.90, December 1996, through 0.96, May 1997) Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson -(libpng versions 0.97, January 1998, through 1.0.6e, April 10, 2000) +(libpng versions 0.97, January 1998, through 1.0.6f, April 14, 2000) For the purposes of this copyright and license, "Contributing Authors" is defined as the following set of individuals: @@ -68,4 +68,4 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson randeg@alum.rpi.edu -April 10, 2000 +April 14, 2000 diff --git a/README b/README index 46c57726e..359886db4 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for libpng 1.0.6e - April 10, 2000 (shared library 2.1) +README for libpng 1.0.6f - April 14, 2000 (shared library 2.1) See the note about version numbers near the top of png.h See INSTALL for instructions on how to install libpng. @@ -172,9 +172,9 @@ Files in this distribution: descrip.mms => VMS makefile for MMS or MMK makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.linux => Linux/ELF makefile - (gcc, creates libpng.so.2.1.0.6e) + (gcc, creates libpng.so.2.1.0.6f) makefile.gcmmx => Linux/ELF makefile (gcc, creates - libpng.so.2.1.0.6e, uses assembler code + libpng.so.2.1.0.6f, uses assembler code tuned for Intel MMX platform) makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.knr => Archaic UNIX Makefile that converts files with @@ -185,10 +185,10 @@ Files in this distribution: makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static) libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) - makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6e) + makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6f) makefile.sunos => Sun makefile makefile.solaris => Solaris 2.X makefile - (gcc, creates libpng.so.2.1.0.6e) + (gcc, creates libpng.so.2.1.0.6f) makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.mips => MIPS makefile makefile.acorn => Acorn makefile diff --git a/Y2KINFO b/Y2KINFO index d676175a9..03fe8950f 100644 --- a/Y2KINFO +++ b/Y2KINFO @@ -1,13 +1,13 @@ Y2K compliance in libpng: ========================= - April 10, 2000 + April 14, 2000 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and - upward through 1.0.6e are Y2K compliant. It is my belief that earlier + upward through 1.0.6f are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has three year fields. One is a 2-byte unsigned integer diff --git a/configure b/configure index 916cc3559..3ecaa4d43 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ echo " - There is no \"configure\" script for Libpng-1.0.6e. Instead, please + There is no \"configure\" script for Libpng-1.0.6f. Instead, please copy the appropriate makefile for your system from the \"scripts\" directory. Read the INSTALL file for more details. " diff --git a/contrib/gregbook/makefile b/contrib/gregbook/makefile new file mode 100644 index 000000000..500f74f70 --- /dev/null +++ b/contrib/gregbook/makefile @@ -0,0 +1,104 @@ +# Sample makefile for rpng-x / rpng2-x / wpng using gcc and make. +# Greg Roelofs +# Last modified: 28 February 2000 +# +# The programs built by this makefile are described in the book, +# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and +# Associates, 1999). Go buy a copy, eh? Buy some for friends +# and family, too. (Not that this is a blatant plug or anything.) +# +# Invoke this makefile from a shell prompt in the usual way; for example: +# +# make -f Makefile.unx +# +# This makefile assumes libpng and zlib have already been built or downloaded +# and are both installed in /usr/local/{include,lib} (as indicated by the +# PNG* and Z* macros below). Edit as appropriate--choose only ONE each of +# the PNGINC, PNGLIB, ZINC and ZLIB lines. +# +# This makefile builds statically linked executables (against libpng and zlib, +# that is), but that can be changed by uncommenting the appropriate PNGLIB and +# ZLIB lines. + + +# macros -------------------------------------------------------------------- + +PNGINC = -I/usr/local/include +#PNGLIB = -L/usr/local/lib -lpng # dynamically linked against libpng +PNGLIB = /usr/local/lib/libpng.a # statically linked against libpng +# or: +#PNGINC = -I../.. +#PNGLIB = -L../.. -lpng +#PNGLIB = ../../libpng.a + +ZINC = -I/usr/local/include +#ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib +ZLIB = /usr/local/lib/libz.a # statically linked against zlib +#ZINC = -I../zlib +#ZLIB = -L../zlib -lz +#ZLIB = ../../../zlib/libz.a + +XINC = -I/usr/include/X11 # old-style, stock X distributions +XLIB = -L/usr/lib/X11 -lX11 +#XINC = -I/usr/openwin/include/X11 # Sun workstations (OpenWindows) +#XLIB = -L/usr/openwin/lib -lX11 +#XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.) +#XLIB = -L/usr/X11R6/lib -lX11 + +INCS = $(PNGINC) $(ZINC) $(XINC) +RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm +WLIBS = $(PNGLIB) $(ZLIB) + +CC = cc -n32 +LD = cc -n32 +RM = rm -f +CFLAGS = -O -fullwarn $(INCS) +# [note that -Wall is a gcc-specific compilation flag ("most warnings on")] +# [-ansi, -pedantic and -W can also be used] +LDFLAGS = +O = .o +E = + +RPNG = rpng-x +RPNG2 = rpng2-x +WPNG = wpng + +ROBJS = $(RPNG)$(O) readpng$(O) +ROBJS2 = $(RPNG2)$(O) readpng2$(O) +WOBJS = $(WPNG)$(O) writepng$(O) + +EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E) + + +# implicit make rules ------------------------------------------------------- + +.c$(O): + $(CC) -c $(CFLAGS) $< + + +# dependencies -------------------------------------------------------------- + +all: $(EXES) + +$(RPNG)$(E): $(ROBJS) + $(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS) + +$(RPNG2)$(E): $(ROBJS2) + $(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS) + +$(WPNG)$(E): $(WOBJS) + $(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS) + +$(RPNG)$(O): $(RPNG).c readpng.h +$(RPNG2)$(O): $(RPNG2).c readpng2.h +$(WPNG)$(O): $(WPNG).c writepng.h + +readpng$(O): readpng.c readpng.h +readpng2$(O): readpng2.c readpng2.h +writepng$(O): writepng.c writepng.h + + +# maintenance --------------------------------------------------------------- + +clean: + $(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS) diff --git a/contrib/gregbook/rpng-x b/contrib/gregbook/rpng-x new file mode 100755 index 000000000..ad371c8f3 Binary files /dev/null and b/contrib/gregbook/rpng-x differ diff --git a/contrib/gregbook/rpng2-x b/contrib/gregbook/rpng2-x new file mode 100755 index 000000000..25f22e576 Binary files /dev/null and b/contrib/gregbook/rpng2-x differ diff --git a/contrib/gregbook/wpng b/contrib/gregbook/wpng new file mode 100755 index 000000000..2037f752e Binary files /dev/null and b/contrib/gregbook/wpng differ diff --git a/libpng.3 b/libpng.3 index e6c7c6fb4..6300b86bc 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "April 10, 2000" +.TH LIBPNG 3 "April 14, 2000" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6e +libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6f .SH SYNOPSIS \fI\fB @@ -713,7 +713,7 @@ Following is a copy of the libpng.txt file that accompanies libpng. .SH LIBPNG.TXT libpng.txt - A description on how to use and modify libpng - libpng version 1.0.6e - April 10, 2000 + libpng version 1.0.6f - April 14, 2000 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson @@ -831,10 +831,10 @@ You will want to do the I/O initialization(*) before you get into libpng, so if it doesn't work, you don't have much to undo. Of course, you will also want to insure that you are, in fact, dealing with a PNG file. Libpng provides a simple check to see if a file is a PNG file. -To use it, pass in the first 1 to 8 bytes of the file, and it will -return true or false (1 or 0) depending on whether the bytes could be -part of a PNG file. Of course, the more bytes you pass in, the -greater the accuracy of the prediction. +To use it, pass in the first 1 to 8 bytes of the file to the function +png_sig_cmp(), and it will return 0 if the bytes match the corresponding +bytes of the PNG signature, or nonzero otherwise. Of course, the more bytes +you pass in, the greater the accuracy of the prediction. If you are intending to keep the file pointer open for use in libpng, you must ensure you don't read more than 8 bytes from the beginning @@ -1205,7 +1205,7 @@ into the info_ptr is returned for any complex types. png_get_hIST(png_ptr, info_ptr, &hist); (PNG_INFO_hIST) hist - histogram of palette (array of - png_color_16) + png_uint_16) png_get_tIME(png_ptr, info_ptr, &mod_time); mod_time - time image was last modified @@ -1221,26 +1221,34 @@ into the info_ptr is returned for any complex types. num_comments - number of comments text_ptr - array of png_text holding image comments - text_ptr[i]->compression - type of compression used + text_ptr[i].compression - type of compression used on "text" PNG_TEXT_COMPRESSION_NONE PNG_TEXT_COMPRESSION_zTXt PNG_ITXT_COMPRESSION_NONE PNG_ITXT_COMPRESSION_zTXt - text_ptr[i]->key - keyword for comment. - text_ptr[i]->text - text comments for current - keyword. - text_ptr[i]->text_length - length of text string, + text_ptr[i].key - keyword for comment. Must contain + 1-79 characters. + text_ptr[i].text - text comments for current + keyword. Can empty. + text_ptr[i].text_length - length of text string, after decompression, 0 for iTXt - text_ptr[i]->itxt_length - length of itxt string, + text_ptr[i].itxt_length - length of itxt string, after decompression, 0 for tEXt/zTXt - text_ptr[i]->lang - language of comment (NULL for unknown). - text_ptr[i]->translated_keyword - keyword in UTF-8 (NULL - for unknown). + text_ptr[i].lang - language of comment (empty + string for unknown). + text_ptr[i].translated_keyword - keyword in UTF-8 + (empty string for unknown). num_text - number of comments (same as num_comments; you can put NULL here to avoid the duplication) - num_spalettes = png_get_spalettes(png_ptr, info_ptr, &palette_ptr); - palette_ptr - array of png_spalette structures holding contents - of one or more sPLT chunks read. + Note while png_set_text() will accept text, language, and + translated keywords that can be NULL pointers, the structure + returned by png_get_text will always contain regular + zero-terminated C strings. They might be empty strings but + they will never be NULL pointers. + + num_spalettes = png_get_sPLT(png_ptr, info_ptr, &palette_ptr); + palette_ptr - array of palette structures holding + contents of one or more sPLT chunks read. num_spalettes - number of sPLT chunks read. png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, @@ -1261,9 +1269,16 @@ into the info_ptr is returned for any complex types. PNG_RESOLUTION_METER png_get_sCAL(png_ptr, info_ptr, &unit, &width, &height) - unit - physical scale units (a string) + unit - physical scale units (an integer) width - width of a pixel in physical scale units height - height of a pixel in physical scale units + (width and height are doubles) + + png_get_sCAL_s(png_ptr, info_ptr, &unit, &width, &height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are strings like "2.54") num_unknown_chunks = png_get_unknown_chunks(png_ptr, info_ptr, &unknowns) @@ -1271,9 +1286,12 @@ into the info_ptr is returned for any complex types. unknown chunks unknowns[i].name - name of unknown chunk unknowns[i].data - data of unknown chunk - unknowns[i].size - size of unknown chunk + unknowns[i].size - size of unknown chunk's data unknowns[i].location - position of chunk in file + The value of "i" corresponds to the order in which the chunks were read + from the PNG file or inserted with the png_set_unknown_chunks() function. + The data from the pHYs chunk can be retrieved in several convenient forms: @@ -1283,6 +1301,12 @@ forms: info_ptr) res_x_and_y = png_get_pixels_per_meter(png_ptr, info_ptr) + res_x = png_get_x_pixels_per_inch(png_ptr, + info_ptr) + res_y = png_get_y_pixels_per_inch(png_ptr, + info_ptr) + res_x_and_y = png_get_pixels_per_inch(png_ptr, + info_ptr) aspect_ratio = png_get_pixel_aspect_ratio(png_ptr, info_ptr) @@ -1290,6 +1314,18 @@ forms: the data is not present or if res_x is 0; res_x_and_y is 0 if res_x != res_y) +The data from the oFFs chunk can be retrieved in several convenient +forms: + + x_offset = png_get_x_offset_microns(png_ptr, info_ptr); + y_offset = png_get_y_offset_microns(png_ptr, info_ptr); + x_offset = png_get_x_offset_inches(png_ptr, info_ptr); + y_offset = png_get_y_offset_inches(png_ptr, info_ptr); + + (Each of these returns 0 [signifying "unknown" if both + x and y are 0] if the data is not present or if the chunk + is present but the unit is the pixel) + For more information, see the png_info definition in png.h and the PNG specification for chunk contents. Be careful with trusting rowbytes, as some of the transformations could increase the space @@ -1310,7 +1346,8 @@ trailing spaces, but non-consecutive spaces are allowed within the keyword. It is possible to have the same keyword any number of times. The text_ptr is an array of png_text structures, each holding a pointer to a language string, a pointer to a keyword and a pointer to -a text string. Only the text string may be null. The keyword/text +a text string. The text string, language code, and translated +keyword may be empty or NULL pointers. The keyword/text pairs are put into the array in the order that they are received. However, some or all of the text chunks may be after the image, so, to make sure you have read all the text chunks, don't mess with these @@ -1728,8 +1765,8 @@ a single row_pointer instead of an array of row_pointers: png_bytep row_pointer = row; png_read_row(png_ptr, row_pointers, NULL); -If the file is interlaced (info_ptr->interlace_type != 0), things get -somewhat harder. The only current (PNG Specification version 1.2) +If the file is interlaced (interlace_type != 0 in the IHDR chunk), things +get somewhat harder. The only current (PNG Specification version 1.2) interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7) is a somewhat complicated 2D interlace scheme, known as Adam7, that breaks down an image into seven smaller images of varying size, based @@ -2076,7 +2113,7 @@ both "png_ptr"; you can call them anything you like, such as If you want to use your own memory allocation routines, define PNG_USER_MEM_SUPPORTED and use -png_create_write_struct_2() instead of png_create_read_struct(): +png_create_write_struct_2() instead of png_create_write_struct(): png_structp png_ptr = png_create_write_struct_2 (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, @@ -2291,7 +2328,7 @@ Some of the more important parts of the png_info are: png_set_hIST(png_ptr, info_ptr, hist); (PNG_INFO_hIST) hist - histogram of palette (array of - png_color_16) + png_uint_16) png_set_tIME(png_ptr, info_ptr, mod_time); mod_time - time image was last modified @@ -2303,26 +2340,29 @@ Some of the more important parts of the png_info are: png_set_text(png_ptr, info_ptr, text_ptr, num_text); text_ptr - array of png_text holding image comments - text_ptr[i]->compression - type of compression used + text_ptr[i].compression - type of compression used on "text" PNG_TEXT_COMPRESSION_NONE PNG_TEXT_COMPRESSION_zTXt PNG_ITXT_COMPRESSION_NONE PNG_ITXT_COMPRESSION_zTXt - text_ptr[i]->key - keyword for comment. - text_ptr[i]->text - text comments for current - keyword. - text_ptr[i]->text_length - length of text string, + text_ptr[i].key - keyword for comment. Must contain + 1-79 characters. + text_ptr[i].text - text comments for current + keyword. Can be NULL or empty. + text_ptr[i].text_length - length of text string, after decompression, 0 for iTXt - text_ptr[i]->itxt_length - length of itxt string, + text_ptr[i].itxt_length - length of itxt string, after decompression, 0 for tEXt/zTXt - text_ptr[i]->lang - language of comment (NULL for unknown). - text_ptr[i]->translated_keyword - keyword in UTF-8 (NULL - for unknown). + text_ptr[i].lang - language of comment (NULL or + empty for unknown). + text_ptr[i].translated_keyword - keyword in UTF-8 (NULL + or empty for unknown). num_text - number of comments - png_set_spalettes(png_ptr, info_ptr, &palette_ptr, num_spalettes); - palette_ptr - array of png_spalette structures to be added to - the list of palettes in the info structure. + png_set_sPLT(png_ptr, info_ptr, &palette_ptr, num_spalettes); + palette_ptr - array of png_sPLT_struct structures to be + added to the list of palettes in the info + structure. num_spalettes - number of palette structures to be added. png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, @@ -2343,16 +2383,23 @@ Some of the more important parts of the png_info are: PNG_RESOLUTION_METER png_set_sCAL(png_ptr, info_ptr, unit, width, height) - unit - physical scale units (a string) + unit - physical scale units (an integer) width - width of a pixel in physical scale units height - height of a pixel in physical scale units + (width and height are doubles) + + png_set_sCAL_s(png_ptr, info_ptr, unit, width, height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are strings like "2.54") png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, num_unknowns) unknowns - array of png_unknown_chunk structures holding unknown chunks unknowns[i].name - name of unknown chunk unknowns[i].data - data of unknown chunk - unknowns[i].size - size of unknown chunk + unknowns[i].size - size of unknown chunk's data unknowns[i].location - position to write chunk in file 0: do not write chunk PNG_HAVE_IHDR: before PLTE @@ -2361,7 +2408,11 @@ Some of the more important parts of the png_info are: The "location" member is set automatically according to what part of the output file has already been written. You can change its value after calling png_set_unknown_chunks() - as demonstrated in pngtest.c. + as demonstrated in pngtest.c. Within each of the "locations", + the chunks are sequenced according to their position in the + structure (that is, the value of "i", which is the order in which + the chunk was either read from the input file or defined with + png_set_unknown_chunks). A quick word about text and num_text. text is an array of png_text structures. num_text is the number of valid structures in the array. @@ -3157,13 +3208,13 @@ the old method. .SH VII. Y2K Compliance in libpng -April 10, 2000 +April 14, 2000 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.0.6e are Y2K compliant. It is my belief that earlier +upward through 1.0.6f are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has three year fields. One is a 2-byte unsigned integer that @@ -3304,7 +3355,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.0.6e - April 10, 2000: +Libpng version 1.0.6f - April 14, 2000: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu). @@ -3319,7 +3370,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. Copyright (c) 1996, 1997 Andreas Dilger (libpng versions 0.89c, May 1996, through 0.96, May 1997) Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson -(libpng versions 0.97, January 1998, through 1.0.6e, April 10, 2000) +(libpng versions 0.97, January 1998, through 1.0.6f, April 14, 2000) For the purposes of this copyright and license, "Contributing Authors" is defined as the following set of individuals: diff --git a/libpng.txt b/libpng.txt index 5a8643ed1..749cc2b0e 100644 --- a/libpng.txt +++ b/libpng.txt @@ -1,6 +1,6 @@ libpng.txt - A description on how to use and modify libpng - libpng version 1.0.6e - April 10, 2000 + libpng version 1.0.6f - April 14, 2000 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson @@ -118,10 +118,10 @@ You will want to do the I/O initialization(*) before you get into libpng, so if it doesn't work, you don't have much to undo. Of course, you will also want to insure that you are, in fact, dealing with a PNG file. Libpng provides a simple check to see if a file is a PNG file. -To use it, pass in the first 1 to 8 bytes of the file, and it will -return true or false (1 or 0) depending on whether the bytes could be -part of a PNG file. Of course, the more bytes you pass in, the -greater the accuracy of the prediction. +To use it, pass in the first 1 to 8 bytes of the file to the function +png_sig_cmp(), and it will return 0 if the bytes match the corresponding +bytes of the PNG signature, or nonzero otherwise. Of course, the more bytes +you pass in, the greater the accuracy of the prediction. If you are intending to keep the file pointer open for use in libpng, you must ensure you don't read more than 8 bytes from the beginning @@ -492,7 +492,7 @@ into the info_ptr is returned for any complex types. png_get_hIST(png_ptr, info_ptr, &hist); (PNG_INFO_hIST) hist - histogram of palette (array of - png_color_16) + png_uint_16) png_get_tIME(png_ptr, info_ptr, &mod_time); mod_time - time image was last modified @@ -508,26 +508,34 @@ into the info_ptr is returned for any complex types. num_comments - number of comments text_ptr - array of png_text holding image comments - text_ptr[i]->compression - type of compression used + text_ptr[i].compression - type of compression used on "text" PNG_TEXT_COMPRESSION_NONE PNG_TEXT_COMPRESSION_zTXt PNG_ITXT_COMPRESSION_NONE PNG_ITXT_COMPRESSION_zTXt - text_ptr[i]->key - keyword for comment. - text_ptr[i]->text - text comments for current - keyword. - text_ptr[i]->text_length - length of text string, + text_ptr[i].key - keyword for comment. Must contain + 1-79 characters. + text_ptr[i].text - text comments for current + keyword. Can empty. + text_ptr[i].text_length - length of text string, after decompression, 0 for iTXt - text_ptr[i]->itxt_length - length of itxt string, + text_ptr[i].itxt_length - length of itxt string, after decompression, 0 for tEXt/zTXt - text_ptr[i]->lang - language of comment (NULL for unknown). - text_ptr[i]->translated_keyword - keyword in UTF-8 (NULL - for unknown). + text_ptr[i].lang - language of comment (empty + string for unknown). + text_ptr[i].translated_keyword - keyword in UTF-8 + (empty string for unknown). num_text - number of comments (same as num_comments; you can put NULL here to avoid the duplication) - num_spalettes = png_get_spalettes(png_ptr, info_ptr, &palette_ptr); - palette_ptr - array of png_spalette structures holding contents - of one or more sPLT chunks read. + Note while png_set_text() will accept text, language, and + translated keywords that can be NULL pointers, the structure + returned by png_get_text will always contain regular + zero-terminated C strings. They might be empty strings but + they will never be NULL pointers. + + num_spalettes = png_get_sPLT(png_ptr, info_ptr, &palette_ptr); + palette_ptr - array of palette structures holding + contents of one or more sPLT chunks read. num_spalettes - number of sPLT chunks read. png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, @@ -548,9 +556,16 @@ into the info_ptr is returned for any complex types. PNG_RESOLUTION_METER png_get_sCAL(png_ptr, info_ptr, &unit, &width, &height) - unit - physical scale units (a string) + unit - physical scale units (an integer) width - width of a pixel in physical scale units height - height of a pixel in physical scale units + (width and height are doubles) + + png_get_sCAL_s(png_ptr, info_ptr, &unit, &width, &height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are strings like "2.54") num_unknown_chunks = png_get_unknown_chunks(png_ptr, info_ptr, &unknowns) @@ -558,9 +573,12 @@ into the info_ptr is returned for any complex types. unknown chunks unknowns[i].name - name of unknown chunk unknowns[i].data - data of unknown chunk - unknowns[i].size - size of unknown chunk + unknowns[i].size - size of unknown chunk's data unknowns[i].location - position of chunk in file + The value of "i" corresponds to the order in which the chunks were read + from the PNG file or inserted with the png_set_unknown_chunks() function. + The data from the pHYs chunk can be retrieved in several convenient forms: @@ -570,6 +588,12 @@ forms: info_ptr) res_x_and_y = png_get_pixels_per_meter(png_ptr, info_ptr) + res_x = png_get_x_pixels_per_inch(png_ptr, + info_ptr) + res_y = png_get_y_pixels_per_inch(png_ptr, + info_ptr) + res_x_and_y = png_get_pixels_per_inch(png_ptr, + info_ptr) aspect_ratio = png_get_pixel_aspect_ratio(png_ptr, info_ptr) @@ -577,6 +601,18 @@ forms: the data is not present or if res_x is 0; res_x_and_y is 0 if res_x != res_y) +The data from the oFFs chunk can be retrieved in several convenient +forms: + + x_offset = png_get_x_offset_microns(png_ptr, info_ptr); + y_offset = png_get_y_offset_microns(png_ptr, info_ptr); + x_offset = png_get_x_offset_inches(png_ptr, info_ptr); + y_offset = png_get_y_offset_inches(png_ptr, info_ptr); + + (Each of these returns 0 [signifying "unknown" if both + x and y are 0] if the data is not present or if the chunk + is present but the unit is the pixel) + For more information, see the png_info definition in png.h and the PNG specification for chunk contents. Be careful with trusting rowbytes, as some of the transformations could increase the space @@ -597,7 +633,8 @@ trailing spaces, but non-consecutive spaces are allowed within the keyword. It is possible to have the same keyword any number of times. The text_ptr is an array of png_text structures, each holding a pointer to a language string, a pointer to a keyword and a pointer to -a text string. Only the text string may be null. The keyword/text +a text string. The text string, language code, and translated +keyword may be empty or NULL pointers. The keyword/text pairs are put into the array in the order that they are received. However, some or all of the text chunks may be after the image, so, to make sure you have read all the text chunks, don't mess with these @@ -1015,8 +1052,8 @@ a single row_pointer instead of an array of row_pointers: png_bytep row_pointer = row; png_read_row(png_ptr, row_pointers, NULL); -If the file is interlaced (info_ptr->interlace_type != 0), things get -somewhat harder. The only current (PNG Specification version 1.2) +If the file is interlaced (interlace_type != 0 in the IHDR chunk), things +get somewhat harder. The only current (PNG Specification version 1.2) interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7) is a somewhat complicated 2D interlace scheme, known as Adam7, that breaks down an image into seven smaller images of varying size, based @@ -1363,7 +1400,7 @@ both "png_ptr"; you can call them anything you like, such as If you want to use your own memory allocation routines, define PNG_USER_MEM_SUPPORTED and use -png_create_write_struct_2() instead of png_create_read_struct(): +png_create_write_struct_2() instead of png_create_write_struct(): png_structp png_ptr = png_create_write_struct_2 (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, @@ -1578,7 +1615,7 @@ Some of the more important parts of the png_info are: png_set_hIST(png_ptr, info_ptr, hist); (PNG_INFO_hIST) hist - histogram of palette (array of - png_color_16) + png_uint_16) png_set_tIME(png_ptr, info_ptr, mod_time); mod_time - time image was last modified @@ -1590,26 +1627,29 @@ Some of the more important parts of the png_info are: png_set_text(png_ptr, info_ptr, text_ptr, num_text); text_ptr - array of png_text holding image comments - text_ptr[i]->compression - type of compression used + text_ptr[i].compression - type of compression used on "text" PNG_TEXT_COMPRESSION_NONE PNG_TEXT_COMPRESSION_zTXt PNG_ITXT_COMPRESSION_NONE PNG_ITXT_COMPRESSION_zTXt - text_ptr[i]->key - keyword for comment. - text_ptr[i]->text - text comments for current - keyword. - text_ptr[i]->text_length - length of text string, + text_ptr[i].key - keyword for comment. Must contain + 1-79 characters. + text_ptr[i].text - text comments for current + keyword. Can be NULL or empty. + text_ptr[i].text_length - length of text string, after decompression, 0 for iTXt - text_ptr[i]->itxt_length - length of itxt string, + text_ptr[i].itxt_length - length of itxt string, after decompression, 0 for tEXt/zTXt - text_ptr[i]->lang - language of comment (NULL for unknown). - text_ptr[i]->translated_keyword - keyword in UTF-8 (NULL - for unknown). + text_ptr[i].lang - language of comment (NULL or + empty for unknown). + text_ptr[i].translated_keyword - keyword in UTF-8 (NULL + or empty for unknown). num_text - number of comments - png_set_spalettes(png_ptr, info_ptr, &palette_ptr, num_spalettes); - palette_ptr - array of png_spalette structures to be added to - the list of palettes in the info structure. + png_set_sPLT(png_ptr, info_ptr, &palette_ptr, num_spalettes); + palette_ptr - array of png_sPLT_struct structures to be + added to the list of palettes in the info + structure. num_spalettes - number of palette structures to be added. png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, @@ -1630,16 +1670,23 @@ Some of the more important parts of the png_info are: PNG_RESOLUTION_METER png_set_sCAL(png_ptr, info_ptr, unit, width, height) - unit - physical scale units (a string) + unit - physical scale units (an integer) width - width of a pixel in physical scale units height - height of a pixel in physical scale units + (width and height are doubles) + + png_set_sCAL_s(png_ptr, info_ptr, unit, width, height) + unit - physical scale units (an integer) + width - width of a pixel in physical scale units + height - height of a pixel in physical scale units + (width and height are strings like "2.54") png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, num_unknowns) unknowns - array of png_unknown_chunk structures holding unknown chunks unknowns[i].name - name of unknown chunk unknowns[i].data - data of unknown chunk - unknowns[i].size - size of unknown chunk + unknowns[i].size - size of unknown chunk's data unknowns[i].location - position to write chunk in file 0: do not write chunk PNG_HAVE_IHDR: before PLTE @@ -1648,7 +1695,11 @@ Some of the more important parts of the png_info are: The "location" member is set automatically according to what part of the output file has already been written. You can change its value after calling png_set_unknown_chunks() - as demonstrated in pngtest.c. + as demonstrated in pngtest.c. Within each of the "locations", + the chunks are sequenced according to their position in the + structure (that is, the value of "i", which is the order in which + the chunk was either read from the input file or defined with + png_set_unknown_chunks). A quick word about text and num_text. text is an array of png_text structures. num_text is the number of valid structures in the array. @@ -2444,13 +2495,13 @@ the old method. VII. Y2K Compliance in libpng -April 10, 2000 +April 14, 2000 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.0.6e are Y2K compliant. It is my belief that earlier +upward through 1.0.6f are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has three year fields. One is a 2-byte unsigned integer that diff --git a/libpngpf.3 b/libpngpf.3 index 0844b6d2b..b9852ba16 100644 --- a/libpngpf.3 +++ b/libpngpf.3 @@ -1,6 +1,6 @@ -.TH LIBPNGPF 3 April 10, 2000 +.TH LIBPNGPF 3 April 14, 2000 .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6e +libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6f (private functions) .SH SYNOPSIS \fB#include \fP diff --git a/png.5 b/png.5 index 979a68fe9..3faa08a01 100644 --- a/png.5 +++ b/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "April 10, 2000" +.TH PNG 5 "April 14, 2000" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION diff --git a/png.c b/png.c index bd17cec12..f84227502 100644 --- a/png.c +++ b/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * libpng version 1.0.6e - April 10, 2000 + * libpng version 1.0.6f - April 14, 2000 * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson @@ -14,14 +14,14 @@ #include "png.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_0_6e Your_png_h_is_not_version_1_0_6e; +typedef version_1_0_6f Your_png_h_is_not_version_1_0_6f; /* Version information for C files. This had better match the version * string defined in png.h. */ #ifdef PNG_USE_GLOBAL_ARRAYS /* png_libpng_ver was changed to a function in version 1.0.5c */ -char png_libpng_ver[12] = "1.0.6e"; +char png_libpng_ver[12] = "1.0.6f"; /* png_sig was changed to a function in version 1.0.5c */ /* Place to hold the signature string for a PNG file. */ @@ -561,7 +561,7 @@ png_charp png_get_copyright(png_structp png_ptr) { if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */ - return ("\n libpng version 1.0.6e - April 10, 2000\n\ + return ("\n libpng version 1.0.6f - April 14, 2000\n\ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\ Copyright (c) 1996, 1997 Andreas Dilger\n\ Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson\n"); @@ -579,8 +579,8 @@ png_get_libpng_ver(png_structp png_ptr) { /* Version of *.c files used when building libpng */ if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ - return("1.0.6e"); - return("1.0.6e"); + return("1.0.6f"); + return("1.0.6f"); } png_charp diff --git a/png.h b/png.h index 6312e702e..d4b90758c 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.0.6e - April 10, 2000 + * libpng version 1.0.6f - April 14, 2000 * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson @@ -9,7 +9,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.0.6e - April 10, 2000: Glenn + * libpng versions 0.97, January 1998, through 1.0.6f - April 14, 2000: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -47,7 +47,7 @@ * 1.0.5e-r 1.0.5e-r 10100 2.1.0.5e-r (not compatible) * 1.0.5s-v 1.0.5s-v 10006 2.1.0.5s-v (compatible) * 1.0.6 (+ 3 patches) 1.0.6 10006 2.1.0.6 - * 1.0.6d-e 1.0.6d-e 10007 2.1.0.6d-e + * 1.0.6d-f 1.0.6d-f 10007 2.1.0.6d-f * 1.0.7 1.0.7 10007 2.1.0.7 (still compatible) * * Henceforth the source version will match the shared-library minor @@ -73,7 +73,7 @@ * Copyright (c) 1996, 1997 Andreas Dilger * (libpng versions 0.89c, June 1996, through 0.96, May 1997) * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson - * (libpng versions 0.97, January 1998, through 1.0.6e, April 10, 2000) + * (libpng versions 0.97, January 1998, through 1.0.6f, April 14, 2000) * * For the purposes of this copyright and license, "Contributing Authors" * is defined as the following set of individuals: @@ -148,13 +148,13 @@ * Y2K compliance in libpng: * ========================= * - * April 10, 2000 + * April 14, 2000 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.0.6e are Y2K compliant. It is my belief that earlier + * upward through 1.0.6f are Y2K compliant. It is my belief that earlier * versions were also Y2K compliant. * * Libpng only has three year fields. One is a 2-byte unsigned integer @@ -232,7 +232,7 @@ extern "C" { */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.0.6e" +#define PNG_LIBPNG_VER_STRING "1.0.6f" /* Careful here. At one time, Guy wanted to use 082, but that would be octal. * We must not include leading zeros. @@ -323,12 +323,17 @@ typedef struct png_sPLT_entry_struct typedef png_sPLT_entry FAR * png_sPLT_entryp; typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp; +/* When the depth of the sPLT palette is 8 bits, the color and alpha samples + * occupy the LSB of their respective members, and the MSB of each member + * is zero-filled. The frequency member always occupies the full 16 bits. + */ + typedef struct png_sPLT_struct { - png_charp name; /* palette name */ - png_byte depth; /* depth of palette samples */ - png_sPLT_entryp entries; /* palette entries */ - png_int_32 nentries; /* number of palette entries */ + png_charp name; /* palette name */ + png_byte depth; /* depth of palette samples */ + png_sPLT_entryp entries; /* palette entries */ + png_int_32 nentries; /* number of palette entries */ } png_sPLT_t; typedef png_sPLT_t FAR * png_sPLT_tp; typedef png_sPLT_t FAR * FAR * png_sPLT_tpp; @@ -336,21 +341,28 @@ typedef png_sPLT_t FAR * FAR * png_sPLT_tpp; #ifdef PNG_TEXT_SUPPORTED /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file, * and whether that contents is compressed or not. The "key" field - * points to a regular C string. */ + * points to a regular zero-terminated C string. The "text", "lang", and + * "lang_key" fields can be regular C strings, empty strings, or NULL pointers. + * However, the * structure returned by png_get_text() will always contain + * regular zero-terminated C strings (possibly empty), never NULL pointers, + * so they can be safely used in printf() and other string-handling functions. + */ typedef struct png_text_struct { - int compression; /* compression value: - -1: tEXt, none - 0: zTXt, deflate - 1: iTXt, none - 2: iTXt, deflate */ + int compression; /* compression value: + -1: tEXt, none + 0: zTXt, deflate + 1: iTXt, none + 2: iTXt, deflate */ png_charp key; /* keyword, 1-79 character description of "text" */ - png_charp text; /* comment, may be an empty string (ie "") */ + png_charp text; /* comment, may be an empty string (ie "") + or a NULL pointer */ png_size_t text_length; /* length of the text string */ png_size_t itxt_length; /* length of the itxt string */ - png_charp lang; /* language code, 1-79 characters */ + png_charp lang; /* language code, 0-79 characters + or a NULL pointer */ png_charp lang_key; /* keyword translated UTF-8 string, 0 or more - chars */ + chars or a NULL pointer */ } png_text; typedef png_text FAR * png_textp; typedef png_text FAR * FAR * png_textpp; @@ -1061,9 +1073,9 @@ struct png_struct_def }; /* This prevents a compiler error in png_get_copyright() in png.c if png.c -and png.h are both at * version 1.0.6e +and png.h are both at * version 1.0.6f */ -typedef png_structp version_1_0_6e; +typedef png_structp version_1_0_6f; typedef png_struct FAR * FAR * png_structpp; @@ -1910,18 +1922,20 @@ extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr, png_infop info_ptr, png_sPLT_tp entries, int nentries)); #endif -#if defined(PNG_TEXT_SUPPORTED) -extern PNG_EXPORT(void,png_set_itxt) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_textp text_ptr, int num_text)); -#endif - #if defined(PNG_READ_TEXT_SUPPORTED) -/* Old interface; apps should use png_get_itxt instead */ /* png_get_text also returns the number of text chunks in *num_text */ extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, int *num_text)); #endif +/* + * Note while png_set_text() will accept a structure whose text, + * language, and translated keywords are NULL pointers, the structure + * returned by png_get_text will always contain regular + * zero-terminated C strings. They might be empty strings but + * they will never be NULL pointers. + */ + #if defined(PNG_TEXT_SUPPORTED) extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, int num_text)); @@ -2044,7 +2058,7 @@ extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr) extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.0.6e - April 10, 2000 (header)\n" + " libpng version 1.0.6f - April 14, 2000 (header)\n" #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED /* With these routines we avoid an integer divide, which will be slower on diff --git a/pngasmrd.h b/pngasmrd.h index 200347ea5..e17994b25 100644 --- a/pngasmrd.h +++ b/pngasmrd.h @@ -1,6 +1,6 @@ /* pngasmrd.h - assembler version of utilities to read a PNG file * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1999, 2000 Glenn Randers-Pehrson * diff --git a/pngconf.h b/pngconf.h index 508dbb360..ded827a39 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngerror.c b/pngerror.c index 2d2e04c00..fd606c0a7 100644 --- a/pngerror.c +++ b/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pnggccrd.c b/pnggccrd.c index b816ada78..a85ffcd5d 100644 --- a/pnggccrd.c +++ b/pnggccrd.c @@ -6,7 +6,7 @@ * and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm * for Intel's performance analysis of the MMX vs. non-MMX code. * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson diff --git a/pngget.c b/pngget.c index ba2c647e5..c250e5ec0 100644 --- a/pngget.c +++ b/pngget.c @@ -1,7 +1,7 @@ /* pngget.c - retrieval of values from info struct * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngmem.c b/pngmem.c index c290fd6c9..0cfc89fd5 100644 --- a/pngmem.c +++ b/pngmem.c @@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngpread.c b/pngpread.c index f74eaef15..18ea85b81 100644 --- a/pngpread.c +++ b/pngpread.c @@ -1,7 +1,7 @@ /* pngpread.c - read a png file in push mode * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngread.c b/pngread.c index 563faa9d4..0b2df736c 100644 --- a/pngread.c +++ b/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -641,7 +641,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) * not called png_set_interlace_handling(), the display_row buffer will * be ignored, so pass NULL to it. * - * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6e. + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6f. */ void @@ -690,7 +690,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row, * only call this function once. If you desire to have an image for * each pass of a interlaced image, use png_read_rows() instead. * - * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6e. + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6f. */ void png_read_image(png_structp png_ptr, png_bytepp image) @@ -834,8 +834,7 @@ png_read_end(png_structp png_ptr, png_infop info_ptr) */ if (length > 0 || png_ptr->mode & PNG_AFTER_IDAT) png_error(png_ptr, "Too many IDAT's found"); - else - png_crc_finish(png_ptr, 0); + png_crc_finish(png_ptr, length); } else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) png_handle_PLTE(png_ptr, info_ptr, length); diff --git a/pngrio.c b/pngrio.c index 627af0fb5..ce9ade3d7 100644 --- a/pngrio.c +++ b/pngrio.c @@ -1,7 +1,7 @@ /* pngrio.c - functions for data input * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngrtran.c b/pngrtran.c index 4272344bb..f442ef7fa 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngrutil.c b/pngrutil.c index 9d08d133c..fc89edeae 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -133,7 +133,7 @@ png_crc_error(png_structp png_ptr) } #if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \ - defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_sPLT_SUPPORTED) + defined(PNG_READ_iCCP_SUPPORTED) /* * Decompress trailing data in a chunk. The assumption is that chunkdata * points at an allocated area holding the contents of a chunk with a @@ -951,7 +951,8 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) if (profile >= chunkdata + slength) { png_free(png_ptr, chunkdata); - png_error(png_ptr, "malformed iCCP chunk"); + png_warning(png_ptr, "malformed iCCP chunk"); + return; } /* compression should always be zero */ @@ -1019,7 +1020,8 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) if (entry_start > chunkdata + slength) { png_free(png_ptr, chunkdata); - png_error(png_ptr, "malformed sPLT chunk"); + png_warning(png_ptr, "malformed sPLT chunk"); + return; } new_palette.depth = *entry_start++; @@ -1563,7 +1565,10 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) #ifdef PNG_FLOATING_POINT_SUPPORTED width = strtod(ep, &vp); if (*vp) - png_error(png_ptr, "malformed width string in sCAL chunk"); + { + png_warning(png_ptr, "malformed width string in sCAL chunk"); + return; + } #else #ifdef PNG_FIXED_POINT_SUPPORTED swidth = (png_charp)png_malloc(png_ptr, strlen(ep) + 1); @@ -1578,7 +1583,10 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) #ifdef PNG_FLOATING_POINT_SUPPORTED height = strtod(ep, &vp); if (*vp) - png_error(png_ptr, "malformed height string in sCAL chunk"); + { + png_warning(png_ptr, "malformed height string in sCAL chunk"); + return; + } #else #ifdef PNG_FIXED_POINT_SUPPORTED sheight = (png_charp)png_malloc(png_ptr, strlen(ep) + 1); diff --git a/pngset.c b/pngset.c index b11d70dfb..c4442a89e 100644 --- a/pngset.c +++ b/pngset.c @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -421,18 +421,25 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr, png_charp name, int compression_type, png_charp profile, png_uint_32 proflen) { + png_charp new_iccp_name; + png_charp new_iccp_profile; + png_debug1(1, "in %s storage function\n", "iCCP"); if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL) return; + new_iccp_name = png_malloc(png_ptr, png_strlen(name)+1); + strcpy(new_iccp_name, name); + new_iccp_profile = png_malloc(png_ptr, proflen); + png_memcpy(new_iccp_profile, profile, (png_size_t)proflen); + png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0); - info_ptr->iccp_name = png_malloc(png_ptr, png_strlen(name)+1); - strcpy(info_ptr->iccp_name, name); - info_ptr->iccp_profile = png_malloc(png_ptr, proflen); - png_memcpy(info_ptr->iccp_profile, profile, (png_size_t)proflen); + info_ptr->iccp_proflen = proflen; + info_ptr->iccp_name = new_iccp_name; + info_ptr->iccp_profile = new_iccp_profile; /* Compression is always zero but is here so the API and info structure - * does not have to change * if we introduce multiple compression types */ + * does not have to change if we introduce multiple compression types */ info_ptr->iccp_compression = (png_byte)compression_type; info_ptr->free_me |= PNG_FREE_ICCP; info_ptr->valid |= PNG_INFO_iCCP; @@ -495,8 +502,14 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, if(text_ptr[i].compression > 0) { /* set iTXt data */ - lang_len = png_strlen(text_ptr[i].lang); - lang_key_len = png_strlen(text_ptr[i].lang_key); + if (text_ptr[i].key != (png_charp)NULL) + lang_len = png_strlen(text_ptr[i].lang); + else + lang_len = 0; + if (text_ptr[i].lang_key != (png_charp)NULL) + lang_key_len = png_strlen(text_ptr[i].lang_key); + else + lang_key_len = 0; } else { @@ -504,7 +517,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, lang_key_len = 0; } - if (text_ptr[i].text[0] == '\0') + if (text_ptr[i].text == (png_charp)NULL || text_ptr[i].text[0] == '\0') { text_length = 0; if(text_ptr[i].compression > 0) @@ -538,19 +551,15 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, } else { - textp->lang=NULL; - textp->lang_key=NULL; + textp->lang=(png_charp)NULL; + textp->lang_key=(png_charp)NULL; textp->text=textp->key + key_len + 1; } if(text_length) - { png_memcpy(textp->text, text_ptr[i].text, (png_size_t)(text_length)); - *(textp->text+text_length) = '\0'; - } - else - textp->text--; + *(textp->text+text_length) = '\0'; if(textp->compression > 0) { @@ -755,8 +764,11 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers) if (png_ptr == NULL || info_ptr == NULL) return; - png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0); - info_ptr->row_pointers = row_pointers; + if(info_ptr->row_pointers != row_pointers) + { + png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0); + info_ptr->row_pointers = row_pointers; + } } #endif diff --git a/pngtest.c b/pngtest.c index fbd8b1669..87fca87f6 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,7 +1,7 @@ /* pngtest.c - a simple test program to test libpng * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -1344,4 +1344,4 @@ main(int argc, char *argv[]) } /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_0_6e your_png_h_is_not_version_1_0_6e; +typedef version_1_0_6f your_png_h_is_not_version_1_0_6f; diff --git a/pngtrans.c b/pngtrans.c index b1f83f502..6d3fd60c3 100644 --- a/pngtrans.c +++ b/pngtrans.c @@ -1,7 +1,7 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngvcrd.c b/pngvcrd.c index cfee16ee3..a0f1f423f 100644 --- a/pngvcrd.c +++ b/pngvcrd.c @@ -2,7 +2,7 @@ * * For Intel x86 CPU and Microsoft Visual C++ compiler * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson diff --git a/pngwio.c b/pngwio.c index a5a5a771a..2701b79d0 100644 --- a/pngwio.c +++ b/pngwio.c @@ -1,7 +1,7 @@ /* pngwio.c - functions for data output * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngwrite.c b/pngwrite.c index 347bda5b8..266ff2f2d 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -1,7 +1,7 @@ /* pngwrite.c - general routines to write a PNG file * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngwtran.c b/pngwtran.c index e69847983..2669eaa08 100644 --- a/pngwtran.c +++ b/pngwtran.c @@ -1,7 +1,7 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngwutil.c b/pngwutil.c index 25bc8ce66..4dd5ec316 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * libpng 1.0.6e - April 10, 2000 + * libpng 1.0.6f - April 14, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/scripts/makefile.beos b/scripts/makefile.beos index 90efb5b72..5f60531b8 100644 --- a/scripts/makefile.beos +++ b/scripts/makefile.beos @@ -31,7 +31,7 @@ RANLIB=ranlib # read libpng.txt or png.h to see why PNGMAJ is 2. You should not # have to change it. PNGMAJ = 2 -PNGMIN = 1.0.6e +PNGMIN = 1.0.6f PNGVER = $(PNGMAJ).$(PNGMIN) # where make install puts libpng.a, libpng.so*, and png.h diff --git a/scripts/makefile.dec b/scripts/makefile.dec index 8850e97ad..39f780a45 100644 --- a/scripts/makefile.dec +++ b/scripts/makefile.dec @@ -14,7 +14,7 @@ ZLIBINC=../zlib # read libpng.txt or png.h to see why PNGMAJ is 2. You should not # have to change it. PNGMAJ = 2 -PNGMIN = 1.0.6e +PNGMIN = 1.0.6f PNGVER = $(PNGMAJ).$(PNGMIN) CC=cc diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx index 7036f731e..5b65f403b 100644 --- a/scripts/makefile.gcmmx +++ b/scripts/makefile.gcmmx @@ -34,7 +34,7 @@ RANLIB=ranlib # read libpng.txt or png.h to see why PNGMAJ is 2. You should not # have to change it. PNGMAJ = 2 -PNGMIN = 1.0.6e +PNGMIN = 1.0.6f PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.linux b/scripts/makefile.linux index 99acfba9d..5339f9e99 100644 --- a/scripts/makefile.linux +++ b/scripts/makefile.linux @@ -34,7 +34,7 @@ RANLIB=ranlib # read libpng.txt or png.h to see why PNGMAJ is 2. You should not # have to change it. PNGMAJ = 2 -PNGMIN = 1.0.6e +PNGMIN = 1.0.6f PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.sco b/scripts/makefile.sco index c37d3f825..7ed46ee5c 100644 --- a/scripts/makefile.sco +++ b/scripts/makefile.sco @@ -25,7 +25,7 @@ RANLIB=echo # read libpng.txt or png.h to see why PNGMAJ is 2. You should not # have to change it. PNGMAJ = 2 -PNGMIN = 1.0.6e +PNGMIN = 1.0.6f PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc index 3e2229b27..13f244e3f 100644 --- a/scripts/makefile.sggcc +++ b/scripts/makefile.sggcc @@ -19,8 +19,8 @@ CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32 # -g -DPNG_DEBUG=5 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm LDSHARED=gcc -shared -VER=1.0.6e -LIBS=libpng.so.1.0.6e +VER=1.0.6f +LIBS=libpng.so.1.0.6f SHAREDLIB=libpng.so libdir=$(prefix)/lib32 diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris index 5f00e8158..826c69c31 100644 --- a/scripts/makefile.solaris +++ b/scripts/makefile.solaris @@ -31,7 +31,7 @@ RANLIB=echo # read libpng.txt or png.h to see why PNGMAJ is 2. You should not # have to change it. PNGMAJ = 2 -PNGMIN = 1.0.6e +PNGMIN = 1.0.6f PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas index c380ab024..084f490c1 100644 --- a/scripts/pngdef.pas +++ b/scripts/pngdef.pas @@ -3,7 +3,7 @@ unit pngdef; interface const - PNG_LIBPNG_VER_STRING = '1.0.6e'; + PNG_LIBPNG_VER_STRING = '1.0.6f'; PNG_LIBPNG_VER = 10007; type