Imported from libpng-1.0.1c.tar

This commit is contained in:
Glenn Randers-Pehrson 1998-05-09 10:02:29 -05:00
parent 1d96361273
commit d0dce40075
30 changed files with 373 additions and 200 deletions

View File

@ -1,14 +1,14 @@
Libpng 1.0.1b May 2, 1998 Libpng 1.0.1c May 9, 1998
This is not intended to be a public release. It will be replaced 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. within a few weeks by a public version or by another test version.
Changes since the last public release: Changes since the last public release:
libpng-1.0.1a: version 1.0.1a [April 21, 1998]
Optimized Paeth calculations by replacing abs() function calls with intrinsics Optimized Paeth calculations by replacing abs() function calls with intrinsics
plus other loop optimizations. Improves avg decoding speed by about 20 percent. plus other loop optimizations. Improves avg decoding speed by about 20%.
Commented out i386istic "align" compiler flags in makefile.lnx. Commented out i386istic "align" compiler flags in makefile.lnx.
Reduced the default warning level in some makefiles, to make them consistent. Reduced the default warning level in some makefiles, to make them consistent.
Removed references to IJG and JPEG in the ansi2knr.c copyright statement. Removed references to IJG and JPEG in the ansi2knr.c copyright statement.
@ -20,7 +20,8 @@ libpng-1.0.1a:
Moved a misplaced pngrutil code block that truncates tRNS if it has more Moved a misplaced pngrutil code block that truncates tRNS if it has more
than num_palette entries -- test was done before num_palette was defined. than num_palette entries -- test was done before num_palette was defined.
Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins). Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
libpng-1.0.1b: Changed compiler flags in makefile.wat for better optimization (Pawel Mrochen).
version 1.0.1b [May 2, 1998]
Relocated png_do_gray_to_rgb() within png_do_read_transformations() (Greg). Relocated png_do_gray_to_rgb() within png_do_read_transformations() (Greg).
Relocated the png_composite macros from pngrtran.c to png.h (Greg). Relocated the png_composite macros from pngrtran.c to png.h (Greg).
Added makefile.sco (contributed by Mike Hopkirk). Added makefile.sco (contributed by Mike Hopkirk).
@ -29,6 +30,18 @@ libpng-1.0.1b:
More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert). More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert).
More work on loop optimization which may help when compiled with C++ compilers. More work on loop optimization which may help when compiled with C++ compilers.
Added warnings when people try to use transforms they've defined out. 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]
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.
Moved PNG_WRIGHT_WEIGHTED_FILTER_SUPPORTED and PNG_WRITE_FLUSH_SUPPORTED
out of the PNG_WRITE_TRANSFORMS_NOT_SUPPORTED block of pngconf.h
Added "PNG_NO_WRITE_TRANSFORMS" etc., as alternatives for *_NOT_SUPPORTED,
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
Send comments/corrections/commendations to Send comments/corrections/commendations to
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu

12
CHANGES
View File

@ -310,3 +310,15 @@ version 1.0.1b [May 2, 1998]
More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert). More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert).
More work on loop optimization which may help when compiled with C++ compilers. More work on loop optimization which may help when compiled with C++ compilers.
Added warnings when people try to use transforms they've defined out. 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]
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.
Moved PNG_WRIGHT_WEIGHTED_FILTER_SUPPORTED and PNG_WRITE_FLUSH_SUPPORTED
out of the PNG_WRITE_TRANSFORMS_NOT_SUPPORTED block of pngconf.h
Added "PNG_NO_WRITE_TRANSFORMS" etc., as alternatives for *_NOT_SUPPORTED,
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

View File

@ -20,7 +20,8 @@ Known bugs and suggested enhancements in libpng-1.0.1
pngrtran.c: if-test for channels/FILLER may be incorrect pngrtran.c: if-test for channels/FILLER may be incorrect
STATUS: Under investigation STATUS: Under investigation. Appears to be working correctly
in libpng-1.0.1c.
4. March 15, 1998 -- BUG -- Kevin Bracey 4. March 15, 1998 -- BUG -- Kevin Bracey
@ -52,11 +53,12 @@ Known bugs and suggested enhancements in libpng-1.0.1
png_uint_32 i; png_uint_32 i;
for(i=0; i < s->a*s->b; i++) for(i=0; i < s->a*s->b; i++)
with with
png_uint_32 i, count; png_uint_32 i, istop;
istop = s->a*s->b; istop = s->a*s->b;
for(i=0; i<istop; i++) for(i=0; i<istop; i++)
STATUS: Mostly done in libpng-1.0.1a, done for all important loops. STATUS: Mostly done in libpng-1.0.1a, done for all important loops.
More done in libpng-1.0.1b.
c. Replace abs() with intrinsic ternary operations in Paeth c. Replace abs() with intrinsic ternary operations in Paeth
filtering -- Glenn R-P filtering -- Glenn R-P
@ -92,7 +94,7 @@ Known bugs and suggested enhancements in libpng-1.0.1
be made possible at run time, via calls to new png_set_malloc_fn() be made possible at run time, via calls to new png_set_malloc_fn()
and png_set_free_fn() functions. and png_set_free_fn() functions.
STATUS: Will do in libpng-1.0.1b STATUS: Under consideration
9. April 11, 1998 -- BUG -- incorrect truncation of tRNS data in 9. April 11, 1998 -- BUG -- incorrect truncation of tRNS data in
illegal PNG file where tRNS precedes PLTE -- Larry Reeve illegal PNG file where tRNS precedes PLTE -- Larry Reeve
@ -131,3 +133,26 @@ Known bugs and suggested enhancements in libpng-1.0.1
that a warning be issued in such cases. that a warning be issued in such cases.
STATUS: Done in libpng-1.0.1b STATUS: Done in libpng-1.0.1b
14. May 2, 1998 -- BUG -- incorrect mask for filler bytes
In pngrtran.c, png_do_filler(), the masks for hi_filler and low_filler
should be 0xff instead of 0xf
STATUS: Fixed in libpng-1.0.1c
15. May 3, 1998 -- BUG -- buffer overflow in png_do_read_filler()
In pngrutil.c, max_pixel_depth needs to be set to 32 when using
png_do_read_filler with palette images.
STATUS: Fixed in libpng-1.0.1c (see also items 1 and 3 above).
16. May 3, 1998 -- BUG -- type definitions wrong on error functions -- Tom Lane
In png_create_xxx_struct(), the error functions should have typedef
png_voidp instead of (void *). Needs to be corrected in the functions,
the prototypes in png.h, the example.c file, and libpng.txt and libpng.3
STATUS: Fixed in libpng-1.0.1c

