summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ANNOUNCE17
-rw-r--r--CHANGES15
-rw-r--r--INSTALL6
-rw-r--r--KNOWNBUG30
-rw-r--r--README2
-rw-r--r--example.c21
-rw-r--r--libpng.36
-rw-r--r--libpng.txt2
-rw-r--r--libpngpf.32
-rw-r--r--png.52
-rw-r--r--png.c6
-rw-r--r--png.h34
-rw-r--r--pngconf.h60
-rw-r--r--pngerror.c8
-rw-r--r--pngget.c4
-rw-r--r--pngmem.c6
-rw-r--r--pngpread.c6
-rw-r--r--pngread.c34
-rw-r--r--pngrio.c18
-rw-r--r--pngrtran.c68
-rw-r--r--pngrutil.c46
-rw-r--r--pngset.c4
-rw-r--r--pngtest.c14
-rw-r--r--pngtrans.c11
-rw-r--r--pngwio.c20
-rw-r--r--pngwrite.c6
-rw-r--r--pngwtran.c4
-rw-r--r--pngwutil.c8
-rw-r--r--scripts/makefile.lnx2
-rw-r--r--scripts/makefile.s2x2
-rw-r--r--scripts/makefile.sco2
-rw-r--r--scripts/pngdef.pas708
-rw-r--r--scripts/pngdll.mak53
-rw-r--r--scripts/zlibdef.pas169
-rw-r--r--scripts/zlibdll.mak36
35 files changed, 1251 insertions, 181 deletions
diff --git a/ANNOUNCE b/ANNOUNCE
index 490a27560..8739266e3 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
-Libpng 1.0.1c May 9, 1998
+Libpng 1.0.1d May 21, 1998
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.
@@ -32,7 +32,7 @@ version 1.0.1b [May 2, 1998]
Added warnings when people try to use transforms they've defined out.
Collapsed 4 "i" and "c" loops into single "i" loops in pngrtran and pngwtran.
Revised paragraph about png_set_expand() in libpng.txt and libpng.3 (Greg)
-version 1.0.1c [May 9, 1998]
+version 1.0.1c [May 11, 1998]
Fixed a bug in pngrtran.c (introduced in libpng-1.0.1a) where the masks for
filler bytes should have been 0xff instead of 0xf.
Added max_pixel_depth=32 in pngrutil.c when using FILLER with palette images.
@@ -42,6 +42,19 @@ version 1.0.1c [May 9, 1998]
for consistency, in pngconf.h
Added individual "ifndef PNG_NO_CAPABILITY" for the capabilities in pngconf.h
to make it easier to remove unwanted capabilities via the compile line
+ Made some corrections to grammar (which, it's) in documentation (Greg).
+ Corrected example.c, use of row_pointers in png_write_image().
+version 1.0.1d [May 21, 1998]
+ Corrected several statements that some compilers interpret as illegal use
+ of side effects in pngrutil.c and pngtrans.c, that were introduced in
+ version 1.0.1b
+ Revised png_read_rows() to avoid repeated if-testing for NULL (A Kleinert)
+ More corrections to example.c, use of row_pointers in png_write_image()
+ and png_read_rows().
+ Added pngdll.mak and pngdef.pas to scripts directory, contributed by
+ Bob Dellaca, to make a png32bd.dll with Borland C++ 4.5
+ Fixed error in example.c with png_set_text: num_text is 3, not 2 (Guido V.)
+ Changed several loops from count-down to count-up, for consistency.
Send comments/corrections/commendations to
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu
diff --git a/CHANGES b/CHANGES
index 3d72a09bd..925706a6c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -312,7 +312,7 @@ version 1.0.1b [May 2, 1998]
Added warnings when people try to use transforms they've defined out.
Collapsed 4 "i" and "c" loops into single "i" loops in pngrtran and pngwtran.
Revised paragraph about png_set_expand() in libpng.txt and libpng.3 (Greg)
-version 1.0.1c [May 9, 1998]
+version 1.0.1c [May 11, 1998]
Fixed a bug in pngrtran.c (introduced in libpng-1.0.1a) where the masks for
filler bytes should have been 0xff instead of 0xf.
Added max_pixel_depth=32 in pngrutil.c when using FILLER with palette images.
@@ -322,3 +322,16 @@ version 1.0.1c [May 9, 1998]
for consistency, in pngconf.h
Added individual "ifndef PNG_NO_[CAPABILITY]" in pngconf.h to make it easier
to remove unwanted capabilities via the compile line
+ Made some corrections to grammar (which, it's) in documentation (Greg).
+ Corrected example.c, use of row_pointers in png_write_image().
+version 1.0.1d [May 21, 1998]
+ Corrected several statements that some compilers interpret as illegal use
+ of side effects in pngrutil.c and pngtrans.c, that were introduced in
+ version 1.0.1b
+ Revised png_read_rows() to avoid repeated if-testing for NULL (A Kleinert)
+ More corrections to example.c, use of row_pointers in png_write_image()
+ and png_read_rows().
+ Added pngdll.mak and pngdef.pas to scripts directory, contributed by
+ Bob Dellaca, to make a png32bd.dll with Borland C++ 4.5
+ Fixed error in example.c with png_set_text: num_text is 3, not 2 (Guido V.)
+ Changed several loops from count-down to count-up, for consistency.
diff --git a/INSTALL b/INSTALL
index 803e9fbca..aa92a3ff0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -10,8 +10,8 @@ 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-%VER% or "lpng100" and "zlib-1.1.1"
-or "zlib111") so that you have directories called "zlib" and "libpng".
+might be called "libpng-%VER% or "lpng100" and "zlib-1.1.2"
+or "zlib112") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
@@ -61,6 +61,8 @@ include
pngos2.def => OS/2 module definition file used by makefile.os2
makefile.wat => Watcom 10a+ Makefile, 32-bit flat memory model
makevms.com => VMS build script
+ pngdll.mak => To make a png32bd.dll with Borland C++ 4.5
+ pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
Copy the file (or files) that you need from the
scripts directory into this directory, for example
diff --git a/KNOWNBUG b/KNOWNBUG
index 1933fdedc..76c51e7c1 100644
--- a/KNOWNBUG
+++ b/KNOWNBUG
@@ -42,7 +42,9 @@ Known bugs and suggested enhancements in libpng-1.0.1
Question whether i-- or --i is better.
- STATUS: Under investigation.
+ STATUS: Under investigation. About 150 loops turned around
+ in libpng-1.0.1d, for testing. Object files and executables
+ are about 20k smaller in SGI and gcc-compiled codes.
b. Remove products and structure members from loop tests -- Glenn R-P
@@ -156,3 +158,29 @@ Known bugs and suggested enhancements in libpng-1.0.1
STATUS: Fixed in libpng-1.0.1c
+
+17. May 10, 1998 -- DOCUMENTATION -- Greg
+
+ There are a number of incorrect usages of "which" and "it's" in the
+ comments.
+
+ STATUS:
+
+ Fixed in libpng-1.0.1c
+
+18. May 20, 1998 -- BUG -- illegal use of side effects -- Magnus Holmgren
+
+ In libpng-1.0.1b several illegal uses of side effects were
+ introduced while tuning loops in pngrutil.c; also one in pngtrans.c.
+
+ STATUS:
+
+ Fixed in libpng-1.0.1d
+
+19. May 20, 1998 -- ENHANCEMENT -- script for making DLL -- Bob Dellaca
+
+ Bob Dellaca contributed script for making PNG DLL on Borland C++ 4.5
+
+ STATUS:
+
+ Added to distribution in libpng-1.0.1d
diff --git a/README b/README
index e2c4ffeef..6afca2bf3 100644
--- a/README
+++ b/README
@@ -178,6 +178,8 @@ Files in this distribution:
makefile.wat => Watcom 10a+ Makefile, 32-bit flat memory model
pngos2.def => OS/2 module definition file used by makefile.os2
makevms.com => VMS build script
+ pngdll.mak => To make a png32bd.dll with Borland C++ 4.5
+ pngdef.pas => Defines for a png32bd.dll with Borland C++ 4.5
Good luck, and happy coding.
diff --git a/example.c b/example.c
index a656c13de..b04d4068e 100644
--- a/example.c
+++ b/example.c
@@ -316,18 +316,18 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
#ifdef single /* Read the image a single row at a time */
for (y = 0; y < height; y++)
{
- png_bytep row_pointers = row[y];
- png_read_rows(png_ptr, &row_pointers, NULL, 1);
+ png_read_rows(png_ptr, &row_pointers[y], NULL, 1);
}
#else no_single /* Read the image several rows at a time */
for (y = 0; y < height; y += number_of_rows)
{
#ifdef sparkle /* Read the image using the "sparkle" effect. */
- png_read_rows(png_ptr, row_pointers, NULL, number_of_rows);
+ png_read_rows(png_ptr, &row_pointers[y], NULL, number_of_rows);
+ png_read_rows(png_ptr, NULL, row_pointers[y], number_of_rows);
#else no_sparkle /* Read the image using the "rectangle" effect */
- png_read_rows(png_ptr, NULL, row_pointers, number_of_rows);
+ png_read_rows(png_ptr, NULL, &row_pointers[y], number_of_rows);
#endif no_sparkle /* use only one of these two methods */
}
@@ -581,7 +581,7 @@ void write_png(char *file_name /* , ... other image information ... */)
text_ptr[2].key = "Description";
text_ptr[2].text = "<long text>";
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
- png_set_text(png_ptr, info_ptr, text_ptr, 2);
+ png_set_text(png_ptr, info_ptr, text_ptr, 3);
/* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */
/* note that if sRGB is present the cHRM chunk must be ignored
@@ -638,7 +638,11 @@ void write_png(char *file_name /* , ... other image information ... */)
* layout, however, so choose what fits your needs best). You need to
* use the first method if you aren't handling interlacing yourself.
*/
- png_byte row_pointers[height][width];
+ png_uint_32 k, height, width;
+ png_byte image[height][width];
+ png_bytep row_pointers[height];
+ for (k = 0; k < height; k++)
+ row_pointers[k] = image + k*width;
/* One of the following output methods is REQUIRED */
#ifdef entire /* write out the entire image data in one call */
@@ -653,13 +657,12 @@ void write_png(char *file_name /* , ... other image information ... */)
for (pass = 0; pass < number_passes; pass++)
{
/* Write a few rows at a time. */
- png_write_rows(png_ptr, row_pointers, number_of_rows);
+ png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows);
/* If you are only writing one row at a time, this works */
for (y = 0; y < height; y++)
{
- png_bytep row_pointers = row[y];
- png_write_rows(png_ptr, &row_pointers, 1);
+ png_write_rows(png_ptr, &row_pointers[y], 1);
}
}
#endif no_entire /* use only one output method */
diff --git a/libpng.3 b/libpng.3
index bd71d52a1..167e1f0e6 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,4 +1,4 @@
-.TH LIBPNG 3 "May 9, 1998"
+.TH LIBPNG 3 "May 21, 1998"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library
.SH SYNOPSIS
@@ -396,7 +396,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.1c May 9, 1998
+ libpng version 1.0.1d May 21, 1998
Updated and distributed by Glenn Randers-Pehrson
<randeg@alumni.rpi.edu>
Copyright (c) 1998, Glenn Randers-Pehrson
@@ -2374,7 +2374,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
-Libpng version 1.0.1c May 9, 1998:
+Libpng version 1.0.1d May 21, 1998:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).
diff --git a/libpng.txt b/libpng.txt
index 295421da2..7506e572e 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.1c May 9, 1998
+ libpng version 1.0.1d May 21, 1998
Updated and distributed by Glenn Randers-Pehrson
<randeg@alumni.rpi.edu>
Copyright (c) 1998, Glenn Randers-Pehrson
diff --git a/libpngpf.3 b/libpngpf.3
index f1fa29687..824f4dd58 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,4 +1,4 @@
-.TH LIBPNGPF 3 "May 9, 1998"
+.TH LIBPNGPF 3 "May 21, 1998"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library
(private functions)
diff --git a/png.5 b/png.5
index 0ef57d305..3ba307918 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "May 9, 1998"
+.TH PNG 5 "May 21, 1998"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
diff --git a/png.c b/png.c
index 73f96eabc..82bee2788 100644
--- a/png.c
+++ b/png.c
@@ -1,12 +1,12 @@
/* png.c - location for general purpose libpng functions
*
- * libpng 1.0.1c
+ * libpng 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*/
#define PNG_INTERNAL
@@ -16,7 +16,7 @@
/* Version information for C files. This had better match the version
* string defined in png.h.
*/
-char png_libpng_ver[12] = "1.0.1c";
+char png_libpng_ver[12] = "1.0.1d";
/* Place to hold the signature string for a PNG file. */
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
diff --git a/png.h b/png.h
index 35c4c3727..03213da5e 100644
--- a/png.h
+++ b/png.h
@@ -1,12 +1,12 @@
/* png.h - header file for PNG reference library
*
- * libpng 1.0.1c
+ * libpng 1.0.1d
* For conditions of distribution and use, see the COPYRIGHT NOTICE below.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998 Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*
* Note about libpng version numbers:
*
@@ -120,7 +120,7 @@ extern "C" {
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.0.1c"
+#define PNG_LIBPNG_VER_STRING "1.0.1d"
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
@@ -233,7 +233,7 @@ typedef png_time FAR * FAR * png_timepp;
* With libpng < 0.95, it was only possible to directly set and read the
* the values in the png_info_struct, which meant that the contents and
* order of the values had to remain fixed. With libpng 0.95 and later,
- * however, * there are now functions which abstract the contents of
+ * however, there are now functions that abstract the contents of
* png_info_struct from the application, so this makes it easier to use
* libpng with dynamic libraries, and even makes it possible to use
* libraries that don't have all of the libpng ancillary chunk-handing
@@ -291,14 +291,14 @@ typedef struct png_info_struct
/* The tEXt and zTXt chunks contain human-readable textual data in
* uncompressed and compressed forms, respectively. The data in "text"
* is an array of pointers to uncompressed, null-terminated C strings.
- * Each chunk has a keyword which describes the textual data contained
+ * Each chunk has a keyword that describes the textual data contained
* in that chunk. Keywords are not required to be unique, and the text
* string may be empty. Any number of text chunks may be in an image.
*/
int num_text; /* number of comments read/to write */
int max_text; /* current size of text array */
png_textp text; /* array of comments read/to write */
-#endif /* PNG_READ_tEXt/zTXt_SUPPORTED || PNG_WRITE_tEXt/zTXt_SUPPORTED */
+#endif /* PNG_READ_OR_WRITE_tEXt_OR_zTXt_SUPPORTED */
#if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED)
/* The tIME chunk holds the last time the displayed image data was
* modified. See the png_time struct for the contents of this struct.
@@ -321,7 +321,7 @@ typedef struct png_info_struct
* same order as the palette colors, starting from index 0. Values
* for the data are in the range [0, 255], ranging from fully transparent
* to fully opaque, respectively. For non-paletted images, there is a
- * single color specified which should be treated as fully transparent.
+ * single color specified that should be treated as fully transparent.
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
*/
png_bytep trans; /* transparent values for paletted image */
@@ -493,10 +493,11 @@ typedef struct png_row_info_struct
typedef png_row_info FAR * png_row_infop;
typedef png_row_info FAR * FAR * png_row_infopp;
-/* These are the function types for the I/O functions, and the functions which
- * modify the default I/O functions to user I/O functions. The png_error_ptr
- * type should match that of user supplied warning and error functions, while
- * the png_rw_ptr type should match that of the user read/write data functions.
+/* These are the function types for the I/O functions and for the functions
+ * that allow the user to override the default I/O functions with his or her
+ * own. The png_error_ptr type should match that of user-supplied warning
+ * and error functions, while the png_rw_ptr type should match that of the
+ * user read/write data functions.
*/
typedef struct png_struct_def png_struct;
typedef png_struct FAR * png_structp;
@@ -1140,7 +1141,7 @@ extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)
extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));
-/* function which combines rows. Not very much different than the
+/* function that combines rows. Not very much different than the
* png_combine_row() call. Is this even used?????
*/
extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
@@ -1392,8 +1393,7 @@ extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED)
extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text));
-#endif /* PNG_READ_tEXt_SUPPORTED || PNG_WRITE_tEXt_SUPPORTED ||
- PNG_READ_zTXt_SUPPORTED || PNG_WRITE_zTXt_SUPPORTED */
+#endif /* PNG_READ_OR_WRITE_tEXt_OR_zTXt_SUPPORTED */
#if defined(PNG_READ_tIME_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
@@ -1446,9 +1446,9 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
#endif /* (PNG_DEBUG > 0) */
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
-/* With these routines, we avoid an integer divide, which will be slower on
- * many machines. However, it does take more operations than the corresponding
- * divide method, so it may be slower on some RISC systems. There are two
+/* With these routines we avoid an integer divide, which will be slower on
+ * most machines. However, it does take more operations than the corresponding
+ * divide method, so it may be slower on a few RISC systems. There are two
* shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
*
* Note that the rounding factors are NOT supposed to be the same! 128 and
diff --git a/pngconf.h b/pngconf.h
index 08b240410..cc9d693eb 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,12 +1,12 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng 1.0.1c
+ * libpng 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*/
/* Any machine specific code is near the front of this file, so if you
@@ -47,7 +47,7 @@
#define PNG_MAX_MALLOC_64K
#endif
-/* This protects us against compilers which run on a windowing system
+/* 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
* in png_error() and png_warning(). #defining PNG_NO_STDIO will
@@ -309,7 +309,9 @@ __dont__ include it again
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#endif
/* the following aren't implemented yet
+#ifndef PNG_NO_READ_RGB_TO_GRAY
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
+#endif
*/
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
@@ -428,88 +430,88 @@ __dont__ include it again
#endif
#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
-#ifndef PNG_NO_PNG_READ_bKGD
+#ifndef PNG_NO_READ_bKGD
#define PNG_READ_bKGD_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_cHRM
+#ifndef PNG_NO_READ_cHRM
#define PNG_READ_cHRM_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_gAMA
+#ifndef PNG_NO_READ_gAMA
#define PNG_READ_gAMA_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_hIST
+#ifndef PNG_NO_READ_hIST
#define PNG_READ_hIST_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_oFFs
+#ifndef PNG_NO_READ_oFFs
#define PNG_READ_oFFs_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_pCAL
+#ifndef PNG_NO_READ_pCAL
#define PNG_READ_pCAL_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_pHYs
+#ifndef PNG_NO_READ_pHYs
#define PNG_READ_pHYs_SUPPORTED
#endif
#ifndef PNG_NO_READ_sBIT
#define PNG_READ_sBIT_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_sRGB
+#ifndef PNG_NO_READ_sRGB
#define PNG_READ_sRGB_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_tEXt
+#ifndef PNG_NO_READ_tEXt
#define PNG_READ_tEXt_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_tIME
+#ifndef PNG_NO_READ_tIME
#define PNG_READ_tIME_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_tRNS
+#ifndef PNG_NO_READ_tRNS
#define PNG_READ_tRNS_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_zTXt
+#ifndef PNG_NO_READ_zTXt
#define PNG_READ_zTXt_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_READ_OPT_PLTE
+#ifndef PNG_NO_READ_OPT_PLTE
#define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the optional */
#endif /* PLTE chunk in RGB and RGBA images */
#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
-#ifndef PNG_NO_PNG_WRITE_bKGD
+#ifndef PNG_NO_WRITE_bKGD
#define PNG_WRITE_bKGD_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_cHRM
+#ifndef PNG_NO_WRITE_cHRM
#define PNG_WRITE_cHRM_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_gAMA
+#ifndef PNG_NO_WRITE_gAMA
#define PNG_WRITE_gAMA_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_hIST
+#ifndef PNG_NO_WRITE_hIST
#define PNG_WRITE_hIST_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_oFFs
+#ifndef PNG_NO_WRITE_oFFs
#define PNG_WRITE_oFFs_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_pCAL
+#ifndef PNG_NO_WRITE_pCAL
#define PNG_WRITE_pCAL_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_pHYs
+#ifndef PNG_NO_WRITE_pHYs
#define PNG_WRITE_pHYs_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_sBIT
+#ifndef PNG_NO_WRITE_sBIT
#define PNG_WRITE_sBIT_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_sRGB
+#ifndef PNG_NO_WRITE_sRGB
#define PNG_WRITE_sRGB_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_tEXt
+#ifndef PNG_NO_WRITE_tEXt
#define PNG_WRITE_tEXt_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_tIME
+#ifndef PNG_NO_WRITE_tIME
#define PNG_WRITE_tIME_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_tRNS
+#ifndef PNG_NO_WRITE_tRNS
#define PNG_WRITE_tRNS_SUPPORTED
#endif
-#ifndef PNG_NO_PNG_WRITE_zTXt
+#ifndef PNG_NO_WRITE_zTXt
#define PNG_WRITE_zTXt_SUPPORTED
#endif
#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
diff --git a/pngerror.c b/pngerror.c
index f5d90cf13..39e893583 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,14 +1,14 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
- * libpng 1.0.1c
+ * libpng 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*
- * This file provides a location for all error handling. Users which
+ * This file provides a location for all error handling. Users who
* need special error handling are expected to write replacement functions
* and use png_set_error_fn() to use those functions. See the instructions
* at each function.
@@ -52,7 +52,7 @@ png_warning(png_structp png_ptr, png_const_charp message)
png_default_warning(png_ptr, message);
}
-/* These utilities are used internally to build an error message which relates
+/* These utilities are used internally to build an error message that relates
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
* this is used to prefix the message. The message is limited in length
* to 63 bytes, the name characters are output as hex digits wrapped in []
diff --git a/pngget.c b/pngget.c
index 6891b51f9..37e9bb972 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,12 +1,12 @@
/* pngget.c - retrieval of values from info struct
*
- * libpng 1.0.1c
+ * libpng 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*/
#define PNG_INTERNAL
diff --git a/pngmem.c b/pngmem.c
index 2b3d27165..47880e968 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,12 +1,12 @@
/* pngmem.c - stub functions for memory allocation
*
- * libpng 1.0.1c
+ * libpng 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*
* This file provides a location for all memory allocation. Users who
* need special memory handling are expected to modify the code in this file
@@ -72,7 +72,7 @@ png_destroy_struct(png_voidp struct_ptr)
* have the ability to do that.
*
* Borland seems to have a problem in DOS mode for exactly 64K.
- * It gives you a segment with an offset of 8 (perhaps to store it's
+ * It gives you a segment with an offset of 8 (perhaps to store its
* memory stuff). zlib doesn't like this at all, so we have to
* detect and deal with it. This code should not be needed in
* Windows or OS/2 modes, and only in 16 bit mode. This code has
diff --git a/pngpread.c b/pngpread.c
index e3f0d7a26..22168b7c3 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,12 +1,12 @@
/* pngpread.c - read a png file in push mode
*
- * 1.0.1c
+ * 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*/
#define PNG_INTERNAL
@@ -1070,7 +1070,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
#endif
/* This function is called when we haven't found a handler for this
- * chunk. In the future we will have code here which can handle
+ * chunk. In the future we will have code here that can handle
* user-defined callback functions for unknown chunks before they are
* ignored or cause an error. If there isn't a problem with the
* chunk itself (ie a bad chunk name or a critical chunk), the chunk
diff --git a/pngread.c b/pngread.c
index f2ece96fe..0d3619860 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,12 +1,12 @@
/* pngread.c - read a PNG file
*
- * 1.0.1c
+ * 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*
* This file contains routines that an application calls directly to
* read a PNG file or stream.
@@ -520,7 +520,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
/* save jump buffer and error functions */
rp = row;
dp = display_row;
- if(rp != NULL && dp != NULL)
+ if (rp != NULL && dp != NULL)
for (i = 0; i < num_rows; i++)
{
png_bytep rptr = *rp++;
@@ -528,25 +528,19 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
png_read_row(png_ptr, rptr, dptr);
}
- else
+ else if(rp != NULL)
for (i = 0; i < num_rows; i++)
{
- png_bytep rptr;
- png_bytep dptr;
-
- if (rp != NULL)
- rptr = *rp;
- else
- rptr = NULL;
- if (dp != NULL)
- dptr = *dp;
- else
- dptr = NULL;
- png_read_row(png_ptr, rptr, dptr);
- if (row != NULL)
- rp++;
- if (display_row != NULL)
- dp++;
+ png_bytep rptr = *rp;
+ png_read_row(png_ptr, rptr, NULL);
+ rp++;
+ }
+ else if(dp != NULL)
+ for (i = 0; i < num_rows; i++)
+ {
+ png_bytep dptr = *dp;
+ png_read_row(png_ptr, NULL, dptr);
+ dp++;
}
}
diff --git a/pngrio.c b/pngrio.c
index df84ca72c..a17c64dda 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -1,17 +1,17 @@
/* pngrio.c - functions for data input
*
- * libpng 1.0.1c
+ * libpng 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*
- * This file provides a location for all input. Users which need
- * special handling are expected to write a function which has the same
- * arguments as this, and perform a similar function, but possibly has
- * a different input method. Note that you shouldn't change this
+ * This file provides a location for all input. Users who need
+ * special handling are expected to write a function that has the same
+ * arguments as this and performs a similar function, but that possibly
+ * has a different input method. Note that you shouldn't change this
* function, but rather write a replacement function and then make
* libpng use it at run time with png_set_read_fn(...).
*/
@@ -35,7 +35,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
}
#if !defined(PNG_NO_STDIO)
-/* This is the function which does the actual reading of data. If you are
+/* This is the function that does the actual reading of data. If you are
not reading from a standard C stream, you should create a replacement
read_data function and use it at run time with png_set_read_fn(), rather
than changing the library. */
@@ -114,10 +114,10 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_ptr - pointer to a png input data structure
io_ptr - pointer to user supplied structure containing info about
the input functions. May be NULL.
- read_data_fn - pointer to a new input function which takes as it's
+ read_data_fn - pointer to a new input function that takes as its
arguments a pointer to a png_struct, a pointer to
a location where input data can be stored, and a 32-bit
- unsigned int which is the number of bytes to be read.
+ unsigned int that is the number of bytes to be read.
To exit and output any fatal error messages the new write
function should call png_error(png_ptr, "Error msg"). */
void
diff --git a/pngrtran.c b/pngrtran.c
index 6449ba818..fd2cc2296 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -1,16 +1,16 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
- * 1.0.1c
+ * 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*
* This file contains functions optionally called by an application
* in order to tell libpng how to handle data when reading a PNG.
- * Transformations which are used in both reading and writing are
+ * Transformations that are used in both reading and writing are
* in pngtrans.c.
*/
@@ -208,11 +208,11 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
/* swap the palette around, and set up a table, if necessary */
if (full_dither)
{
- int j;
+ int j = num_palette;
/* put all the useful colors within the max, but don't
move the others */
- for (i = 0, j = num_palette; i < maximum_colors; i++)
+ for (i = 0; i < maximum_colors; i++)
{
if ((int)sort[i] >= maximum_colors)
{
@@ -225,11 +225,11 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
}
else
{
- int j;
+ int j = num_palette;
/* move all the used colors inside the max limit, and
develop a translation table */
- for (i = 0, j = num_palette; i < maximum_colors; i++)
+ for (i = 0; i < maximum_colors; i++)
{
/* only move the colors we need to */
if ((int)sort[i] >= maximum_colors)
@@ -576,16 +576,19 @@ png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
void
png_init_read_transformations(png_structp png_ptr)
{
+ png_debug(1, "in png_init_read_transformations\n");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
- if(png_ptr == NULL) return;
+ if(png_ptr != NULL)
+#endif
+ {
+#if defined(PNG_READ_BACKGROUND_SUPPORTED) || defined(PNG_READ_SHIFT_SUPPORTED) \
+ || defined(PNG_READ_GAMMA_SUPPORTED)
+ int color_type = png_ptr->color_type;
#endif
-
- png_debug(1, "in png_init_read_transformations\n");
#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
if (png_ptr->transformations & PNG_BACKGROUND_EXPAND)
{
- int color_type = png_ptr->color_type;
if (!(color_type & PNG_COLOR_MASK_COLOR)) /* i.e., GRAY or GRAY_ALPHA */
{
/* expand background chunk. */
@@ -881,6 +884,7 @@ png_init_read_transformations(png_structp png_ptr)
}
}
#endif
+ }
}
/* Modify the info structure to reflect the transformations. The
@@ -1334,19 +1338,20 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
}
case 4:
{
- png_bytep bp;
+ png_bytep bp = row;
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
png_byte mask = (png_byte)(((int)0xf0 >> shift[0]) & (int)0xf0) |
(png_byte)((int)0xf >> shift[0]);
- for (bp = row, i = 0; i < istop; i++)
+ for (i = 0; i < istop; i++)
{
*bp >>= shift[0];
*bp++ &= mask;
}
break;
}
+#ifndef PNG_SLOW_SHIFT
case 8:
{
png_bytep bp = row;
@@ -1374,6 +1379,43 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
}
break;
}
+#else
+ case 8:
+ {
+ png_bytep bp;
+ png_uint_32 i;
+ int cstop;
+
+ cstop=(int)row_info->channels;
+ for (bp = row, i = 0; i < row_width; i++)
+ {
+ for (c = 0; c < cstop; c++, bp++)
+ {
+ *bp >>= shift[c];
+ }
+ }
+ break;
+ }
+ case 16:
+ {
+ png_bytep bp;
+ png_size_t i;
+ int cstop;
+
+ cstop=(int)row_info->channels;
+ for (bp = row, i = 0; i < row_width; i++)
+ {
+ for (c = 0; c < cstop; c++, bp += 2)
+ {
+ value = (png_uint_16)((*bp << 8) + *(bp + 1));
+ value >>= shift[c];
+ *bp = (png_byte)(value >> 8);
+ *(bp + 1) = (png_byte)(value & 0xff);
+ }
+ }
+ break;
+ }
+#endif
}
}
}
diff --git a/pngrutil.c b/pngrutil.c
index 428188bc2..b476eb76a 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,14 +1,14 @@
/* pngrutil.c - utilities to read a PNG file
*
- * 1.0.1c
+ * 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*
- * This file contains routines which are only called from within
+ * This file contains routines that are only called from within
* libpng itself during the course of reading an image.
*/
@@ -16,7 +16,7 @@
#include "png.h"
#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
-/* Grab an unsigned 32-bit integer from a buffer in big endian format. */
+/* Grab an unsigned 32-bit integer from a buffer in big-endian format. */
png_uint_32
png_get_uint_32(png_bytep buf)
{
@@ -29,7 +29,7 @@ png_get_uint_32(png_bytep buf)
}
#if defined(PNG_READ_pCAL_SUPPORTED)
-/* Grab a signed 32-bit integer from a buffer in big endian format. The
+/* Grab a signed 32-bit integer from a buffer in big-endian format. The
* data is stored in the PNG file in two's complement format, and it is
* assumed that the machine format for signed integers is the same. */
png_int_32
@@ -44,7 +44,7 @@ png_get_int_32(png_bytep buf)
}
#endif /* PNG_READ_pCAL_SUPPORTED */
-/* Grab an unsigned 16-bit integer from a buffer in big endian format. */
+/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
png_uint_16
png_get_uint_16(png_bytep buf)
{
@@ -1724,7 +1724,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
s_inc = 1;
}
- for (i = row_info->width; i; i--)
+ for (i = 0; i < row_info->width; i++)
{
v = (png_byte)((*sp >> sshift) & 0x1);
for (j = 0; j < jstop; j++)
@@ -1777,7 +1777,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
s_inc = 2;
}
- for (i = row_info->width; i; i--)
+ for (i = 0; i < row_info->width; i++)
{
png_byte v;
int j;
@@ -1833,7 +1833,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
s_inc = 4;
}
- for (i = row_info->width; i; i--)
+ for (i = 0; i < row_info->width; i++)
{
png_byte v = (png_byte)((*sp >> sshift) & 0xf);
int j;
@@ -1868,7 +1868,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
int jstop = png_pass_inc[pass];
png_uint_32 i;
- for (i = row_info->width; i; i--)
+ for (i = 0; i < row_info->width; i++)
{
png_byte v[8];
int j;
@@ -1914,7 +1914,8 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
for (i = bpp; i < istop; i++)
{
- *rp++ = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff);
+ *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff);
+ rp++;
}
break;
}
@@ -1927,7 +1928,8 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
for (i = 0; i < istop; i++)
{
- *rp++ = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
+ *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
+ rp++;
}
break;
}
@@ -1938,18 +1940,20 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
png_bytep pp = prev_row;
png_bytep lp = row;
png_uint_32 bpp = (row_info->pixel_depth + 7) / 8;
- png_uint_32 istop = row_info->rowbytes;
+ png_uint_32 istop = row_info->rowbytes - bpp;
for (i = 0; i < bpp; i++)
{
- *rp++ = (png_byte)(((int)(*rp) +
+ *rp = (png_byte)(((int)(*rp) +
((int)(*pp++) / 2)) & 0xff);
+ rp++;
}
- for (lp = row; i < istop; i++)
+ for (i = 0; i < istop; i++)
{
- *rp++ = (png_byte)(((int)(*rp) +
+ *rp = (png_byte)(((int)(*rp) +
(int)(*pp++ + *lp++) / 2) & 0xff);
+ rp++;
}
break;
}
@@ -1961,14 +1965,15 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
png_bytep lp = row;
png_bytep cp = prev_row;
png_uint_32 bpp = (row_info->pixel_depth + 7) / 8;
- png_uint_32 istop=row_info->rowbytes;
+ png_uint_32 istop=row_info->rowbytes - bpp;
for (i = 0; i < bpp; i++)
{
- *rp++ = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
+ *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
+ rp++;
}
- for ( ; i < istop; i++) /* use leftover i,rp,pp */
+ for (i = 0; i < istop; i++) /* use leftover rp,pp */
{
int a, b, c, pa, pb, pc, p;
@@ -2000,7 +2005,8 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
- *rp++ = (png_byte)(((int)(*rp) + p) & 0xff);
+ *rp = (png_byte)(((int)(*rp) + p) & 0xff);
+ rp++;
}
break;
}
diff --git a/pngset.c b/pngset.c
index d186d1854..05511780e 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,12 +1,12 @@
/* pngset.c - storage of image information into info struct
*
- * 1.0.1c
+ * 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*
* The functions here are used during reads to store data from the file
* into the info struct, and during writes to store application data
diff --git a/pngtest.c b/pngtest.c
index 85ffce2ba..fed8e9c9e 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,12 +1,12 @@
/* pngtest.c - a simple test program to test libpng
*
- * libpng 1.0.1c
+ * libpng 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*
* This program reads in a PNG image, writes it out again, and then
* compares the two files. If the files are identical, this shows that
@@ -180,7 +180,7 @@ static int wrote_question = 0;
/* START of code to validate stdio-free compilation */
/* These copies of the default read/write functions come from pngrio.c and */
/* pngwio.c. They allow "don't include stdio" testing of the library. */
-/* This is the function which does the actual reading of data. If you are
+/* This is the function that does the actual reading of data. If you are
not reading from a standard C stream, you should create a replacement
read_data function and use it at run time with png_set_read_fn(), rather
than changing the library. */
@@ -262,7 +262,7 @@ png_default_flush(png_structp png_ptr)
}
#endif
-/* This is the function which does the actual writing of data. If you are
+/* This is the function that does the actual writing of data. If you are
not writing to a standard C stream, you should create a replacement
write_data function and use it at run time with png_set_write_fn(), rather
than changing the library. */
@@ -352,8 +352,8 @@ static void
png_default_error(png_structp png_ptr, png_const_charp message)
{
png_default_warning(png_ptr, message);
- /* We can return because png_error calls the default handler which is
- * actually ok in this case. */
+ /* We can return because png_error calls the default handler, which is
+ * actually OK in this case. */
}
#endif /* PNG_NO_STDIO */
/* END of code to validate stdio-free compilation */
@@ -439,7 +439,7 @@ png_free(png_structp png_ptr, png_voidp ptr)
if (current_allocation < 0)
fprintf(STDERR, "Duplicate free of memory\n");
/* We must free the list element too, but first kill
- the memory which is to be freed. */
+ the memory that is to be freed. */
memset(ptr, 0x55, pinfo->size);
png_debug_free(png_ptr, pinfo);
break;
diff --git a/pngtrans.c b/pngtrans.c
index 85e956112..327f6eec7 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -1,12 +1,12 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
- * 1.0.1c
+ * 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*/
#define PNG_INTERNAL
@@ -87,8 +87,8 @@ png_set_interlace_handling(png_structp png_ptr)
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
/* Add a filler byte on read, or remove a filler or alpha byte on write.
* The filler type has changed in v0.95 to allow future 2-byte fillers
- * for 48-bit input data, as well as avoiding problems with some compilers
- * which don't like bytes as parameters.
+ * for 48-bit input data, as well as to avoid problems with some compilers
+ * that don't like bytes as parameters.
*/
void
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
@@ -148,7 +148,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
for (i = 0; i < istop; i++)
{
- *rp++ = (png_byte)(~(*rp));
+ *rp = (png_byte)(~(*rp));
+ rp++;
}
}
}
diff --git a/pngwio.c b/pngwio.c
index a7ac6b0cb..917c38f21 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -1,17 +1,17 @@
/* pngwio.c - functions for data output
*
- * libpng 1.0.1c
+ * libpng 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*
- * This file provides a location for all output. Users which need
- * special handling are expected to write functions which have the same
- * arguments as these, and perform similar functions, but possibly use
- * different output methods. Note that you shouldn't change these
+ * This file provides a location for all output. Users who need
+ * special handling are expected to write functions that have the same
+ * arguments as these and perform similar functions, but that possibly
+ * use different output methods. Note that you shouldn't change these
* functions, but rather write replacement functions and then change
* them at run time with png_set_write_fn(...).
*/
@@ -35,7 +35,7 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
}
#if !defined(PNG_NO_STDIO)
-/* This is the function which does the actual writing of data. If you are
+/* This is the function that does the actual writing of data. If you are
not writing to a standard C stream, you should create a replacement
write_data function and use it at run time with png_set_write_fn(), rather
than changing the library. */
@@ -133,13 +133,13 @@ png_default_flush(png_structp png_ptr)
png_ptr - pointer to a png output data structure
io_ptr - pointer to user supplied structure containing info about
the output functions. May be NULL.
- write_data_fn - pointer to a new output function which takes as its
+ write_data_fn - pointer to a new output function that takes as its
arguments a pointer to a png_struct, a pointer to
- data to be written, and a 32-bit unsigned int which is
+ data to be written, and a 32-bit unsigned int that is
the number of bytes to be written. The new write
function should call png_error(png_ptr, "Error msg")
to exit and output any fatal error messages.
- flush_data_fn - pointer to a new flush function which takes as its
+ flush_data_fn - pointer to a new flush function that takes as its
arguments a pointer to a png_struct. After a call to
the flush function, there should be no data in any buffers
or pending transmission. If the output method doesn't do
diff --git a/pngwrite.c b/pngwrite.c
index 59a2f39fa..02ee7b098 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,12 +1,12 @@
/* pngwrite.c - general routines to write a PNG file
*
- * 1.0.1c
+ * 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*/
/* get internal access to png.h */
@@ -824,9 +824,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
int num_weights, png_doublep filter_weights,
png_doublep filter_costs)
{
-#if defined(PNG_WRITE_tEXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED)
int i;
-#endif
png_debug(1, "in png_set_filter_heuristics\n");
if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST)
diff --git a/pngwtran.c b/pngwtran.c
index fc1ba7cca..3b43996d5 100644
--- a/pngwtran.c
+++ b/pngwtran.c
@@ -1,12 +1,12 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
- * 1.0.1c
+ * 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*/
#define PNG_INTERNAL
diff --git a/pngwutil.c b/pngwutil.c
index ee5e6dc92..8e0dc2191 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,12 +1,12 @@
/* pngwutil.c - utilities to write a PNG file
*
- * 1.0.1c
+ * 1.0.1d
* 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, Glenn Randers-Pehrson
- * May 9, 1998
+ * May 21, 1998
*/
#define PNG_INTERNAL
@@ -766,7 +766,7 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
}
/* We can't write the chunk until we find out how much data we have,
- * which means we need to run the compressor first, and save the
+ * which means we need to run the compressor first and save the
* output. This shouldn't be a problem, as the vast majority of
* comments should be reasonable, but we will set up an array of
* malloc'd pointers to be sure.
@@ -1412,7 +1412,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
/* The prediction method we use is to find which method provides the
* smallest value when summing the absolute values of the distances
- * from zero using anything >= 128 as negative numbers. This is known
+ * from zero, using anything >= 128 as negative numbers. This is known
* as the "minimum sum of absolute differences" heuristic. Other
* heuristics are the "weighted minimum sum of absolute differences"
* (experimental and can in theory improve compression), and the "zlib
diff --git a/scripts/makefile.lnx b/scripts/makefile.lnx
index 0c149e769..33351cff0 100644
--- a/scripts/makefile.lnx
+++ b/scripts/makefile.lnx
@@ -29,7 +29,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.1c
+PNGMIN = 1.0.1d
PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h
diff --git a/scripts/makefile.s2x b/scripts/makefile.s2x
index afa03a5e5..167828cbe 100644
--- a/scripts/makefile.s2x
+++ b/scripts/makefile.s2x
@@ -29,7 +29,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.1c
+PNGMIN = 1.0.1d
PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index 36568de1a..65d5fb283 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -22,7 +22,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.1c
+PNGMIN = 1.0.1d
PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h
diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas
new file mode 100644
index 000000000..7c9acb57c
--- /dev/null
+++ b/scripts/pngdef.pas
@@ -0,0 +1,708 @@
+unit pngdef;
+
+interface
+
+const
+ PNG_LIBPNG_VER_STRING = '1.0.1d';
+ PNG_LIBPNG_VER = 10001;
+
+type
+ png_uint_32 = Cardinal;
+ png_int_32 = Longint;
+ png_uint_16 = Word;
+ png_int_16 = Smallint;
+ png_byte = Byte;
+ png_size_t = png_uint_32;
+ png_charpp = ^png_charp;
+ png_charp = PChar;
+ float = single;
+ int = Integer;
+ png_bytepp = ^png_bytep;
+ png_bytep = ^png_byte;
+ png_uint_16p = ^png_uint_16;
+ png_uint_16pp = ^png_uint_16p;
+ png_voidp = pointer;
+ time_t = Longint;
+ png_doublep = ^png_double;
+ png_double = double;
+
+ user_error_ptr = Pointer;
+ png_error_ptrp = ^png_error_ptr;
+ png_error_ptr = procedure(png_ptr: Pointer; msg: Pointer);
+ stdcall;
+ png_rw_ptrp = ^png_rw_ptr;
+ png_rw_ptr = procedure(png_ptr: Pointer; data: Pointer;
+ length: png_size_t);
+ stdcall;
+ png_flush_ptrp = ^png_flush_ptr;
+ png_flush_ptr = procedure(png_ptr: Pointer);
+ stdcall;
+ png_progressive_info_ptrp = ^png_progressive_info_ptr;
+ png_progressive_info_ptr = procedure(png_ptr: Pointer;
+ info_ptr: Pointer);
+ stdcall;
+ png_progressive_end_ptrp = ^png_progressive_end_ptr;
+ png_progressive_end_ptr = procedure(png_ptr: Pointer;
+ info_ptr: Pointer);
+ stdcall;
+ png_progressive_row_ptrp = ^png_progressive_row_ptr;
+ png_progressive_row_ptr = procedure(png_ptr: Pointer;
+ data: Pointer; length: png_uint_32;
+ count: int);
+ stdcall;
+ png_read_status_ptr = procedure(png_ptr: Pointer;
+ row_number: png_uint_32; pass: int);
+ stdcall;
+ png_write_status_ptr = procedure(png_ptr: Pointer;
+ row_number: png_uint_32; pass: int);
+ stdcall;
+ png_user_transform_ptr = procedure(png_ptr: Pointer;
+ row_info: Pointer; data: png_bytep);
+ stdcall;
+
+ png_colorpp = ^png_colorp;
+ png_colorp = ^png_color;
+ png_color = packed record
+ red, green, blue: png_byte;
+ end;
+
+ png_color_16pp = ^png_color_16p;
+ png_color_16p = ^png_color_16;
+ png_color_16 = packed record
+ index: png_byte; //used for palette files
+ red, green, blue: png_uint_16; //for use in red green blue files
+ gray: png_uint_16; //for use in grayscale files
+ end;
+
+ png_color_8pp = ^png_color_8p;
+ png_color_8p = ^png_color_8;
+ png_color_8 = packed record
+ red, green, blue: png_byte; //for use in red green blue files
+ gray: png_byte; //for use in grayscale files
+ alpha: png_byte; //for alpha channel files
+ end;
+
+ png_textpp = ^png_textp;
+ png_textp = ^png_text;
+ png_text = packed record
+ compression: int; //compression value
+ key: png_charp; //keyword, 1-79 character description of "text"
+ text: png_charp; //comment, may be empty ("")
+ text_length: png_size_t; //length of text field
+ end;
+
+ png_timepp = ^png_timep;
+ png_timep = ^png_time;
+ png_time = packed record
+ year: png_uint_16; //yyyy
+ month: png_byte; //1..12
+ day: png_byte; //1..31
+ hour: png_byte; //0..23
+ minute: png_byte; //0..59
+ second: png_byte; //0..60 (leap seconds)
+ end;
+
+ png_infopp = ^png_infop;
+ png_infop = Pointer;
+
+ png_row_infopp = ^png_row_infop;
+ png_row_infop = ^png_row_info;
+ png_row_info = packed record
+ width: png_uint_32; //width of row
+ rowbytes: png_size_t; //number of bytes in row
+ color_type: png_byte; //color type of row
+ bit_depth: png_byte; //bit depth of row
+ channels: png_byte; //number of channels (1, 2, 3, or 4)
+ pixel_depth: png_byte; //bits per pixel (depth * channels)
+ end;
+
+ png_structpp = ^png_structp;
+ png_structp = Pointer;
+
+const
+
+// Supported compression types for text in PNG files (tEXt, and zTXt).
+// The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed.
+
+ PNG_TEXT_COMPRESSION_NONE_WR = -3;
+ PNG_TEXT_COMPRESSION_zTXt_WR = -2;
+ PNG_TEXT_COMPRESSION_NONE = -1;
+ PNG_TEXT_COMPRESSION_zTXt = 0;
+
+// These describe the color_type field in png_info.
+// color type masks
+
+ PNG_COLOR_MASK_PALETTE = 1;
+ PNG_COLOR_MASK_COLOR = 2;
+ PNG_COLOR_MASK_ALPHA = 4;
+
+// color types. Note that not all combinations are legal
+
+ PNG_COLOR_TYPE_GRAY = 0;
+ PNG_COLOR_TYPE_PALETTE = PNG_COLOR_MASK_COLOR or
+ PNG_COLOR_MASK_PALETTE;
+ PNG_COLOR_TYPE_RGB = PNG_COLOR_MASK_COLOR;
+ PNG_COLOR_TYPE_RGB_ALPHA = PNG_COLOR_MASK_COLOR or
+ PNG_COLOR_MASK_ALPHA;
+ PNG_COLOR_TYPE_GRAY_ALPHA = PNG_COLOR_MASK_ALPHA;
+
+// This is for compression type. PNG 1.0 only defines the single type.
+
+ PNG_COMPRESSION_TYPE_BASE = 0; // Deflate method 8, 32K window
+ PNG_COMPRESSION_TYPE_DEFAULT = PNG_COMPRESSION_TYPE_BASE;
+
+// This is for filter type. PNG 1.0 only defines the single type.
+
+ PNG_FILTER_TYPE_BASE = 0; // Single row per-byte filtering
+ PNG_FILTER_TYPE_DEFAULT = PNG_FILTER_TYPE_BASE;
+
+// These are for the interlacing type. These values should NOT be changed.
+
+ PNG_INTERLACE_NONE = 0; // Non-interlaced image
+ PNG_INTERLACE_ADAM7 = 1; // Adam7 interlacing
+
+// These are for the oFFs chunk. These values should NOT be changed.
+
+ PNG_OFFSET_PIXEL = 0; // Offset in pixels
+ PNG_OFFSET_MICROMETER = 1; // Offset in micrometers (1/10^6 meter)
+
+// These are for the pCAL chunk. These values should NOT be changed.
+
+ PNG_EQUATION_LINEAR = 0; // Linear transformation
+ PNG_EQUATION_BASE_E = 1; // Exponential base e transform
+ PNG_EQUATION_ARBITRARY = 2; // Arbitrary base exponential transform
+ PNG_EQUATION_HYPERBOLIC = 3; // Hyperbolic sine transformation
+
+// These are for the pHYs chunk. These values should NOT be changed.
+
+ PNG_RESOLUTION_UNKNOWN = 0; // pixels/unknown unit (aspect ratio)
+ PNG_RESOLUTION_METER = 1; // pixels/meter
+
+// These are for the sRGB chunk. These values should NOT be changed.
+ PNG_sRGB_INTENT_SATURATION = 0;
+ PNG_sRGB_INTENT_PERCEPTUAL = 1;
+ PNG_sRGB_INTENT_ABSOLUTE = 2;
+ PNG_sRGB_INTENT_RELATIVE = 3;
+
+// Handle alpha and tRNS by replacing with a background color.
+ PNG_BACKGROUND_GAMMA_UNKNOWN = 0;
+ PNG_BACKGROUND_GAMMA_SCREEN = 1;
+ PNG_BACKGROUND_GAMMA_FILE = 2;
+ PNG_BACKGROUND_GAMMA_UNIQUE = 3;
+
+// Values for png_set_crc_action() to say how to handle CRC errors in
+// ancillary and critical chunks, and whether to use the data contained
+// therein. Note that it is impossible to "discard" data in a critical
+// chunk. For versions prior to 0.90, the action was always error/quit,
+// whereas in version 0.90 and later, the action for CRC errors in ancillary
+// chunks is warn/discard. These values should NOT be changed.
+
+// value action:critical action:ancillary
+
+ PNG_CRC_DEFAULT = 0; // error/quit warn/discard data
+ PNG_CRC_ERROR_QUIT = 1; // error/quit error/quit
+ PNG_CRC_WARN_DISCARD = 2; // (INVALID) warn/discard data
+ PNG_CRC_WARN_USE = 3; // warn/use data warn/use data
+ PNG_CRC_QUIET_USE = 4; // quiet/use data quiet/use data
+ PNG_CRC_NO_CHANGE = 5; // use current value use current value
+
+// Flags for png_set_filter() to say which filters to use. The flags
+// are chosen so that they don't conflict with real filter types
+// below, in case they are supplied instead of the #defined constants.
+// These values should NOT be changed.
+
+ PNG_NO_FILTERS = $00;
+ PNG_FILTER_NONE = $08;
+ PNG_FILTER_SUB = $10;
+ PNG_FILTER_UP = $20;
+ PNG_FILTER_AVG = $40;
+ PNG_FILTER_PAETH = $80;
+ PNG_ALL_FILTERS = PNG_FILTER_NONE or PNG_FILTER_SUB or
+ PNG_FILTER_UP or PNG_FILTER_AVG or
+ PNG_FILTER_PAETH;
+
+// Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
+// These defines should NOT be changed.
+
+ PNG_FILTER_VALUE_NONE = 0;
+ PNG_FILTER_VALUE_SUB = 1;
+ PNG_FILTER_VALUE_UP = 2;
+ PNG_FILTER_VALUE_AVG = 3;
+ PNG_FILTER_VALUE_PAETH = 4;
+
+// Heuristic used for row filter selection. These defines should NOT be
+// changed.
+
+ PNG_FILTER_HEURISTIC_DEFAULT = 0; // Currently "UNWEIGHTED"
+ PNG_FILTER_HEURISTIC_UNWEIGHTED = 1; // Used by libpng < 0.95
+ PNG_FILTER_HEURISTIC_WEIGHTED = 2; // Experimental feature
+ PNG_FILTER_HEURISTIC_LAST = 3; // Not a valid value
+
+procedure png_build_grayscale_palette(bit_depth: int; palette: png_colorp);
+ stdcall;
+function png_check_sig(sig: png_bytep; num: int): int;
+ stdcall;
+procedure png_chunk_error(png_ptr: png_structp;
+ const mess: png_charp);
+ stdcall;
+procedure png_chunk_warning(png_ptr: png_structp;
+ const mess: png_charp);
+ stdcall;
+procedure png_convert_from_time_t(ptime: png_timep; ttime: time_t);
+ stdcall;
+function png_convert_to_rfc1123(png_ptr: png_structp; ptime: png_timep):
+ png_charp;
+ stdcall;
+function png_create_info_struct(png_ptr: png_structp): png_infop;
+ stdcall;
+function png_create_read_struct(user_png_ver: png_charp;
+ error_ptr: user_error_ptr; error_fn: png_error_ptr;
+ warn_fn: png_error_ptr): png_structp;
+ 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;
+ stdcall;
+procedure png_destroy_info_struct(png_ptr: png_structp;
+ info_ptr_ptr: png_infopp);
+ stdcall;
+procedure png_destroy_read_struct(png_ptr_ptr: png_structpp;
+ info_ptr_ptr, end_info_ptr_ptr: png_infopp);
+ stdcall;
+procedure png_destroy_write_struct(png_ptr_ptr: png_structpp;
+ info_ptr_ptr: png_infopp);
+ stdcall;
+function png_get_IHDR(png_ptr: png_structp; info_ptr: png_infop;
+ var width, height: png_uint_32; var bit_depth,
+ color_type, interlace_type, compression_type,
+ filter_type: int): png_uint_32;
+ stdcall;
+function png_get_PLTE(png_ptr: png_structp; info_ptr: png_infop;
+ var palette: png_colorp; var num_palette: int):
+ png_uint_32;
+ stdcall;
+function png_get_bKGD(png_ptr: png_structp; info_ptr: png_infop;
+ var background: png_color_16p): png_uint_32;
+ stdcall;
+function png_get_bit_depth(png_ptr: png_structp; info_ptr: png_infop):
+ png_byte;
+ stdcall;
+function png_get_cHRM(png_ptr: png_structp; info_ptr: png_infop;
+ var white_x, white_y, red_x, red_y, green_x, green_y,
+ blue_x, blue_y: double): png_uint_32;
+ stdcall;
+function png_get_channels(png_ptr: png_structp; info_ptr: png_infop):
+ png_byte;
+ stdcall;
+function png_get_color_type(png_ptr: png_structp; info_ptr: png_infop):
+ png_byte;
+ stdcall;
+function png_get_compression_type(png_ptr: png_structp;
+ info_ptr: png_infop): png_byte;
+ stdcall;
+function png_get_error_ptr(png_ptr: png_structp): png_voidp;
+ stdcall;
+function png_get_filter_type(png_ptr: png_structp; info_ptr: png_infop):
+ png_byte;
+ stdcall;
+function png_get_gAMA(png_ptr: png_structp; info_ptr: png_infop;
+ var file_gamma: double): png_uint_32;
+ stdcall;
+function png_get_hIST(png_ptr: png_structp; info_ptr: png_infop;
+ var hist: png_uint_16p): png_uint_32;
+ stdcall;
+function png_get_image_height(png_ptr: png_structp; info_ptr: png_infop):
+ png_uint_32;
+ stdcall;
+function png_get_image_width(png_ptr: png_structp; info_ptr: png_infop):
+ png_uint_32;
+ stdcall;
+function png_get_interlace_type(png_ptr: png_structp;
+ info_ptr: png_infop): png_byte;
+ stdcall;
+function png_get_io_ptr(png_ptr: png_structp): png_voidp;
+ stdcall;
+function png_get_oFFs(png_ptr: png_structp; info_ptr: png_infop;
+ var offset_x, offset_y: png_uint_32;
+ var unit_type: int): png_uint_32;
+ stdcall;
+function png_get_pCAL(png_ptr: png_structp; info_ptr: png_infop;
+ var purpose: png_charp; var X0, X1: png_int_32;
+ var typ, nparams: int; var units: png_charp;
+ var params: png_charpp): png_uint_32;
+ stdcall;
+function png_get_pHYs(png_ptr: png_structp; info_ptr: png_infop;
+ var res_x, res_y: png_uint_32; var unit_type: int):
+ png_uint_32;
+ stdcall;
+function png_get_pixel_aspect_ratio(png_ptr: png_structp;
+ info_ptr: png_infop): float;
+ stdcall;
+function png_get_pixels_per_meter(png_ptr: png_structp;
+ info_ptr: png_infop): png_uint_32;
+ stdcall;
+function png_get_progressive_ptr(png_ptr: png_structp): png_voidp;
+ stdcall;
+function png_get_rowbytes(png_ptr: png_structp; info_ptr: png_infop):
+ png_uint_32;
+ stdcall;
+function png_get_sBIT(png_ptr: png_structp; info_ptr: png_infop;
+ var sig_bits: png_color_8p): png_uint_32;
+ stdcall;
+function png_get_sRGB(png_ptr: png_structp; info_ptr: png_infop;
+ var file_srgb_intent: int): png_uint_32;
+ stdcall;
+function png_get_signature(png_ptr: png_structp; info_ptr: png_infop):
+ png_bytep;
+ stdcall;
+function png_get_tIME(png_ptr: png_structp; info_ptr: png_infop;
+ var mod_time: png_timep): png_uint_32;
+ stdcall;
+function png_get_tRNS(png_ptr: png_structp; info_ptr: png_infop;
+ var trans: png_bytep; var num_trans: int;
+ var trans_values: png_color_16p): png_uint_32;
+ stdcall;
+function png_get_text(png_ptr: png_structp; info_ptr: png_infop;
+ var text_ptr: png_textp; var num_text: int):
+ png_uint_32;
+ stdcall;
+function png_get_valid(png_ptr: png_structp; info_ptr: png_infop;
+ flag: png_uint_32): png_uint_32;
+ stdcall;
+function png_get_x_offset_microns(png_ptr: png_structp;
+ info_ptr: png_infop): png_uint_32;
+ stdcall;
+function png_get_x_offset_pixels(png_ptr: png_structp;
+ info_ptr: png_infop): png_uint_32;
+ stdcall;
+function png_get_x_pixels_per_meter(png_ptr: png_structp;
+ info_ptr: png_infop): png_uint_32;
+ stdcall;
+function png_get_y_offset_microns(png_ptr: png_structp;
+ info_ptr: png_infop): png_uint_32;
+ stdcall;
+function png_get_y_offset_pixels(png_ptr: png_structp;
+ info_ptr: png_infop): png_uint_32;
+ stdcall;
+function png_get_y_pixels_per_meter(png_ptr: png_structp;
+ info_ptr: png_infop): png_uint_32;
+ stdcall;
+procedure png_process_data(png_ptr: png_structp; info_ptr: png_infop;
+ buffer: png_bytep; buffer_size: png_size_t);
+ stdcall;
+procedure png_progressive_combine_row(png_ptr: png_structp;
+ old_row, new_row: png_bytep);
+ stdcall;
+procedure png_read_end(png_ptr: png_structp; info_ptr: png_infop);
+ stdcall;
+procedure png_read_image(png_ptr: png_structp; image: png_bytepp);
+ stdcall;
+procedure png_read_info(png_ptr: png_structp; info_ptr: png_infop);
+ stdcall;
+procedure png_read_row(png_ptr: png_structp; row, dsp_row: png_bytep);
+ stdcall;
+procedure png_read_rows(png_ptr: png_structp; row, display_row:
+ png_bytepp; num_rows: png_uint_32);
+ stdcall;
+procedure png_read_update_info(png_ptr: png_structp; info_ptr: png_infop);
+ stdcall;
+procedure png_set_IHDR(png_ptr: png_structp; info_ptr: png_infop;
+ width, height: png_uint_32; bit_depth, color_type,
+ interlace_type, compression_type, filter_type: int);
+ stdcall;
+procedure png_set_PLTE(png_ptr: png_structp; info_ptr: png_infop;
+ palette: png_colorp; num_palette: int);
+ stdcall;
+procedure png_set_bKGD(png_ptr: png_structp; info_ptr: png_infop;
+ background: png_color_16p);
+ stdcall;
+procedure png_set_background(png_ptr: png_structp;
+ background_color: png_color_16p;
+ background_gamma_code, need_expand: int;
+ background_gamma: double);
+ stdcall;
+procedure png_set_bgr(png_ptr: png_structp);
+ stdcall;
+procedure png_set_cHRM(png_ptr: png_structp; info_ptr: png_infop;
+ white_x, white_y, red_x, red_y, green_x, green_y,
+ blue_x, blue_y: double);
+ stdcall;
+procedure png_set_compression_level(png_ptr: png_structp; level: int);
+ stdcall;
+procedure png_set_compression_mem_level(png_ptr: png_structp;
+ mem_level: int);
+ stdcall;
+procedure png_set_compression_method(png_ptr: png_structp; method: int);
+ stdcall;
+procedure png_set_compression_strategy(png_ptr: png_structp;
+ strategy: int);
+ stdcall;
+procedure png_set_compression_window_bits(png_ptr: png_structp;
+ window_bits: int);
+ stdcall;
+procedure png_set_crc_action(png_ptr: png_structp;
+ crit_action, ancil_action: int);
+ stdcall;
+procedure png_set_dither(png_ptr: png_structp; plaette: png_colorp;
+ num_palette, maximum_colors: int;
+ histogram: png_uint_16p; full_dither: int);
+ stdcall;
+procedure png_set_error_fn(png_ptr: png_structp; error_ptr: png_voidp;
+ error_fn, warning_fn: png_error_ptr);
+ stdcall;
+procedure png_set_expand(png_ptr: png_structp);
+ stdcall;
+procedure png_set_filler(png_ptr: png_structp; filler: png_uint_32;
+ filler_loc: int);
+ stdcall;
+procedure png_set_filter(png_ptr: png_structp; method, filters: int);
+ stdcall;
+procedure png_set_filter_heuristics(png_ptr: png_structp;
+ heuristic_method, num_weights: int;
+ filter_weights, filter_costs: png_doublep);
+ stdcall;
+procedure png_set_flush(png_ptr: png_structp; nrows: int);
+ stdcall;
+procedure png_set_gAMA(png_ptr: png_structp; info_ptr: png_infop;
+ file_gamma: double);
+ stdcall;
+procedure png_set_gamma(png_ptr: png_structp; screen_gamma,
+ default_file_gamma: double);
+ stdcall;
+procedure png_set_gray_to_rgb(png_ptr: png_structp);
+ stdcall;
+procedure png_set_hIST(png_ptr: png_structp; info_ptr: png_infop;
+ hist: png_uint_16p);
+ stdcall;
+function png_set_interlace_handling(png_ptr: png_structp): int;
+ stdcall;
+procedure png_set_invert_alpha(png_ptr: png_structp);
+ stdcall;
+procedure png_set_invert_mono(png_ptr: png_structp);
+ stdcall;
+procedure png_set_oFFs(png_ptr: png_structp; info_ptr: png_infop;
+ offset_x, offset_y: png_uint_32; unit_type: int);
+ stdcall;
+procedure png_set_pCAL(png_ptr: png_structp; info_ptr: png_infop;
+ purpose: png_charp; X0, X1: png_int_32;
+ typ, nparams: int; units: png_charp;
+ params: png_charpp);
+ stdcall;
+procedure png_set_pHYs(png_ptr: png_structp; info_ptr: png_infop;
+ res_x, res_y: png_uint_32; unit_type: int);
+ stdcall;
+procedure png_set_packing(png_ptr: png_structp);
+ stdcall;
+procedure png_set_packswap(png_ptr: png_structp);
+ stdcall;
+procedure png_set_progressive_read_fn(png_ptr: png_structp;
+ progressive_ptr: png_voidp;
+ info_fn: png_progressive_info_ptr;
+ row_fn: png_progressive_row_ptr;
+ end_fn: png_progressive_end_ptr);
+ stdcall;
+procedure png_set_read_fn(png_ptr: png_structp;
+ io_ptr: png_voidp; read_data_fn: png_rw_ptr);
+ stdcall;
+procedure png_set_read_status_fn(png_ptr: png_structp;
+ read_row_fn: png_read_status_ptr);
+ stdcall;
+procedure png_set_read_user_transform_fn(png_ptr: png_structp;
+ read_user_transform_fn: png_user_transform_ptr);
+ stdcall;
+procedure png_set_sBIT(png_ptr: png_structp; info_ptr: png_infop;
+ sig_bits: png_color_8p);
+ stdcall;
+procedure png_set_sRGB(png_ptr: png_structp; info_ptr: png_infop;
+ intent: int);
+ stdcall;
+procedure png_set_sRGB_gAMA_and_cHRM(png_ptr: png_structp;
+ info_ptr: png_infop; intent: int);
+ stdcall;
+procedure png_set_shift(png_ptr: png_structp; true_bits: png_color_8p);
+ stdcall;
+procedure png_set_sig_bytes(png_ptr: png_structp; num_bytes: int);
+ stdcall;
+procedure png_set_strip_16(png_ptr: png_structp);
+ stdcall;
+procedure png_set_strip_alpha(png_ptr: png_structp);
+ stdcall;
+procedure png_set_swap(png_ptr: png_structp);
+ stdcall;
+procedure png_set_swap_alpha(png_ptr: png_structp);
+ stdcall;
+procedure png_set_tIME(png_ptr: png_structp; info_ptr: png_infop;
+ mod_time: png_timep);
+ stdcall;
+procedure png_set_tRNS(png_ptr: png_structp; info_ptr: png_infop;
+ trans: png_bytep; num_trans: int;
+ trans_values: png_color_16p);
+ stdcall;
+procedure png_set_text(png_ptr: png_structp; info_ptr: png_infop;
+ text_ptr: png_textp; num_text: int);
+ stdcall;
+procedure png_set_write_fn(png_ptr: png_structp;
+ io_ptr: png_voidp; write_data_fn: png_rw_ptr;
+ output_flush_fn: png_flush_ptr);
+ stdcall;
+procedure png_set_write_status_fn(png_ptr: png_structp;
+ write_row_fn: png_write_status_ptr);
+ stdcall;
+procedure png_set_write_user_transform_fn(png_ptr: png_structp;
+ write_user_transform_fn: png_user_transform_ptr);
+ stdcall;
+function png_sig_cmp(sig: png_bytep; start, num_to_check: png_size_t):
+ int;
+ stdcall;
+procedure png_start_read_image(png_ptr: png_structp);
+ stdcall;
+procedure png_write_chunk(png_ptr: png_structp;
+ chunk_name, data: png_bytep; length: png_size_t);
+ stdcall;
+procedure png_write_chunk_data(png_ptr: png_structp;
+ data: png_bytep; length: png_size_t);
+ stdcall;
+procedure png_write_chunk_end(png_ptr: png_structp);
+ stdcall;
+procedure png_write_chunk_start(png_ptr: png_structp;
+ chunk_name: png_bytep; length: png_uint_32);
+ stdcall;
+procedure png_write_end(png_ptr: png_structp; info_ptr: png_infop);
+ stdcall;
+procedure png_write_flush(png_ptr: png_structp);
+ stdcall;
+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_row(png_ptr: png_structp; row: png_bytep);
+ stdcall;
+procedure png_write_rows(png_ptr: png_structp; row: png_bytepp;
+ num_rows: png_uint_32);
+ stdcall;
+
+implementation
+
+const
+ pngDLL = 'png32bd.dll';
+
+procedure png_build_grayscale_palette; external pngDLL;
+function png_check_sig; external pngDLL;
+procedure png_chunk_error; external pngDLL;
+procedure png_chunk_warning; external pngDLL;
+procedure png_convert_from_time_t; external pngDLL;
+function png_convert_to_rfc1123; external pngDLL;
+function png_create_info_struct; external pngDLL;
+function png_create_read_struct; external pngDLL;
+function png_create_write_struct; external pngDLL;
+procedure png_destroy_info_struct; external pngDLL;
+procedure png_destroy_read_struct; external pngDLL;
+procedure png_destroy_write_struct; external pngDLL;
+function png_get_IHDR; external pngDLL;
+function png_get_PLTE; external pngDLL;
+function png_get_bKGD; external pngDLL;
+function png_get_bit_depth; external pngDLL;
+function png_get_cHRM; external pngDLL;
+function png_get_channels; external pngDLL;
+function png_get_color_type; external pngDLL;
+function png_get_compression_type; external pngDLL;
+function png_get_error_ptr; external pngDLL;
+function png_get_filter_type; external pngDLL;
+function png_get_gAMA; external pngDLL;
+function png_get_hIST; external pngDLL;
+function png_get_image_height; external pngDLL;
+function png_get_image_width; external pngDLL;
+function png_get_interlace_type; external pngDLL;
+function png_get_io_ptr; external pngDLL;
+function png_get_oFFs; external pngDLL;
+function png_get_pCAL; external pngDLL;
+function png_get_pHYs; external pngDLL;
+function png_get_pixel_aspect_ratio; external pngDLL;
+function png_get_pixels_per_meter; external pngDLL;
+function png_get_progressive_ptr; external pngDLL;
+function png_get_rowbytes; external pngDLL;
+function png_get_sBIT; external pngDLL;
+function png_get_sRGB; external pngDLL;
+function png_get_signature; external pngDLL;
+function png_get_tIME; external pngDLL;
+function png_get_tRNS; external pngDLL;
+function png_get_text; external pngDLL;
+function png_get_valid; external pngDLL;
+function png_get_x_offset_microns; external pngDLL;
+function png_get_x_offset_pixels; external pngDLL;
+function png_get_x_pixels_per_meter; external pngDLL;
+function png_get_y_offset_microns; external pngDLL;
+function png_get_y_offset_pixels; external pngDLL;
+function png_get_y_pixels_per_meter; external pngDLL;
+procedure png_process_data; external pngDLL;
+procedure png_progressive_combine_row; external pngDLL;
+procedure png_read_end; external pngDLL;
+procedure png_read_image; external pngDLL;
+procedure png_read_info; external pngDLL;
+procedure png_read_row; external pngDLL;
+procedure png_read_rows; external pngDLL;
+procedure png_read_update_info; external pngDLL;
+procedure png_set_IHDR; external pngDLL;
+procedure png_set_PLTE; external pngDLL;
+procedure png_set_bKGD; external pngDLL;
+procedure png_set_background; external pngDLL;
+procedure png_set_bgr; external pngDLL;
+procedure png_set_cHRM; external pngDLL;
+procedure png_set_compression_level; external pngDLL;
+procedure png_set_compression_mem_level; external pngDLL;
+procedure png_set_compression_method; external pngDLL;
+procedure png_set_compression_strategy; external pngDLL;
+procedure png_set_compression_window_bits; external pngDLL;
+procedure png_set_crc_action; external pngDLL;
+procedure png_set_dither; external pngDLL;
+procedure png_set_error_fn; external pngDLL;
+procedure png_set_expand; external pngDLL;
+procedure png_set_filler; external pngDLL;
+procedure png_set_filter; external pngDLL;
+procedure png_set_filter_heuristics; external pngDLL;
+procedure png_set_flush; external pngDLL;
+procedure png_set_gAMA; external pngDLL;
+procedure png_set_gamma; external pngDLL;
+procedure png_set_gray_to_rgb; external pngDLL;
+procedure png_set_hIST; external pngDLL;
+function png_set_interlace_handling; external pngDLL;
+procedure png_set_invert_alpha; external pngDLL;
+procedure png_set_invert_mono; external pngDLL;
+procedure png_set_oFFs; external pngDLL;
+procedure png_set_pCAL; external pngDLL;
+procedure png_set_pHYs; external pngDLL;
+procedure png_set_packing; external pngDLL;
+procedure png_set_packswap; external pngDLL;
+procedure png_set_progressive_read_fn; external pngDLL;
+procedure png_set_read_fn; external pngDLL;
+procedure png_set_read_status_fn; external pngDLL;
+procedure png_set_read_user_transform_fn; external pngDLL;
+procedure png_set_sBIT; external pngDLL;
+procedure png_set_sRGB; external pngDLL;
+procedure png_set_sRGB_gAMA_and_cHRM; external pngDLL;
+procedure png_set_shift; external pngDLL;
+procedure png_set_sig_bytes; external pngDLL;
+procedure png_set_strip_16; external pngDLL;
+procedure png_set_strip_alpha; external pngDLL;
+procedure png_set_swap; external pngDLL;
+procedure png_set_swap_alpha; external pngDLL;
+procedure png_set_tIME; external pngDLL;
+procedure png_set_tRNS; external pngDLL;
+procedure png_set_text; external pngDLL;
+procedure png_set_write_fn; external pngDLL;
+procedure png_set_write_status_fn; external pngDLL;
+procedure png_set_write_user_transform_fn; external pngDLL;
+function png_sig_cmp; external pngDLL;
+procedure png_start_read_image; external pngDLL;
+procedure png_write_chunk; external pngDLL;
+procedure png_write_chunk_data; external pngDLL;
+procedure png_write_chunk_end; external pngDLL;
+procedure png_write_chunk_start; external pngDLL;
+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_row; external pngDLL;
+procedure png_write_rows; external pngDLL;
+
+end.
diff --git a/scripts/pngdll.mak b/scripts/pngdll.mak
new file mode 100644
index 000000000..921530063
--- /dev/null
+++ b/scripts/pngdll.mak
@@ -0,0 +1,53 @@
+# Makefile for png32bd.dll
+# ------------- Borland C++ 4.5 -------------
+
+# This makefile expects to find zlib.h and zlib32bd.lib in the
+# $(ZLIBDIR) directory.
+
+# The object files here are compiled with the "stdcall" calling convention.
+# This DLL requires zlib32bd.lib to be compiled in the same way.
+
+# Note that png32bd.dll exports the zlib functions adler32, crc32 and
+# the deflate... and inflate... functions. It does not export the
+# compress and uncompress functions, nor any of the gz... functions,
+# since libpng does not call them.
+
+ZLIBDIR=..\zlib112
+ZLIB=zlib32bd.lib
+PNGDLL=png32bd.dll
+
+CFLAGS= -ps -O2 -C -K -N- -k- -d -3 -r- -w-par -w-aus -WDE -I$(ZLIBDIR)
+CC=f:\bc45\bin\bcc32
+LINKFLAGS= -Tpd -aa -c
+LINK=f:\bc45\bin\tlink32
+LIBDIR=f:\bc45\lib
+IMPLIB=f:\bc45\bin\implib
+
+.autodepend
+.c.obj:
+ $(CC) -c $(CFLAGS) $<
+
+OBJ1=png.obj pngerror.obj pngget.obj pngmem.obj pngpread.obj
+OBJ2=pngread.obj pngrio.obj pngrtran.obj pngrutil.obj pngset.obj
+OBJ3=pngtrans.obj pngwio.obj pngwrite.obj pngwtran.obj pngwutil.obj
+
+all: $(PNGDLL)
+
+$(PNGDLL): $(OBJ1) $(OBJ2) $(OBJ3) $(ZLIBDIR)\$(ZLIB)
+ $(LINK) @&&|
+$(LINKFLAGS) $(LIBDIR)\c0d32 +
+$(OBJ1) +
+$(OBJ2) +
+$(OBJ3)
+$@
+-x
+$(ZLIBDIR)\$(ZLIB) $(LIBDIR)\import32 $(LIBDIR)\cw32
+|,&&|
+LIBRARY $(@B)
+EXETYPE WINDOWS
+CODE PRELOAD MOVEABLE DISCARDABLE
+DATA PRELOAD MOVEABLE MULTIPLE
+|
+ $(IMPLIB) -c $(@R).lib $@
+
+# End of makefile for png32bd.dll
diff --git a/scripts/zlibdef.pas b/scripts/zlibdef.pas
new file mode 100644
index 000000000..49664d676
--- /dev/null
+++ b/scripts/zlibdef.pas
@@ -0,0 +1,169 @@
+unit zlibdef;
+
+interface
+
+uses
+ Windows;
+
+const
+ ZLIB_VERSION = '1.1.2';
+
+type
+ voidpf = Pointer;
+ int = Integer;
+ uInt = Cardinal;
+ pBytef = PChar;
+ uLong = Cardinal;
+
+ alloc_func = function(opaque: voidpf; items, size: uInt): voidpf;
+ stdcall;
+ free_func = procedure(opaque, address: voidpf);
+ stdcall;
+
+ internal_state = Pointer;
+
+ z_streamp = ^z_stream;
+ z_stream = packed record
+ next_in: pBytef; // next input byte
+ avail_in: uInt; // number of bytes available at next_in
+ total_in: uLong; // total nb of input bytes read so far
+
+ next_out: pBytef; // next output byte should be put there
+ avail_out: uInt; // remaining free space at next_out
+ total_out: uLong; // total nb of bytes output so far
+
+ msg: PChar; // last error message, NULL if no error
+ state: internal_state; // not visible by applications
+
+ zalloc: alloc_func; // used to allocate the internal state
+ zfree: free_func; // used to free the internal state
+ opaque: voidpf; // private data object passed to zalloc and zfree
+
+ data_type: int; // best guess about the data type: ascii or binary
+ adler: uLong; // adler32 value of the uncompressed data
+ reserved: uLong; // reserved for future use
+ end;
+
+const
+ Z_NO_FLUSH = 0;
+ Z_SYNC_FLUSH = 2;
+ Z_FULL_FLUSH = 3;
+ Z_FINISH = 4;
+
+ Z_OK = 0;
+ Z_STREAM_END = 1;
+
+ Z_NO_COMPRESSION = 0;
+ Z_BEST_SPEED = 1;
+ Z_BEST_COMPRESSION = 9;
+ Z_DEFAULT_COMPRESSION = -1;
+
+ Z_FILTERED = 1;
+ Z_HUFFMAN_ONLY = 2;
+ Z_DEFAULT_STRATEGY = 0;
+
+ Z_BINARY = 0;
+ Z_ASCII = 1;
+ Z_UNKNOWN = 2;
+
+ Z_DEFLATED = 8;
+
+ MAX_MEM_LEVEL = 9;
+
+function adler32(adler: uLong; const buf: pBytef; len: uInt): uLong;
+ stdcall;
+function crc32(crc: uLong; const buf: pBytef; len: uInt): uLong;
+ stdcall;
+function deflate(strm: z_streamp; flush: int): int;
+ stdcall;
+function deflateCopy(dest, source: z_streamp): int;
+ stdcall;
+function deflateEnd(strm: z_streamp): int;
+ stdcall;
+function deflateInit2_(strm: z_streamp; level, method,
+ windowBits, memLevel, strategy: int;
+ const version: PChar; stream_size: int): int;
+ stdcall;
+function deflateInit_(strm: z_streamp; level: int;
+ const version: PChar; stream_size: int): int;
+ stdcall;
+function deflateParams(strm: z_streamp; level, strategy: int): int;
+ stdcall;
+function deflateReset(strm: z_streamp): int;
+ stdcall;
+function deflateSetDictionary(strm: z_streamp;
+ const dictionary: pBytef;
+ dictLength: uInt): int;
+ stdcall;
+function inflate(strm: z_streamp; flush: int): int;
+ stdcall;
+function inflateEnd(strm: z_streamp): int;
+ stdcall;
+function inflateInit2_(strm: z_streamp; windowBits: int;
+ const version: PChar; stream_size: int): int;
+ stdcall;
+function inflateInit_(strm: z_streamp; const version: PChar;
+ stream_size: int): int;
+ stdcall;
+function inflateReset(strm: z_streamp): int;
+ stdcall;
+function inflateSetDictionary(strm: z_streamp;
+ const dictionary: pBytef;
+ dictLength: uInt): int;
+ stdcall;
+function inflateSync(strm: z_streamp): int;
+ stdcall;
+
+function deflateInit(strm: z_streamp; level: int): int;
+function deflateInit2(strm: z_streamp; level, method, windowBits,
+ memLevel, strategy: int): int;
+function inflateInit(strm: z_streamp): int;
+function inflateInit2(strm: z_streamp; windowBits: int): int;
+
+implementation
+
+function deflateInit(strm: z_streamp; level: int): int;
+begin
+ Result := deflateInit_(strm, level, ZLIB_VERSION, sizeof(z_stream));
+end;
+
+function deflateInit2(strm: z_streamp; level, method, windowBits,
+ memLevel, strategy: int): int;
+begin
+ Result := deflateInit2_(strm, level, method, windowBits, memLevel,
+ strategy, ZLIB_VERSION, sizeof(z_stream));
+end;
+
+function inflateInit(strm: z_streamp): int;
+begin
+ Result := inflateInit_(strm, ZLIB_VERSION, sizeof(z_stream));
+end;
+
+function inflateInit2(strm: z_streamp; windowBits: int): int;
+begin
+ Result := inflateInit2_(strm, windowBits, ZLIB_VERSION,
+ sizeof(z_stream));
+end;
+
+const
+ zlibDLL = 'png32bd.dll';
+
+function adler32; external zlibDLL;
+function crc32; external zlibDLL;
+function deflate; external zlibDLL;
+function deflateCopy; external zlibDLL;
+function deflateEnd; external zlibDLL;
+function deflateInit2_; external zlibDLL;
+function deflateInit_; external zlibDLL;
+function deflateParams; external zlibDLL;
+function deflateReset; external zlibDLL;
+function deflateSetDictionary; external zlibDLL;
+function inflate; external zlibDLL;
+function inflateEnd; external zlibDLL;
+function inflateInit2_; external zlibDLL;
+function inflateInit_; external zlibDLL;
+function inflateReset; external zlibDLL;
+function inflateSetDictionary; external zlibDLL;
+function inflateSync; external zlibDLL;
+
+end.
diff --git a/scripts/zlibdll.mak b/scripts/zlibdll.mak
new file mode 100644
index 000000000..ba557e2b9
--- /dev/null
+++ b/scripts/zlibdll.mak
@@ -0,0 +1,36 @@
+# Makefile for zlib32bd.lib
+# ------------- Borland C++ 4.5 -------------
+
+# The (32-bit) zlib32bd.lib made with this makefile is intended for use
+# in making the (32-bit) DLL, png32bd.dll. It uses the "stdcall" calling
+# convention.
+
+CFLAGS= -ps -O2 -C -K -N- -k- -d -3 -r- -w-par -w-aus -WDE
+CC=f:\bc45\bin\bcc32
+LIBFLAGS= /C
+LIB=f:\bc45\bin\tlib
+ZLIB=zlib32bd.lib
+
+.autodepend
+.c.obj:
+ $(CC) -c $(CFLAGS) $<
+
+OBJ1=adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infblock.obj
+OBJ2=infcodes.obj inflate.obj inftrees.obj infutil.obj inffast.obj
+OBJ3=trees.obj uncompr.obj zutil.obj
+pOBJ1=+adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infblock.obj
+pOBJ2=+infcodes.obj+inflate.obj+inftrees.obj+infutil.obj+inffast.obj
+pOBJ3=+trees.obj+uncompr.obj+zutil.obj
+
+all: $(ZLIB)
+
+$(ZLIB): $(OBJ1) $(OBJ2) $(OBJ3)
+ @if exist $@ del $@
+ $(LIB) @&&|
+$@ $(LIBFLAGS) &
+$(pOBJ1) &
+$(pOBJ2) &
+$(pOBJ3)
+|
+
+# End of makefile for zlib32bd.lib