From e68f5a361bf09f8b92ce1c77f6b083018512565a Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 14 May 2001 09:20:53 -0500 Subject: [PATCH] Imported from libpng-1.0.12beta1.tar --- ANNOUNCE | 22 +++---- CHANGES | 11 ++++ INSTALL | 12 ++-- LICENSE | 4 +- README | 10 ++-- Y2KINFO | 4 +- configure | 2 +- contrib/msvctest/msvctest.dsp | 8 +-- contrib/visupng/VisualPng.dsp | 12 ++-- libpng.3 | 26 +++++---- libpng.txt | 15 ++--- libpngpf.3 | 4 +- png.5 | 2 +- png.c | 53 +++++++++++------ png.h | 99 +++++++++++++++++++++---------- pngasmrd.h | 2 +- pngconf.h | 95 ++++++++++++++++++++---------- pngerror.c | 106 ++++++++++++++++++++++++++++++++-- pnggccrd.c | 2 +- pngget.c | 91 ++++++++++++++++++++++++++++- pngmem.c | 46 +++++++++++---- pngpread.c | 2 +- pngread.c | 84 ++++++++++++++++++--------- pngrio.c | 4 +- pngrtran.c | 2 +- pngrutil.c | 24 +++++--- pngset.c | 62 +++++++++++++++++++- pngtest.c | 14 ++--- pngtrans.c | 2 +- pngvcrd.c | 2 +- pngwio.c | 2 +- pngwrite.c | 78 +++++++++++++++++-------- pngwtran.c | 2 +- pngwutil.c | 47 +++++++++------ projects/msvc/README.txt | 14 ++--- projects/msvc/libpng.dsp | 8 +-- projects/msvc/png32ms.def | 41 ++++++++++--- projects/wince/READMEE.WCE | 8 +-- projects/wince/READMEJ.WCE | 2 +- projects/wince/png32ce.def | 43 +++++++++++--- scripts/makefile.aix | 2 +- scripts/makefile.beos | 2 +- scripts/makefile.cygwin | 11 ++-- scripts/makefile.dec | 2 +- scripts/makefile.gcmmx | 2 +- scripts/makefile.hpgcc | 2 +- scripts/makefile.hpux | 2 +- scripts/makefile.linux | 2 +- scripts/makefile.netbsd | 2 +- scripts/makefile.sco | 2 +- scripts/makefile.sggcc | 4 +- scripts/makefile.sgi | 2 +- scripts/makefile.solaris | 2 +- scripts/pngdef.pas | 4 +- scripts/pngos2.def | 2 +- 55 files changed, 807 insertions(+), 303 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 40efcbf8..c97e93ff 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,18 +1,20 @@ -Libpng 1.0.11 - April 27, 2001 +Libpng 1.0.12beta1 - May 14, 2001 This is a public release of libpng, intended for use in production codes. -Changes since the last public release (1.0.10): +Changes since the last public release (1.0.11): - Added type casts on several png_malloc() calls (Dimitri Papadapoulos). - Removed a no-longer needed AIX work-around from pngconf.h - Changed several "//" single-line comments to C-style in pnggccrd.c - Removed PNGAPI from private functions whose prototypes did not have PNGAPI. - Updated scripts/pngos2.def - Added a check for NULL return from user's malloc_fn(). - Removed some useless type casts of the NULL pointer. - Added makefile.netbsd + Test for Windows platform in pngconf.h when including malloc.h (Emmanuel Blot) + Updated makefile.cygwin and handling of Cygwin's ALL_STATIC in pngconf.h + Added some never-to-be-executed code in pnggccrd.c to quiet compiler warnings. + Bumped DLLNUM to 2. + Added a check for attempts to read or write PLTE in grayscale PNG datastreams. + Eliminated the png_error about apps using png_read|write_init(). Instead, + libpng will reallocate the png_struct and info_struct if they are too small. + This achieves future binary compatibility for old applications written for + libpng-0.88 and earlier. + Modified png_create_struct so it passes user mem_ptr to user memory allocator. Send comments/corrections/commendations to png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu diff --git a/CHANGES b/CHANGES index 15e94498..e4b75f47 100644 --- a/CHANGES +++ b/CHANGES @@ -930,6 +930,17 @@ version 1.0.11beta4 [April 20, 2001] Added makefile.netbsd version 1.0.11 [April 27, 2001] Revised makefile.netbsd +version 1.0.12beta1 [May 14, 2001] + Test for Windows platform in pngconf.h when including malloc.h (Emmanuel Blot) + Updated makefile.cygwin and handling of Cygwin's ALL_STATIC in pngconf.h + Added some never-to-be-executed code in pnggccrd.c to quiet compiler warnings. + Bumped DLLNUM to 2. + Added a check for attempts to read or write PLTE in grayscale PNG datastreams. + Eliminated the png_error about apps using png_read|write_init(). Instead, + libpng will reallocate the png_struct and info_struct if they are too small. + This achieves future binary compatibility for old applications written for + libpng-0.88 and earlier. + Modified png_create_struct so it passes user mem_ptr to user memory allocator. Send comments/corrections/commendations to png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu diff --git a/INSTALL b/INSTALL index e81b1de1..58111cd7 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ -Installing libpng version 1.0.11 - April 27, 2001 +Installing libpng version 1.0.12beta1 - May 14, 2001 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.11" or "lpng109" and "zlib-1.1.3" +might be called "libpng-1.0.12beta1" or "lpng109" and "zlib-1.1.3" or "zlib113") so that you have directories called "zlib" and "libpng". Your directory structure should look like this: @@ -60,8 +60,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.11) - makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11, + makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.12beta1) + makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.12beta1, 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 @@ -78,9 +78,9 @@ include makefile.macosx => MACOS X Makefile makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) - makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11) + makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.12beta1) makefile.sunos => Sun makefile - makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.11) + makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.12beta1) 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 68f73819..e5e9b4a2 100644 --- a/LICENSE +++ b/LICENSE @@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: If you modify libpng you may insert additional notices immediately following this sentence. -libpng versions 1.0.7, July 1, 2000, through 1.0.11, April 27, 2001, are +libpng versions 1.0.7, July 1, 2000, through 1.0.12beta1, May 14, 2001, are Copyright (c) 2000, 2001 Glenn Randers-Pehrson and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors @@ -99,4 +99,4 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson randeg@alum.rpi.edu -April 27, 2001 +May 14, 2001 diff --git a/README b/README index 3692bfb2..6c83f338 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for libpng 1.0.11 - April 27, 2001 (shared library 2.1) +README for libpng 1.0.12beta1 - May 14, 2001 (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. @@ -183,9 +183,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.11) + (gcc, creates libpng.so.2.1.0.12beta1) makefile.gcmmx => Linux/ELF makefile (gcc, creates - libpng.so.2.1.0.11, uses assembler code + libpng.so.2.1.0.12beta1, 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 @@ -202,10 +202,10 @@ Files in this distribution: makefile.macosx => MACOS X Makefile makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) - makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11) + makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.12beta1) makefile.sunos => Sun makefile makefile.solaris => Solaris 2.X makefile - (gcc, creates libpng.so.2.1.0.11) + (gcc, creates libpng.so.2.1.0.12beta1) 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 84feed24..86b7213a 100644 --- a/Y2KINFO +++ b/Y2KINFO @@ -1,13 +1,13 @@ Y2K compliance in libpng: ========================= - April 27, 2001 + May 14, 2001 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.11 are Y2K compliant. It is my belief that earlier + upward through 1.0.12beta1 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 a4eff0fb..1d125c63 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ echo " - There is no \"configure\" script for Libpng-1.0.11. Instead, please + There is no \"configure\" script for Libpng-1.0.12beta1. Instead, please copy the appropriate makefile for your system from the \"scripts\" directory. Read the INSTALL file for more details. " diff --git a/contrib/msvctest/msvctest.dsp b/contrib/msvctest/msvctest.dsp index df3034eb..ba394875 100644 --- a/contrib/msvctest/msvctest.dsp +++ b/contrib/msvctest/msvctest.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /machine:I386 -# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll\libpng1.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll\libpng2.lib /nologo /subsystem:console /machine:I386 # Begin Special Build Tool OutDir=.\dll SOURCE="$(InputPath)" @@ -84,7 +84,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbg\libpng1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbg\libpng2d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # Begin Special Build Tool OutDir=.\dll_dbg SOURCE="$(InputPath)" @@ -114,7 +114,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /machine:I386 -# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_asm\libpng1a.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_asm\libpng2a.lib /nologo /subsystem:console /machine:I386 # Begin Special Build Tool OutDir=.\dll_asm SOURCE="$(InputPath)" @@ -144,7 +144,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbga\libpng1b.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbga\libpng2b.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # Begin Special Build Tool OutDir=.\dll_dbga SOURCE="$(InputPath)" diff --git a/contrib/visupng/VisualPng.dsp b/contrib/visupng/VisualPng.dsp index fec5219f..a88346fd 100644 --- a/contrib/visupng/VisualPng.dsp +++ b/contrib/visupng/VisualPng.dsp @@ -59,8 +59,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 libpng1.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"libpng" /libpath:"zlib" -# ADD LINK32 libpng1.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll" +# ADD BASE LINK32 libpng2.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"libpng" /libpath:"zlib" +# ADD LINK32 libpng2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll" # Begin Special Build Tool OutDir=.\dll SOURCE="$(InputPath)" @@ -92,9 +92,9 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 libpng1.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"libpng" /libpath:"zlib" +# ADD BASE LINK32 libpng2.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"libpng" /libpath:"zlib" # SUBTRACT BASE LINK32 /nodefaultlib -# ADD LINK32 libpng1d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg" +# ADD LINK32 libpng2d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg" # SUBTRACT LINK32 /nodefaultlib # Begin Special Build Tool OutDir=.\dll_dbg @@ -128,7 +128,7 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 libpng1.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll" +# ADD BASE LINK32 libpng2.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll" # ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\lib" # Begin Special Build Tool OutDir=.\lib @@ -161,7 +161,7 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 libpng1d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg" +# ADD BASE LINK32 libpng2d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg" # SUBTRACT BASE LINK32 /nodefaultlib # ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\lib_dbg" # SUBTRACT LINK32 /nodefaultlib diff --git a/libpng.3 b/libpng.3 index 170a3841..e09809a6 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "April 27, 2001" +.TH LIBPNG 3 "May 14, 2001" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11 +libpng \- Portable Network Graphics (PNG) Reference Library 1.0.12beta1 .SH SYNOPSIS \fI\fB @@ -747,10 +747,10 @@ 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.11 - April 27, 2001 + libpng version 1.0.12beta1 - May 14, 2001 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson + Copyright (c) 1998-2001 Glenn Randers-Pehrson For conditions of distribution and use, see copyright notice in png.h. @@ -1033,7 +1033,8 @@ called after each row has been read, which you can use to control a progress meter or the like. It's demonstrated in pngtest.c. You must supply a function - void read_row_callback(png_ptr ptr, png_uint_32 row, int pass); + void read_row_callback(png_ptr ptr, png_uint_32 row, + int pass); { /* put your code here */ } @@ -2145,7 +2146,7 @@ png_infop info_ptr; void row_callback(png_structp png_ptr, png_bytep new_row, - png_uint_32 row_num, int pass) + png_uint_32 row_num, int pass) { /* If the image is interlaced, and you turned on the interlace handler, this function will @@ -3427,7 +3428,7 @@ of the original PNG Group, Glenn Randers-Pehrson. Guy and Andreas are still alive and well, but they have moved on to other things. The old libpng functions png_read_init(), png_write_init(), -png_info_init(), png_read_destroy(), and png_write_destory() have been +png_info_init(), png_read_destroy(), and png_write_destroy() have been moved to PNG_INTERNAL in version 0.95 to discourage their use. These functions will be removed from libpng version 2.0.0. @@ -3468,13 +3469,13 @@ application: .SH VIII. Y2K Compliance in libpng -April 27, 2001 +May 14, 2001 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.11 are Y2K compliant. It is my belief that earlier +upward through 1.0.12beta1 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 @@ -3586,6 +3587,7 @@ the first widely used release: 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 1.0.11rc1 1 10011 2.1.0.11rc1 1.0.11 1 10011 2.1.0.11 + 1.0.12beta1 1 10012 2.1.0.12beta1 Henceforth the source version will match the shared-library minor and patch numbers; the shared-library major version number will be @@ -3643,7 +3645,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.0.11 - April 27, 2001: +Libpng version 1.0.12beta1 - May 14, 2001: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu). @@ -3660,7 +3662,7 @@ included in the libpng distribution, the latter shall prevail.) If you modify libpng you may insert additional notices immediately following this sentence. -libpng versions 1.0.7, July 1, 2000, through 1.0.11, April 27, 2001, are +libpng versions 1.0.7, July 1, 2000, through 1.0.12beta1, May 14, 2001, are Copyright (c) 2000-2001 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors @@ -3752,7 +3754,7 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson randeg@alum.rpi.edu -April 27, 2001 +May 14, 2001 .\" end of man page diff --git a/libpng.txt b/libpng.txt index d7f766e3..b279116a 100644 --- a/libpng.txt +++ b/libpng.txt @@ -1,9 +1,9 @@ libpng.txt - A description on how to use and modify libpng - libpng version 1.0.11 - April 27, 2001 + libpng version 1.0.12beta1 - May 14, 2001 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson + Copyright (c) 1998-2001 Glenn Randers-Pehrson For conditions of distribution and use, see copyright notice in png.h. @@ -286,7 +286,8 @@ called after each row has been read, which you can use to control a progress meter or the like. It's demonstrated in pngtest.c. You must supply a function - void read_row_callback(png_ptr ptr, png_uint_32 row, int pass); + void read_row_callback(png_ptr ptr, png_uint_32 row, + int pass); { /* put your code here */ } @@ -1398,7 +1399,7 @@ png_infop info_ptr; void row_callback(png_structp png_ptr, png_bytep new_row, - png_uint_32 row_num, int pass) + png_uint_32 row_num, int pass) { /* If the image is interlaced, and you turned on the interlace handler, this function will @@ -2680,7 +2681,7 @@ of the original PNG Group, Glenn Randers-Pehrson. Guy and Andreas are still alive and well, but they have moved on to other things. The old libpng functions png_read_init(), png_write_init(), -png_info_init(), png_read_destroy(), and png_write_destory() have been +png_info_init(), png_read_destroy(), and png_write_destroy() have been moved to PNG_INTERNAL in version 0.95 to discourage their use. These functions will be removed from libpng version 2.0.0. @@ -2721,13 +2722,13 @@ application: VIII. Y2K Compliance in libpng -April 27, 2001 +May 14, 2001 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.11 are Y2K compliant. It is my belief that earlier +upward through 1.0.12beta1 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 bd7325ea..d6124039 100644 --- a/libpngpf.3 +++ b/libpngpf.3 @@ -1,6 +1,6 @@ -.TH LIBPNGPF 3 "April 27, 2001" +.TH LIBPNGPF 3 "May 14, 2001" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11 +libpng \- Portable Network Graphics (PNG) Reference Library 1.0.12beta1 (private functions) .SH SYNOPSIS \fB#include \fP diff --git a/png.5 b/png.5 index c9eaebcf..588d96d0 100644 --- a/png.5 +++ b/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "April 27, 2001" +.TH PNG 5 "May 14, 2001" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION diff --git a/png.c b/png.c index e2cf0b7d..691807ce 100644 --- a/png.c +++ b/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * libpng version 1.0.11 - April 27, 2001 + * libpng version 1.0.12beta1 - May 14, 2001 * Copyright (c) 1998-2001 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.) @@ -13,14 +13,14 @@ #include "png.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_0_11 Your_png_h_is_not_version_1_0_11; +typedef version_1_0_12beta1 Your_png_h_is_not_version_1_0_12beta1; /* 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 */ -const char png_libpng_ver[18] = "1.0.11"; +const char png_libpng_ver[18] = "1.0.12beta1"; /* png_sig was changed to a function in version 1.0.5c */ /* Place to hold the signature string for a PNG file. */ @@ -213,12 +213,12 @@ png_create_info_struct(png_structp png_ptr) if(png_ptr == NULL) return (NULL); #ifdef PNG_USER_MEM_SUPPORTED if ((info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO, - png_ptr->malloc_fn)) != NULL) + png_ptr->malloc_fn, png_ptr->mem_ptr)) != NULL) #else if ((info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO)) != NULL) #endif { - png_info_init(info_ptr); + png_info_init_3(&info_ptr, sizeof(png_info)); } return (info_ptr); @@ -243,7 +243,8 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr) png_info_destroy(png_ptr, info_ptr); #ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)info_ptr, png_ptr->free_fn); + png_destroy_struct_2((png_voidp)info_ptr, png_ptr->free_fn, + png_ptr->mem_ptr); #else png_destroy_struct((png_voidp)info_ptr); #endif @@ -255,10 +256,28 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr) * and applications using it are urged to use png_create_info_struct() * instead. */ -void /* PRIVATE */ +#undef png_info_init +void PNGAPI png_info_init(png_infop info_ptr) { - png_debug(1, "in png_info_init\n"); + /* We only come here via pre-1.0.12-compiled applications */ + png_info_init_3(&info_ptr, 0); +} + +void PNGAPI +png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size) +{ + png_infop info_ptr = *ptr_ptr; + + png_debug(1, "in png_info_init_3\n"); + + if(sizeof(png_info) > png_info_struct_size) + { + png_destroy_struct(info_ptr); + info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO); + *ptr_ptr = info_ptr; + } + /* set everything to 0 */ png_memset(info_ptr, 0, sizeof (png_info)); } @@ -537,7 +556,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr) } #endif - png_info_init(info_ptr); + png_info_init_3(&info_ptr, sizeof(png_info)); } /* This function returns a pointer to the io_ptr associated with the user @@ -627,7 +646,7 @@ png_charp PNGAPI png_get_copyright(png_structp png_ptr) { if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */ - return ((png_charp) "\n libpng version 1.0.11 - April 27, 2001\n\ + return ((png_charp) "\n libpng version 1.0.12beta1 - May 14, 2001\n\ Copyright (c) 1998-2001 Glenn Randers-Pehrson\n\ Copyright (c) 1996, 1997 Andreas Dilger\n\ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n"); @@ -645,8 +664,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((png_charp) "1.0.11"); - return((png_charp) "1.0.11"); + return((png_charp) "1.0.12beta1"); + return((png_charp) "1.0.12beta1"); } png_charp PNGAPI @@ -696,17 +715,15 @@ png_uint_32 PNGAPI png_access_version_number(void) { /* Version of *.c files used when building libpng */ - return((png_uint_32) 10011L); + return((png_uint_32) 10012L); } - -#if 0 /* delay this until version 1.2.0 */ -/* this function was added to libpng 1.0.9 (porting aid to libpng-1.2.0) */ -#ifndef PNG_ASSEMBLER_CODE_SUPPORTED +/* this function was added to libpng 1.2.0 */ +#if !defined(PNG_USE_PNGGCCRD) && \ + !(defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD)) int PNGAPI png_mmx_support(void) { return -1; } #endif -#endif /* 0 */ diff --git a/png.h b/png.h index a8fc40c8..03a2bc1f 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.0.11 - April 27, 2001 + * libpng version 1.0.12beta1 - May 14, 2001 * Copyright (c) 1998-2001 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.) @@ -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.11 - April 27, 2001: Glenn + * libpng versions 0.97, January 1998, through 1.0.12beta1 - May 14, 2001: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -70,6 +70,10 @@ * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 * 1.0.11rc1 1 10011 2.1.0.11rc1 * 1.0.11 1 10011 2.1.0.11 + * 1.0.12beta1 2 10012 2.1.0.11beta1 + * 1.1.0a-f 1 10100 2.1.1.0a-f (branch abandoned) + * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 + * 1.2.0beta3 3 10200 3.1.2.0beta3 * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -99,7 +103,7 @@ * If you modify libpng you may insert additional notices immediately following * this sentence. * - * libpng versions 1.0.7, July 1, 2000, through 1.0.11, April 27, 2001, are + * libpng versions 1.0.7, July 1, 2000, through 1.0.12beta1, May 14, 2001, are * Copyright (c) 2000, 2001 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.0.6 * with the following individuals added to the list of Contributing Authors @@ -204,13 +208,13 @@ * Y2K compliance in libpng: * ========================= * - * April 27, 2001 + * May 14, 2001 * * 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.11 are Y2K compliant. It is my belief that earlier + * upward through 1.0.12beta1 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 @@ -266,7 +270,7 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.0.11" +#define PNG_LIBPNG_VER_STRING "1.0.12beta1" #define PNG_LIBPNG_VER_SONUM 2 #define PNG_LIBPNG_VER_DLLNUM %DLLNUM% @@ -274,11 +278,11 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 0 -#define PNG_LIBPNG_VER_RELEASE 11 +#define PNG_LIBPNG_VER_RELEASE 12 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ -#define PNG_LIBPNG_VER_BUILD 0 +#define PNG_LIBPNG_VER_BUILD 1 #define PNG_LIBPNG_BUILD_ALPHA 1 #define PNG_LIBPNG_BUILD_BETA 2 @@ -286,14 +290,14 @@ #define PNG_LIBPNG_BUILD_STABLE 4 #define PNG_LIBPNG_BUILD_TYPEMASK 7 #define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with STABLE only */ -#define PNG_LIBPNG_BUILD_TYPE 4 +#define PNG_LIBPNG_BUILD_TYPE 2 /* Careful here. At one time, Guy wanted to use 082, but that would be octal. * We must not include leading zeros. * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10011 /* 1.0.11 */ +#define PNG_LIBPNG_VER 10012 /* 1.0.12 */ #ifndef PNG_VERSION_INFO_ONLY @@ -699,6 +703,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_byte pcal_nparams; /* number of parameters given in pcal_params */ #endif +/* New members added in libpng-1.0.6 */ #ifdef PNG_FREE_ME_SUPPORTED png_uint_32 free_me; /* flags items libpng is responsible for freeing */ #endif @@ -1139,12 +1144,6 @@ struct png_struct_def png_charp time_buffer; /* String to hold RFC 1123 time text */ #endif -#ifdef PNG_USER_MEM_SUPPORTED - png_voidp mem_ptr; /* user supplied struct for mem functions */ - png_malloc_ptr malloc_fn; /* function for allocating memory */ - png_free_ptr free_fn; /* function for freeing memory */ -#endif - /* New members added in libpng-1.0.6 */ #ifdef PNG_FREE_ME_SUPPORTED @@ -1161,35 +1160,59 @@ struct png_struct_def png_bytep chunk_list; #endif +/* New members added in libpng-1.0.3 */ #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) png_byte rgb_to_gray_status; + /* These were changed from png_byte in libpng-1.0.6 */ png_uint_16 rgb_to_gray_red_coeff; png_uint_16 rgb_to_gray_green_coeff; png_uint_16 rgb_to_gray_blue_coeff; #endif +/* New member added in libpng-1.0.4 (renamed in 1.0.9) */ #if defined(PNG_MNG_FEATURES_SUPPORTED) || \ defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) -/* Note to maintainer: change this to png_uint_32 at next opportunity */ +/* changed from png_byte to png_uint_32 at version 1.2.0 */ png_byte mng_features_permitted; #endif +/* New member added in libpng-1.0.7 */ #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) png_fixed_point int_gamma; #endif +/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */ +#if defined(PNG_MNG_FEATURES_SUPPORTED) png_byte filter_type; +#endif +#if defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD) +/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */ png_uint_32 row_buf_size; +#endif + +/* New members added in libpng-1.2.0 */ +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) + png_byte mmx_bitdepth_threshold; + png_uint_32 mmx_rowbytes_threshold; + png_uint_32 asm_flags; +#endif + +/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ +#ifdef PNG_USER_MEM_SUPPORTED + png_voidp mem_ptr; /* user supplied struct for mem functions */ + png_malloc_ptr malloc_fn; /* function for allocating memory */ + png_free_ptr free_fn; /* function for freeing memory */ +#endif }; /* This prevents a compiler error in png_get_copyright() in png.c if png.c -and png.h are both at * version 1.0.11 + and png.h are both at version 1.0.12beta1 */ -typedef png_structp version_1_0_11; +typedef png_structp version_1_0_12beta1; typedef png_struct FAR * FAR * png_structpp; @@ -1240,6 +1263,7 @@ extern PNG_EXPORT(void,png_set_compression_buffer_size) /* Reset the compression stream */ extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr)); +/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ #ifdef PNG_USER_MEM_SUPPORTED extern PNG_EXPORT(png_structp,png_create_read_struct_2) PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, @@ -1270,8 +1294,11 @@ extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(png_infop,png_create_info_struct) PNGARG((png_structp png_ptr)); -/* Initialize the info structure (old interface - NOT DLL EXPORTED) */ -extern void png_info_init PNGARG((png_infop info_ptr)); +/* Initialize the info structure (old interface - DEPRECATED) */ +extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr)); +#define png_info_init(info_ptr) png_info_init_3(&info_ptr, sizeof(png_info)); +extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr, + png_size_t png_info_struct_size)); /* Writes all the PNG information before the image. */ extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr, @@ -2229,15 +2256,23 @@ extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp png_ptr, png_uint_32 mng_features_permitted)); #endif -#if 0 /* delay these until version 1.2.0 */ +/* png_mmx_support will be included unconditionally starting in version 1.2.0 */ +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) || defined(PNG_USE_PNGGCCRD) /* png.c, pnggccrd.c, or pngvcrd.c */ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + +/* Strip the prepended error numbers ("#nnn ") from error and warning + * messages before passing them to the error or warning handler. */ +#ifdef PNG_ERROR_NUMBERS_SUPPORTED +extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp + png_ptr, png_uint_32 strip_mode)); #endif /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.0.11 - April 27, 2001 (header)\n" + " libpng version 1.0.12beta1 - May 14, 2001 (header)\n" #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED /* With these routines we avoid an integer divide, which will be slower on @@ -2360,6 +2395,8 @@ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L #define PNG_FLAG_LIBRARY_MISMATCH 0x20000L +#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L +#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L /* For use in png_set_keep_unknown, png_handle_as_unknown */ #define HANDLE_CHUNK_AS_DEFAULT 0 @@ -2468,8 +2505,10 @@ PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf)); * (old interface - DEPRECATED - use png_create_read_struct instead). */ extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr)); -#define png_read_init(png_ptr) png_read_init_2(png_ptr, \ - PNG_LIBPNG_VER_STRING, sizeof(png_struct), sizeof(png_info)); +#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \ + PNG_LIBPNG_VER_STRING, sizeof(png_struct)); +extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size)); extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr, png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t png_info_size)); @@ -2478,8 +2517,10 @@ extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr, * (old interface - DEPRECATED - use png_create_write_struct instead). */ extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr)); -#define png_write_init(png_ptr) png_write_init_2(png_ptr, \ - PNG_LIBPNG_VER_STRING, sizeof(png_struct), sizeof(png_info)); +#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \ + PNG_LIBPNG_VER_STRING, sizeof(png_struct)); +extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size)); extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr, png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t png_info_size)); @@ -2491,9 +2532,9 @@ PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr - malloc_fn)); + malloc_fn, png_voidp mem_ptr)); PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, - png_free_ptr free_fn)); + png_free_ptr free_fn, png_voidp mem_ptr)); /* Free any memory that info_ptr points to and reset struct. */ PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, diff --git a/pngasmrd.h b/pngasmrd.h index 1ed10e46..728fec99 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.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 2001 Glenn Randers-Pehrson * diff --git a/pngconf.h b/pngconf.h index 14a07072..35150785 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,6 +1,6 @@ /* pngconf.h - machine configurable file for libpng * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -45,8 +45,8 @@ # define PNG_WRITE_SUPPORTED #endif -/* Enable if you need to support PNGs that are embedded in MNG - datastreams */ +/* Enabled by default in 1.2.0. You can disable this if you don't need to + support PNGs that are embedded in MNG datastreams */ /* #ifndef PNG_NO_MNG_FEATURES # ifndef PNG_MNG_FEATURES_SUPPORTED @@ -91,47 +91,58 @@ * this bit of #ifdefs will define the 'correct' config variables based on * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but * unnecessary. + * + * Also, the precedence order is: + * ALL_STATIC (since we can't #undef something outside our namespace) + * PNG_BUILD_DLL + * PNG_STATIC + * (nothing) == PNG_USE_DLL */ #if defined(__CYGWIN__) -# if defined(PNG_BUILD_DLL) +# if defined(ALL_STATIC) +# if defined(PNG_BUILD_DLL) +# undef PNG_BUILD_DLL +# endif # if defined(PNG_USE_DLL) # undef PNG_USE_DLL # endif -# if !defined(PNG_DLL) -# define PNG_DLL +# if defined(PNG_DLL) +# undef PNG_DLL # endif -# if defined(PNG_STATIC) -# undef PNG_STATIC -# endif -# else -# if defined(ALL_STATIC) +# if !defined(PNG_STATIC) # define PNG_STATIC # endif -# if defined(PNG_STATIC) +# else +# if defined (PNG_BUILD_DLL) +# if defined(PNG_STATIC) +# undef PNG_STATIC +# endif # if defined(PNG_USE_DLL) # undef PNG_USE_DLL # endif -# if defined(PNG_DLL) -# undef PNG_DLL +# if !defined(PNG_DLL) +# define PNG_DLL # endif # else -# if defined(PNG_USE_DLL) +# if defined(PNG_STATIC) +# if defined(PNG_USE_DLL) +# undef PNG_USE_DLL +# endif +# if defined(PNG_DLL) +# undef PNG_DLL +# endif +# else +# if !defined(PNG_USE_DLL) +# define PNG_USE_DLL +# endif # if !defined(PNG_DLL) # define PNG_DLL # endif -# else -# if defined(PNG_DLL) -# define PNG_USE_DLL -# else -# define PNG_USE_DLL -# define PNG_DLL -# endif -# endif -# endif +# endif +# endif # endif #endif - /* This protects us against compilers that run on a windowing system * and thus don't have or would rather us not use the stdio types: * stdin, stdout, and stderr. The only one currently used is stderr @@ -306,7 +317,8 @@ # include "alloc.h" #endif -#ifdef _MSC_VER +#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \ + defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__)) # include #endif @@ -578,6 +590,13 @@ # define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #endif +/* Will be enabled in libpng-1.2.0 */ +/* +#ifndef PNG_NO_ERROR_NUMBERS +#define PNG_ERROR_NUMBERS_SUPPORTED +#endif +*/ + #ifndef PNG_NO_WRITE_FLUSH # define PNG_WRITE_FLUSH_SUPPORTED #endif @@ -609,12 +628,22 @@ * png_get_x_offset_microns() * png_get_y_offset_microns() */ -#ifndef PNG_NO_EASY_ACCESS +#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED) # define PNG_EASY_ACCESS_SUPPORTED #endif -/* PNG_ASSEMBLER_CODE will be enabled by default in version 1.2.0 +/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */ +/* +#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) +# ifndef PNG_ASSEMBLER_CODE_SUPPORTED +# define PNG_ASSEMBLER_CODE_SUPPORTED +# endif +# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) +# define PNG_MMX_CODE_SUPPORTED +# endif +#endif +*/ #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) # if defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD) # ifndef PNG_ASSEMBLER_CODE_SUPPORTED @@ -626,6 +655,13 @@ # endif #endif +/* This will be enabled by default in libpng-1.2.0 */ +/* +#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) +# define PNG_USER_MEM_SUPPORTED +#endif +*/ + /* These are currently experimental features, define them if you want */ /* very little testing */ @@ -635,9 +671,6 @@ # define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED # endif #endif -#ifndef PNG_NO_USER_MEM -# define PNG_USER_MEM_SUPPORTED -#endif #ifndef PNG_NO_ZALLOC_ZERO # define PNG_ZALLOC_ZERO #endif diff --git a/pngerror.c b/pngerror.c index c991b538..1e6602cd 100644 --- a/pngerror.c +++ b/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -31,6 +31,38 @@ png_default_warning PNGARG((png_structp png_ptr, void PNGAPI png_error(png_structp png_ptr, png_const_charp message) { +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + char msg[16]; + if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) + { + int offset = 0; + if (*message == '#') + { + for (offset=1; offset<15; offset++) + if (*(message+offset) == ' ') + break; + if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT) + { + int i; + for (i=0; iflags&PNG_FLAG_STRIP_ERROR_TEXT) + { + msg[0]='0'; + msg[1]='\0'; + message=msg; + } + } + } +#endif if (png_ptr->error_fn != NULL) (*(png_ptr->error_fn))(png_ptr, message); @@ -47,10 +79,22 @@ png_error(png_structp png_ptr, png_const_charp message) void PNGAPI png_warning(png_structp png_ptr, png_const_charp message) { + int offset = 0; +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) +#endif + { + if (*message == '#') + { + for (offset=1; offset<15; offset++) + if (*(message+offset) == ' ') + break; + } + } if (png_ptr->warning_fn != NULL) - (*(png_ptr->warning_fn))(png_ptr, message); + (*(png_ptr->warning_fn))(png_ptr, (png_const_charp)(message+offset)); else - png_default_warning(png_ptr, message); + png_default_warning(png_ptr, (png_const_charp)(message+offset)); } /* These utilities are used internally to build an error message that relates @@ -122,6 +166,27 @@ static void /* PRIVATE */ png_default_error(png_structp png_ptr, png_const_charp message) { #ifndef PNG_NO_CONSOLE_IO +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + if (*message == '#') + { + int offset; + char error_number[16]; + for (offset=0; offset<15; offset++) + { + error_number[offset] = *(message+offset+1); + if (*(message+offset) == ' ') + break; + } + if((offset > 1) && (offset < 15)) + { + error_number[offset-1]='\0'; + fprintf(stderr, "libpng error no. %s: %s\n", error_number, message+offset); + } + else + fprintf(stderr, "libpng error: %s, offset=%d\n", message,offset); + } + else +#endif fprintf(stderr, "libpng error: %s\n", message); #else if (message) @@ -154,7 +219,29 @@ static void /* PRIVATE */ png_default_warning(png_structp png_ptr, png_const_charp message) { #ifndef PNG_NO_CONSOLE_IO - fprintf(stderr, "libpng warning: %s\n", message); +# ifdef PNG_ERROR_NUMBERS_SUPPORTED + if (*message == '#') + { + int offset; + char warning_number[16]; + for (offset=0; offset<15; offset++) + { + warning_number[offset]=*(message+offset+1); + if (*(message+offset) == ' ') + break; + } + if((offset > 1) && (offset < 15)) + { + warning_number[offset-1]='\0'; + fprintf(stderr, "libpng warning no. %s: %s\n", warning_number, + message+offset); + } + else + fprintf(stderr, "libpng warning: %s\n", message); + } + else +# endif + fprintf(stderr, "libpng warning: %s\n", message); #else if (message) /* appease compiler */ ; @@ -189,4 +276,15 @@ png_get_error_ptr(png_structp png_ptr) } +#ifdef PNG_ERROR_NUMBERS_SUPPORTED +void +png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode) +{ + if(png_ptr != NULL) + { + png_ptr->flags &= + ((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode); + } +} +#endif diff --git a/pnggccrd.c b/pnggccrd.c index b4703ee7..557a9434 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 version 1.0.11 - April 27, 2001 + * libpng version 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * Copyright (c) 1998, Intel Corporation diff --git a/pngget.c b/pngget.c index 5348c60e..c5a6444e 100644 --- a/pngget.c +++ b/pngget.c @@ -1,7 +1,7 @@ /* pngget.c - retrieval of values from info struct * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -826,3 +826,92 @@ png_get_compression_buffer_size(png_structp png_ptr) return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L); } + +#ifdef PNG_ASSEMBLER_CODE_SUPPORTED +/* 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) +{ + return (png_uint_32)(png_ptr? png_ptr->asm_flags : 0L); +} + +/* 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) +{ + png_uint_32 settable_asm_flags = 0; + + if (flag_select & PNG_SELECT_READ) + settable_asm_flags |= + PNG_ASM_FLAG_MMX_READ_COMBINE_ROW | + PNG_ASM_FLAG_MMX_READ_INTERLACE | + PNG_ASM_FLAG_MMX_READ_FILTER_SUB | + PNG_ASM_FLAG_MMX_READ_FILTER_UP | + PNG_ASM_FLAG_MMX_READ_FILTER_AVG | + PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ; + /* no non-MMX flags yet */ + +#if 0 + /* GRR: no write-flags yet, either, but someday... */ + if (flag_select & PNG_SELECT_WRITE) + settable_asm_flags |= + PNG_ASM_FLAG_MMX_WRITE_ [whatever] ; +#endif /* 0 */ + + return settable_asm_flags; /* _theoretically_ settable capabilities only */ +} +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) + /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */ +/* this function was added to libpng 1.2.0 */ +png_uint_32 PNGAPI +png_get_mmx_flagmask (int flag_select, int *compilerID) +{ + png_uint_32 settable_mmx_flags = 0; + + if (flag_select & PNG_SELECT_READ) + settable_mmx_flags |= + PNG_ASM_FLAG_MMX_READ_COMBINE_ROW | + PNG_ASM_FLAG_MMX_READ_INTERLACE | + PNG_ASM_FLAG_MMX_READ_FILTER_SUB | + PNG_ASM_FLAG_MMX_READ_FILTER_UP | + PNG_ASM_FLAG_MMX_READ_FILTER_AVG | + PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ; +#if 0 + /* GRR: no MMX write support yet, but someday... */ + if (flag_select & PNG_SELECT_WRITE) + settable_mmx_flags |= + PNG_ASM_FLAG_MMX_WRITE_ [whatever] ; +#endif /* 0 */ + + if (compilerID != NULL) { +#ifdef PNG_USE_PNGVCRD + *compilerID = 1; /* MSVC */ +#else +#ifdef PNG_USE_PNGGCCRD + *compilerID = 2; /* gcc/gas */ +#else + *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */ +#endif +#endif + } + + return settable_mmx_flags; /* _theoretically_ settable capabilities only */ +} + +/* this function was added to libpng 1.2.0 */ +png_byte PNGAPI +png_get_mmx_bitdepth_threshold (png_structp png_ptr) +{ + return (png_byte)(png_ptr? png_ptr->mmx_bitdepth_threshold : 0); +} + +/* this function was added to libpng 1.2.0 */ +png_uint_32 PNGAPI +png_get_mmx_rowbytes_threshold (png_structp png_ptr) +{ + return (png_uint_32)(png_ptr? png_ptr->mmx_rowbytes_threshold : 0L); +} +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ diff --git a/pngmem.c b/pngmem.c index 425df56b..3d086bab 100644 --- a/pngmem.c +++ b/pngmem.c @@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -27,12 +27,12 @@ png_voidp /* PRIVATE */ png_create_struct(int type) { #ifdef PNG_USER_MEM_SUPPORTED - return (png_create_struct_2(type, NULL)); + return (png_create_struct_2(type, NULL, NULL)); } /* Alternate version of png_create_struct, for use with user-defined malloc. */ png_voidp /* PRIVATE */ -png_create_struct_2(int type, png_malloc_ptr malloc_fn) +png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) { #endif /* PNG_USER_MEM_SUPPORTED */ png_size_t size; @@ -48,9 +48,18 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn) #ifdef PNG_USER_MEM_SUPPORTED if(malloc_fn != NULL) { - if ((struct_ptr = (*(malloc_fn))(NULL, size)) != NULL) + if (mem_ptr != NULL) + { + png_struct dummy_struct; + png_structp png_ptr = &dummy_struct; + png_ptr->mem_ptr=mem_ptr; + struct_ptr = (*(malloc_fn))(png_ptr, size); + } + else + struct_ptr = (*(malloc_fn))(NULL, size); + if (struct_ptr != NULL) png_memset(struct_ptr, 0, size); - return (struct_ptr); + return (struct_ptr); } #endif /* PNG_USER_MEM_SUPPORTED */ if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL) @@ -66,12 +75,13 @@ void /* PRIVATE */ png_destroy_struct(png_voidp struct_ptr) { #ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2(struct_ptr, (png_free_ptr)NULL); + png_destroy_struct_2(struct_ptr, (png_free_ptr)NULL, (png_voidp)NULL); } /* Free memory allocated by a png_create_struct() call */ void /* PRIVATE */ -png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn) +png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, + png_voidp mem_ptr) { #endif if (struct_ptr != NULL) @@ -81,6 +91,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn) { png_struct dummy_struct; png_structp png_ptr = &dummy_struct; + png_ptr->mem_ptr=mem_ptr; (*(free_fn))(png_ptr, struct_ptr); return; } @@ -286,14 +297,14 @@ png_voidp /* PRIVATE */ png_create_struct(int type) { #ifdef PNG_USER_MEM_SUPPORTED - return (png_create_struct_2(type, NULL)); + return (png_create_struct_2(type, NULL, NULL)); } /* Allocate memory for a png_struct or a png_info. The malloc and memset can be replaced by a single call to calloc() if this is thought to improve performance noticably.*/ png_voidp /* PRIVATE */ -png_create_struct_2(int type, png_malloc_ptr malloc_fn) +png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) { #endif /* PNG_USER_MEM_SUPPORTED */ png_size_t size; @@ -309,7 +320,16 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn) #ifdef PNG_USER_MEM_SUPPORTED if(malloc_fn != NULL) { - if ((struct_ptr = (*(malloc_fn))(NULL, size)) != NULL) + if (mem_ptr != NULL) + { + png_struct dummy_struct; + png_structp png_ptr = &dummy_struct; + png_ptr->mem_ptr=mem_ptr; + struct_ptr = (*(malloc_fn))(png_ptr, size); + } + else + struct_ptr = (*(malloc_fn))(NULL, size); + if (struct_ptr != NULL) png_memset(struct_ptr, 0, size); return (struct_ptr); } @@ -337,12 +357,13 @@ void /* PRIVATE */ png_destroy_struct(png_voidp struct_ptr) { #ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2(struct_ptr, (png_free_ptr)NULL); + png_destroy_struct_2(struct_ptr, (png_free_ptr)NULL, (png_voidp)NULL); } /* Free memory allocated by a png_create_struct() call */ void /* PRIVATE */ -png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn) +png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, + png_voidp mem_ptr) { #endif /* PNG_USER_MEM_SUPPORTED */ if (struct_ptr != NULL) @@ -352,6 +373,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn) { png_struct dummy_struct; png_structp png_ptr = &dummy_struct; + png_ptr->mem_ptr=mem_ptr; (*(free_fn))(png_ptr, struct_ptr); return; } diff --git a/pngpread.c b/pngpread.c index 9b4a9e51..309fc286 100644 --- a/pngpread.c +++ b/pngpread.c @@ -1,7 +1,7 @@ /* pngpread.c - read a png file in push mode * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngread.c b/pngread.c index f84ede84..f4567c4d 100644 --- a/pngread.c +++ b/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -46,7 +46,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_debug(1, "in png_create_read_struct\n"); #ifdef PNG_USER_MEM_SUPPORTED if ((png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, - (png_malloc_ptr)malloc_fn)) == NULL) + (png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr)) == NULL) #else if ((png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG)) == NULL) #endif @@ -92,6 +92,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, * only check the first digit. */ if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] || + (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) || (user_png_ver[0] == '0' && user_png_ver[2] < '9')) { png_error(png_ptr, @@ -99,15 +100,17 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, } /* Libpng 1.0.6 was not binary compatible, due to insertion of the - info_ptr->free_me member. Note to maintainer: this test can be - removed from version 2.0.0 and beyond because the previous test - would have already rejected it. */ + info_ptr->free_me member. Libpng-1.0.1 and earlier were not + compatible due to insertion of the user transform function. Note + to maintainer: this test can be removed from version 1.2.0 and + beyond because the previous test would have already rejected it. */ - if (user_png_ver[4] == '6' && user_png_ver[2] == '0' && - user_png_ver[0] == '1' && user_png_ver[5] == '\0') + if (user_png_ver[0] == '1' && user_png_ver[2] == '0' && + (user_png_ver[4] < '2' || user_png_ver[4] == '6') && + user_png_ver[5] == '\0') { png_error(png_ptr, - "Application must be recompiled; version 1.0.6 was incompatible"); + "Application must be recompiled; versions <= 1.0.6 were incompatible"); } } @@ -144,18 +147,42 @@ void PNGAPI png_read_init(png_structp png_ptr) { /* We only come here via pre-1.0.7-compiled applications */ - png_read_init_2(png_ptr, "1.0.0", 10000, 10000); + png_read_init_2(png_ptr, "1.0.0", 0, 0); } +#undef png_read_init_2 void PNGAPI png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t png_info_size) +{ + /* We only come here via pre-1.0.12-compiled applications */ + if(sizeof(png_struct) > png_struct_size) + { + png_ptr->error_fn=(png_error_ptr)NULL; + png_error(png_ptr, + "The png struct allocated by the application for reading is too small."); + } + if(sizeof(png_info) > png_info_size) + { + png_ptr->error_fn=(png_error_ptr)NULL; + png_error(png_ptr, + "The info struct allocated by application for reading is too small."); + } + png_read_init_3(&png_ptr, user_png_ver, png_struct_size); +} + +void PNGAPI +png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, + png_size_t png_struct_size) { #ifdef PNG_SETJMP_SUPPORTED jmp_buf tmp_jmp; /* to save current jump buffer */ #endif int i=0; + + png_structp png_ptr=*ptr_ptr; + do { if(user_png_ver[i] != png_libpng_ver[i]) @@ -163,28 +190,28 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver, #ifdef PNG_LEGACY_SUPPORTED png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; #else - png_ptr->error_fn=(png_error_ptr)NULL; - png_error(png_ptr, - "Application uses deprecated png_read_init() and must be recompiled."); + png_ptr->warning_fn=(png_error_ptr)NULL; + png_warning(png_ptr, + "Application uses deprecated png_read_init() and should be recompiled."); + break; #endif } } while (png_libpng_ver[i++]); - if(sizeof(png_struct) > png_struct_size || - sizeof(png_info) > png_info_size) - { - png_ptr->error_fn=(png_error_ptr)NULL; - png_error(png_ptr, - "Application and library have different sized structs. Please recompile."); - } - - png_debug(1, "in png_read_init_2\n"); + png_debug(1, "in png_read_init_3\n"); #ifdef PNG_SETJMP_SUPPORTED /* save jump buffer and error functions */ png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf)); #endif + if(sizeof(png_struct) > png_struct_size) + { + png_destroy_struct(png_ptr); + *ptr_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); + png_ptr = *ptr_ptr; + } + /* reset all variables to 0 */ png_memset(png_ptr, 0, sizeof (png_struct)); @@ -715,7 +742,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.11 + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.12beta1 */ void PNGAPI @@ -764,7 +791,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.11 + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.12beta1 */ void PNGAPI png_read_image(png_structp png_ptr, png_bytepp image) @@ -994,6 +1021,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infop info_ptr = NULL, end_info_ptr = NULL; #ifdef PNG_USER_MEM_SUPPORTED png_free_ptr free_fn = NULL; + png_voidp mem_ptr = NULL; #endif png_debug(1, "in png_destroy_read_struct\n"); @@ -1009,6 +1037,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, #ifdef PNG_USER_MEM_SUPPORTED free_fn = png_ptr->free_fn; + mem_ptr = png_ptr->mem_ptr; #endif png_read_destroy(png_ptr, info_ptr, end_info_ptr); @@ -1020,7 +1049,8 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, #endif #ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)info_ptr, free_fn); + png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); #else png_destroy_struct((png_voidp)info_ptr); #endif @@ -1033,7 +1063,8 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_free_data(png_ptr, end_info_ptr, PNG_FREE_TEXT, -1); #endif #ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)end_info_ptr, free_fn); + png_destroy_struct_2((png_voidp)end_info_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); #else png_destroy_struct((png_voidp)end_info_ptr); #endif @@ -1043,7 +1074,8 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, if (png_ptr != NULL) { #ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)png_ptr, free_fn); + png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); #else png_destroy_struct((png_voidp)png_ptr); #endif diff --git a/pngrio.c b/pngrio.c index 4290624e..006d72e3 100644 --- a/pngrio.c +++ b/pngrio.c @@ -1,7 +1,7 @@ /* pngrio.c - functions for data input * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -26,7 +26,7 @@ void /* PRIVATE */ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { - png_debug1(4,"reading %d bytes\n", length); + png_debug1(4,"reading %d bytes\n", (int)length); if (png_ptr->read_data_fn != NULL) (*(png_ptr->read_data_fn))(png_ptr, data, length); else diff --git a/pngrtran.c b/pngrtran.c index af7631ee..e2d46ff4 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.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngrutil.c b/pngrutil.c index 284f636d..311f81ee 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -339,7 +339,9 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_ptr->bit_depth = (png_byte)bit_depth; png_ptr->interlaced = (png_byte)interlace_type; png_ptr->color_type = (png_byte)color_type; +#if defined(PNG_MNG_FEATURES_SUPPORTED) png_ptr->filter_type = (png_byte)filter_type; +#endif /* find number of channels */ switch (png_ptr->color_type) @@ -396,6 +398,13 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_ptr->mode |= PNG_HAVE_PLTE; + if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR)) + { + png_warning(png_ptr, + "Ignoring PLTE chunk in grayscale PNG"); + png_crc_finish(png_ptr, length); + return; + } #if !defined(PNG_READ_OPT_PLTE_SUPPORTED) if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE) { @@ -512,9 +521,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_error(png_ptr, "No image in file"); - /* to quiet compiler warnings about unused info_ptr */ - if (info_ptr == NULL) - return; + info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */ } png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND); @@ -2083,8 +2090,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_crc_finish(png_ptr, skip); #if !defined(PNG_READ_USER_CHUNKS_SUPPORTED) - if (info_ptr == NULL) - /* quiet compiler warnings about unused info_ptr */ ; + info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */ #endif } @@ -2545,9 +2551,7 @@ png_do_read_interlace(png_structp png_ptr) (png_uint_32)row_info->pixel_depth + 7) >> 3); } #if !defined(PNG_READ_PACKSWAP_SUPPORTED) - /* silence compiler warning */ - if (transformations) - return; + transformations = transformations; /* silence compiler warning */ #endif } #endif /* !PNG_HAVE_ASSEMBLER_READ_INTERLACE */ @@ -2964,7 +2968,9 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) png_error(png_ptr, "This image requires a row greater than 64KB"); #endif png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, row_bytes); +#if defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD) png_ptr->row_buf_size = row_bytes; +#endif #ifdef PNG_MAX_MALLOC_64K if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L) diff --git a/pngset.c b/pngset.c index 61de5dd0..4fb6c0e9 100644 --- a/pngset.c +++ b/pngset.c @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -654,8 +654,9 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, textp->key = (png_charp)png_malloc(png_ptr, (png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4)); - png_debug2(2, "Allocated %d bytes at %x in png_set_text\n", - key_len + lang_len + lang_key_len + text_length + 4, (int)textp->key); + png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n", + (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)); @@ -968,3 +969,58 @@ png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask) info_ptr->valid &= ~(mask); } + +#ifdef PNG_ASSEMBLER_CODE_SUPPORTED +/* this 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) +{ + png_uint_32 settable_asm_flags; + png_uint_32 settable_mmx_flags; + + settable_mmx_flags = +#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW + PNG_ASM_FLAG_MMX_READ_COMBINE_ROW | +#endif +#ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE + PNG_ASM_FLAG_MMX_READ_INTERLACE | +#endif +#ifdef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW + PNG_ASM_FLAG_MMX_READ_FILTER_SUB | + PNG_ASM_FLAG_MMX_READ_FILTER_UP | + PNG_ASM_FLAG_MMX_READ_FILTER_AVG | + PNG_ASM_FLAG_MMX_READ_FILTER_PAETH | +#endif + 0; + + /* could be some non-MMX ones in the future, but not currently: */ + settable_asm_flags = settable_mmx_flags; + + if (!(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED) || + !(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU)) + { + /* clear all MMX flags if MMX isn't supported */ + settable_asm_flags &= ~settable_mmx_flags; + png_ptr->asm_flags &= ~settable_mmx_flags; + } + + /* we're replacing the settable bits with those passed in by the user, + * so first zero them out of the master copy, then logical-OR in the + * allowed subset that was requested */ + + png_ptr->asm_flags &= ~settable_asm_flags; /* zero them */ + png_ptr->asm_flags |= (asm_flags & settable_asm_flags); /* set them */ +} +#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ + +#ifdef PNG_ASSEMBLER_CODE_SUPPORTED +/* 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) +{ + png_ptr->mmx_bitdepth_threshold = mmx_bitdepth_threshold; + png_ptr->mmx_rowbytes_threshold = mmx_rowbytes_threshold; +} +#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ diff --git a/pngtest.c b/pngtest.c index 03e7da3e..daaa6b8e 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,7 +1,7 @@ /* pngtest.c - a simple test program to test libpng * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -710,14 +710,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) # endif #else png_set_read_fn(read_ptr, (png_voidp)fpin, pngtest_read_data); -#ifdef PNG_WRITE_SUPPORTED +# ifdef PNG_WRITE_SUPPORTED png_set_write_fn(write_ptr, (png_voidp)fpout, pngtest_write_data, -#if defined(PNG_WRITE_FLUSH_SUPPORTED) +# if defined(PNG_WRITE_FLUSH_SUPPORTED) pngtest_flush); -#else -#endif +# else NULL); -#endif +# endif +# endif #endif if(status_dots_requested == 1) { @@ -1511,4 +1511,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_11 your_png_h_is_not_version_1_0_11; +typedef version_1_0_12beta1 your_png_h_is_not_version_1_0_12beta1; diff --git a/pngtrans.c b/pngtrans.c index a3b80a38..85d27559 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.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngvcrd.c b/pngvcrd.c index b00a56d4..75cc9b57 100644 --- a/pngvcrd.c +++ b/pngvcrd.c @@ -2,7 +2,7 @@ * * For Intel x86 CPU and Microsoft Visual C++ compiler * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * Copyright (c) 1998, Intel Corporation diff --git a/pngwio.c b/pngwio.c index a5bd4570..1b4e2661 100644 --- a/pngwio.c +++ b/pngwio.c @@ -1,7 +1,7 @@ /* pngwio.c - functions for data output * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngwrite.c b/pngwrite.c index e0291d39..86829c43 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -1,7 +1,7 @@ /* pngwrite.c - general routines to write a PNG file * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -444,7 +444,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_debug(1, "in png_create_write_struct\n"); #ifdef PNG_USER_MEM_SUPPORTED if ((png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, - (png_malloc_ptr)malloc_fn)) == NULL) + (png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr)) == NULL) #else if ((png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG)) == NULL) #endif /* PNG_USER_MEM_SUPPORTED */ @@ -489,6 +489,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, * only check the first digit. */ if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] || + (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) || (user_png_ver[0] == '0' && user_png_ver[2] < '9')) { png_error(png_ptr, @@ -496,15 +497,17 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, } /* Libpng 1.0.6 was not binary compatible, due to insertion of the - info_ptr->free_me member. Note to maintainer: this test can be - removed from version 2.0.0 and beyond because the previous test - would have already rejected it. */ + info_ptr->free_me member. Libpng-1.0.1 and earlier were not + compatible due to insertion of the user transform function. Note + to maintainer: this test can be removed from version 1.2.0 and + beyond because the previous test would have already rejected it. */ - if (user_png_ver[4] == '6' && user_png_ver[2] == '0' && - user_png_ver[0] == '1' && user_png_ver[5] == '\0') + if (user_png_ver[0] == '1' && user_png_ver[2] == '0' && + (user_png_ver[4] < '2' || user_png_ver[4] == '6') && + user_png_ver[5] == '\0') { png_error(png_ptr, - "Application must be recompiled; version 1.0.6 was incompatible"); + "Application must be recompiled; versions <= 1.0.6 were incompatible"); } } @@ -529,13 +532,36 @@ void PNGAPI png_write_init(png_structp png_ptr) { /* We only come here via pre-1.0.7-compiled applications */ - png_write_init_2(png_ptr, "1.0.0", 10000, 10000); + png_write_init_2(png_ptr, "1.0.0", 0, 0); } +#undef png_write_init_2 void PNGAPI png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t png_info_size) { + /* We only come here via pre-1.0.12-compiled applications */ + if(sizeof(png_struct) > png_struct_size) + { + png_ptr->error_fn=(png_error_ptr)NULL; + png_error(png_ptr, + "The png struct allocated by the application is too small."); + } + if(sizeof(png_info) > png_info_size) + { + png_ptr->error_fn=(png_error_ptr)NULL; + png_error(png_ptr, + "The info struct allocated by the application is too small."); + } + png_write_init_3(&png_ptr, user_png_ver, png_struct_size); +} + + +void PNGAPI +png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, + 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 */ #endif @@ -547,28 +573,28 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver, #ifdef PNG_LEGACY_SUPPORTED png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; #else - png_ptr->error_fn=(png_error_ptr)NULL; - png_error(png_ptr, - "Application uses deprecated png_write_init() and must be recompiled."); + png_ptr->warning_fn=(png_error_ptr)NULL; + png_warning(png_ptr, + "Application uses deprecated png_write_init() and should be recompiled."); + break; #endif } } while (png_libpng_ver[i++]); - if (sizeof(png_struct) > png_struct_size || - sizeof(png_info) > png_info_size) - { - png_ptr->error_fn=(png_error_ptr)NULL; - png_error(png_ptr, - "Application and library have different sized structs. Please recompile."); - } - - png_debug(1, "in png_write_init_2\n"); + png_debug(1, "in png_write_init_3\n"); #ifdef PNG_SETJMP_SUPPORTED /* save jump buffer and error functions */ png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf)); #endif + if (sizeof(png_struct) > png_struct_size) + { + png_destroy_struct(png_ptr); + png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); + *ptr_ptr = png_ptr; + } + /* reset all variables to 0 */ png_memset(png_ptr, 0, sizeof (png_struct)); @@ -577,11 +603,12 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver, png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf)); #endif + png_set_write_fn(png_ptr, NULL, NULL, NULL); + /* 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_set_write_fn(png_ptr, NULL, NULL, NULL); #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT, @@ -876,6 +903,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr) png_infop info_ptr = NULL; #ifdef PNG_USER_MEM_SUPPORTED png_free_ptr free_fn = NULL; + png_voidp mem_ptr = NULL; #endif png_debug(1, "in png_destroy_write_struct\n"); @@ -904,7 +932,8 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr) #endif #ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)info_ptr, free_fn); + png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); #else png_destroy_struct((png_voidp)info_ptr); #endif @@ -915,7 +944,8 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr) { png_write_destroy(png_ptr); #ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)png_ptr, free_fn); + png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); #else png_destroy_struct((png_voidp)png_ptr); #endif diff --git a/pngwtran.c b/pngwtran.c index fc18c603..8740b83f 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.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngwutil.c b/pngwutil.c index b8c82226..ed964ced 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * libpng 1.0.11 - April 27, 2001 + * libpng 1.0.12beta1 - May 14, 2001 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2001 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -285,7 +285,7 @@ png_text_compress(png_structp png_ptr, comp->output_ptr = (png_charpp)png_malloc(png_ptr, (png_uint_32)(comp->max_output_ptr * sizeof (png_charpp))); png_memcpy(comp->output_ptr, old_ptr, - old_max * sizeof (png_charp)); + old_max * sizeof (png_charp)); png_free(png_ptr, old_ptr); } else @@ -435,7 +435,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, #if defined(PNG_MNG_FEATURES_SUPPORTED) !((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) && - (color_type == PNG_COLOR_TYPE_RGB || + (color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_RGB_ALPHA) && (filter_type == PNG_INTRAPIXEL_DIFFERENCING)) && #endif @@ -460,7 +460,9 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, 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) png_ptr->filter_type = (png_byte)filter_type; +#endif png_ptr->width = width; png_ptr->height = height; @@ -536,20 +538,27 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) png_debug(1, "in png_write_PLTE\n"); if (( #if defined(PNG_MNG_FEATURES_SUPPORTED) || \ - defined (PNG_WRITE_EMPTY_PLTE_SUPPORTED) + defined(PNG_WRITE_EMPTY_PLTE_PERMITTED) !(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) && #endif num_pal == 0) || num_pal > 256) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - { - png_error(png_ptr, "Invalid number of colors in palette"); - } - else - { - png_warning(png_ptr, "Invalid number of colors in palette"); - return; - } + png_error(png_ptr, "Invalid number of colors in palette"); + } + else + { + png_warning(png_ptr, "Invalid number of colors in palette"); + return; + } + } + + if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR)) + { + png_warning(png_ptr, + "Ignoring request to write a PLTE chunk in grayscale PNG"); + return; } png_ptr->num_palette = (png_uint_16)num_pal; @@ -1020,7 +1029,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) { if ( #if defined(PNG_MNG_FEATURES_SUPPORTED) || \ - defined (PNG_WRITE_EMPTY_PLTE_SUPPORTED) + defined(PNG_WRITE_EMPTY_PLTE_PERMITTED) (png_ptr->num_palette || (!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) && #endif @@ -1109,7 +1118,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) png_debug1(2, "Keyword to be checked is '%s'\n", key); *new_key = (png_charp)png_malloc(png_ptr, (png_uint_32)(key_len + 2)); - + /* Replace non-printing characters with a blank and print a warning */ for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++) { @@ -1417,9 +1426,9 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, png_warning(png_ptr, "Unrecognized equation type for pCAL chunk"); purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1; - png_debug1(3, "pCAL purpose length = %d\n", purpose_len); + png_debug1(3, "pCAL purpose length = %d\n", (int)purpose_len); units_len = png_strlen(units) + (nparams == 0 ? 0 : 1); - png_debug1(3, "pCAL units length = %d\n", units_len); + png_debug1(3, "pCAL units length = %d\n", (int)units_len); total_len = purpose_len + units_len + 10; params_len = (png_uint_32p)png_malloc(png_ptr, (png_uint_32)(nparams @@ -1434,7 +1443,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, total_len += (png_size_t)params_len[i]; } - png_debug1(3, "pCAL total length = %d\n", total_len); + png_debug1(3, "pCAL total length = %d\n", (int)total_len); png_write_chunk_start(png_ptr, (png_bytep)png_pCAL, (png_uint_32)total_len); png_write_chunk_data(png_ptr, (png_bytep)new_purpose, purpose_len); png_save_int_32(buf, X0); @@ -1486,7 +1495,7 @@ png_write_sCAL(png_structp png_ptr, int unit, double width,double height) #endif total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf); - png_debug1(3, "sCAL total length = %d\n", total_len); + png_debug1(3, "sCAL total length = %d\n", (int)total_len); png_write_chunk_start(png_ptr, (png_bytep)png_sCAL, (png_uint_32)total_len); png_write_chunk_data(png_ptr, (png_bytep)&unit, 1); png_write_chunk_data(png_ptr, (png_bytep)wbuf, png_strlen(wbuf)+1); diff --git a/projects/msvc/README.txt b/projects/msvc/README.txt index 75503607..b08db7df 100644 --- a/projects/msvc/README.txt +++ b/projects/msvc/README.txt @@ -1,5 +1,5 @@ Microsoft Developer Studio Build File, Format Version 6.00 for -libpng 1.0.11 (April 27, 2001) and zlib +libpng 1.0.12beta1 (May 14, 2001) and zlib Copyright (C) 2000 Simon-Pierre Cadieux For conditions of distribution and use, see copyright notice in png.h @@ -24,12 +24,12 @@ To build: This project will build the PNG Development Group's "official" versions of libpng and zlib libraries: - libpng1.dll (default version, currently C code only) - libpng1.dll (C + Assembler version) - libpng1.dll (C + Assembler debug version) - libpng1.dll (C code debug version) - libpng1[c,e-m].dll (reserved for official versions) - libpng1[n-z].dll (available for private versions) + libpng2.dll (default version, currently C code only) + libpng2.dll (C + Assembler version) + libpng2.dll (C + Assembler debug version) + libpng2.dll (C code debug version) + libpng2[c,e-m].dll (reserved for official versions) + libpng2[n-z].dll (available for private versions) zlib.dll (default version, currently C code only) zlibd.dll (debug version) diff --git a/projects/msvc/libpng.dsp b/projects/msvc/libpng.dsp index 4421782c..82f66dba 100644 --- a/projects/msvc/libpng.dsp +++ b/projects/msvc/libpng.dsp @@ -56,7 +56,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /machine:I386 -# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll\libpng1.dll" +# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll\libpng2.dll" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug" @@ -84,7 +84,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbg\libpng1d.dll" +# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbg\libpng2d.dll" !ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM" @@ -111,7 +111,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /machine:I386 -# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll_asm\libpng1a.dll" +# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll_asm\libpng2a.dll" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug ASM" @@ -139,7 +139,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbga\libpng1b.dll" +# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbga\libpng2b.dll" !ELSEIF "$(CFG)" == "libpng - Win32 LIB" diff --git a/projects/msvc/png32ms.def b/projects/msvc/png32ms.def index 7afd54c7..388fdadc 100644 --- a/projects/msvc/png32ms.def +++ b/projects/msvc/png32ms.def @@ -6,7 +6,7 @@ LIBRARY DESCRIPTION "PNG image compression library for Windows" EXPORTS -;Version 1.0.11 +;Version 1.0.12beta1 png_build_grayscale_palette @1 png_check_sig @2 png_chunk_error @3 @@ -77,13 +77,15 @@ EXPORTS png_malloc @68 png_memcpy_check @69 png_memset_check @70 +; png_permit_empty_plte is deprecated png_permit_empty_plte @71 png_process_data @72 png_progressive_combine_row @73 png_read_end @74 png_read_image @75 png_read_info @76 - png_read_init @77 ; deprecated +; png_read_init is deprecated + png_read_init @77 png_read_png @78 png_read_row @79 png_read_rows @80 @@ -168,10 +170,12 @@ EXPORTS png_write_image @159 png_write_info @160 png_write_info_before_PLTE @161 - png_write_init @162 ; deprecated +; png_write_init is deprecated + png_write_init @162 png_write_png @163 png_write_row @164 png_write_rows @165 +; png_read_init_2 and png_write_init_2 are deprecated. png_read_init_2 @166 png_write_init_2 @167 png_access_version_number @168 @@ -180,7 +184,30 @@ EXPORTS png_init_io @171 png_convert_to_rfc1123 @172 png_set_invalid @173 -;To be added at version 1.2.0 -; png_permit_mng_features @174 -;To be added at version 1.2.0 -; png_mmx_support @175 +; Added at version 1.0.12 +; For compatiblity with 1.0.7-1.0.11 + png_info_init @174 + png_read_init_3 @175 + png_write_init_3 @176 + png_info_init_3 @177 + png_destroy_struct @178 +; To be added at version 1.2.0 +; For use with PNG_USER_MEM_SUPPORTED +; png_destroy_struct_2 @179 +; png_create_read_struct_2 @180 +; png_create_write_struct_2 @181 +; png_malloc_default @182 +; png_free_default @183 +; MNG features +; png_permit_mng_features @184 +; MMX support +; png_mmx_support @185 +; png_get_mmx_flagmask @186 +; png_get_asm_flagmask @187 +; png_get_asm_flags @188 +; png_get_mmx_bitdepth_threshold @189 +; png_get_mmx_rowbytes_threshold @190 +; png_set_asm_flags @191 +; png_init_mmx_flags @192 +; Strip error numbers +; png_set_strip_error_numbers @193 diff --git a/projects/wince/READMEE.WCE b/projects/wince/READMEE.WCE index 714555ed..c211cf10 100644 --- a/projects/wince/READMEE.WCE +++ b/projects/wince/READMEE.WCE @@ -8,9 +8,9 @@ libpng for WindowsCE Rel.1.0 Introduction ============ -This is libpng 1.0.11 ported to WindowsCE 2.0 and 2.11. -libpng 1.0.11 is a PNG reference library. -See README, a document of original libpng 1.0.11. +This is libpng 1.0.12beta1 ported to WindowsCE 2.0 and 2.11. +libpng 1.0.12beta1 is a PNG reference library. +See README, a document of original libpng 1.0.12beta1. zlib for WindowsCE ================== @@ -23,7 +23,7 @@ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -See README and LICENSE, documents of original libpng 1.0.11, for conditions +See README and LICENSE, documents of original libpng 1.0.12beta1, for conditions of use and distribution. Files diff --git a/projects/wince/READMEJ.WCE b/projects/wince/READMEJ.WCE index 8c19f86e..4a2e2c38 100644 --- a/projects/wince/READMEJ.WCE +++ b/projects/wince/READMEJ.WCE @@ -24,7 +24,7 @@ libpng になったいかなる被害についても、作者、配布者、その他利用者以外の人物、 団体に責任をとる義務はないものとします。 -その他、このソフトウェアの利用条件については、原版である libpng 1.0.11に +その他、このソフトウェアの利用条件については、原版である libpng 1.0.12beta1に 準拠するものとします。詳しくは、付属の README,LICENSE をお読みください。 収録内容 diff --git a/projects/wince/png32ce.def b/projects/wince/png32ce.def index e7016ece..f97061fd 100644 --- a/projects/wince/png32ce.def +++ b/projects/wince/png32ce.def @@ -5,7 +5,7 @@ LIBRARY lpngce EXPORTS -;Version 1.0.11 +;Version 1.0.12beta1 png_build_grayscale_palette @1 png_check_sig @2 png_chunk_error @3 @@ -76,13 +76,15 @@ EXPORTS png_malloc @68 png_memcpy_check @69 png_memset_check @70 +; png_permit_empty_plte is deprecated png_permit_empty_plte @71 png_process_data @72 png_progressive_combine_row @73 png_read_end @74 png_read_image @75 png_read_info @76 - png_read_init @77 ; deprecated +; png_read_init is deprecated + png_read_init @77 png_read_png @78 png_read_row @79 png_read_rows @80 @@ -167,19 +169,44 @@ EXPORTS png_write_image @159 png_write_info @160 png_write_info_before_PLTE @161 - png_write_init @162 ; deprecated +; png_write_init is deprecated + png_write_init @162 png_write_png @163 png_write_row @164 png_write_rows @165 +; png_read_init_2 and png_write_init_2 are deprecated. png_read_init_2 @166 png_write_init_2 @167 png_access_version_number @168 ; png_sig_bytes @169 - png_libpng_ver @170 +; png_libpng_ver @170 png_init_io @171 png_convert_to_rfc1123 @172 png_set_invalid @173 -;To be added at version 1.2.0 -; png_permit_mng_features @174 -;To be added at version 1.2.0 -; png_mmx_support @175 +; Added at version 1.0.12 +; For compatiblity with 1.0.7-1.0.11 + png_info_init @174 + png_read_init_3 @175 + png_write_init_3 @176 + png_info_init_3 @177 + png_destroy_struct @178 +; To be added at version 1.2.0 +; For use with PNG_USER_MEM_SUPPORTED +; png_destroy_struct_2 @179 +; png_create_read_struct_2 @180 +; png_create_write_struct_2 @181 +; png_malloc_default @182 +; png_free_default @183 +; MNG features +; png_permit_mng_features @184 +; MMX support +; png_mmx_support @185 +; png_get_mmx_flagmask @186 +; png_get_asm_flagmask @187 +; png_get_asm_flags @188 +; png_get_mmx_bitdepth_threshold @189 +; png_get_mmx_rowbytes_threshold @190 +; png_set_asm_flags @191 +; png_init_mmx_flags @192 +; Strip error numbers +; png_set_strip_error_numbers @193 diff --git a/scripts/makefile.aix b/scripts/makefile.aix index be7691f8..38c44b55 100644 --- a/scripts/makefile.aix +++ b/scripts/makefile.aix @@ -18,7 +18,7 @@ RM = rm -f # read libpng.txt or png.h to see why PNGMAJ is 2. You should not # have to change it. PNGMAJ = 2 -PNGMIN = 1.0.11 +PNGMIN = 1.0.12beta1 PNGVER = $(PNGMAJ).$(PNGMIN) prefix=/usr/local diff --git a/scripts/makefile.beos b/scripts/makefile.beos index 46a7b1ae..8811b576 100644 --- a/scripts/makefile.beos +++ b/scripts/makefile.beos @@ -13,7 +13,7 @@ ZLIBINC=/usr/local/include # read libpng.txt or png.h to see why PNGMAJ is 2. You should not # have to change it. PNGMAJ = 2 -PNGMIN = 1.0.11 +PNGMIN = 1.0.12beta1 PNGVER = $(PNGMAJ).$(PNGMIN) ALIGN= diff --git a/scripts/makefile.cygwin b/scripts/makefile.cygwin index 76ac4bf5..c88c9843 100644 --- a/scripts/makefile.cygwin +++ b/scripts/makefile.cygwin @@ -38,10 +38,10 @@ CFLAGS=-I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \ # read libpng.txt or png.h to see why PNGMAJ is 2. You should not # have to change it. PNGMAJ = 2 -#PNGDLL = $1# msvc -PNGDLL = 2# cygwin 1.0.11 -PNGMIN = 1.0.11 -PNGMIN_BASE = 1.0.11 +#PNGDLL = $2# msvc +PNGDLL = 2# cygwin 1.0.12beta1 +PNGMIN = 1.0.12beta1 +PNGMIN_BASE = 1.0.12 PNGVER = $(PNGMAJ).$(PNGMIN) SHAREDLIB=cygpng$(PNGDLL).dll @@ -108,7 +108,8 @@ $(STATLIB): $(OBJS) $(RANLIB) $@ $(SHAREDDEF): projects/msvc/png32ms.def - cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' > $@ + cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' | \ + sed -e 's/\([^;]*\);/;/' > $@ $(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF) $(LDSHARED) -o $@ $(LDEXTRA) $(OBJSDLL) -L. -L$(ZLIBLIB) -lz diff --git a/scripts/makefile.dec b/scripts/makefile.dec index f1f3746d..19893cad 100644 --- a/scripts/makefile.dec +++ b/scripts/makefile.dec @@ -17,7 +17,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.11 +PNGMIN = 1.0.12beta1 PNGVER = $(PNGMAJ).$(PNGMIN) CC=cc diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx index 7f00df14..3fd75599 100644 --- a/scripts/makefile.gcmmx +++ b/scripts/makefile.gcmmx @@ -51,7 +51,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.11 +PNGMIN = 1.0.12beta1 PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.hpgcc b/scripts/makefile.hpgcc index 9e6ff2f4..1002affb 100644 --- a/scripts/makefile.hpgcc +++ b/scripts/makefile.hpgcc @@ -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.11 +PNGMIN = 1.0.12beta1 PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.hpux b/scripts/makefile.hpux index 8899a777..bfd26c89 100644 --- a/scripts/makefile.hpux +++ b/scripts/makefile.hpux @@ -19,7 +19,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.11 +PNGMIN = 1.0.12beta1 PNGVER = $(PNGMAJ).$(PNGMIN) # where make install puts libpng.a and png.h diff --git a/scripts/makefile.linux b/scripts/makefile.linux index 15aad024..5e8ba4cb 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.11 +PNGMIN = 1.0.12beta1 PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.netbsd b/scripts/makefile.netbsd index b9032cf6..719bc717 100644 --- a/scripts/makefile.netbsd +++ b/scripts/makefile.netbsd @@ -11,7 +11,7 @@ INCSDIR=${LOCALBASE}/include LIB=png SHLIB_MAJOR= 2 -SHLIB_MINOR= 1.0.11 +SHLIB_MINOR= 1.0.12beta1 SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngwtran.c pngmem.c pngerror.c pngpread.c diff --git a/scripts/makefile.sco b/scripts/makefile.sco index 546adc31..f32f1640 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.11 +PNGMIN = 1.0.12beta1 PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc index 44311122..bea04498 100644 --- a/scripts/makefile.sggcc +++ b/scripts/makefile.sggcc @@ -19,8 +19,8 @@ CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm LDSHARED=gcc -shared -VER=1.0.11 -LIBS=libpng.so.1.0.11 +VER=1.0.12beta1 +LIBS=libpng.so.1.0.12beta1 SHAREDLIB=libpng.so libdir=$(prefix)/lib32 diff --git a/scripts/makefile.sgi b/scripts/makefile.sgi index 50831c94..4726d5d1 100644 --- a/scripts/makefile.sgi +++ b/scripts/makefile.sgi @@ -25,7 +25,7 @@ CFLAGS=-I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm LDSHARED=cc -shared -VER=1.0.11 +VER=1.0.12beta1 SONUM=2 SHAREDLIB=libpng.so libdir=$(prefix) diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris index 0a972f73..93da477f 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.11 +PNGMIN = 1.0.12beta1 PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas index 583ab486..3e8c3bc7 100644 --- a/scripts/pngdef.pas +++ b/scripts/pngdef.pas @@ -7,8 +7,8 @@ unit pngdef; interface const - PNG_LIBPNG_VER_STRING = '1.0.11'; - PNG_LIBPNG_VER = 10011; + PNG_LIBPNG_VER_STRING = '1.0.12beta1'; + PNG_LIBPNG_VER = 10012; type png_uint_32 = Cardinal; diff --git a/scripts/pngos2.def b/scripts/pngos2.def index b4b73f79..f096faf7 100644 --- a/scripts/pngos2.def +++ b/scripts/pngos2.def @@ -2,7 +2,7 @@ ; PNG.LIB module definition file for OS/2 ;---------------------------------------- -; Version 1.0.11 +; Version 1.0.12beta1 LIBRARY PNG DESCRIPTION "PNG image compression library for OS/2"