2
TODO
View File

@ -1,7 +1,9 @@
TODO - list of things to do for libpng TODO - list of things to do for libpng
fix problem with C++ and EXTERN "C" fix problem with C++ and EXTERN "C"
add capability to set user malloc/free functions at run time
add "grayscale->palette" transformation and "palette->grayscale" detection add "grayscale->palette" transformation and "palette->grayscale" detection
color to gray transformation
improved dithering improved dithering
multi-lingual error and warning message support multi-lingual error and warning message support
sPLT chunk handling sPLT chunk handling

View File

@ -83,7 +83,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
* was compiled with a compatible version of the library. REQUIRED * was compiled with a compatible version of the library. REQUIRED
*/ */
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
(void *)user_error_ptr, user_error_fn, user_warning_fn); png_voidp user_error_ptr, user_error_fn, user_warning_fn);
if (png_ptr == NULL) if (png_ptr == NULL)
{ {
@ -362,7 +362,7 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
* linked libraries. * linked libraries.
*/ */
*png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, *png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
(void *)user_error_ptr, user_error_fn, user_warning_fn); png_voidp user_error_ptr, user_error_fn, user_warning_fn);
if (*png_ptr == NULL) if (*png_ptr == NULL)
{ {
@ -498,7 +498,7 @@ void write_png(char *file_name /* , ... other image information ... */)
* in case we are using dynamically linked libraries. REQUIRED. * in case we are using dynamically linked libraries. REQUIRED.
*/ */
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
(void *)user_error_ptr, user_error_fn, user_warning_fn); png_voidp user_error_ptr, user_error_fn, user_warning_fn);
if (png_ptr == NULL) if (png_ptr == NULL)
{ {

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "May 2, 1998" .TH LIBPNG 3 "May 9, 1998"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library libpng \- Portable Network Graphics (PNG) Reference Library
.SH SYNOPSIS .SH SYNOPSIS
@ -396,7 +396,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.0.1b May 2, 1998 libpng version 1.0.1c May 9, 1998
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<randeg@alumni.rpi.edu> <randeg@alumni.rpi.edu>
Copyright (c) 1998, Glenn Randers-Pehrson Copyright (c) 1998, Glenn Randers-Pehrson
@ -539,7 +539,7 @@ be NULL if the default error handlers are to be used). See the section
on Changes to Libpng below regarding the old initialization functions. on Changes to Libpng below regarding the old initialization functions.
png_structp png_ptr = png_create_read_struct png_structp png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr, (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn); user_error_fn, user_warning_fn);
if (!png_ptr) if (!png_ptr)
return; return;
@ -974,20 +974,18 @@ RGB. This code will do that conversion:
png_set_gray_to_rgb(png_ptr); png_set_gray_to_rgb(png_ptr);
If you have a grayscale and you are using png_set_expand() to change to If you have a grayscale and you are using png_set_expand() to change to
a higher bit-depth you must indicate if the supplied background gray a higher bit-depth, you must either supply the background color as a gray
is supplied in the original file bit depth (need_expand = 1) or in the value at the original file bit-depth (need_expand = 1) or else supply the
expanded bit depth (need_expand = 0). Similarly, if you are reading background color as an RGB triplet at the final, expanded bit depth
a paletted image, you must indicate if you have supplied the background (need_expand = 0). Similarly, if you are reading a paletted image, you
as a palette index that needs to be expanded (need_expand = 1). You can must either supply the background color as a palette index (need_expand = 1)
also specify an RGB triplet that isn't in the palette when setting your or as an RGB triplet that may or may not be in the palette (need_expand = 0).
background for a paletted image.
png_color_16 my_background; png_color_16 my_background;
png_color_16p image_background; png_color_16p image_background;
if (png_get_bKGD(png_ptr, info_ptr, if (png_get_bKGD(png_ptr, info_ptr, &image_background))
&image_background)) png_set_background(png_ptr, image_background,
png_set_background(png_ptr, image_background),
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
else else
png_set_background(png_ptr, &my_background, png_set_background(png_ptr, &my_background,
@ -1271,7 +1269,7 @@ png_infop info_ptr;
initialize_png_reader() initialize_png_reader()
{ {
png_ptr = png_create_read_struct png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr, (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn); user_error_fn, user_warning_fn);
if (!png_ptr) if (!png_ptr)
return -1; return -1;
@ -1443,7 +1441,7 @@ both "png_ptr"; you can call them anything you like, such as
"read_ptr" and "write_ptr". Look at pngtest.c, for example. "read_ptr" and "write_ptr". Look at pngtest.c, for example.
png_structp png_ptr = png_create_write_struct png_structp png_ptr = png_create_write_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr, (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn); user_error_fn, user_warning_fn);
if (!png_ptr) if (!png_ptr)
return; return;
@ -2223,19 +2221,23 @@ Removing unwanted object code:
There are a bunch of #define's in pngconf.h that control what parts of There are a bunch of #define's in pngconf.h that control what parts of
libpng are compiled. All the defines end in _SUPPORTED. If you are libpng are compiled. All the defines end in _SUPPORTED. If you are
never going to use an ability, you can change the #define to #undef never going to use a capability, you can change the #define to #undef
before recompiling libpng and save yourself code and data space. before recompiling libpng and save yourself code and data space, or
You can also turn a number of them off en masse with a compiler directive you can turn off individual capabilities with defines that begin with
that defines PNG_READ[or WRITE]_TRANSFORMS_NOT_SUPPORTED, or PNG_NO_.
PNG_READ[or WRITE]_ANCILLARY_CHUNKS_NOT_SUPPORTED, or all four,
You can also turn all of the transforms and ancillary chunk capabilities
off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four,
along with directives to turn on any of the capabilities that you do along with directives to turn on any of the capabilities that you do
want. The PNG_READ[or WRITE]_TRANSFORMS_NOT_SUPPORTED directives disable want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable
the extra transformations but still leave the library fully capable of reading the extra transformations but still leave the library fully capable of reading
and writing PNG files with all known public chunks [except for sPLT]. and writing PNG files with all known public chunks [except for sPLT].
Use of the PNG_READ[or WRITE]_ANCILLARY_CHUNKS_NOT_SUPPORTED directive Use of the PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive
produces a library that is incapable of reading or writing ancillary chunks. produces a library that is incapable of reading or writing ancillary chunks.
If you are not using the progressive reading capability, you can If you are not using the progressive reading capability, you can
turn that off with PNG_PROGRESSIVE_READ_NOT_SUPPORTED (don't confuse turn that off with PNG_NO_PROGRESSIVE_READ (don't confuse
this with the INTERLACING capability, which you'll still have). this with the INTERLACING capability, which you'll still have).
All the reading and writing specific code are in separate files, so the All the reading and writing specific code are in separate files, so the
@ -2372,7 +2374,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.1b May 2, 1998: Libpng version 1.0.1c May 9, 1998:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu). Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).

View File

@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.0.1b May 2, 1998 libpng version 1.0.1c May 9, 1998
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<randeg@alumni.rpi.edu> <randeg@alumni.rpi.edu>
Copyright (c) 1998, Glenn Randers-Pehrson Copyright (c) 1998, Glenn Randers-Pehrson
@ -143,7 +143,7 @@ be NULL if the default error handlers are to be used). See the section
on Changes to Libpng below regarding the old initialization functions. on Changes to Libpng below regarding the old initialization functions.
png_structp png_ptr = png_create_read_struct png_structp png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr, (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn); user_error_fn, user_warning_fn);
if (!png_ptr) if (!png_ptr)
return; return;
@ -578,20 +578,18 @@ RGB. This code will do that conversion:
png_set_gray_to_rgb(png_ptr); png_set_gray_to_rgb(png_ptr);
If you have a grayscale and you are using png_set_expand() to change to If you have a grayscale and you are using png_set_expand() to change to
a higher bit-depth you must indicate if the supplied background gray a higher bit-depth, you must either supply the background color as a gray
is supplied in the original file bit depth (need_expand = 1) or in the value at the original file bit-depth (need_expand = 1) or else supply the
expanded bit depth (need_expand = 0). Similarly, if you are reading background color as an RGB triplet at the final, expanded bit depth
a paletted image, you must indicate if you have supplied the background (need_expand = 0). Similarly, if you are reading a paletted image, you
as a palette index that needs to be expanded (need_expand = 1). You can must either supply the background color as a palette index (need_expand = 1)
also specify an RGB triplet that isn't in the palette when setting your or as an RGB triplet that may or may not be in the palette (need_expand = 0).
background for a paletted image.
png_color_16 my_background; png_color_16 my_background;
png_color_16p image_background; png_color_16p image_background;
if (png_get_bKGD(png_ptr, info_ptr, if (png_get_bKGD(png_ptr, info_ptr, &image_background))
&image_background)) png_set_background(png_ptr, image_background,
png_set_background(png_ptr, image_background),
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
else else
png_set_background(png_ptr, &my_background, png_set_background(png_ptr, &my_background,
@ -875,7 +873,7 @@ png_infop info_ptr;
initialize_png_reader() initialize_png_reader()
{ {
png_ptr = png_create_read_struct png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr, (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn); user_error_fn, user_warning_fn);
if (!png_ptr) if (!png_ptr)
return -1; return -1;
@ -1047,7 +1045,7 @@ both "png_ptr"; you can call them anything you like, such as
"read_ptr" and "write_ptr". Look at pngtest.c, for example. "read_ptr" and "write_ptr". Look at pngtest.c, for example.
png_structp png_ptr = png_create_write_struct png_structp png_ptr = png_create_write_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr, (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn); user_error_fn, user_warning_fn);
if (!png_ptr) if (!png_ptr)
return; return;
@ -1827,19 +1825,23 @@ Removing unwanted object code:
There are a bunch of #define's in pngconf.h that control what parts of There are a bunch of #define's in pngconf.h that control what parts of
libpng are compiled. All the defines end in _SUPPORTED. If you are libpng are compiled. All the defines end in _SUPPORTED. If you are
never going to use an ability, you can change the #define to #undef never going to use a capability, you can change the #define to #undef
before recompiling libpng and save yourself code and data space. before recompiling libpng and save yourself code and data space, or
You can also turn a number of them off en masse with a compiler directive you can turn off individual capabilities with defines that begin with
that defines PNG_READ[or WRITE]_TRANSFORMS_NOT_SUPPORTED, or PNG_NO_.
PNG_READ[or WRITE]_ANCILLARY_CHUNKS_NOT_SUPPORTED, or all four,
You can also turn all of the transforms and ancillary chunk capabilities
off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four,
along with directives to turn on any of the capabilities that you do along with directives to turn on any of the capabilities that you do
want. The PNG_READ[or WRITE]_TRANSFORMS_NOT_SUPPORTED directives disable want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable
the extra transformations but still leave the library fully capable of reading the extra transformations but still leave the library fully capable of reading
and writing PNG files with all known public chunks [except for sPLT]. and writing PNG files with all known public chunks [except for sPLT].
Use of the PNG_READ[or WRITE]_ANCILLARY_CHUNKS_NOT_SUPPORTED directive Use of the PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive
produces a library that is incapable of reading or writing ancillary chunks. produces a library that is incapable of reading or writing ancillary chunks.
If you are not using the progressive reading capability, you can If you are not using the progressive reading capability, you can
turn that off with PNG_PROGRESSIVE_READ_NOT_SUPPORTED (don't confuse turn that off with PNG_NO_PROGRESSIVE_READ (don't confuse
this with the INTERLACING capability, which you'll still have). this with the INTERLACING capability, which you'll still have).
All the reading and writing specific code are in separate files, so the All the reading and writing specific code are in separate files, so the

View File

@ -1,4 +1,4 @@
.TH LIBPNGPF 3 "May 2, 1998" .TH LIBPNGPF 3 "May 9, 1998"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library libpng \- Portable Network Graphics (PNG) Reference Library
(private functions) (private functions)

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "May 2, 1998" .TH PNG 5 "May 9, 1998"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION

6
png.c
View File

@ -1,12 +1,12 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* libpng 1.0.1b * libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
@ -16,7 +16,7 @@
/* Version information for C files. This had better match the version /* Version information for C files. This had better match the version
* string defined in png.h. * string defined in png.h.
*/ */
char png_libpng_ver[12] = "1.0.1b"; char png_libpng_ver[12] = "1.0.1c";
/* Place to hold the signature string for a PNG file. */ /* Place to hold the signature string for a PNG file. */
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10}; png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};

15
png.h
View File

@ -1,12 +1,12 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng 1.0.1b * libpng 1.0.1c
* For conditions of distribution and use, see the COPYRIGHT NOTICE below. * For conditions of distribution and use, see the COPYRIGHT NOTICE below.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998 Glenn Randers-Pehrson * Copyright (c) 1998 Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
* *
* Note about libpng version numbers: * Note about libpng version numbers:
* *
@ -31,8 +31,9 @@
* 1.00 1.00 100 2.1.0 [int should be 10000] * 1.00 1.00 100 2.1.0 [int should be 10000]
* 1.0.0 1.0.0 100 2.1.0 [int should be 10000] * 1.0.0 1.0.0 100 2.1.0 [int should be 10000]
* 1.0.1 1.0.1 10001 2.1.0 * 1.0.1 1.0.1 10001 2.1.0
* 1.0.1a 1.0.1a 10002 2.1.0 * 1.0.1a 1.0.1a 10002 2.1.0.1a
* 1.0.1b 1.0.1b 10002 2.1.0 * 1.0.1b 1.0.1b 10002 2.1.0.1b
* 1.0.1c 1.0.1c 10002 2.1.0.1c
* *
* Henceforth the source version will match the shared-library minor * Henceforth the source version will match the shared-library minor
* and patch numbers; the shared-library major version number will be * and patch numbers; the shared-library major version number will be
@ -119,7 +120,7 @@ extern "C" {
*/ */
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.1b" #define PNG_LIBPNG_VER_STRING "1.0.1c"
/* Careful here. At one time, Guy wanted to use 082, but that would be octal. /* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros. * We must not include leading zeros.
@ -711,12 +712,12 @@ extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num));
/* Allocate and initialize png_ptr struct for reading, and any other memory. */ /* Allocate and initialize png_ptr struct for reading, and any other memory. */
extern PNG_EXPORT(png_structp,png_create_read_struct) extern PNG_EXPORT(png_structp,png_create_read_struct)
PNGARG((png_const_charp user_png_ver, voidp error_ptr, PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn)); png_error_ptr error_fn, png_error_ptr warn_fn));
/* Allocate and initialize png_ptr struct for reading, and any other memory */ /* Allocate and initialize png_ptr struct for reading, and any other memory */
extern PNG_EXPORT(png_structp,png_create_write_struct) extern PNG_EXPORT(png_structp,png_create_write_struct)
PNGARG((png_const_charp user_png_ver, voidp error_ptr, PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn)); png_error_ptr error_fn, png_error_ptr warn_fn));
/* Write a PNG chunk - size, type, (optional) data, CRC. */ /* Write a PNG chunk - size, type, (optional) data, CRC. */

