Imported from libpng-1.0.8beta1.tar

This commit is contained in:
Glenn Randers-Pehrson 2000-07-08 13:19:41 -05:00
parent 3d5a520610
commit 316f97a063
49 changed files with 1037 additions and 394 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.0.7 - July 1, 2000
Libpng 1.0.8beta1 - July 8, 2000
This is a public release of libpng, intended for use in production codes.
@ -96,6 +96,14 @@ Changes since the last public release (1.0.6):
Removed leading underscores from "_PNG_H" and "_PNG_SAVE_BSD_SOURCE" macros.
Fixed bugs in pngwrite.c and pngwutil.c that prevented writing iCCP chunks.
Revised the definition of "trans_values" in libpng.3/libpng.txt
Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks.
Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and
pngwutil.c.
Changed PNG_EXPORT_VAR to use PNG_IMPEXP, in pngconf.h.
Removed unused "#include <assert.h>" from png.c
Added WindowsCE support.
Revised pnggccrd.c to work with gcc-2.95.2 and in the Cygwin environment.
Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

View File

@ -797,6 +797,14 @@ version 1.0.7rc2 [June 28, 2000]
Fixed "DJBPP" typo in pnggccrd.c introduced in beta18.
version 1.0.7 [July 1, 2000]
Revised the definition of "trans_values" in libpng.3/libpng.txt
version 1.0.8beta1 [July 8, 2000]
Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks.
Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and
pngwutil.c.
Changed PNG_EXPORT_VAR to use PNG_IMPEXP, in pngconf.h.
Removed unused "#include <assert.h>" from png.c
Added WindowsCE support.
Revised pnggccrd.c to work with gcc-2.95.2 and in the Cygwin environment.
Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

12
INSTALL
View File

@ -1,5 +1,5 @@
Installing libpng version 1.0.7 - July 1, 2000
Installing libpng version 1.0.8beta1 - July 8, 2000
Before installing libpng, you must first install zlib. zlib
can usually be found wherever you got libpng. zlib can be
@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
version of zlib that's installed.
You can rename the directories that you downloaded (they
might be called "libpng-1.0.7" or "lpng107" and "zlib-1.1.3"
might be called "libpng-1.0.8beta1" or "lpng107" and "zlib-1.1.3"
or "zlib113") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
@ -54,8 +54,8 @@ The files that are presently available in the scripts directory
include
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.7)
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.7,
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.8beta1)
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.8beta1,
uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
@ -67,9 +67,9 @@ include
makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.8beta1)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.7)
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.8beta1)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile

View File

@ -1,7 +1,48 @@
Known bugs and suggested enhancements in libpng-1.0.7
1. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
1. July 2, 2000 -- BUG -- pnggccrd.c
Some programs compiled with PNG_USE_PNGGCCRD crash in pnggccrd.c.
Also, pnggccrd.c will not compile under gcc-2.95-2.
STATUS: Under investigation. Experts on MMX assembler code are
invited to help with the debugging. Note that pngvcrd.c works fine.
2. July 3, 2000 -- BUG -- MEMORY LEAK
There is a memory leak in pngpread.c; it doesn't free "key".
STATUS: Fixed in libpng-1.0.8beta1, by adding.
png_free(png_ptr, text_ptr);
after lines 1221 and 1038 in pngpread.c
3. July 3, 2000 -- BUG -- PNG_EXPORT_VAR
The definition of PNG_EXPORT_VAR, in pngconf.h, should be
# define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
STATUS: Fixed in libpng-1.0.8beta1.
4. July 3, 2000 -- BUG -- PNG_NO_STDIO
Several places in pngrutil.c and pngwutil.c, there are printf statements
inside PNG_NO_STDIO blocks (should be PNG_NO_CONSOLE_IO)
STATUS: Fixed in libpng-1.0.8beta1.
5. July 3, 2000 -- ENHANCEMENT -- WindowsCE support
Libpng-1.0.7 does not support WindowsCE.
STATUS: Libpng-1.0.8 and libpng-2.0.0 will support WindowsCE. A
new typedef, png_file_p, will be added which is normally FILE * but
will be HANDLE if libpng is being built for WindowsCE. Other patches
required for WindowsCE support have been provided and will be applied.
6. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
Loops need to be optimized everywhere
@ -14,9 +55,9 @@ Known bugs and suggested enhancements in libpng-1.0.7
STATUS: Under investigation, postponed until after
libpng-1.1.0. About 160 loops will be turned around
in libpng-1.1.Nn, for testing.
in libpng-2.0.x betaxx, for testing.
2. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
7. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
libpng-1.0.5 and earlier transform colors to gamma=1.0 space for
merging with background, and then back to the image's gamma. The
@ -28,14 +69,12 @@ Known bugs and suggested enhancements in libpng-1.0.7
STATUS: under development.
3. September 1999 -- ENHANCEMENT --
8. September 1999 -- ENHANCEMENT --
It should be possible to use libpng without floating-point aritmetic.
STATUS: Under investigation, implementation postponed until after
libpng-1.0.7. The application interface will change because replacements
for the png_set_gAMA(), png_set_cHRM(), and corresponding png_get_()
functions will be needed.
libpng-1.0.7.
Much of this was completed in libpng-1.0.6, but gamma compensation
is not yet done in fixed-point arithmetic.

