From 5379b24536b5e48feb035c0d857938446ec3d18a Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 27 Nov 1999 10:22:33 -0600 Subject: [PATCH] Imported from libpng-1.0.5c.tar --- ANNOUNCE | 24 +++++++- CHANGES | 20 +++++++ INSTALL | 8 +-- LICENSE | 4 +- README | 6 +- Y2KINFO | 4 +- contrib/gregbook/makevms.com | 104 ++++++++++++++++++++++++++++++++++ contrib/gregbook/rpng-x.c | 6 +- contrib/gregbook/rpng2-x.c | 16 ++++-- contrib/pngminus/README | 4 +- contrib/pngminus/makefile.std | 8 +-- contrib/pngminus/makevms.com | 92 ++++++++++++++++++++++++++++++ example.c | 8 +++ libpng.3 | 44 ++++++++++---- libpng.txt | 24 +++++--- libpngpf.3 | 4 +- png.5 | 2 +- png.c | 67 +++++++++++++++++++--- png.h | 86 +++++++++++++++------------- pngasmrd.h | 4 +- pngconf.h | 10 +++- pngerror.c | 2 +- pngget.c | 2 +- pngmem.c | 2 +- pngpread.c | 45 ++++++++++++--- pngread.c | 11 +++- pngrio.c | 2 +- pngrtran.c | 10 ++-- pngrutil.c | 38 ++++++++++++- pngset.c | 4 +- pngtest.c | 16 ++++-- pngtrans.c | 2 +- pngtypes.h | 35 ++++++++++++ pngvcrd.c | 4 +- pngwio.c | 2 +- pngwrite.c | 31 +++++++--- pngwtran.c | 2 +- pngwutil.c | 100 ++++++++++++++++++++++++-------- scripts/makefile.beos | 2 +- scripts/makefile.dec | 2 +- scripts/makefile.linux | 2 +- scripts/makefile.sco | 2 +- scripts/makefile.solaris | 9 +-- scripts/makevms.com | 14 +++-- scripts/pngdef.pas | 11 +++- scripts/pngos2.def | 3 + 46 files changed, 720 insertions(+), 178 deletions(-) create mode 100644 contrib/gregbook/makevms.com create mode 100644 contrib/pngminus/makevms.com create mode 100644 pngtypes.h diff --git a/ANNOUNCE b/ANNOUNCE index a2256c2b0..b5f108509 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,12 +1,12 @@ -Libpng 1.0.5a - October 23, 1999 +Libpng 1.0.5c - November 27, 1999 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. Changes since the last public release (1.0.5): -version 1.0.5a [October 23, 1999] +version libpng-1.0.5a October 23, 1999 Added contrib/pngsuite and contrib/pngminus (Willem van Schaik) Fixed a typo in the png_set_sRGB() function call in example.c (Jan Nijtmans) Further optimization and bugfix of pngvcrd.c @@ -14,6 +14,26 @@ version 1.0.5a [October 23, 1999] text_ptr structure. Instead, it makes its own copy. Created separate write_end_info_struct in pngtest.c for a more severe test. Added code in pngwrite.c to free info_ptr->text[i].key to stop a memory leak. +version libpng-1.0.5b November 23, 1999 + Moved PNG_FLAG_HAVE_CHUNK_HEADER, PNG_FLAG_BACKGROUND_IS_GRAY and + PNG_FLAG_WROTE_tIME from flags to mode. + Added png_write_info_before_PLTE() function. + Fixed some typecasting in contrib/gregbook/*.c + Updated scripts/makevms.com and added makevms.com to contrib/gregbook + and contrib/pngminus (Martin Zinser) +version 1.0.5c [November 27, 1999] + Moved png_get_header_version from png.h to png.c, to accomodate ansi2knr. + Removed all global arrays (according to PNG_NO_GLOBAL_ARRAYS macro), to + accomodate making DLL's: Moved usr_png_ver from global variable to function + png_get_header_ver() in png.c. Moved png_sig to png_sig_bytes in png.c and + eliminated use of png_sig in pngwutil.c. Moved the various png_CHNK arrays + into pngtypes.h. Eliminated use of global png_pass arrays. Declared the + png_CHNK and png_pass arrays to be "const". Made the global arrays + available to applications (although none are used in libpng itself) when + PNG_NO_GLOBAL_ARRAYS is not defined or when PNG_GLOBAL_ARRAYS is defined. + Removed some extraneous "-I" from contrib/pngminus/makefile.std + Changed the PNG_sRGB_INTENT macros in png.h to be consistent with PNG-1.2. + Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3 Send comments/corrections/commendations to png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu diff --git a/CHANGES b/CHANGES index 6dec25730..49567ab23 100644 --- a/CHANGES +++ b/CHANGES @@ -484,3 +484,23 @@ version 1.0.5a [October 23, 1999] text_ptr structure. Instead, it makes its own copy. Created separate write_end_info_struct in pngtest.c for a more severe test. Added code in pngwrite.c to free info_ptr->text[i].key to stop a memory leak. +version 1.0.5b [November 23, 1999] + Moved PNG_FLAG_HAVE_CHUNK_HEADER, PNG_FLAG_BACKGROUND_IS_GRAY and + PNG_FLAG_WROTE_tIME from flags to mode. + Added png_write_info_before_PLTE() function. + Fixed some typecasting in contrib/gregbook/*.c + Updated scripts/makevms.com and added makevms.com to contrib/gregbook + and contrib/pngminus (Martin Zinser) +version 1.0.5c [November 27, 1999] + Moved png_get_header_version from png.h to png.c, to accomodate ansi2knr. + Removed all global arrays (according to PNG_NO_GLOBAL_ARRAYS macro), to + accomodate making DLL's: Moved usr_png_ver from global variable to function + png_get_header_ver() in png.c. Moved png_sig to png_sig_bytes in png.c and + eliminated use of png_sig in pngwutil.c. Moved the various png_CHNK arrays + into pngtypes.h. Eliminated use of global png_pass arrays. Declared the + png_CHNK and png_pass arrays to be "const". Made the global arrays + available to applications (although none are used in libpng itself) when + PNG_NO_GLOBAL_ARRAYS is not defined or when PNG_GLOBAL_ARRAYS is defined. + Removed some extraneous "-I" from contrib/pngminus/makefile.std + Changed the PNG_sRGB_INTENT macros in png.h to be consistent with PNG-1.2. + Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3 diff --git a/INSTALL b/INSTALL index 44a1de380..f53bbde61 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ -Installing libpng version 1.0.5a - October 23, 1999 +Installing libpng version 1.0.5c - November 27, 1999 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.5a" or "lpng103" and "zlib-1.1.3" +might be called "libpng-1.0.5c" or "lpng103" and "zlib-1.1.3" or "zlib113") so that you have directories called "zlib" and "libpng". Your directory structure should look like this: @@ -51,8 +51,8 @@ include makefile.hpux => HPUX (10.20 and 11.00) makefile makefile.sgi => Silicon Graphics IRIX makefile makefile.sunos => Sun makefile - makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.5a) - makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.5a) + makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.5c) + makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.5c) 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 27f94d5bd..d6ca4e6f7 100644 --- a/LICENSE +++ b/LICENSE @@ -5,7 +5,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. Copyright (c) 1996, 1997 Andreas Dilger (libpng versions 0.90, December 1996, through 0.96, May 1997) Copyright (c) 1998, 1999 Glenn Randers-Pehrson -(libpng versions 0.97, January 1998, through 1.0.5a, October 23, 1999) +(libpng versions 0.97, January 1998, through 1.0.5c, November 27, 1999) For the purposes of this copyright and license, "Contributing Authors" is defined as the following set of individuals: @@ -67,4 +67,4 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson randeg@alum.rpi.edu -October 23, 1999 +November 27, 1999 diff --git a/README b/README index a972c95b1..1d07f8f74 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for libpng 1.0.5a - October 23, 1999 (shared library 2.1) +README for libpng 1.0.5c - November 27, 1999 (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. @@ -171,9 +171,9 @@ Files in this distribution: makefile.sgi => Silicon Graphics IRIX makefile makefile.sunos => Sun makefile makefile.solaris => Solaris 2.X makefile - (gcc, creates libpng.so.2.1.0.5a) + (gcc, creates libpng.so.2.1.0.5c) makefile.linux => Linux/ELF makefile - (gcc, creates libpng.so.2.1.0.5a) + (gcc, creates libpng.so.2.1.0.5c) 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 b32bfdf9c..ade705649 100644 --- a/Y2KINFO +++ b/Y2KINFO @@ -1,13 +1,13 @@ Y2K compliance in libpng: ========================= - October 23, 1999 + November 27, 1999 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.5a are Y2K compliant. It is my belief that earlier + upward through 1.0.5c 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/contrib/gregbook/makevms.com b/contrib/gregbook/makevms.com new file mode 100644 index 000000000..5f7a9c6ca --- /dev/null +++ b/contrib/gregbook/makevms.com @@ -0,0 +1,104 @@ +$!------------------------------------------------------------------------------ +$! make Contrib programs of libpng under OpenVMS +$! +$! +$! Look for the compiler used +$! +$ zlibsrc = "[---.zlib]" +$ ccopt="/include=(''zlibsrc',[--])" +$ if f$getsyi("HW_MODEL").ge.1024 +$ then +$ ccopt = "/prefix=all"+ccopt +$ comp = "__decc__=1" +$ if f$trnlnm("SYS").eqs."" then define sys sys$library: +$ else +$ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs."" +$ then +$ if f$trnlnm("SYS").eqs."" then define sys sys$library: +$ if f$search("SYS$SYSTEM:VAXC.EXE").eqs."" +$ then +$ comp = "__gcc__=1" +$ CC :== GCC +$ else +$ comp = "__vaxc__=1" +$ endif +$ else +$ if f$trnlnm("SYS").eqs."" then define sys decc$library_include: +$ ccopt = "/decc/prefix=all"+ccopt +$ comp = "__decc__=1" +$ endif +$ endif +$ open/write lopt lib.opt +$ write lopt "[--]libpng.olb/lib" +$ write lopt "''zlibsrc'libz.olb/lib" +$ close lopt +$ open/write xopt x11.opt +$ write xopt "sys$library:decw$xlibshr.exe/share" +$ close xopt +$ write sys$output "Compiling PNG contrib programs ..." +$ CALL MAKE readpng.OBJ "cc ''CCOPT' readpng" - + readpng.c readpng.h +$ CALL MAKE readpng2.OBJ "cc ''CCOPT' readpng2" - + readpng2.c readpng2.h +$ CALL MAKE writepng.OBJ "cc ''CCOPT' writepng" - + writepng.c writepng.h +$ write sys$output "Building rpng-x..." +$ CALL MAKE rpng-x.OBJ "cc ''CCOPT' rpng-x" - + rpng-x.c readpng.h +$ call make rpng-x.exe - + "LINK rpng-x,readpng,lib.opt/opt,x11.opt/opt" - + rpng-x.obj readpng.obj +$ write sys$output "Building rpng2-x..." +$ CALL MAKE rpng2-x.OBJ "cc ''CCOPT' rpng2-x" - + rpng2-x.c readpng2.h +$ call make rpng2-x.exe - + "LINK rpng2-x,readpng2,lib.opt/opt,x11.opt/opt" - + rpng2-x.obj readpng2.obj +$ write sys$output "Building wpng..." +$ CALL MAKE wpng.OBJ "cc ''CCOPT' wpng" - + wpng.c writepng.h +$ call make wpng.exe - + "LINK wpng,writepng,lib.opt/opt" - + wpng.obj writepng.obj +$ exit +$! +$! +$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES +$ V = 'F$Verify(0) +$! P1 = What we are trying to make +$! P2 = Command to make it +$! P3 - P8 What it depends on +$ +$ If F$Search(P1) .Eqs. "" Then Goto Makeit +$ Time = F$CvTime(F$File(P1,"RDT")) +$arg=3 +$Loop: +$ Argument = P'arg +$ If Argument .Eqs. "" Then Goto Exit +$ El=0 +$Loop2: +$ File = F$Element(El," ",Argument) +$ If File .Eqs. " " Then Goto Endl +$ AFile = "" +$Loop3: +$ OFile = AFile +$ AFile = F$Search(File) +$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl +$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit +$ Goto Loop3 +$NextEL: +$ El = El + 1 +$ Goto Loop2 +$EndL: +$ arg=arg+1 +$ If arg .Le. 8 Then Goto Loop +$ Goto Exit +$ +$Makeit: +$ VV=F$VERIFY(0) +$ write sys$output P2 +$ 'P2 +$ VV='F$Verify(VV) +$Exit: +$ If V Then Set Verify +$ENDSUBROUTINE diff --git a/contrib/gregbook/rpng-x.c b/contrib/gregbook/rpng-x.c index 70a19e59f..ee9ebb72b 100644 --- a/contrib/gregbook/rpng-x.c +++ b/contrib/gregbook/rpng-x.c @@ -222,7 +222,8 @@ int main(int argc, char **argv) fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename); ++error; } else { - if ((rc = readpng_init(infile, &image_width, &image_height)) != 0) { + if ((rc = readpng_init(infile, (long *)(&image_width), + (long *)(&image_height))) != 0) { switch (rc) { case 1: fprintf(stderr, PROGNAME @@ -542,7 +543,8 @@ static int rpng_x_create_window() static int rpng_x_display_image() { - uch *src, *dest; + uch *src; + char *dest; uch r, g, b, a; int ximage_rowbytes = ximage->bytes_per_line; ulg i, row, lastrow = 0; diff --git a/contrib/gregbook/rpng2-x.c b/contrib/gregbook/rpng2-x.c index bfa83e609..f0ad73038 100644 --- a/contrib/gregbook/rpng2-x.c +++ b/contrib/gregbook/rpng2-x.c @@ -57,6 +57,10 @@ #include #include /* defines XK_* macros */ +#ifdef VMS +#include +#endif + /* all for PvdM background code: */ #ifndef PI # define PI 3.141592653589793238 @@ -721,7 +725,8 @@ static int rpng2_x_create_window() static int rpng2_x_load_bg_image() { - uch *src, *dest; + uch *src; + char *dest; uch r1, r2, g1, g2, b1, b2; uch r1_inv, r2_inv, g1_inv, g2_inv, b1_inv, b2_inv; int k, hmax, max; @@ -784,7 +789,7 @@ static int rpng2_x_load_bg_image() g2_inv = g2_min + (g2_diff * (yidx_max-yidx)) / yidx_max; b2_inv = b2_min + (b2_diff * (yidx_max-yidx)) / yidx_max; - dest = bg_data + row*bg_rowbytes; + dest = (char *)(bg_data + row*bg_rowbytes); for (i = 0; i < rpng2_info.width; ++i) { even_odd_horiz = (i / bgscale) & 1; even_odd = even_odd_vert ^ even_odd_horiz; @@ -837,7 +842,7 @@ static int rpng2_x_load_bg_image() yidx = row % bgscale; if (yidx > hmax) yidx = bgscale-1 - yidx; - dest = bg_data + row*bg_rowbytes; + dest = (char *)(bg_data + row*bg_rowbytes); for (i = 0; i < rpng2_info.width; ++i) { xidx = i % bgscale; if (xidx > hmax) @@ -887,7 +892,7 @@ static int rpng2_x_load_bg_image() for (row = 0; row < rpng2_info.height; ++row) { y = row - hh; - dest = bg_data + row*bg_rowbytes; + dest = (char *)(bg_data + row*bg_rowbytes); for (i = 0; i < rpng2_info.width; ++i) { x = i - hw; angle = (x == 0)? PI_2 : atan((double)y / (double)x); @@ -1001,7 +1006,8 @@ static void rpng2_x_display_row(ulg row) uch bg_red = rpng2_info.bg_red; uch bg_green = rpng2_info.bg_green; uch bg_blue = rpng2_info.bg_blue; - uch *src, *src2=NULL, *dest; + uch *src, *src2=NULL; + char *dest; uch r, g, b, a; int ximage_rowbytes = ximage->bytes_per_line; ulg i, pixel; diff --git a/contrib/pngminus/README b/contrib/pngminus/README index cfcb20c34..02486c514 100644 --- a/contrib/pngminus/README +++ b/contrib/pngminus/README @@ -94,8 +94,8 @@ can be part of a pipe. To list the options type "png2pnm -h" or "pnm2png -h". -Just like IKEA --------------- +Just like Scandinavian furniture +-------------------------------- You have to put it together yourself. I did test the software under MS-DOS with Turbo-C 3.0 and under RedHat Linux 4.2 with gcc. In both cases I used libpng-1.0.4 and zlib-1.1.3. Later versions should be OK, diff --git a/contrib/pngminus/makefile.std b/contrib/pngminus/makefile.std index 9d2edf797..c98cd640b 100644 --- a/contrib/pngminus/makefile.std +++ b/contrib/pngminus/makefile.std @@ -10,13 +10,13 @@ RM=rm CP=cp PNGPATH = /usr/local -PNGINC = -I$(PNGPATH)/include -#PNGLIB = -L$(PNGPATH)/lib -lpng +PNGINC = $(PNGPATH)/include +#PNGLIB = $(PNGPATH)/lib -lpng PNGLIB = $(PNGPATH)/lib/libpng.a ZPATH = /usr/local -ZINC = -I$(ZPATH)/include -#ZLIB = -L$(ZPATH)/lib -lz +ZINC = $(ZPATH)/include +#ZLIB = $(ZPATH)/lib -lz ZLIB = $(ZPATH)/lib/libz.a CCFLAGS=-I$(PNGINC) -I$(ZINC) diff --git a/contrib/pngminus/makevms.com b/contrib/pngminus/makevms.com new file mode 100644 index 000000000..15d4ad478 --- /dev/null +++ b/contrib/pngminus/makevms.com @@ -0,0 +1,92 @@ +$!------------------------------------------------------------------------------ +$! make Contrib programs of libpng under OpenVMS +$! +$! +$! Look for the compiler used +$! +$ zlibsrc = "[---.zlib]" +$ ccopt="/include=(''zlibsrc',[--])" +$ if f$getsyi("HW_MODEL").ge.1024 +$ then +$ ccopt = "/prefix=all"+ccopt +$ comp = "__decc__=1" +$ if f$trnlnm("SYS").eqs."" then define sys sys$library: +$ else +$ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs."" +$ then +$ if f$trnlnm("SYS").eqs."" then define sys sys$library: +$ if f$search("SYS$SYSTEM:VAXC.EXE").eqs."" +$ then +$ comp = "__gcc__=1" +$ CC :== GCC +$ else +$ comp = "__vaxc__=1" +$ endif +$ else +$ if f$trnlnm("SYS").eqs."" then define sys decc$library_include: +$ ccopt = "/decc/prefix=all"+ccopt +$ comp = "__decc__=1" +$ endif +$ endif +$ open/write lopt lib.opt +$ write lopt "[--]libpng.olb/lib" +$ write lopt "''zlibsrc'libz.olb/lib" +$ close lopt +$ open/write xopt x11.opt +$ write xopt "sys$library:decw$xlibshr.exe/share" +$ close xopt +$ write sys$output "Compiling PNG contrib programs ..." +$ write sys$output "Building pnm2png..." +$ CALL MAKE pnm2png.OBJ "cc ''CCOPT' pnm2png" - + pnm2png.c +$ call make pnm2png.exe - + "LINK pnm2png,lib.opt/opt" - + pnm2png.obj +$ write sys$output "Building png2pnm..." +$ CALL MAKE png2pnm.OBJ "cc ''CCOPT' png2pnm" - + png2pnm.c +$ call make pnm2png.exe - + "LINK pnm2png,lib.opt/opt" - + pnm2png.obj +$ exit +$! +$! +$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES +$ V = 'F$Verify(0) +$! P1 = What we are trying to make +$! P2 = Command to make it +$! P3 - P8 What it depends on +$ +$ If F$Search(P1) .Eqs. "" Then Goto Makeit +$ Time = F$CvTime(F$File(P1,"RDT")) +$arg=3 +$Loop: +$ Argument = P'arg +$ If Argument .Eqs. "" Then Goto Exit +$ El=0 +$Loop2: +$ File = F$Element(El," ",Argument) +$ If File .Eqs. " " Then Goto Endl +$ AFile = "" +$Loop3: +$ OFile = AFile +$ AFile = F$Search(File) +$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl +$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit +$ Goto Loop3 +$NextEL: +$ El = El + 1 +$ Goto Loop2 +$EndL: +$ arg=arg+1 +$ If arg .Le. 8 Then Goto Loop +$ Goto Exit +$ +$Makeit: +$ VV=F$VERIFY(0) +$ write sys$output P2 +$ 'P2 +$ VV='F$Verify(VV) +$Exit: +$ If V Then Set Verify +$ENDSUBROUTINE diff --git a/example.c b/example.c index d60ff2a74..430450437 100644 --- a/example.c +++ b/example.c @@ -604,6 +604,14 @@ void write_png(char *file_name /* , ... other image information ... */) /* Write the file header information. REQUIRED */ png_write_info(png_ptr, info_ptr); + /* If you want, you can write the info in two steps, in case you need to + * write your private chunk ahead of PLTE: + * + * png_write_info_before_PLTE(write_ptr, write_info_ptr); + * write_my_chunk(); + * png_write_info(png_ptr, info_ptr); + */ + /* Once we write out the header, the compression type on the text * chunks gets changed to PNG_TEXT_COMPRESSION_NONE_WR or * PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again diff --git a/libpng.3 b/libpng.3 index 8485a4ac7..3ebe44698 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "October 23, 1999" +.TH LIBPNG 3 "November 27, 1999" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5a - October 23, 1999 +libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5c - November 27, 1999 .SH SYNOPSIS \fI\fB @@ -128,6 +128,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5a - October 23, \fI\fB +\fBpng_byte png_get_header_ver (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + \fBpng_byte png_get_header_version (png_structp \fIpng_ptr\fP\fB);\fP \fI\fB @@ -156,6 +160,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5a - October 23, \fI\fB +\fBpng_byte png_get_libpng_ver (png_structp \fIpng_ptr\fP\fB);\fP + +\fI\fB + \fBpng_voidp png_get_mem_ptr(png_structp \fIpng_ptr\fP\fB);\fP \fI\fB @@ -598,6 +606,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5a - October 23, \fI\fB +\fBvoid png_write_info_before_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP + +\fI\fB + \fBvoid png_write_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP \fI\fB @@ -617,7 +629,7 @@ Following is a copy of the libpng.txt file that accompanies libpng. .SH LIBPNG.TXT libpng.txt - A description on how to use and modify libpng - libpng version 1.0.5a - October 23, 1999 + libpng version 1.0.5c - November 27, 1999 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998, 1999 Glenn Randers-Pehrson @@ -846,7 +858,7 @@ 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, png_uint_32 row, int pass); + void read_row_callback(png_ptr ptr, png_uint_32 row, int pass); { /* put your code here */ } @@ -1939,10 +1951,10 @@ Some of the more important parts of the png_info are: Color Consortium (http://www.color.org). It can be one of - PNG_SRGB_INTENT_SATURATION, - PNG_SRGB_INTENT_PERCEPTUAL, - PNG_SRGB_INTENT_ABSOLUTE, or - PNG_SRGB_INTENT_RELATIVE. + PNG_sRGB_INTENT_SATURATION, + PNG_sRGB_INTENT_PERCEPTUAL, + PNG_sRGB_INTENT_ABSOLUTE, or + PNG_sRGB_INTENT_RELATIVE. png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, @@ -2106,6 +2118,14 @@ image data. You do this with a call to png_write_info(). png_write_info(png_ptr, info_ptr); +If you need to write a private chunk that you want to appear before +the PLTE chunk when PLTE is present, you can write the PNG info in +two steps, and insert code to write your own chunk between them: + + png_write_info_before_PLTE(png_ptr, info_ptr); + write_my_private_chunks(); + png_write_info(png_ptr, info_ptr); + After you've written the file information, you can set up the library to handle any special transformations of the image data. The various ways to transform the data will be described in the order that they @@ -2675,13 +2695,13 @@ the old method. .SH VII. Y2K Compliance in libpng -October 23, 1999 +November 27, 1999 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.5a are Y2K compliant. It is my belief that earlier +upward through 1.0.5c 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 @@ -2807,7 +2827,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.0.5a - October 23, 1999: +Libpng version 1.0.5c - November 27, 1999: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu). @@ -2822,7 +2842,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. Copyright (c) 1996, 1997 Andreas Dilger (libpng versions 0.90, December 1996, through 0.96, May 1997) Copyright (c) 1998, 1999 Glenn Randers-Pehrson -(libpng versions 0.97, January 1998, through 1.0.5a, October 23, 1999) +(libpng versions 0.97, January 1998, through 1.0.5c, November 27, 1999) For the purposes of this copyright and license, "Contributing Authors" is defined as the following set of individuals: diff --git a/libpng.txt b/libpng.txt index e9ffb0b5b..db313b628 100644 --- a/libpng.txt +++ b/libpng.txt @@ -1,6 +1,6 @@ libpng.txt - A description on how to use and modify libpng - libpng version 1.0.5a - October 23, 1999 + libpng version 1.0.5c - November 27, 1999 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998, 1999 Glenn Randers-Pehrson @@ -229,7 +229,7 @@ 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, png_uint_32 row, int pass); + void read_row_callback(png_ptr ptr, png_uint_32 row, int pass); { /* put your code here */ } @@ -1322,10 +1322,10 @@ Some of the more important parts of the png_info are: Color Consortium (http://www.color.org). It can be one of - PNG_SRGB_INTENT_SATURATION, - PNG_SRGB_INTENT_PERCEPTUAL, - PNG_SRGB_INTENT_ABSOLUTE, or - PNG_SRGB_INTENT_RELATIVE. + PNG_sRGB_INTENT_SATURATION, + PNG_sRGB_INTENT_PERCEPTUAL, + PNG_sRGB_INTENT_ABSOLUTE, or + PNG_sRGB_INTENT_RELATIVE. png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, @@ -1489,6 +1489,14 @@ image data. You do this with a call to png_write_info(). png_write_info(png_ptr, info_ptr); +If you need to write a private chunk that you want to appear before +the PLTE chunk when PLTE is present, you can write the PNG info in +two steps, and insert code to write your own chunk between them: + + png_write_info_before_PLTE(png_ptr, info_ptr); + write_my_private_chunks(); + png_write_info(png_ptr, info_ptr); + After you've written the file information, you can set up the library to handle any special transformations of the image data. The various ways to transform the data will be described in the order that they @@ -2058,13 +2066,13 @@ the old method. VII. Y2K Compliance in libpng -October 23, 1999 +November 27, 1999 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.5a are Y2K compliant. It is my belief that earlier +upward through 1.0.5c 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 fbc5acadc..a42e998f7 100644 --- a/libpngpf.3 +++ b/libpngpf.3 @@ -1,6 +1,6 @@ -.TH LIBPNGPF 3 October 23, 1999 +.TH LIBPNGPF 3 November 27, 1999 .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5a - October 23, 1999 +libpng \- Portable Network Graphics (PNG) Reference Library 1.0.5c - November 27, 1999 (private functions) .SH SYNOPSIS \fB#include \fP diff --git a/png.5 b/png.5 index c68a600b8..ce332757e 100644 --- a/png.5 +++ b/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "October 23, 1999" +.TH PNG 5 "November 27, 1999" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION diff --git a/png.c b/png.c index 563d0b625..c5d19aacc 100644 --- a/png.c +++ b/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * libpng version 1.0.5a - October 23, 1999 + * libpng version 1.0.5c - November 27, 1999 * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1998, 1999 Glenn Randers-Pehrson @@ -12,16 +12,21 @@ #define PNG_NO_EXTERN #include "png.h" -PNG_GET_HEADER - /* Version information for C files. This had better match the version * string defined in png.h. */ -char png_libpng_ver[12] = "1.0.5a"; +#ifdef PNG_GLOBAL_ARRAYS +/* png_libpng_ver was changed to a function in version 1.0.5c */ +char png_libpng_ver[12] = "1.0.5c"; +/* png_sig was changed to a function in version 1.0.5c */ /* Place to hold the signature string for a PNG file. */ png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10}; + +/* This was moved to pngtypes.h and other places in version 1.0.5c. + * It was nicer having them all in one place, but it interfered with + * people building DLL's. */ /* Constant strings for known chunk types. If you need to add a chunk, * add a string holding the name here. If you want to make the code @@ -75,6 +80,8 @@ int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; /* Mask to determine which pixels to overwrite while displaying */ int FARDATA png_pass_dsp_mask[] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; +#endif + /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another * stream we can set num_bytes = 8 so that libpng will not attempt to read @@ -102,6 +109,7 @@ png_set_sig_bytes(png_structp png_ptr, int num_bytes) int png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check) { + png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; if (num_to_check > 8) num_to_check = 8; else if (num_to_check < 1) @@ -113,7 +121,7 @@ png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check) if (start + num_to_check > 8) num_to_check = 8 - start; - return ((int)(png_memcmp(&sig[start], &png_sig[start], num_to_check))); + return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check))); } /* (Obsolete) function to check signature bytes. It does not allow one @@ -356,22 +364,65 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime) } #endif /* PNG_TIME_RFC1123_SUPPORTED */ +/* Signature string for a PNG file. */ +png_bytep +png_sig_bytes(png_structp png_ptr) +{ + const png_byte png_sig_numbers[9] = {137, 80, 78, 71, 13, 10, 26, 10, 0}; + if (png_ptr == NULL) /* silence compiler warning */ + return ((png_bytep) strdup(png_sig_numbers)); + return ((png_bytep) strdup(png_sig_numbers)); +} + png_charp png_get_copyright(png_structp png_ptr) { if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */ - return ("\n libpng version 1.0.5a - October 23, 1999\n\ + return ("\n libpng version 1.0.5c - November 27, 1999\n\ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\ Copyright (c) 1996, 1997 Andreas Dilger\n\ Copyright (c) 1998, 1999 Glenn Randers-Pehrson\n"); return (""); } +/* The following return the library version as a short string in the + * format 1.0.0 through 99.99.99zz. To get the version of *.h files used + * with your application, print out PNG_LIBPNG_VER_STRING, which is defined + * in png.h. + */ + +png_charp +png_get_libpng_ver(png_structp png_ptr) +{ + /* Version of *.c files used when building libpng */ + if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ + return("1.0.5c"); + return("1.0.5c"); +} + +png_charp +png_get_header_ver(png_structp png_ptr) +{ + /* Version of *.h files used when building libpng */ + if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ + return(PNG_LIBPNG_VER_STRING); + return(PNG_LIBPNG_VER_STRING); +} + +png_charp +png_get_header_version(png_structp png_ptr) +{ + /* Returns longer string containing both version and date */ + if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ + return(PNG_HEADER_VERSION_STRING); + return(PNG_HEADER_VERSION_STRING); +} + /* Generate a compiler error if there is an old png.h in the search path. */ void png_check_version - (version_1_0_5a png_h_is_not_version_1_0_5a) + (version_1_0_5c png_h_is_not_version_1_0_5c) { - if(png_h_is_not_version_1_0_5a == NULL) + if(png_h_is_not_version_1_0_5c == NULL) return; } diff --git a/png.h b/png.h index 530772d1b..3b67afac2 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.0.5a - October 23, 1999 + * libpng version 1.0.5c - November 27, 1999 * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1998, 1999 Glenn Randers-Pehrson @@ -9,19 +9,19 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.89c, May 1996: Guy Schalnat * libpng versions 0.90, December 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.0.5a - October 23, 1999: Glenn + * libpng versions 0.97, January 1998, through 1.0.5c - November 27, 1999: Glenn * See also "Contributing Authors", below. * * Y2K compliance in libpng: * ========================= * - * October 23, 1999 + * November 27, 1999 * * 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.5a are Y2K compliant. It is my belief that earlier + * upward through 1.0.5c 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 @@ -97,7 +97,7 @@ * 1.0.4 1.0.4 10004 2.1.0.4 * 1.0.4a-f 1.0.4a-f 10005 2.1.0.4a-f * 1.0.5 1.0.5 10005 2.1.0.5 - * 1.0.5a 1.0.5a 10006 2.1.0.5a + * 1.0.5a-d 1.0.5a-d 10006 2.1.0.5a-d * 1.0.6 1.0.6 10006 2.1.0.6 * * Henceforth the source version will match the shared-library minor @@ -122,7 +122,7 @@ * Copyright (c) 1996, 1997 Andreas Dilger * (libpng versions 0.90, December 1996, through 0.96, May 1997) * Copyright (c) 1998, 1999 Glenn Randers-Pehrson - * (libpng versions 0.97, January 1998, through 1.0.5a, October 23, 1999) + * (libpng versions 0.97, January 1998, through 1.0.5c, November 27, 1999) * * For the purposes of this copyright and license, "Contributing Authors" * is defined as the following set of individuals: @@ -222,7 +222,7 @@ extern "C" { */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.0.5a" +#define PNG_LIBPNG_VER_STRING "1.0.5c" /* Careful here. At one time, Guy wanted to use 082, but that would be octal. * We must not include leading zeros. @@ -238,8 +238,14 @@ extern "C" { /* Version information for C files, stored in png.c. This had better match * the version above. */ +#ifdef PNG_GLOBAL_ARRAYS extern char png_libpng_ver[12]; /* need room for 99.99.99aa */ +#else +#define png_libpng_ver png_get_header_ver(NULL) +#endif +#ifdef PNG_GLOBAL_ARRAYS +/* This was removed in version 1.0.5c */ /* Structures to facilitate easy interlacing. See png.c for more details */ extern int FARDATA png_pass_start[7]; extern int FARDATA png_pass_inc[7]; @@ -251,6 +257,7 @@ extern int FARDATA png_pass_dsp_mask[7]; extern int FARDATA png_pass_width[7]; extern int FARDATA png_pass_height[7]; */ +#endif #endif /* PNG_NO_EXTERN */ @@ -559,10 +566,10 @@ typedef png_info FAR * FAR * png_infopp; #define PNG_RESOLUTION_LAST 2 /* Not a valid value */ /* These are for the sRGB chunk. These values should NOT be changed. */ -#define PNG_sRGB_INTENT_SATURATION 0 -#define PNG_sRGB_INTENT_PERCEPTUAL 1 -#define PNG_sRGB_INTENT_ABSOLUTE 2 -#define PNG_sRGB_INTENT_RELATIVE 3 +#define PNG_sRGB_INTENT_PERCEPTUAL 0 +#define PNG_sRGB_INTENT_RELATIVE 1 +#define PNG_sRGB_INTENT_SATURATION 2 +#define PNG_sRGB_INTENT_ABSOLUTE 3 #define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */ @@ -820,9 +827,9 @@ struct png_struct_def }; /* This prevents a compiler error in png_get_copyright() in png.c if png.c -and png.h are both at * version 1.0.5a +and png.h are both at * version 1.0.5c */ -typedef png_structp version_1_0_5a; +typedef png_structp version_1_0_5c; typedef png_struct FAR * FAR * png_structpp; @@ -895,6 +902,8 @@ extern PNG_EXPORT(png_infop,png_create_info_struct) extern void png_info_init PNGARG((png_infop info_ptr)); /* Writes all the PNG information before the image. */ +extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr)); extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr, png_infop info_ptr)); @@ -1633,21 +1642,14 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, #define png_debug2(l, m, p1, p2) #endif +extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((png_structp png_ptr)); + extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); -#ifdef PNG_NO_EXTERN -/* this only gets included in png.c */ - -#define PNG_GET_HEADER \ -png_charp \ -png_get_header_version(png_structp png_ptr) \ -{ \ - if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ \ - return("\n libpng version 1.0.5a - October 23, 1999 (header)\n"); \ - return("\n libpng version 1.0.5a - October 23, 1999 (header)\n"); \ -} -#endif +#define PNG_HEADER_VERSION_STRING " libpng version 1.0.5c - November 27, 1999 (header)\n" #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED /* With these routines we avoid an integer divide, which will be slower on @@ -1701,15 +1703,19 @@ png_get_header_version(png_structp png_ptr) \ /* Various modes of operation. Note that after an init, mode is set to * zero automatically when the structure is created. */ -#define PNG_BEFORE_IHDR 0x00 -#define PNG_HAVE_IHDR 0x01 -#define PNG_HAVE_PLTE 0x02 -#define PNG_HAVE_IDAT 0x04 -#define PNG_AFTER_IDAT 0x08 -#define PNG_HAVE_IEND 0x10 -#define PNG_HAVE_gAMA 0x20 -#define PNG_HAVE_cHRM 0x40 -#define PNG_HAVE_sRGB 0x80 +#define PNG_BEFORE_IHDR 0x00 +#define PNG_HAVE_IHDR 0x01 +#define PNG_HAVE_PLTE 0x02 +#define PNG_HAVE_IDAT 0x04 +#define PNG_AFTER_IDAT 0x08 +#define PNG_HAVE_IEND 0x10 +#define PNG_HAVE_gAMA 0x20 +#define PNG_HAVE_cHRM 0x40 +#define PNG_HAVE_sRGB 0x80 +#define PNG_HAVE_CHUNK_HEADER 0x100 +#define PNG_WROTE_tIME 0x200 +#define PNG_WROTE_INFO_BEFORE_PLTE 0x400 +#define PNG_BACKGROUND_IS_GRAY 0x800 /* push model modes */ #define PNG_READ_SIG_MODE 0 @@ -1773,9 +1779,7 @@ png_get_header_version(png_structp png_ptr) \ #define PNG_FLAG_FREE_PALETTE 0x1000 #define PNG_FLAG_FREE_TRANS 0x2000 #define PNG_FLAG_FREE_HIST 0x4000 -#define PNG_FLAG_HAVE_CHUNK_HEADER 0x8000L -#define PNG_FLAG_WROTE_tIME 0x10000L -#define PNG_FLAG_BACKGROUND_IS_GRAY 0x20000L + #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ PNG_FLAG_CRC_ANCILLARY_NOWARN) @@ -1794,8 +1798,13 @@ png_get_header_version(png_structp png_ptr) \ /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) /* place to hold the signature string for a PNG file. */ -extern png_byte FARDATA png_sig[8]; +#ifdef PNG_GLOBAL_ARRAYS + extern png_byte FARDATA png_sig[8]; +#else +#define png_sig png_sig_bytes(NULL) +#endif +#ifdef PNG_GLOBAL_ARRAYS /* Constant strings for known chunk types. If you need to add a chunk, * add a string holding the name here. See png.c for more details. We * can't selectively include these, since we still check for chunk in the @@ -1818,6 +1827,7 @@ extern png_byte FARDATA png_tEXt[5]; extern png_byte FARDATA png_tIME[5]; extern png_byte FARDATA png_tRNS[5]; extern png_byte FARDATA png_zTXt[5]; +#endif /* PNG_GLOBAL_ARRAYS */ #endif /* PNG_NO_EXTERN */ diff --git a/pngasmrd.h b/pngasmrd.h index 6e60c33a1..50b34728b 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.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1999 Glenn Randers-Pehrson * @@ -21,7 +21,7 @@ /* Set this in the makefile for gcc on Pentium, not in pngconf.h */ #ifdef PNG_USE_PNGGCCRD /* Platform must be Pentium. Makefile must assemble and load pnggccrd.c - * (not available in libpng 1.0.5a). + * (not available in libpng 1.0.5c). * MMX will be detected at run time and used if present. */ #define PNG_HAVE_ASSEMBLER_COMBINE_ROW diff --git a/pngconf.h b/pngconf.h index 5ad19513e..089b15fbf 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -418,6 +418,14 @@ __dont__ include it again #define PNG_ASSEMBLER_CODE_SUPPORTED #endif +/* Do not use global arrays (helps with building DLL's) + * They are no longer used in libpng itself, since version 1.0.5c, + * but might be required for some pre-1.0.5c applications. + */ +#ifndef PNG_NO_GLOBAL_ARRAYS +#define PNG_GLOBAL_ARRAYS +#endif + /* These are currently experimental features, define them if you want */ /* very little testing */ diff --git a/pngerror.c b/pngerror.c index b10072d67..6278b2952 100644 --- a/pngerror.c +++ b/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngget.c b/pngget.c index 96204f11f..62486afbc 100644 --- a/pngget.c +++ b/pngget.c @@ -1,7 +1,7 @@ /* pngget.c - retrieval of values from info struct * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngmem.c b/pngmem.c index 35f49801a..15d534460 100644 --- a/pngmem.c +++ b/pngmem.c @@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngpread.c b/pngpread.c index 98108f327..b6fff686c 100644 --- a/pngpread.c +++ b/pngpread.c @@ -1,7 +1,7 @@ /* pngpread.c - read a png file in push mode * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -116,13 +116,14 @@ png_push_read_sig(png_structp png_ptr, png_infop info_ptr) void png_push_read_chunk(png_structp png_ptr, png_infop info_ptr) { +#include "pngtypes.h" /* First we make sure we have enough data for the 4 byte chunk name * and the 4 byte chunk length before proceeding with decoding the * chunk data. To fully decode each of these chunks, we also make * sure we have enough data in the buffer for the 4 byte CRC at the * end of every chunk (except IDAT, which is handled separately). */ - if (!(png_ptr->flags & PNG_FLAG_HAVE_CHUNK_HEADER)) + if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) { png_byte chunk_length[4]; @@ -136,7 +137,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr) png_ptr->push_length = png_get_uint_32(chunk_length); png_reset_crc(png_ptr); png_crc_read(png_ptr, png_ptr->chunk_name, 4); - png_ptr->flags |= PNG_FLAG_HAVE_CHUNK_HEADER; + png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; } if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) @@ -159,7 +160,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr) png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length); } - else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + else if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) { /* If we reach an IDAT chunk, this means we have read all of the * header chunks, and we can start reading the image (or if this @@ -343,7 +344,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr) png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length); } - png_ptr->flags &= ~PNG_FLAG_HAVE_CHUNK_HEADER; + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; } void @@ -496,7 +497,8 @@ png_push_restore_buffer(png_structp png_ptr, png_bytep buffer, void png_push_read_IDAT(png_structp png_ptr) { - if (!(png_ptr->flags & PNG_FLAG_HAVE_CHUNK_HEADER)) + const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}; + if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) { png_byte chunk_length[4]; @@ -511,9 +513,9 @@ png_push_read_IDAT(png_structp png_ptr) png_reset_crc(png_ptr); png_crc_read(png_ptr, png_ptr->chunk_name, 4); - png_ptr->flags |= PNG_FLAG_HAVE_CHUNK_HEADER; + png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; - if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) { png_ptr->process_mode = PNG_READ_CHUNK_MODE; if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) @@ -576,7 +578,7 @@ png_push_read_IDAT(png_structp png_ptr) } png_crc_finish(png_ptr, 0); - png_ptr->flags &= ~PNG_FLAG_HAVE_CHUNK_HEADER; + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; } } @@ -767,6 +769,30 @@ png_push_process_row(png_structp png_ptr) void png_read_push_finish_row(png_structp png_ptr) { + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* start of interlace block */ + const int png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; + + /* offset to next interlace block */ + const int png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; + + /* start of interlace block in the y direction */ + const int png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; + + /* offset to next interlace block in the y direction */ + const int png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; + + /* Width of interlace block. This is not currently used - if you need + * it, uncomment it here and in png.h + const int png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; + */ + + /* Height of interlace block. This is not currently used - if you need + * it, uncomment it here and in png.h + const int png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; + */ + png_ptr->row_number++; if (png_ptr->row_number < png_ptr->num_rows) return; @@ -1115,6 +1141,7 @@ void png_progressive_combine_row (png_structp png_ptr, png_bytep old_row, png_bytep new_row) { + const int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */ png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]); } diff --git a/pngread.c b/pngread.c index cd07bb4b6..45fc21611 100644 --- a/pngread.c +++ b/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -156,6 +156,7 @@ png_read_init(png_structp png_ptr) void png_read_info(png_structp png_ptr, png_infop info_ptr) { +#include "pngtypes.h" png_debug(1, "in png_read_info\n"); /* save jump buffer and error functions */ /* If we haven't checked all of the PNG signature bytes, do so now. */ @@ -297,6 +298,9 @@ png_start_read_image(png_structp png_ptr) void png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) { + const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}; + const int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; + const int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; int ret; png_debug2(1, "in png_read_row (row %d, pass %d)\n", png_ptr->row_number, png_ptr->pass); @@ -529,7 +533,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.5a. + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.5c. */ void @@ -578,7 +582,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.5a. + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.5c. */ void png_read_image(png_structp png_ptr, png_bytepp image) @@ -621,6 +625,7 @@ png_read_image(png_structp png_ptr, png_bytepp image) void png_read_end(png_structp png_ptr, png_infop info_ptr) { +#include "pngtypes.h" png_byte chunk_length[4]; png_uint_32 length; diff --git a/pngrio.c b/pngrio.c index ba1c9963d..7aba19646 100644 --- a/pngrio.c +++ b/pngrio.c @@ -1,7 +1,7 @@ /* pngrio.c - functions for data input * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngrtran.c b/pngrtran.c index 693befcd5..edaa02024 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.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -92,13 +92,13 @@ png_set_background(png_structp png_ptr, /* Note: if need_expand is set and color_type is either RGB or RGB_ALPHA * (in which case need_expand is superfluous anyway), the background color * might actually be gray yet not be flagged as such. This is not a problem - * for the current code, which uses PNG_FLAG_BACKGROUND_IS_GRAY only to + * for the current code, which uses PNG_BACKGROUND_IS_GRAY only to * decide when to do the png_do_gray_to_rgb() transformation. */ if ((need_expand && !(png_ptr->color_type & PNG_COLOR_MASK_COLOR)) || (!need_expand && background_color->red == background_color->green && background_color->red == background_color->blue)) - png_ptr->flags |= PNG_FLAG_BACKGROUND_IS_GRAY; + png_ptr->mode |= PNG_BACKGROUND_IS_GRAY; } #endif @@ -1171,7 +1171,7 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998: /* if gray -> RGB, do so now only if background is non-gray; else do later * for performance reasons */ if (png_ptr->transformations & PNG_GRAY_TO_RGB && - !(png_ptr->flags & PNG_FLAG_BACKGROUND_IS_GRAY)) + !(png_ptr->mode & PNG_BACKGROUND_IS_GRAY)) png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif @@ -1245,7 +1245,7 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998: #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) /* if gray -> RGB, do so now only if we did not do so above */ if (png_ptr->transformations & PNG_GRAY_TO_RGB && - png_ptr->flags & PNG_FLAG_BACKGROUND_IS_GRAY) + png_ptr->mode & PNG_BACKGROUND_IS_GRAY) png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif diff --git a/pngrutil.c b/pngrutil.c index 7d103137a..270a72bc6 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -1713,6 +1713,11 @@ png_do_read_interlace (png_row_infop row_info, png_bytep row, int pass, png_uint_32 transformations) { + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* offset to next interlace block */ + const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + png_debug(1,"in png_do_read_interlace\n"); if (row != NULL && row_info != NULL) { @@ -2051,6 +2056,20 @@ png_read_filter_row void png_read_finish_row(png_structp png_ptr) { + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* start of interlace block */ + const int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* offset to next interlace block */ + const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* start of interlace block in the y direction */ + const int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* offset to next interlace block in the y direction */ + const int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; + png_debug(1, "in png_read_finish_row\n"); png_ptr->row_number++; if (png_ptr->row_number < png_ptr->num_rows) @@ -2091,6 +2110,7 @@ png_read_finish_row(png_structp png_ptr) if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) { + const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}; char extra; int ret; @@ -2111,7 +2131,7 @@ png_read_finish_row(png_structp png_ptr) png_reset_crc(png_ptr); png_crc_read(png_ptr, png_ptr->chunk_name, 4); - if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) png_error(png_ptr, "Not enough image data"); } @@ -2154,6 +2174,20 @@ png_read_finish_row(png_structp png_ptr) void png_read_start_row(png_structp png_ptr) { + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* start of interlace block */ + const int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* offset to next interlace block */ + const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* start of interlace block in the y direction */ + const int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* offset to next interlace block in the y direction */ + const int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; + int max_pixel_depth; png_uint_32 row_bytes; diff --git a/pngset.c b/pngset.c index d965d1fcd..8afe6d6fd 100644 --- a/pngset.c +++ b/pngset.c @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -368,7 +368,7 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time) { png_debug1(1, "in %s storage function\n", "tIME"); if (png_ptr == NULL || info_ptr == NULL || - (png_ptr->flags & PNG_FLAG_WROTE_tIME)) + (png_ptr->mode & PNG_WROTE_tIME)) return; png_memcpy(&(info_ptr->mod_time), mod_time, sizeof (png_time)); diff --git a/pngtest.c b/pngtest.c index 7bee58520..f29b32559 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,7 +1,7 @@ /* pngtest.c - a simple test program to test libpng * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -773,7 +773,6 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0) { - int i; png_debug1(0, "Handling %d tEXt/zTXt chunks\n", num_text); png_set_text(write_ptr, write_info_ptr, text_ptr, num_text); } @@ -812,6 +811,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif png_debug(0, "\nWriting info struct\n"); + +/* If we wanted, we could write info in two steps: + png_write_info_before_PLTE(write_ptr, write_info_ptr); + */ png_write_info(write_ptr, write_info_ptr); png_debug(0, "\nAllocating row buffer \n"); @@ -872,7 +875,6 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) if (png_get_text(read_ptr, end_info_ptr, &text_ptr, &num_text) > 0) { - int i; png_debug1(0, "Handling %d tEXt/zTXt chunks\n", num_text); png_set_text(write_ptr, write_end_info_ptr, text_ptr, num_text); } @@ -1005,6 +1007,10 @@ main(int argc, char *argv[]) fprintf(STDERR, "Testing libpng version %s\n", PNG_LIBPNG_VER_STRING); fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION); fprintf(STDERR,"%s",png_get_copyright(NULL)); + /* Show the version of libpng used in building the library */ + fprintf(STDERR," library:%s",png_get_header_version(NULL)); + /* Show the version of libpng used in building the application */ + fprintf(STDERR," pngtest:%s",PNG_HEADER_VERSION_STRING); /* Do some consistency checking on the memory allocation settings, I'm not sure this matters, but it is nice to know, the first of these @@ -1217,7 +1223,7 @@ main(int argc, char *argv[]) /* Generate a compiler error if there is an old png.h in the search path. */ void png_check_pngtest_version - (version_1_0_5a png_h_is_not_version_1_0_5a) + (version_1_0_5c png_h_is_not_version_1_0_5c) { - if(png_h_is_not_version_1_0_5a == NULL) return; + if(png_h_is_not_version_1_0_5c == NULL) return; } diff --git a/pngtrans.c b/pngtrans.c index 4ec7b383a..92d2c3605 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.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngtypes.h b/pngtypes.h new file mode 100644 index 000000000..6be6862b7 --- /dev/null +++ b/pngtypes.h @@ -0,0 +1,35 @@ +/* pngtypes.h - array of chunk-types for libpng + * + * libpng 1.0.5c - November 27, 1999 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. + * Copyright (c) 1996, 1997 Andreas Dilger + * Copyright (c) 1998, 1999 Glenn Randers-Pehrson + */ + +/* Constant strings for known chunk types. If you need to add a chunk, + * add a string holding the name here. + * + * We can't selectively include these, since we still check for chunk in + * the wrong locations with these labels. (I'm not exactly sure what + * this comment means. I inherited it from libpng-0.96 -- glennrp) + */ + +const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}; +const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}; +const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}; +const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}; +const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}; +const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}; +const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}; +const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}; +const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}; +const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}; +const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}; +const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}; +const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}; +const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}; +const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}; +const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}; +const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}; + diff --git a/pngvcrd.c b/pngvcrd.c index 092037a7c..ae48a78bc 100644 --- a/pngvcrd.c +++ b/pngvcrd.c @@ -2,7 +2,7 @@ * * For Intel x86 CPU and Microsoft Visual C++ compiler * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, 1999 Glenn Randers-Pehrson @@ -96,6 +96,7 @@ NOT_SUPPORTED: void png_combine_row(png_structp png_ptr, png_bytep row, int mask) { + const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; #ifdef DISABLE_PNGVCRD_COMBINE int save_mmx_supported = mmx_supported; #endif @@ -966,6 +967,7 @@ void png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, png_uint_32 transformations) { + const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; #ifdef DISABLE_PNGVCRD_INTERLACE int save_mmx_supported = mmx_supported; #endif diff --git a/pngwio.c b/pngwio.c index 958e74ebc..0631a1d10 100644 --- a/pngwio.c +++ b/pngwio.c @@ -1,7 +1,7 @@ /* pngwio.c - functions for data output * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngwrite.c b/pngwrite.c index e93ba476c..f7e8535ae 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -1,7 +1,7 @@ /* pngwrite.c - general routines to write a PNG file * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -22,13 +22,11 @@ * them in png_write_end(), and compressing them. */ void -png_write_info(png_structp png_ptr, png_infop info_ptr) +png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr) { -#if defined(PNG_WRITE_tEXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED) - int i; -#endif - - png_debug(1, "in png_write_info\n"); + png_debug(1, "in png_write_info_before_PLTE\n"); + if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) + { png_write_sig(png_ptr); /* write PNG signature */ /* write IHDR information. */ png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height, @@ -61,6 +59,21 @@ png_write_info(png_structp png_ptr, png_infop info_ptr) info_ptr->x_green, info_ptr->y_green, info_ptr->x_blue, info_ptr->y_blue); #endif + png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE; + } +} + +void +png_write_info(png_structp png_ptr, png_infop info_ptr) +{ +#if defined(PNG_WRITE_tEXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED) + int i; +#endif + + png_debug(1, "in png_write_info\n"); + + png_write_info_before_PLTE(png_ptr, info_ptr); + if (info_ptr->valid & PNG_INFO_PLTE) png_write_PLTE(png_ptr, info_ptr->palette, (png_uint_32)info_ptr->num_palette); @@ -112,7 +125,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr) if (info_ptr->valid & PNG_INFO_tIME) { png_write_tIME(png_ptr, &(info_ptr->mod_time)); - png_ptr->flags |= PNG_FLAG_WROTE_tIME; + png_ptr->mode |= PNG_WROTE_tIME; } #endif #if defined(PNG_WRITE_tEXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED) @@ -172,7 +185,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr) #if defined(PNG_WRITE_tIME_SUPPORTED) /* check to see if user has supplied a time chunk */ if (info_ptr->valid & PNG_INFO_tIME && - !(png_ptr->flags & PNG_FLAG_WROTE_tIME)) + !(png_ptr->mode & PNG_WROTE_tIME)) png_write_tIME(png_ptr, &(info_ptr->mod_time)); #endif #if defined(PNG_WRITE_tEXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED) diff --git a/pngwtran.c b/pngwtran.c index f6956319d..2098534a5 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.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngwutil.c b/pngwutil.c index 459800d40..a34201e3d 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * libpng 1.0.5a - October 23, 1999 + * libpng 1.0.5c - November 27, 1999 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -127,8 +127,9 @@ png_write_chunk_end(png_structp png_ptr) void png_write_sig(png_structp png_ptr) { + png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; /* write the rest of the 8 byte signature */ - png_write_data(png_ptr, &png_sig[png_ptr->sig_bytes], + png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes], (png_size_t)8 - png_ptr->sig_bytes); } @@ -141,6 +142,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int compression_type, int filter_type, int interlace_type) { + const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}; png_byte buf[13]; /* buffer to store the IHDR info */ png_debug(1, "in png_write_IHDR\n"); @@ -234,7 +236,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, buf[12] = (png_byte)interlace_type; /* write the chunk */ - png_write_chunk(png_ptr, png_IHDR, buf, (png_size_t)13); + png_write_chunk(png_ptr, (png_bytep)png_IHDR, buf, (png_size_t)13); /* initialize zlib with PNG info */ png_ptr->zstream.zalloc = png_zalloc; @@ -279,6 +281,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, void png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) { + const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}; png_uint_32 i; png_colorp pal_ptr; png_byte buf[3]; @@ -304,7 +307,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) png_ptr->num_palette = (png_uint_16)num_pal; png_debug1(3, "num_palette = %d\n", png_ptr->num_palette); - png_write_chunk_start(png_ptr, png_PLTE, num_pal * 3); + png_write_chunk_start(png_ptr, (png_bytep)png_PLTE, num_pal * 3); for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++) { buf[0] = pal_ptr->red; @@ -320,8 +323,9 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) void png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) { + const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}; png_debug(1, "in png_write_IDAT\n"); - png_write_chunk(png_ptr, png_IDAT, data, length); + png_write_chunk(png_ptr, (png_bytep)png_IDAT, data, length); png_ptr->mode |= PNG_HAVE_IDAT; } @@ -329,8 +333,9 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) void png_write_IEND(png_structp png_ptr) { + const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}; png_debug(1, "in png_write_IEND\n"); - png_write_chunk(png_ptr, png_IEND, NULL, (png_size_t)0); + png_write_chunk(png_ptr, (png_bytep)png_IEND, NULL, (png_size_t)0); png_ptr->mode |= PNG_HAVE_IEND; } @@ -339,6 +344,7 @@ png_write_IEND(png_structp png_ptr) void png_write_gAMA(png_structp png_ptr, double file_gamma) { + const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}; png_uint_32 igamma; png_byte buf[4]; @@ -346,7 +352,7 @@ png_write_gAMA(png_structp png_ptr, double file_gamma) /* file_gamma is saved in 1/1000000ths */ igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5); png_save_uint_32(buf, igamma); - png_write_chunk(png_ptr, png_gAMA, buf, (png_size_t)4); + png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4); } #endif @@ -355,6 +361,7 @@ png_write_gAMA(png_structp png_ptr, double file_gamma) void png_write_sRGB(png_structp png_ptr, int srgb_intent) { + const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}; png_byte buf[1]; png_debug(1, "in png_write_sRGB\n"); @@ -362,7 +369,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent) png_warning(png_ptr, "Invalid sRGB rendering intent specified"); buf[0]=(png_byte)srgb_intent; - png_write_chunk(png_ptr, png_sRGB, buf, (png_size_t)1); + png_write_chunk(png_ptr, (png_bytep)png_sRGB, buf, (png_size_t)1); } #endif @@ -371,6 +378,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent) void png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type) { + const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}; png_byte buf[4]; png_size_t size; @@ -415,7 +423,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type) buf[size++] = sbit->alpha; } - png_write_chunk(png_ptr, png_sBIT, buf, size); + png_write_chunk(png_ptr, (png_bytep)png_sBIT, buf, size); } #endif @@ -426,6 +434,7 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y, double red_x, double red_y, double green_x, double green_y, double blue_x, double blue_y) { + const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}; png_uint_32 itemp; png_byte buf[32]; @@ -475,7 +484,7 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y, itemp = (png_uint_32)(blue_y * 100000.0 + 0.5); png_save_uint_32(buf + 28, itemp); - png_write_chunk(png_ptr, png_cHRM, buf, (png_size_t)32); + png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); } #endif @@ -485,6 +494,7 @@ void png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, int num_trans, int color_type) { + const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}; png_byte buf[6]; png_debug(1, "in png_write_tRNS\n"); @@ -496,13 +506,13 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, return; } /* write the chunk out as it is */ - png_write_chunk(png_ptr, png_tRNS, trans, (png_size_t)num_trans); + png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans, (png_size_t)num_trans); } else if (color_type == PNG_COLOR_TYPE_GRAY) { /* one 16 bit value */ png_save_uint_16(buf, tran->gray); - png_write_chunk(png_ptr, png_tRNS, buf, (png_size_t)2); + png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)2); } else if (color_type == PNG_COLOR_TYPE_RGB) { @@ -510,7 +520,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, png_save_uint_16(buf, tran->red); png_save_uint_16(buf + 2, tran->green); png_save_uint_16(buf + 4, tran->blue); - png_write_chunk(png_ptr, png_tRNS, buf, (png_size_t)6); + png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)6); } else { @@ -524,6 +534,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, void png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) { + const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}; png_byte buf[6]; png_debug(1, "in png_write_bKGD\n"); @@ -540,19 +551,19 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) return; } buf[0] = back->index; - png_write_chunk(png_ptr, png_bKGD, buf, (png_size_t)1); + png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)1); } else if (color_type & PNG_COLOR_MASK_COLOR) { png_save_uint_16(buf, back->red); png_save_uint_16(buf + 2, back->green); png_save_uint_16(buf + 4, back->blue); - png_write_chunk(png_ptr, png_bKGD, buf, (png_size_t)6); + png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)6); } else { png_save_uint_16(buf, back->gray); - png_write_chunk(png_ptr, png_bKGD, buf, (png_size_t)2); + png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)2); } } #endif @@ -562,6 +573,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) void png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist) { + const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}; int i; png_byte buf[3]; @@ -574,7 +586,7 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist) return; } - png_write_chunk_start(png_ptr, png_hIST, (png_uint_32)(num_hist * 2)); + png_write_chunk_start(png_ptr, (png_bytep)png_hIST, (png_uint_32)(num_hist * 2)); for (i = 0; i < num_hist; i++) { png_save_uint_16(buf, hist[i]); @@ -710,6 +722,7 @@ void png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text, png_size_t text_len) { + const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}; png_size_t key_len; png_charp new_key; @@ -724,7 +737,7 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text, text_len = 0; /* make sure we include the 0 after the key */ - png_write_chunk_start(png_ptr, png_tEXt, (png_uint_32)key_len+text_len+1); + png_write_chunk_start(png_ptr, (png_bytep)png_tEXt, (png_uint_32)key_len+text_len+1); /* * We leave it to the application to meet PNG-1.0 requirements on the * contents of the text. PNG-1.0 through PNG-1.2 discourage the use of @@ -745,6 +758,7 @@ void png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text, png_size_t text_len, int compression) { + const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}; png_size_t key_len; char buf[1]; png_charp new_key; @@ -914,7 +928,7 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text, text_len += png_ptr->zbuf_size - (png_size_t)png_ptr->zstream.avail_out; /* write start of chunk */ - png_write_chunk_start(png_ptr, png_zTXt, (png_uint_32)(key_len+text_len+2)); + png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32)(key_len+text_len+2)); /* write key */ png_write_chunk_data(png_ptr, (png_bytep)key, key_len + 1); buf[0] = (png_byte)compression; @@ -949,6 +963,7 @@ png_write_oFFs(png_structp png_ptr, png_uint_32 x_offset, png_uint_32 y_offset, int unit_type) { + const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}; png_byte buf[9]; png_debug(1, "in png_write_oFFs\n"); @@ -959,7 +974,7 @@ png_write_oFFs(png_structp png_ptr, png_uint_32 x_offset, png_save_uint_32(buf + 4, y_offset); buf[8] = (png_byte)unit_type; - png_write_chunk(png_ptr, png_oFFs, buf, (png_size_t)9); + png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9); } #endif @@ -969,6 +984,7 @@ void png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, png_charp units, png_charpp params) { + const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}; png_size_t purpose_len, units_len, total_len; png_uint_32p params_len; png_byte buf[10]; @@ -998,7 +1014,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, } png_debug1(3, "pCAL total length = %d\n", total_len); - png_write_chunk_start(png_ptr, png_pCAL, (png_uint_32)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); png_save_int_32(buf + 4, X1); @@ -1027,6 +1043,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, int unit_type) { + const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}; png_byte buf[9]; png_debug(1, "in png_write_pHYs\n"); @@ -1037,7 +1054,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, png_save_uint_32(buf + 4, y_pixels_per_unit); buf[8] = (png_byte)unit_type; - png_write_chunk(png_ptr, png_pHYs, buf, (png_size_t)9); + png_write_chunk(png_ptr, (png_bytep)png_pHYs, buf, (png_size_t)9); } #endif @@ -1048,6 +1065,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, void png_write_tIME(png_structp png_ptr, png_timep mod_time) { + const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}; png_byte buf[7]; png_debug(1, "in png_write_tIME\n"); @@ -1066,7 +1084,7 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time) buf[5] = mod_time->minute; buf[6] = mod_time->second; - png_write_chunk(png_ptr, png_tIME, buf, (png_size_t)7); + png_write_chunk(png_ptr, (png_bytep)png_tIME, buf, (png_size_t)7); } #endif @@ -1074,6 +1092,20 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time) void png_write_start_row(png_structp png_ptr) { + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* start of interlace block */ + int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* offset to next interlace block */ + int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* start of interlace block in the y direction */ + int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* offset to next interlace block in the y direction */ + int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; + png_size_t buf_size; png_debug(1, "in png_write_start_row\n"); @@ -1152,6 +1184,20 @@ png_write_start_row(png_structp png_ptr) void png_write_finish_row(png_structp png_ptr) { + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* start of interlace block */ + int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* offset to next interlace block */ + int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* start of interlace block in the y direction */ + int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* offset to next interlace block in the y direction */ + int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; + int ret; png_debug(1, "in png_write_finish_row\n"); @@ -1250,6 +1296,14 @@ png_write_finish_row(png_structp png_ptr) void png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) { + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* start of interlace block */ + int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* offset to next interlace block */ + int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + png_debug(1, "in png_do_write_interlace\n"); /* we don't have to do anything on the last pass (6) */ #if defined(PNG_USELESS_TESTS_SUPPORTED) diff --git a/scripts/makefile.beos b/scripts/makefile.beos index c93de02b5..2c0bba27e 100644 --- a/scripts/makefile.beos +++ b/scripts/makefile.beos @@ -31,7 +31,7 @@ RANLIB=ranlib # read libpng.txt or png.h to see why PNGMAJ is 2. You should not # have to change it. PNGMAJ = 2 -PNGMIN = 1.0.5a +PNGMIN = 1.0.5c PNGVER = $(PNGMAJ).$(PNGMIN) # where make install puts libpng.a, libpng.so*, and png.h diff --git a/scripts/makefile.dec b/scripts/makefile.dec index 2cda5c1c8..c0ef1d12e 100644 --- a/scripts/makefile.dec +++ b/scripts/makefile.dec @@ -14,7 +14,7 @@ ZLIBINC=../zlib # read libpng.txt or png.h to see why PNGMAJ is 2. You should not # have to change it. PNGMAJ = 2 -PNGMIN = 1.0.5a +PNGMIN = 1.0.5c PNGVER = $(PNGMAJ).$(PNGMIN) CC=cc diff --git a/scripts/makefile.linux b/scripts/makefile.linux index 3aada1112..2ecbfc09b 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.5a +PNGMIN = 1.0.5c PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.sco b/scripts/makefile.sco index c38d67554..795a8a80a 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.5a +PNGMIN = 1.0.5c PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris index 853394972..d941e64bb 100644 --- a/scripts/makefile.solaris +++ b/scripts/makefile.solaris @@ -7,9 +7,10 @@ CC=gcc # The commands "CC" and "LD" must NOT refer to /usr/ucb/cc and /usr/ucb/ld. -# If they do, you need to adjust your PATH environment variable. -# The environment variable LD_LIBRARY_PATH should not be set at all. If -# it is, things are likely to break. +# If they do, you need to adjust your PATH environment variable to put +# /usr/ccs/bin ahead of /usr/ucb. The environment variable LD_LIBRARY_PATH +# should not be set at all. If it is, things are likely to break because +# of the libucb dependency that is created. # Where make install puts libpng.a, libpng.so*, and png.h prefix=/usr/local @@ -36,7 +37,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.5a +PNGMIN = 1.0.5c PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makevms.com b/scripts/makevms.com index a570546ab..8f8bf32a8 100644 --- a/scripts/makevms.com +++ b/scripts/makevms.com @@ -1,6 +1,12 @@ $! make libpng under VMS $! $! +$! Check for MMK/MMS +$! +$ Make = "" +$ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS" +$ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK" +$! $! Look for the compiler used $! $ zlibsrc = "[-.zlib]" @@ -28,10 +34,10 @@ $ comp = "__decc__=1" $ endif $ endif $! -$! Build the thing plain or with mms +$! Build the thing plain or with mms/mmk $! $ write sys$output "Compiling Libpng sources ..." -$ if f$search("SYS$SYSTEM:MMS.EXE").eqs."" +$ if make.eqs."" $ then $ dele pngtest.obj;* $ CALL MAKE png.OBJ "cc ''CCOPT' png" - @@ -72,12 +78,12 @@ $ write sys$output "Building pngtest..." $ CALL MAKE pngtest.OBJ "cc ''CCOPT' pngtest" - pngtest.c png.h pngconf.h $ call make pngtest.exe - - "LINK pngtest,libpng.olb/lib,''zlibsrc'libgz.olb/lib" - + "LINK pngtest,libpng.olb/lib,''zlibsrc'libz.olb/lib" - pngtest.obj libpng.olb $ write sys$output "Testing Libpng..." $ run pngtest $ else -$ mms/macro=('comp',zlibsrc='zlibsrc') +$ 'make'/macro=('comp',zlibsrc='zlibsrc') $ endif $ write sys$output "Libpng build completed" $ exit diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas index 52220ea67..e208349d7 100644 --- a/scripts/pngdef.pas +++ b/scripts/pngdef.pas @@ -3,8 +3,8 @@ unit pngdef; interface const - PNG_LIBPNG_VER_STRING = '1.0.5a'; - PNG_LIBPNG_VER = 10005; + PNG_LIBPNG_VER_STRING = '1.0.5c'; + PNG_LIBPNG_VER = 10006; type png_uint_32 = Cardinal; @@ -261,8 +261,12 @@ function png_create_read_struct(user_png_ver: png_charp; stdcall; function png_get_copyright(png_ptr: png_structp): png_charp; stdcall; +function png_get_header_ver(png_ptr: png_structp): png_charp; + stdcall; function png_get_header_version(png_ptr: png_structp): png_charp; stdcall; +function png_get_libpng_ver(png_ptr: png_structp): png_charp; + stdcall; function png_create_write_struct(user_png_ver: png_charp; error_ptr: user_error_ptr; error_fn: png_error_ptr; warn_fn: png_error_ptr): png_structp; @@ -589,6 +593,8 @@ procedure png_write_image(png_ptr: png_structp; image: png_bytepp); stdcall; procedure png_write_info(png_ptr: png_structp; info_ptr: png_infop); stdcall; +procedure png_write_info_before_PLTE(png_ptr: png_structp; info_ptr: png_infop); + stdcall; procedure png_write_row(png_ptr: png_structp; row: png_bytep); stdcall; procedure png_write_rows(png_ptr: png_structp; row: png_bytepp; @@ -716,6 +722,7 @@ procedure png_write_end; external pngDLL; procedure png_write_flush; external pngDLL; procedure png_write_image; external pngDLL; procedure png_write_info; external pngDLL; +procedure png_write_info_before_PLTE; external pngDLL; procedure png_write_row; external pngDLL; procedure png_write_rows; external pngDLL; diff --git a/scripts/pngos2.def b/scripts/pngos2.def index e557b0963..611918c5f 100644 --- a/scripts/pngos2.def +++ b/scripts/pngos2.def @@ -22,6 +22,7 @@ EXPORTS png_create_info_struct png_info_init png_write_info + png_write_info_before_PLTE png_read_info png_convert_to_rfc1123 png_convert_from_struct_tm @@ -75,7 +76,9 @@ EXPORTS png_get_copyright png_set_error_fn png_get_error_ptr + png_get_header_ver png_get_header_version + png_get_libpng_ver ; png_get_mem_fn ; png_set_mem_fn png_set_write_fn