156
pngconf.h
View File

@ -1,12 +1,12 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng 1.0.1b * libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
*/ */
/* Any machine specific code is near the front of this file, so if you /* Any machine specific code is near the front of this file, so if you
@ -237,72 +237,139 @@ __dont__ include it again
/* Any transformations you will not be using can be undef'ed here */ /* Any transformations you will not be using can be undef'ed here */
/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
to turn it off with "*TRANSFORMS_NOT_SUPPORTED" on the compile line, to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
then pick and choose which ones to define without having to edit on the compile line, then pick and choose which ones to define without
this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED if you having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
only want to have a png-compliant reader/writer but don't need if you only want to have a png-compliant reader/writer but don't need
any of the extra transformations. This saves about 80 kbytes in a any of the extra transformations. This saves about 80 kbytes in a
typical installation of the library. typical installation of the library. (PNG_NO_* form added in version
1.0.1c, for consistency)
*/ */
#ifndef PNG_READ_TRANSFORMS_NOT_SUPPORTED #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_READ_TRANSFORMS)
#define PNG_READ_TRANSFORMS_SUPPORTED #define PNG_READ_TRANSFORMS_SUPPORTED
#endif #endif
#ifndef PNG_WRITE_TRANSFORMS_NOT_SUPPORTED #if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_WRITE_TRANSFORMS)
#define PNG_WRITE_TRANSFORMS_SUPPORTED #define PNG_WRITE_TRANSFORMS_SUPPORTED
#endif #endif
#ifdef PNG_READ_TRANSFORMS_SUPPORTED #ifdef PNG_READ_TRANSFORMS_SUPPORTED
#ifndef PNG_NO_READ_EXPAND
#define PNG_READ_EXPAND_SUPPORTED #define PNG_READ_EXPAND_SUPPORTED
#endif
#ifndef PNG_NO_READ_SHIFT
#define PNG_READ_SHIFT_SUPPORTED #define PNG_READ_SHIFT_SUPPORTED
#endif
#ifndef PNG_NO_READ_PACK
#define PNG_READ_PACK_SUPPORTED #define PNG_READ_PACK_SUPPORTED
#endif
#ifndef PNG_NO_READ_BGR
#define PNG_READ_BGR_SUPPORTED #define PNG_READ_BGR_SUPPORTED
#endif
#ifndef PNG_NO_READ_SWAP
#define PNG_READ_SWAP_SUPPORTED #define PNG_READ_SWAP_SUPPORTED
#endif
#ifndef PNG_NO_READ_PACKSWAP
#define PNG_READ_PACKSWAP_SUPPORTED #define PNG_READ_PACKSWAP_SUPPORTED
#endif
#ifndef PNG_NO_READ_INVERT
#define PNG_READ_INVERT_SUPPORTED #define PNG_READ_INVERT_SUPPORTED
#endif
#ifndef PNG_NO_READ_DITHER
#define PNG_READ_DITHER_SUPPORTED #define PNG_READ_DITHER_SUPPORTED
#endif
#ifndef PNG_NO_READ_BACKGROUND
#define PNG_READ_BACKGROUND_SUPPORTED #define PNG_READ_BACKGROUND_SUPPORTED
#endif
#ifndef PNG_NO_READ_16_TO_8
#define PNG_READ_16_TO_8_SUPPORTED #define PNG_READ_16_TO_8_SUPPORTED
#endif
#ifndef PNG_NO_READ_FILLER
#define PNG_READ_FILLER_SUPPORTED #define PNG_READ_FILLER_SUPPORTED
#endif
#ifndef PNG_NO_READ_GAMMA
#define PNG_READ_GAMMA_SUPPORTED #define PNG_READ_GAMMA_SUPPORTED
#endif
#ifndef PNG_NO_READ_GRAY_TO_RGB
#define PNG_READ_GRAY_TO_RGB_SUPPORTED #define PNG_READ_GRAY_TO_RGB_SUPPORTED
#endif
#ifndef PNG_NO_READ_SWAP_ALPHA
#define PNG_READ_SWAP_ALPHA_SUPPORTED #define PNG_READ_SWAP_ALPHA_SUPPORTED
#endif
#ifndef PNG_NO_READ_INVERT_ALPHA
#define PNG_READ_INVERT_ALPHA_SUPPORTED #define PNG_READ_INVERT_ALPHA_SUPPORTED
#endif
#ifndef PNG_NO_READ_STRIP_ALPHA
#define PNG_READ_STRIP_ALPHA_SUPPORTED #define PNG_READ_STRIP_ALPHA_SUPPORTED
#endif
#ifndef PNG_NO_READ_USER_TRANSFORM
#define PNG_READ_USER_TRANSFORM_SUPPORTED #define PNG_READ_USER_TRANSFORM_SUPPORTED
#endif
/* the following aren't implemented yet /* the following aren't implemented yet
#define PNG_READ_RGB_TO_GRAY_SUPPORTED #define PNG_READ_RGB_TO_GRAY_SUPPORTED
*/ */
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
#ifndef PNG_PROGRESSIVE_READ_NOT_SUPPORTED /* if you don't do progressive */ #if !defined(PNG_NO_PROGRESSIVE_READ) && \
!defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
#define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ #define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
#endif /* about interlacing capability! You'll */ #endif /* about interlacing capability! You'll */
/* still have interlacing unless you change the following line: */ /* still have interlacing unless you change the following line: */
#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
#ifndef PNG_NO_READ_COMPOSITED_NODIV
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */ #define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */
#endif
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
#ifndef PNG_NO_WRITE_SHIFT
#define PNG_WRITE_SHIFT_SUPPORTED #define PNG_WRITE_SHIFT_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_PACK
#define PNG_WRITE_PACK_SUPPORTED #define PNG_WRITE_PACK_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_BGR
#define PNG_WRITE_BGR_SUPPORTED #define PNG_WRITE_BGR_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_SWAP
#define PNG_WRITE_SWAP_SUPPORTED #define PNG_WRITE_SWAP_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_PACKSWAP
#define PNG_WRITE_PACKSWAP_SUPPORTED #define PNG_WRITE_PACKSWAP_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_INVERT
#define PNG_WRITE_INVERT_SUPPORTED #define PNG_WRITE_INVERT_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_FILLER
#define PNG_WRITE_FILLER_SUPPORTED /* This is the same as WRITE_STRIP_ALPHA */ #define PNG_WRITE_FILLER_SUPPORTED /* This is the same as WRITE_STRIP_ALPHA */
#define PNG_WRITE_FLUSH_SUPPORTED #endif
#ifndef PNG_NO_WRITE_SWAP_ALPHA
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED #define PNG_WRITE_SWAP_ALPHA_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_INVERT_ALPHA
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED #define PNG_WRITE_INVERT_ALPHA_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #endif
#ifndef PNG_NO_WRITE_USER_TRANSFORM
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED #define PNG_WRITE_USER_TRANSFORM_SUPPORTED
#endif
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant #define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
encoders, but can cause trouble encoders, but can cause trouble
if left undefined */ if left undefined */
#if !defined(PNG_NO_STDIO) #ifndef PNG_NO_WRITE_WEIGHTED_FILTER
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_FLUSH
#define PNG_WRITE_FLUSH_SUPPORTED
#endif
#ifndef PNG_NO_STDIO
#define PNG_TIME_RFC1123_SUPPORTED #define PNG_TIME_RFC1123_SUPPORTED
#endif #endif
@ -322,7 +389,7 @@ __dont__ include it again
* png_get_x_offset_microns() * png_get_x_offset_microns()
* png_get_y_offset_microns() * png_get_y_offset_microns()
*/ */
#if !defined(PNG_NO_EASY_ACCESS) #ifndef PNG_NO_EASY_ACCESS
#define PNG_EASY_ACCESS_SUPPORTED #define PNG_EASY_ACCESS_SUPPORTED
#endif #endif
@ -351,45 +418,100 @@ __dont__ include it again
* a bit smaller. * a bit smaller.
*/ */
#ifndef PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED #if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
!defined(PNG_NO_READ_ANCILLARY_CHUNKS)
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#endif #endif
#ifndef PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED #if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
!defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED #define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#endif #endif
#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#ifndef PNG_NO_PNG_READ_bKGD
#define PNG_READ_bKGD_SUPPORTED #define PNG_READ_bKGD_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_cHRM
#define PNG_READ_cHRM_SUPPORTED #define PNG_READ_cHRM_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_gAMA
#define PNG_READ_gAMA_SUPPORTED #define PNG_READ_gAMA_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_hIST
#define PNG_READ_hIST_SUPPORTED #define PNG_READ_hIST_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_oFFs
#define PNG_READ_oFFs_SUPPORTED #define PNG_READ_oFFs_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_pCAL
#define PNG_READ_pCAL_SUPPORTED #define PNG_READ_pCAL_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_pHYs
#define PNG_READ_pHYs_SUPPORTED #define PNG_READ_pHYs_SUPPORTED
#endif
#ifndef PNG_NO_READ_sBIT
#define PNG_READ_sBIT_SUPPORTED #define PNG_READ_sBIT_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_sRGB
#define PNG_READ_sRGB_SUPPORTED #define PNG_READ_sRGB_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_tEXt
#define PNG_READ_tEXt_SUPPORTED #define PNG_READ_tEXt_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_tIME
#define PNG_READ_tIME_SUPPORTED #define PNG_READ_tIME_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_tRNS
#define PNG_READ_tRNS_SUPPORTED #define PNG_READ_tRNS_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_zTXt
#define PNG_READ_zTXt_SUPPORTED #define PNG_READ_zTXt_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_OPT_PLTE
#define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the optional */ #define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the optional */
/* PLTE chunk in RGB and RGBA images */ #endif /* PLTE chunk in RGB and RGBA images */
#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#ifndef PNG_NO_PNG_WRITE_bKGD
#define PNG_WRITE_bKGD_SUPPORTED #define PNG_WRITE_bKGD_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_cHRM
#define PNG_WRITE_cHRM_SUPPORTED #define PNG_WRITE_cHRM_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_gAMA
#define PNG_WRITE_gAMA_SUPPORTED #define PNG_WRITE_gAMA_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_hIST
#define PNG_WRITE_hIST_SUPPORTED #define PNG_WRITE_hIST_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_oFFs
#define PNG_WRITE_oFFs_SUPPORTED #define PNG_WRITE_oFFs_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_pCAL
#define PNG_WRITE_pCAL_SUPPORTED #define PNG_WRITE_pCAL_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_pHYs
#define PNG_WRITE_pHYs_SUPPORTED #define PNG_WRITE_pHYs_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_sBIT
#define PNG_WRITE_sBIT_SUPPORTED #define PNG_WRITE_sBIT_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_sRGB
#define PNG_WRITE_sRGB_SUPPORTED #define PNG_WRITE_sRGB_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_tEXt
#define PNG_WRITE_tEXt_SUPPORTED #define PNG_WRITE_tEXt_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_tIME
#define PNG_WRITE_tIME_SUPPORTED #define PNG_WRITE_tIME_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_tRNS
#define PNG_WRITE_tRNS_SUPPORTED #define PNG_WRITE_tRNS_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_zTXt
#define PNG_WRITE_zTXt_SUPPORTED #define PNG_WRITE_zTXt_SUPPORTED
#endif
#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
/* need the time information for reading tIME chunks */ /* need the time information for reading tIME chunks */