View File

@ -4,7 +4,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following
this sentence.
libpng version 1.0.7, July 1, 2000 is Copyright (c) 2000 Glenn Randers-Pehrson
libpng version 1.0.8beta1, July 8, 2000 is Copyright (c) 2000 Glenn Randers-Pehrson
Distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors
@ -94,4 +94,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
randeg@alum.rpi.edu
July 1, 2000
July 8, 2000

10
README
View File

@ -1,4 +1,4 @@
README for libpng 1.0.7 - July 1, 2000 (shared library 2.1)
README for libpng 1.0.8beta1 - July 8, 2000 (shared library 2.1)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
@ -176,9 +176,9 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng.so.2.1.0.7)
(gcc, creates libpng.so.2.1.0.8beta1)
makefile.gcmmx => Linux/ELF makefile (gcc, creates
libpng.so.2.1.0.7, uses assembler code
libpng.so.2.1.0.8beta1, uses assembler code
tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
@ -190,10 +190,10 @@ Files in this distribution:
makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.8beta1)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng.so.2.1.0.7)
(gcc, creates libpng.so.2.1.0.8beta1)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile

View File

@ -1,13 +1,13 @@
Y2K compliance in libpng:
=========================
July 1, 2000
July 8, 2000
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.7 are Y2K compliant. It is my belief that earlier
upward through 1.0.8beta1 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

2
configure vendored
View File

@ -1,5 +1,5 @@
echo "
There is no \"configure\" script for Libpng-1.0.7. Instead, please
There is no \"configure\" script for Libpng-1.0.8beta1. Instead, please
copy the appropriate makefile for your system from the \"scripts\"
directory. Read the INSTALL file for more details.
"

View File

@ -1,6 +1,6 @@
.TH LIBPNG 3 "July 1, 2000"
.TH LIBPNG 3 "July 8, 2000"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.8beta1
.SH SYNOPSIS
\fI\fB
@ -747,7 +747,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.7 - July 1, 2000
libpng version 1.0.8beta1 - July 8, 2000
Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -3381,13 +3381,13 @@ application:
.SH VII. Y2K Compliance in libpng
July 1, 2000
July 8, 2000
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.7 are Y2K compliant. It is my belief that earlier
upward through 1.0.8beta1 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
@ -3528,7 +3528,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.7 - July 1, 2000:
Libpng version 1.0.8beta1 - July 8, 2000:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
@ -3541,7 +3541,7 @@ Supported by the PNG development group
If you modify libpng you may insert additional notices immediately following
this sentence.
libpng version 1.0.7, July 1, 2000 is
libpng version 1.0.8beta1, July 8, 2000 is
Copyright (c) 2000 Glenn Randers-Pehrson
Distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors
@ -3632,7 +3632,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
randeg@alum.rpi.edu
July 1, 2000
July 8, 2000
.\" end of man page

View File

@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.7 - July 1, 2000
libpng version 1.0.8beta1 - July 8, 2000
Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -2634,13 +2634,13 @@ application:
VII. Y2K Compliance in libpng
July 1, 2000
July 8, 2000
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.7 are Y2K compliant. It is my belief that earlier
upward through 1.0.8beta1 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

View File

@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "July 1, 2000"
.TH LIBPNGPF 3 "July 8, 2000"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.8beta1
(private functions)
.SH SYNOPSIS
\fB#include <png.h>\fP

View File

@ -1,5 +1,5 @@
Microsoft Developer Studio Build File, Format Version 6.00 for
libpng 1.0.7 (July 1, 2000) and zlib
libpng 1.0.8beta1 (July 8, 2000) and zlib
Copyright (C) 2000 Simon-Pierre Cadieux
For conditions of distribution and use, see copyright notice in png.h

View File

@ -6,7 +6,7 @@ LIBRARY
DESCRIPTION "PNG image compression library for Windows"
EXPORTS
;Version 1.0.7
;Version 1.0.8beta1
png_build_grayscale_palette @1
png_check_sig @2
png_chunk_error @3

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "July 1, 2000"
.TH PNG 5 "July 8, 2000"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