View File

@ -1,12 +1,12 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* libpng 1.0.1b * libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
* *
* This file provides a location for all error handling. Users which * This file provides a location for all error handling. Users which
* need special error handling are expected to write replacement functions * need special error handling are expected to write replacement functions

View File

@ -1,12 +1,12 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* libpng 1.0.1b * libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL

View File

@ -1,12 +1,12 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* libpng 1.0.1b * libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
* *
* This file provides a location for all memory allocation. Users who * This file provides a location for all memory allocation. Users who
* need special memory handling are expected to modify the code in this file * need special memory handling are expected to modify the code in this file

View File

@ -1,12 +1,12 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* libpng 1.0.1b * 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL

View File

@ -1,12 +1,12 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* libpng 1.0.1b * 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
* *
* This file contains routines that an application calls directly to * This file contains routines that an application calls directly to
* read a PNG file or stream. * read a PNG file or stream.
@ -17,7 +17,7 @@
/* Create a PNG structure for reading, and allocate any memory needed. */ /* Create a PNG structure for reading, and allocate any memory needed. */
png_structp png_structp
png_create_read_struct(png_const_charp user_png_ver, voidp error_ptr, png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn) png_error_ptr error_fn, png_error_ptr warn_fn)
{ {
png_structp png_ptr; png_structp png_ptr;
@ -82,7 +82,7 @@ png_create_read_struct(png_const_charp user_png_ver, voidp error_ptr,
} }
/* Initialize PNG structure for reading, and allocate any memory needed. /* Initialize PNG structure for reading, and allocate any memory needed.
This interface is depreciated in favour of the png_create_read_struct(), This interface is deprecated in favour of the png_create_read_struct(),
and it will eventually disappear. */ and it will eventually disappear. */
void void
png_read_init(png_structp png_ptr) png_read_init(png_structp png_ptr)

View File

@ -1,12 +1,12 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* libpng 1.0.1b * libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
* *
* This file provides a location for all input. Users which need * This file provides a location for all input. Users which need
* special handling are expected to write a function which has the same * special handling are expected to write a function which has the same

View File

@ -1,12 +1,12 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* libpng 1.0.1b * 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
* *
* This file contains functions optionally called by an application * This file contains functions optionally called by an application
* in order to tell libpng how to handle data when reading a PNG. * in order to tell libpng how to handle data when reading a PNG.
@ -576,13 +576,16 @@ png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
void void
png_init_read_transformations(png_structp png_ptr) png_init_read_transformations(png_structp png_ptr)
{ {
int color_type = png_ptr->color_type; #if defined(PNG_USELESS_TESTS_SUPPORTED)
if(png_ptr == NULL) return;
#endif
png_debug(1, "in png_init_read_transformations\n"); png_debug(1, "in png_init_read_transformations\n");
#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED) #if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
if (png_ptr->transformations & PNG_BACKGROUND_EXPAND) 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 */ if (!(color_type & PNG_COLOR_MASK_COLOR)) /* i.e., GRAY or GRAY_ALPHA */
{ {
/* expand background chunk. */ /* expand background chunk. */
@ -1322,10 +1325,10 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
png_uint_32 i; png_uint_32 i;
png_uint_32 istop = row_info->rowbytes; png_uint_32 istop = row_info->rowbytes;
for (bp = row, i = 0; i < istop; i++, bp++) for (bp = row, i = 0; i < istop; i++)
{ {
*bp >>= 1; *bp >>= 1;
*bp &= 0x55; *bp++ &= 0x55;
} }
break; break;
} }
@ -1337,43 +1340,37 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
png_byte mask = (png_byte)(((int)0xf0 >> shift[0]) & (int)0xf0) | png_byte mask = (png_byte)(((int)0xf0 >> shift[0]) & (int)0xf0) |
(png_byte)((int)0xf >> shift[0]); (png_byte)((int)0xf >> shift[0]);
for (bp = row, i = 0; i < istop; i++, bp++) for (bp = row, i = 0; i < istop; i++)
{ {
*bp >>= shift[0]; *bp >>= shift[0];
*bp &= mask; *bp++ &= mask;
} }
break; break;
} }
case 8: case 8:
{ {
png_bytep bp; png_bytep bp = row;
png_uint_32 i; png_uint_32 i;
int cstop=(int)row_info->channels; png_uint_32 istop = row_width * channels;
for (bp = row, i = 0; i < row_width; i++) for (i = 0; i < istop; i++)
{ {
for (c = 0; c < cstop; c++, bp++) *bp++ >>= shift[i%channels];
{
*bp >>= shift[c];
}
} }
break; break;
} }
case 16: case 16:
{ {
png_bytep bp; png_bytep bp = row;
png_size_t i; png_uint_32 i;
int cstop=(int)row_info->channels; png_uint_32 istop = channels * row_width;
for (bp = row, i = 0; i < row_width; i++) for (i = 0; i < istop; i++)
{
for (c = 0; c < cstop; c++, bp += 2)
{ {
value = (png_uint_16)((*bp << 8) + *(bp + 1)); value = (png_uint_16)((*bp << 8) + *(bp + 1));
value >>= shift[c]; value >>= shift[i%channels];
*bp = (png_byte)(value >> 8); *bp++ = (png_byte)(value >> 8);
*(bp + 1) = (png_byte)(value & 0xff); *bp++ = (png_byte)(value & 0xff);
}
} }
break; break;
} }
@ -1620,8 +1617,8 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
png_byte hi_filler = (png_byte)((filler>>8) & 0xf); png_byte hi_filler = (png_byte)((filler>>8) & 0xff);
png_byte low_filler = (png_byte)(filler & 0xf); png_byte low_filler = (png_byte)(filler & 0xff);
png_debug(1, "in png_do_read_filler\n"); png_debug(1, "in png_do_read_filler\n");
if ( if (

View File

@ -1,12 +1,12 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* 1.0.1b * 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
* *
* This file contains routines which are only called from within * This file contains routines which are only called from within
* libpng itself during the course of reading an image. * libpng itself during the course of reading an image.
@ -73,7 +73,7 @@ png_crc_finish(png_structp png_ptr, png_uint_32 skip)
png_size_t i; png_size_t i;
png_size_t istop = png_ptr->zbuf_size; png_size_t istop = png_ptr->zbuf_size;
for (i = skip; i > istop; i -= istop) for (i = (png_size_t)skip; i > istop; i -= istop)
{ {
png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
} }
@ -2225,7 +2225,7 @@ void
png_read_start_row(png_structp png_ptr) png_read_start_row(png_structp png_ptr)
{ {
int max_pixel_depth; int max_pixel_depth;
png_uint_32 rowbytes; png_uint_32 row_bytes;
png_debug(1, "in png_read_start_row\n"); png_debug(1, "in png_read_start_row\n");
png_ptr->zstream.avail_in = 0; png_ptr->zstream.avail_in = 0;
@ -2243,10 +2243,10 @@ png_read_start_row(png_structp png_ptr)
png_pass_start[png_ptr->pass]) / png_pass_start[png_ptr->pass]) /
png_pass_inc[png_ptr->pass]; png_pass_inc[png_ptr->pass];
rowbytes = ((png_ptr->iwidth * row_bytes = ((png_ptr->iwidth *
(png_uint_32)png_ptr->pixel_depth + 7) >> 3) +1; (png_uint_32)png_ptr->pixel_depth + 7) >> 3) +1;
png_ptr->irowbytes = (png_size_t)rowbytes; png_ptr->irowbytes = (png_size_t)row_bytes;
if((png_uint_32)png_ptr->irowbytes != rowbytes) if((png_uint_32)png_ptr->irowbytes != row_bytes)
png_error(png_ptr, "Rowbytes overflow in png_read_start_row"); png_error(png_ptr, "Rowbytes overflow in png_read_start_row");
} }
else else
@ -2293,7 +2293,9 @@ png_read_start_row(png_structp png_ptr)
#if defined(PNG_READ_FILLER_SUPPORTED) #if defined(PNG_READ_FILLER_SUPPORTED)
if (png_ptr->transformations & (PNG_FILLER)) if (png_ptr->transformations & (PNG_FILLER))
{ {
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY) if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
max_pixel_depth = 32;
else if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
{ {
if (max_pixel_depth <= 8) if (max_pixel_depth <= 8)
max_pixel_depth = 16; max_pixel_depth = 16;
@ -2333,16 +2335,16 @@ png_read_start_row(png_structp png_ptr)
/* align the width on the next larger 8 pixels. Mainly used /* align the width on the next larger 8 pixels. Mainly used
for interlacing */ for interlacing */
rowbytes = ((png_ptr->width + 7) & ~((png_uint_32)7)); row_bytes = ((png_ptr->width + 7) & ~((png_uint_32)7));
/* calculate the maximum bytes needed, adding a byte and a pixel /* calculate the maximum bytes needed, adding a byte and a pixel
for safety's sake */ for safety's sake */
rowbytes = ((rowbytes * (png_uint_32)max_pixel_depth + 7) >> 3) + row_bytes = ((row_bytes * (png_uint_32)max_pixel_depth + 7) >> 3) +
1 + ((max_pixel_depth + 7) >> 3); 1 + ((max_pixel_depth + 7) >> 3);
#ifdef PNG_MAX_MALLOC_64K #ifdef PNG_MAX_MALLOC_64K
if (rowbytes > (png_uint_32)65536L) if (row_bytes > (png_uint_32)65536L)
png_error(png_ptr, "This image requires a row greater than 64KB"); png_error(png_ptr, "This image requires a row greater than 64KB");
#endif #endif
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, rowbytes); png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, row_bytes);
#ifdef PNG_MAX_MALLOC_64K #ifdef PNG_MAX_MALLOC_64K
if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L) if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L)

View File

@ -1,12 +1,12 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* libpng 1.0.1b * 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
* *
* The functions here are used during reads to store data from the file * The functions here are used during reads to store data from the file
* into the info struct, and during writes to store application data * into the info struct, and during writes to store application data

View File

@ -1,12 +1,12 @@
/* pngtest.c - a simple test program to test libpng /* pngtest.c - a simple test program to test libpng
* *
* libpng 1.0.1b * libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
* *
* This program reads in a PNG image, writes it out again, and then * 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 * compares the two files. If the files are identical, this shows that

View File

@ -1,12 +1,12 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* libpng 1.0.1b * 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL

View File

@ -1,12 +1,12 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* libpng 1.0.1b * libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
* *
* This file provides a location for all output. Users which need * This file provides a location for all output. Users which need
* special handling are expected to write functions which have the same * special handling are expected to write functions which have the same

View File

@ -1,12 +1,12 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* libpng 1.0.1b * 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
*/ */
/* get internal access to png.h */ /* get internal access to png.h */
@ -281,7 +281,7 @@ png_convert_from_time_t(png_timep ptime, time_t ttime)
/* Initialize png_ptr structure, and allocate any memory needed */ /* Initialize png_ptr structure, and allocate any memory needed */
png_structp png_structp
png_create_write_struct(png_const_charp user_png_ver, voidp error_ptr, png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn) png_error_ptr error_fn, png_error_ptr warn_fn)
{ {
png_structp png_ptr; png_structp png_ptr;

View File

@ -1,12 +1,12 @@
/* pngwtran.c - transforms the data in a row for PNG writers /* pngwtran.c - transforms the data in a row for PNG writers
* *
* 1.0.1b * 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
@ -218,9 +218,8 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
row_info->color_type != PNG_COLOR_TYPE_PALETTE) row_info->color_type != PNG_COLOR_TYPE_PALETTE)
{ {
int shift_start[4], shift_dec[4]; int shift_start[4], shift_dec[4];
int channels; int channels = 0;
channels = 0;
if (row_info->color_type & PNG_COLOR_MASK_COLOR) if (row_info->color_type & PNG_COLOR_MASK_COLOR)
{ {
shift_start[channels] = row_info->bit_depth - bit_depth->red; shift_start[channels] = row_info->bit_depth - bit_depth->red;
@ -281,16 +280,14 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
{ {
png_bytep bp = row; png_bytep bp = row;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 istop = channels * row_info->width;
for (i = 0; i < row_width; i++) for (i = 0; i < istop; i++, bp++)
{ {
int c;
for (c = 0; c < channels; c++, bp++)
{
png_uint_16 v; png_uint_16 v;
int j; int j;
int c = (int)(i%channels);
v = *bp; v = *bp;
*bp = 0; *bp = 0;
@ -303,19 +300,15 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
} }
} }
} }
}
else else
{ {
png_bytep bp; png_bytep bp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 istop = channels * row_info->width;
for (bp = row, i = 0; i < row_width; i++) for (bp = row, i = 0; i < istop; i++)
{
int c;
for (c = 0; c < channels; c++, bp += 2)
{ {
int c = (int)(i%channels);
png_uint_16 value, v; png_uint_16 value, v;
int j; int j;
@ -328,9 +321,8 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
else else
value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff); value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
} }
*bp = (png_byte)(value >> 8); *bp++ = (png_byte)(value >> 8);
*(bp + 1) = (png_byte)(value & 0xff); *bp++ = (png_byte)(value & 0xff);
}
} }
} }
} }

View File

@ -1,12 +1,12 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* 1.0.1b * 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson * Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998 * May 9, 1998
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
@ -1432,7 +1432,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_bytep rp; png_bytep rp;
png_uint_32 sum = 0; png_uint_32 sum = 0;
png_uint_32 i; png_uint_32 i;
int j;
int v; int v;
for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++) for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
@ -1445,6 +1444,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{ {
png_uint_32 sumhi, sumlo; png_uint_32 sumhi, sumlo;
int j;
sumlo = sum & PNG_LOMASK; sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */ sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */
@ -1484,7 +1484,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
{ {
png_bytep rp, lp, dp; png_bytep rp, lp, dp;
png_uint_32 i; png_uint_32 i;
int j;
for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp; for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp;
i++, rp++, dp++) i++, rp++, dp++)
{ {
@ -1503,7 +1502,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_bytep rp, dp, lp; png_bytep rp, dp, lp;
png_uint_32 sum = 0, lmins = mins; png_uint_32 sum = 0, lmins = mins;
png_uint_32 i; png_uint_32 i;
int j;
int v; int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
@ -1513,6 +1511,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
*/ */
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{ {
int j;
png_uint_32 lmhi, lmlo; png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK; lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
@ -1561,6 +1560,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{ {
int j;
png_uint_32 sumhi, sumlo; png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK; sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
@ -1615,13 +1615,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_bytep rp, dp, pp; png_bytep rp, dp, pp;
png_uint_32 sum = 0, lmins = mins; png_uint_32 sum = 0, lmins = mins;
png_uint_32 i; png_uint_32 i;
int j;
int v; int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{ {
int j;
png_uint_32 lmhi, lmlo; png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK; lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
@ -1663,6 +1663,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{ {
int j;
png_uint_32 sumhi, sumlo; png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK; sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
@ -1720,12 +1721,12 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_bytep rp, dp, pp, lp; png_bytep rp, dp, pp, lp;
png_uint_32 sum = 0, lmins = mins; png_uint_32 sum = 0, lmins = mins;
png_uint_32 i; png_uint_32 i;
int j;
int v; int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{ {
int j;
png_uint_32 lmhi, lmlo; png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK; lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
@ -1774,6 +1775,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{ {
int j;
png_uint_32 sumhi, sumlo; png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK; sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
@ -1852,12 +1854,12 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_bytep rp, dp, pp, cp, lp; png_bytep rp, dp, pp, cp, lp;
png_uint_32 sum = 0, lmins = mins; png_uint_32 sum = 0, lmins = mins;
png_uint_32 i; png_uint_32 i;
int j;
int v; int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{ {
int j;
png_uint_32 lmhi, lmlo; png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK; lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
@ -1938,6 +1940,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{ {
int j;
png_uint_32 sumhi, sumlo; png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK; sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;

View File

@ -29,7 +29,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.1b PNGMIN = 1.0.1c
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h # where make install puts libpng.a, libpng.so*, and png.h

View File

@ -29,7 +29,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.1b PNGMIN = 1.0.1c
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h # where make install puts libpng.a, libpng.so*, and png.h

View File

@ -22,7 +22,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 2 PNGMAJ = 2
PNGMIN = 1.0.1b PNGMIN = 1.0.1c
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h # where make install puts libpng.a, libpng.so*, and png.h