29
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* libpng version 1.0.7 - July 1, 2000
* libpng version 1.0.8beta1 - July 8, 2000
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -10,18 +10,17 @@
#define PNG_INTERNAL
#define PNG_NO_EXTERN
#include <assert.h>
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_7 Your_png_h_is_not_version_1_0_7;
typedef version_1_0_8beta1 Your_png_h_is_not_version_1_0_8beta1;
/* Version information for C files. This had better match the version
* string defined in png.h. */
#ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */
char png_libpng_ver[12] = "1.0.7";
char png_libpng_ver[12] = "1.0.8beta1";
/* png_sig was changed to a function in version 1.0.5c */
/* Place to hold the signature string for a PNG file. */
@ -548,7 +547,7 @@ png_get_io_ptr(png_structp png_ptr)
* necessarily available.
*/
void PNGAPI
png_init_io(png_structp png_ptr, FILE *fp)
png_init_io(png_structp png_ptr, png_FILE_p fp)
{
png_debug(1, "in png_init_io\n");
png_ptr->io_ptr = (png_voidp)fp;
@ -572,6 +571,17 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
sizeof(char)));
}
#if defined(_WIN32_WCE)
{
wchar_t time_buf[29];
wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"),
ptime->day % 32, short_months[(ptime->month - 1) % 12],
ptime->year, ptime->hour % 24, ptime->minute % 60,
ptime->second % 61);
WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29,
NULL, NULL);
}
#else
#ifdef USE_FAR_KEYWORD
{
char near_time_buf[29];
@ -588,6 +598,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
ptime->year, ptime->hour % 24, ptime->minute % 60,
ptime->second % 61);
#endif
#endif /* _WIN32_WCE */
return ((png_charp)png_ptr->time_buffer);
}
#endif /* PNG_TIME_RFC1123_SUPPORTED */
@ -605,7 +616,7 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
return ("\n libpng version 1.0.7 - July 1, 2000\n\
return ("\n libpng version 1.0.8beta1 - July 8, 2000\n\
Copyright (c) 1998-2000 Glenn Randers-Pehrson\n\
Copyright (c) 1996, 1997 Andreas Dilger\n\
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n");
@ -623,8 +634,8 @@ png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
return("1.0.7");
return("1.0.7");
return("1.0.8beta1");
return("1.0.8beta1");
}
png_charp PNGAPI
@ -673,5 +684,5 @@ png_uint_32 PNGAPI
png_access_version_number(void)
{
/* Version of *.c files used when building libpng */
return((png_uint_32) 10007L);
return((png_uint_32) 10008L);
}

27
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.0.7 - July 1, 2000
* libpng version 1.0.8beta1 - July 8, 2000
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -9,7 +9,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.0.7 - July 1, 2000: Glenn
* libpng versions 0.97, January 1998, through 1.0.8beta1 - July 8, 2000: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -81,7 +81,7 @@
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
* libpng version 1.0.7, July 1, 2000, is
* libpng version 1.0.8beta1, July 8, 2000, is
* Copyright (c) 2000 Glenn Randers-Pehrson
* Distributed according to the same disclaimer and license as libpng-1.0.6
* with the following individuals added to the list of Contributing Authors
@ -186,13 +186,13 @@
* Y2K compliance in libpng:
* =========================
*
* July 1, 2000
* July 8, 2000
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.0.7 are Y2K compliant. It is my belief that earlier
* upward through 1.0.8beta1 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
@ -248,24 +248,24 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.7"
#define PNG_LIBPNG_VER_STRING "1.0.8beta1"
#define PNG_LIBPNG_VER_SONUM 2
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 0
#define PNG_LIBPNG_VER_RELEASE 7
#define PNG_LIBPNG_VER_RELEASE 8
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
#define PNG_LIBPNG_VER_BUILD 0
#define PNG_LIBPNG_VER_BUILD 1
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
* version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */
#define PNG_LIBPNG_VER 10007 /* 1.0.7 */
#define PNG_LIBPNG_VER 10008 /* 1.0.8 */
/* Note to maintainer: update this number in scripts/pngdef.pas as well */
@ -1147,9 +1147,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.7
and png.h are both at * version 1.0.8beta1
*/
typedef png_structp version_1_0_7;
typedef png_structp version_1_0_8beta1;
typedef png_struct FAR * FAR * png_structpp;
@ -1248,6 +1248,8 @@ extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)
PNGARG((png_structp png_ptr, png_timep ptime));
#endif
#if !defined(_WIN32_WCE)
/* "time.h" functions are not supported on WindowsCE */
#if defined(PNG_WRITE_tIME_SUPPORTED)
/* convert from a struct tm to png_time */
extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
@ -1257,6 +1259,7 @@ extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,
time_t ttime));
#endif /* PNG_WRITE_tIME_SUPPORTED */
#endif /* _WIN32_WCE */
#if defined(PNG_READ_EXPAND_SUPPORTED)
/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
@ -2168,7 +2171,7 @@ extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)
extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.0.7 - July 1, 2000 (header)\n"
" libpng version 1.0.8beta1 - July 8, 2000 (header)\n"
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on

View File

@ -1,6 +1,6 @@
/* pngasmrd.h - assembler version of utilities to read a PNG file
*
* libpng 1.0.7 - July 1, 2000
* libpng 1.0.8beta1 - July 8, 2000
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1999, 2000 Glenn Randers-Pehrson
*

View File

@ -1,6 +1,6 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng 1.0.7 - July 1, 2000
* libpng 1.0.8beta1 - July 8, 2000
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -62,6 +62,15 @@
* #define PNG_NO_STDIO
*/
#if defined(_WIN32_WCE)
#include <windows.h>
/* Console I/O functions are not supported on WindowsCE */
#define PNG_NO_CONSOLE_IO
#ifdef PNG_DEBUG
# undef PNG_DEBUG
#endif
#endif
#ifdef PNG_BUILD_DLL
# ifndef PNG_CONSOLE_IO_SUPPORTED
# ifndef PNG_NO_CONSOLE_IO
@ -80,7 +89,10 @@
# endif
# endif
# else
# include <stdio.h>
# if !defined(_WIN32_WCE)
/* "stdio.h" functions are not supported on WindowsCE */
# include <stdio.h>
# endif
# endif
/* This macro protects us against machines that don't have function
@ -118,7 +130,7 @@
#endif
/* enough people need this for various reasons to include it here */
#if !defined(MACOS) && !defined(RISCOS)
#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
#include <sys/types.h>
#endif
@ -799,7 +811,10 @@ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
/* need the time information for reading tIME chunks */
#if defined(PNG_tIME_SUPPORTED)
# include <time.h>
# if !defined(_WIN32_WCE)
/* "time.h" functions are not supported on WindowsCE */
# include <time.h>
# endif
#endif
/* Some typedefs to get us started. These should be safe on most of the
@ -896,6 +911,11 @@ typedef png_int_16 FAR * png_int_16p;
typedef PNG_CONST char FAR * png_const_charp;
typedef char FAR * png_charp;
typedef png_fixed_point FAR * png_fixed_point_p;
#if defined(_WIN32_WCE)
typedef HANDLE png_FILE_p;
#else
typedef FILE * png_FILE_p;
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
typedef double FAR * png_doublep;
#endif
@ -1021,7 +1041,7 @@ typedef z_stream FAR * png_zstreamp;
#ifdef PNG_USE_GLOBAL_ARRAYS
#ifndef PNG_EXPORT_VAR
# define PNG_EXPORT_VAR(type) extern type
# define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
#endif
#endif

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* libpng 1.0.7 - July 1, 2000
* libpng 1.0.8beta1 - July 8, 2000
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -6,7 +6,7 @@
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
* for Intel's performance analysis of the MMX vs. non-MMX code.
*
* libpng 1.0.7 - July 1, 2000
* libpng version 1.0.8beta1 - July 8, 2000
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation
@ -122,11 +122,33 @@
* - fixed up both versions of mmxsupport() (ORIG_THAT_USED_TO_CLOBBER_EBX
* macro determines which is used); original not yet tested.
*
* 20000213:
* - When compiling with gcc, be sure to use -fomit-frame-pointer
*
* 20000319:
* - fixed a register-name typo in png_do_read_interlace(), default (MMX) case,
* pass == 4 or 5, that caused visible corruption of interlaced images
*
* - When compiling with gcc, be sure to use -fomit-frame-pointer
* 20000623:
* - Various problems were reported with gcc 2.95.2 in the Cygwin environment,
* many of the form "forbidden register 0 (ax) was spilled for class AREG."
* This is explained at http://gcc.gnu.org/fom_serv/cache/23.html, and
* Chuck Wilson supplied a patch involving dummy output registers. See
* http://sourceforge.net/bugs/?func=detailbug&bug_id=108741&group_id=5624
* for the original (anonymous) SourceForge bug report.
*
* 20000706:
* - Chuck Wilson passed along these remaining gcc 2.95.2 errors:
* pnggccrd.c: In function `png_combine_row':
* pnggccrd.c:525: more than 10 operands in `asm'
* pnggccrd.c:669: more than 10 operands in `asm'
* pnggccrd.c:828: more than 10 operands in `asm'
* pnggccrd.c:994: more than 10 operands in `asm'
* pnggccrd.c:1177: more than 10 operands in `asm'
* They are all the same problem and can be worked around by using the
* global _unmask variable unconditionally, not just in the -fPIC case.
* Apparently earlier versions of gcc also have the problem with more than
* 10 operands; they just don't report it. Much strangeness ensues, etc.
*/
#define PNG_INTERNAL
@ -174,9 +196,13 @@ static const int png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
/* These constants are used in the inlined MMX assembly code.
Ignore gcc's "At top level: defined but not used" warnings. */
#ifdef __PIC__
static int _unmask; // not enough regs when compiling with -fPIC, so...
#endif
/* GRR 20000706: originally _unmask was needed only when compiling with -fPIC,
* since that case uses the %ebx register for indexing the Global Offset Table
* and there were no other registers available. But gcc 2.95 and later emit
* "more than 10 operands in `asm'" errors when %ebx is used to preload unmask
* in the non-PIC case, so we'll just use the global unconditionally now.
*/
static int _unmask;
static unsigned long long _mask8_0 = 0x0102040810204080LL;
@ -430,23 +456,19 @@ fflush(stderr);
{
png_uint_32 len;
int diff;
#ifndef __PIC__
int unmask = ~mask;
#else
int dummy_value_a; // fix 'forbidden register spilled' error
int dummy_value_d;
int dummy_value_c;
int dummy_value_S;
int dummy_value_D;
_unmask = ~mask; // global variable for -fPIC version
#endif
srcptr = png_ptr->row_buf + 1;
dstptr = row;
len = png_ptr->width &~7; // reduce to multiple of 8
diff = png_ptr->width & 7; // amount lost
__asm__ (
#ifdef __PIC__
__asm__ __volatile__ (
"movd _unmask, %%mm7 \n\t" // load bit pattern
#else
// preload "movd unmask, %%mm7 \n\t" // (unmask is in ebx)
"movd %%ebx, %%mm7 \n\t" // load bit pattern (unmask)
#endif
"psubb %%mm6, %%mm6 \n\t" // zero mm6
"punpcklbw %%mm7, %%mm7 \n\t"
"punpcklwd %%mm7, %%mm7 \n\t"
@ -498,21 +520,22 @@ fflush(stderr);
"end8: \n\t"
"EMMS \n\t" // DONE
: // output regs (none)
: "=a" (dummy_value_a), // output regs (dummy)
"=d" (dummy_value_d),
"=c" (dummy_value_c),
"=S" (dummy_value_S),
"=D" (dummy_value_D)
: "S" (srcptr), // esi // input regs
"D" (dstptr), // edi
"a" (diff), // eax
#ifndef __PIC__
"b" (unmask), // ebx // Global Offset Table idx
#endif
"c" (len), // ecx
"d" (mask) // edx
: "3" (srcptr), // esi // input regs
"4" (dstptr), // edi
"0" (diff), // eax
// was (unmask) "b" RESERVED // ebx // Global Offset Table idx
"2" (len), // ecx
"1" (mask) // edx
: "%esi", "%edi", "%eax", // clobber list
"%ecx", "%edx"
// : // clobber list
#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm4", "%mm6", "%mm7"
: "%mm0", "%mm4", "%mm6", "%mm7"
#endif
);
}
@ -550,23 +573,19 @@ fflush(stderr);
{
png_uint_32 len;
int diff;
#ifndef __PIC__
int unmask = ~mask;
#else
int dummy_value_a; // fix 'forbidden register spilled' error
int dummy_value_d;
int dummy_value_c;
int dummy_value_S;
int dummy_value_D;
_unmask = ~mask; // global variable for -fPIC version
#endif
srcptr = png_ptr->row_buf + 1;
dstptr = row;
len = png_ptr->width &~7; // reduce to multiple of 8
diff = png_ptr->width & 7; // amount lost
__asm__ (
#ifdef __PIC__
__asm__ __volatile__ (
"movd _unmask, %%mm7 \n\t" // load bit pattern
#else
// preload "movd unmask, %%mm7 \n\t" // (unmask is in ebx)
"movd %%ebx, %%mm7 \n\t" // load bit pattern (unmask)
#endif
"psubb %%mm6, %%mm6 \n\t" // zero mm6
"punpcklbw %%mm7, %%mm7 \n\t"
"punpcklwd %%mm7, %%mm7 \n\t"
@ -633,21 +652,22 @@ fflush(stderr);
"end16: \n\t"
"EMMS \n\t" // DONE
: // output regs (none)
: "=a" (dummy_value_a), // output regs (dummy)
"=d" (dummy_value_d),
"=c" (dummy_value_c),
"=S" (dummy_value_S),
"=D" (dummy_value_D)
: "S" (srcptr), // esi // input regs
"D" (dstptr), // edi
"a" (diff), // eax
#ifndef __PIC__
"b" (unmask), // ebx // Global Offset Table idx
#endif
"c" (len), // ecx
"d" (mask) // edx
: "3" (srcptr), // esi // input regs
"4" (dstptr), // edi
"0" (diff), // eax
// was (unmask) "b" RESERVED // ebx // Global Offset Table idx
"2" (len), // ecx
"1" (mask) // edx
: "%esi", "%edi", "%eax", // clobber list
"%ecx", "%edx"
// : // clobber list
#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm1",
: "%mm0", "%mm1",
"%mm4", "%mm5", "%mm6", "%mm7"
#endif
);
@ -686,23 +706,19 @@ fflush(stderr);
{
png_uint_32 len;
int diff;
#ifndef __PIC__
int unmask = ~mask;
#else
int dummy_value_a; // fix 'forbidden register spilled' error
int dummy_value_d;
int dummy_value_c;
int dummy_value_S;
int dummy_value_D;
_unmask = ~mask; // global variable for -fPIC version
#endif
srcptr = png_ptr->row_buf + 1;
dstptr = row;
len = png_ptr->width &~7; // reduce to multiple of 8
diff = png_ptr->width & 7; // amount lost
__asm__ (
#ifdef __PIC__
__asm__ __volatile__ (
"movd _unmask, %%mm7 \n\t" // load bit pattern
#else
// preload "movd unmask, %%mm7 \n\t" // (unmask is in ebx)
"movd %%ebx, %%mm7 \n\t" // load bit pattern (unmask)
#endif
"psubb %%mm6, %%mm6 \n\t" // zero mm6
"punpcklbw %%mm7, %%mm7 \n\t"
"punpcklwd %%mm7, %%mm7 \n\t"
@ -784,21 +800,22 @@ fflush(stderr);
"end24: \n\t"
"EMMS \n\t" // DONE
: // output regs (none)
: "=a" (dummy_value_a), // output regs (dummy)
"=d" (dummy_value_d),
"=c" (dummy_value_c),
"=S" (dummy_value_S),
"=D" (dummy_value_D)
: "S" (srcptr), // esi // input regs
"D" (dstptr), // edi
"a" (diff), // eax
#ifndef __PIC__
"b" (unmask), // ebx // Global Offset Table idx
#endif
"c" (len), // ecx
"d" (mask) // edx
: "3" (srcptr), // esi // input regs
"4" (dstptr), // edi
"0" (diff), // eax
// was (unmask) "b" RESERVED // ebx // Global Offset Table idx
"2" (len), // ecx
"1" (mask) // edx
: "%esi", "%edi", "%eax", // clobber list
"%ecx", "%edx"
// : // clobber list
#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm1", "%mm2",
: "%mm0", "%mm1", "%mm2",
"%mm4", "%mm5", "%mm6", "%mm7"
#endif
);
@ -837,23 +854,19 @@ fflush(stderr);
{
png_uint_32 len;
int diff;
#ifndef __PIC__
int unmask = ~mask;
#else
int dummy_value_a; // fix 'forbidden register spilled' error
int dummy_value_d;
int dummy_value_c;
int dummy_value_S;
int dummy_value_D;
_unmask = ~mask; // global variable for -fPIC version
#endif
srcptr = png_ptr->row_buf + 1;
dstptr = row;
len = png_ptr->width &~7; // reduce to multiple of 8
diff = png_ptr->width & 7; // amount lost
__asm__ (
#ifdef __PIC__
__asm__ __volatile__ (
"movd _unmask, %%mm7 \n\t" // load bit pattern
#else
// preload "movd unmask, %%mm7 \n\t" // (unmask is in ebx)
"movd %%ebx, %%mm7 \n\t" // load bit pattern (unmask)
#endif
"psubb %%mm6, %%mm6 \n\t" // zero mm6
"punpcklbw %%mm7, %%mm7 \n\t"
"punpcklwd %%mm7, %%mm7 \n\t"
@ -942,21 +955,22 @@ fflush(stderr);
"end32: \n\t"
"EMMS \n\t" // DONE
: // output regs (none)
: "=a" (dummy_value_a), // output regs (dummy)
"=d" (dummy_value_d),
"=c" (dummy_value_c),
"=S" (dummy_value_S),
"=D" (dummy_value_D)
: "S" (srcptr), // esi // input regs
"D" (dstptr), // edi
"a" (diff), // eax
#ifndef __PIC__
"b" (unmask), // ebx // Global Offset Table idx
#endif
"c" (len), // ecx
"d" (mask) // edx
: "3" (srcptr), // esi // input regs
"4" (dstptr), // edi
"0" (diff), // eax
// was (unmask) "b" RESERVED // ebx // Global Offset Table idx
"2" (len), // ecx
"1" (mask) // edx
: "%esi", "%edi", "%eax", // clobber list
"%ecx", "%edx"
// : // clobber list
#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm1", "%mm2", "%mm3",
: "%mm0", "%mm1", "%mm2", "%mm3",
"%mm4", "%mm5", "%mm6", "%mm7"
#endif
);
@ -995,23 +1009,19 @@ fflush(stderr);
{
png_uint_32 len;
int diff;
#ifndef __PIC__
int unmask = ~mask;
#else
int dummy_value_a; // fix 'forbidden register spilled' error
int dummy_value_d;
int dummy_value_c;
int dummy_value_S;
int dummy_value_D;
_unmask = ~mask; // global variable for -fPIC version
#endif
srcptr = png_ptr->row_buf + 1;
dstptr = row;
len = png_ptr->width &~7; // reduce to multiple of 8
diff = png_ptr->width & 7; // amount lost
__asm__ (
#ifdef __PIC__
__asm__ __volatile__ (
"movd _unmask, %%mm7 \n\t" // load bit pattern
#else
// preload "movd unmask, %%mm7 \n\t" // (unmask is in ebx)
"movd %%ebx, %%mm7 \n\t" // load bit pattern (unmask)
#endif
"psubb %%mm6, %%mm6 \n\t" // zero mm6
"punpcklbw %%mm7, %%mm7 \n\t"
"punpcklwd %%mm7, %%mm7 \n\t"
@ -1117,21 +1127,22 @@ fflush(stderr);
"end48: \n\t"
"EMMS \n\t" // DONE
: // output regs (none)
: "=a" (dummy_value_a), // output regs (dummy)
"=d" (dummy_value_d),
"=c" (dummy_value_c),
"=S" (dummy_value_S),
"=D" (dummy_value_D)
: "S" (srcptr), // esi // input regs
"D" (dstptr), // edi
"a" (diff), // eax
#ifndef __PIC__
"b" (unmask), // ebx // Global Offset Table idx
#endif
"c" (len), // ecx
"d" (mask) // edx
: "3" (srcptr), // esi // input regs
"4" (dstptr), // edi
"0" (diff), // eax
// was (unmask) "b" RESERVED // ebx // Global Offset Table idx
"2" (len), // ecx
"1" (mask) // edx
: "%esi", "%edi", "%eax", // clobber list
"%ecx", "%edx"
// : // clobber list
#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm1", "%mm2", "%mm3",
: "%mm0", "%mm1", "%mm2", "%mm3",
"%mm4", "%mm5", "%mm6", "%mm7"
#endif
);
@ -1453,7 +1464,10 @@ fflush(stderr);
{
if (((pass == 0) || (pass == 1)) && width)
{
__asm__ (
int dummy_value_c; // fix 'forbidden register spilled'
int dummy_value_S;
int dummy_value_D;
__asm__ __volatile__ (
"subl $21, %%edi \n\t"
// (png_pass_inc[pass] - 1)*pixel_bytes
@ -1482,22 +1496,27 @@ fflush(stderr);
"jnz .loop3_pass0 \n\t"
"EMMS \n\t" // DONE
: // output regs (none)
: "=c" (dummy_value_c), // output regs (dummy)
"=S" (dummy_value_S),
"=D" (dummy_value_D)
: "S" (sptr), // esi // input regs
"D" (dp), // edi
"c" (width) // ecx
: "1" (sptr), // esi // input regs
"2" (dp), // edi
"0" (width) // ecx
// doesn't work "i" (0x0000000000FFFFFFLL) // %1 (a.k.a. _const4)
: "%esi", "%edi", "%ecx" // clobber list
// : // clobber list
#if 0 /* %mm0, ..., %mm4 not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm1", "%mm2", "%mm3", "%mm4"
: "%mm0", "%mm1", "%mm2", "%mm3", "%mm4"
#endif
);
}
else if (((pass == 2) || (pass == 3)) && width)
{
__asm__ (
int dummy_value_c; // fix 'forbidden register spilled'
int dummy_value_S;
int dummy_value_D;
__asm__ __volatile__ (
"subl $9, %%edi \n\t"
// (png_pass_inc[pass] - 1)*pixel_bytes
@ -1520,15 +1539,17 @@ fflush(stderr);
"jnz .loop3_pass2 \n\t"
"EMMS \n\t" // DONE
: // output regs (none)
: "=c" (dummy_value_c), // output regs (dummy)
"=S" (dummy_value_S),
"=D" (dummy_value_D)
: "S" (sptr), // esi // input regs
"D" (dp), // edi
"c" (width) // ecx
: "1" (sptr), // esi // input regs
"2" (dp), // edi
"0" (width) // ecx
: "%esi", "%edi", "%ecx" // clobber list
// : // clobber list
#if 0 /* %mm0, ..., %mm2 not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm1", "%mm2"
: "%mm0", "%mm1", "%mm2"
#endif
);
}
@ -1543,7 +1564,10 @@ fflush(stderr);
// png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
// sptr points at last pixel in pre-expanded row
// dp points at last pixel position in expanded row
__asm__ (
int dummy_value_c; // fix 'forbidden register spilled'
int dummy_value_S;
int dummy_value_D;
__asm__ __volatile__ (
"subl $3, %%esi \n\t"
"subl $9, %%edi \n\t"
// (png_pass_inc[pass] + 1)*pixel_bytes
@ -1569,15 +1593,17 @@ fflush(stderr);
"jnz .loop3_pass4 \n\t"
"EMMS \n\t" // DONE
: // output regs (none)
: "=c" (dummy_value_c), // output regs (dummy)
"=S" (dummy_value_S),
"=D" (dummy_value_D)
: "S" (sptr), // esi // input regs
"D" (dp), // edi
"c" (width_mmx) // ecx
: "1" (sptr), // esi // input regs
"2" (dp), // edi
"0" (width_mmx) // ecx
: "%esi", "%edi", "%ecx" // clobber list
// : // clobber list
#if 0 /* %mm0, ..., %mm3 not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm1", "%mm2", "%mm3"
: "%mm0", "%mm1", "%mm2", "%mm3"
#endif
);
}
@ -1609,7 +1635,10 @@ fflush(stderr);
width -= width_mmx; // 0-3 pixels => 0-3 bytes
if (width_mmx)
{
__asm__ (
int dummy_value_c; // fix 'forbidden register spilled'
int dummy_value_S;
int dummy_value_D;
__asm__ __volatile__ (
"subl $3, %%esi \n\t"
"subl $31, %%edi \n\t"
@ -1636,15 +1665,17 @@ fflush(stderr);
"jnz .loop1_pass0 \n\t"
"EMMS \n\t" // DONE
: // output regs (none)
: "=c" (dummy_value_c), // output regs (dummy)
"=S" (dummy_value_S),
"=D" (dummy_value_D)
: "S" (sptr), // esi // input regs
"D" (dp), // edi
"c" (width_mmx) // ecx
: "1" (sptr), // esi // input regs
"2" (dp), // edi
"0" (width_mmx) // ecx
: "%esi", "%edi", "%ecx" // clobber list
// : // clobber list
#if 0 /* %mm0, ..., %mm4 not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm1", "%mm2", "%mm3", "%mm4"
: "%mm0", "%mm1", "%mm2", "%mm3", "%mm4"
#endif
);
}
@ -1684,7 +1715,10 @@ fflush(stderr);
width -= width_mmx; // 0-3 pixels => 0-3 bytes
if (width_mmx)
{
__asm__ (
int dummy_value_c; // fix 'forbidden register spilled'
int dummy_value_S;
int dummy_value_D;
__asm__ __volatile__ (
"subl $3, %%esi \n\t"
"subl $15, %%edi \n\t"
@ -1702,15 +1736,17 @@ fflush(stderr);
"jnz .loop1_pass2 \n\t"
"EMMS \n\t" // DONE
: // output regs (none)
: "=c" (dummy_value_c), // output regs (dummy)
"=S" (dummy_value_S),
"=D" (dummy_value_D)
: "S" (sptr), // esi // input regs
"D" (dp), // edi
"c" (width_mmx) // ecx
: "1" (sptr), // esi // input regs
"2" (dp), // edi
"0" (width_mmx) // ecx
: "%esi", "%edi", "%ecx" // clobber list
// : // clobber list
#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm1"
: "%mm0", "%mm1"
#endif
);
}
@ -1732,7 +1768,10 @@ fflush(stderr);
width -= width_mmx; // 0-3 pixels => 0-3 bytes
if (width_mmx)
{
__asm__ (
int dummy_value_c; // fix 'forbidden register spilled'
int dummy_value_S;
int dummy_value_D;
__asm__ __volatile__ (
"subl $7, %%esi \n\t"
"subl $15, %%edi \n\t"
@ -1749,15 +1788,17 @@ fflush(stderr);
"jnz .loop1_pass4 \n\t"
"EMMS \n\t" // DONE
: // output regs (none)
: "=c" (dummy_value_c), // output regs (none)
"=S" (dummy_value_S),
"