Imported from libpng-1.0.11rc1.tar
This commit is contained in:
parent
e1eff58f87
commit
82ae383331
6
ANNOUNCE
6
ANNOUNCE
@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.0.11beta3 - April 15, 2001
|
||||
Libpng 1.0.11rc1 - April 20, 2001
|
||||
|
||||
This is a public release of libpng, intended for use in production codes.
|
||||
|
||||
@ -10,7 +10,9 @@ Changes since the last public release (1.0.10):
|
||||
Changed several "//" single-line comments to C-style in pnggccrd.c
|
||||
Removed PNGAPI from private functions whose prototypes did not have PNGAPI.
|
||||
Updated scripts/pngos2.def
|
||||
Added checking the results of many instances of png_malloc() for NULL
|
||||
Added makefile.netbsd
|
||||
Added a check for NULL return from user's malloc_fn().
|
||||
Removed some useless type casts of the NULL pointer.
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||
|
7
CHANGES
7
CHANGES
@ -921,8 +921,13 @@ version 1.0.11beta1 [April 3, 2001]
|
||||
version 1.0.11beta2 [April 11, 2001]
|
||||
Removed PNGAPI from several functions whose prototypes did not have PNGAPI.
|
||||
Updated scripts/pngos2.def
|
||||
version 1.0.11beta3 [April 15, 2001]
|
||||
version 1.0.11beta3 [April 14, 2001]
|
||||
Added checking the results of many instances of png_malloc() for NULL
|
||||
version 1.0.11rc1 [April 20, 2001]
|
||||
Undid the changes from version 1.0.11beta3. Added a check for NULL return
|
||||
from user's malloc_fn().
|
||||
Removed some useless type casts of the NULL pointer.
|
||||
Added makefile.netbsd .
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||
|
13
INSTALL
13
INSTALL
@ -1,5 +1,5 @@
|
||||
|
||||
Installing libpng version 1.0.11beta3 - April 15, 2001
|
||||
Installing libpng version 1.0.11rc1 - April 20, 2001
|
||||
|
||||
Before installing libpng, you must first install zlib. zlib
|
||||
can usually be found wherever you got libpng. zlib can be
|
||||
@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
|
||||
version of zlib that's installed.
|
||||
|
||||
You can rename the directories that you downloaded (they
|
||||
might be called "libpng-1.0.11beta3" or "lpng109" and "zlib-1.1.3"
|
||||
might be called "libpng-1.0.11rc1" or "lpng109" and "zlib-1.1.3"
|
||||
or "zlib113") so that you have directories called "zlib" and "libpng".
|
||||
|
||||
Your directory structure should look like this:
|
||||
@ -60,8 +60,8 @@ The files that are presently available in the scripts directory
|
||||
include
|
||||
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11beta3)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11beta3,
|
||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11rc1)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11rc1,
|
||||
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
|
||||
@ -76,10 +76,11 @@ 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.macosx => MACOS X Makefile
|
||||
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD
|
||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11beta3)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11rc1)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.11beta3)
|
||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.11rc1)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.mips => MIPS makefile
|
||||
makefile.acorn => Acorn makefile
|
||||
|
5
KNOWNBUG
5
KNOWNBUG
@ -25,4 +25,7 @@ Known bugs in libpng-1.0.10
|
||||
4. April 14, 2001: Many instances of png_malloc() are not followed by
|
||||
a check to make sure it didn't return NULL.
|
||||
|
||||
STATUS: tests were added in libpng-1.0.11beta3.
|
||||
STATUS: This only seems to matter if the user is using a custom
|
||||
malloc_fn() that returns NULL. In libpng-1.0.11rc1 the return from
|
||||
malloc_fn() will be checked for NULL and png_error() issued if one
|
||||
is found.
|
||||
|
4
LICENSE
4
LICENSE
@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.0.11beta3, April 15, 2001, are
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.0.11rc1, April 20, 2001, are
|
||||
Copyright (c) 2000, 2001 Glenn Randers-Pehrson
|
||||
and are distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
with the following individuals added to the list of Contributing Authors
|
||||
@ -99,4 +99,4 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
randeg@alum.rpi.edu
|
||||
April 15, 2001
|
||||
April 20, 2001
|
||||
|
11
README
11
README
@ -1,4 +1,4 @@
|
||||
README for libpng 1.0.11beta3 - April 15, 2001 (shared library 2.1)
|
||||
README for libpng 1.0.11rc1 - April 20, 2001 (shared library 2.1)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
@ -183,9 +183,9 @@ Files in this distribution:
|
||||
descrip.mms => VMS makefile for MMS or MMK
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng.so.2.1.0.11beta3)
|
||||
(gcc, creates libpng.so.2.1.0.11rc1)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
||||
libpng.so.2.1.0.11beta3, uses assembler code
|
||||
libpng.so.2.1.0.11rc1, 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
|
||||
@ -200,11 +200,12 @@ 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.macosx => MACOS X Makefile
|
||||
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD
|
||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11beta3)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11rc1)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile
|
||||
(gcc, creates libpng.so.2.1.0.11beta3)
|
||||
(gcc, creates libpng.so.2.1.0.11rc1)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.mips => MIPS makefile
|
||||
makefile.acorn => Acorn makefile
|
||||
|
4
Y2KINFO
4
Y2KINFO
@ -1,13 +1,13 @@
|
||||
Y2K compliance in libpng:
|
||||
=========================
|
||||
|
||||
April 15, 2001
|
||||
April 20, 2001
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.0.11beta3 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.11rc1 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
2
configure
vendored
@ -1,5 +1,5 @@
|
||||
echo "
|
||||
There is no \"configure\" script for Libpng-1.0.11beta3. Instead, please
|
||||
There is no \"configure\" script for Libpng-1.0.11rc1. Instead, please
|
||||
copy the appropriate makefile for your system from the \"scripts\"
|
||||
directory. Read the INSTALL file for more details.
|
||||
"
|
||||
|
@ -338,7 +338,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
||||
|
||||
for (row = 0; row < height; row++)
|
||||
{
|
||||
row_pointers[row] = malloc(png_get_rowbytes(png_ptr, info_ptr));
|
||||
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
||||
info_ptr));
|
||||
}
|
||||
|
||||
/* Now it's time to read the image. One of these methods is REQUIRED */
|
||||
@ -605,8 +606,6 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
/* set the palette if there is one. REQUIRED for indexed-color images */
|
||||
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
|
||||
* sizeof (png_color));
|
||||
if (palette == NULL)
|
||||
png_error(png_ptr, "Example: malloc of palette failed");
|
||||
/* ... set palette colors ... */
|
||||
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
||||
/* You must not free palette here, because png_set_PLTE only makes a link to
|
||||
|
21
libpng.3
21
libpng.3
@ -1,6 +1,6 @@
|
||||
.TH LIBPNG 3 "April 15, 2001"
|
||||
.TH LIBPNG 3 "April 20, 2001"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11beta3
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11rc1
|
||||
.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.11beta3 - April 15, 2001
|
||||
libpng version 1.0.11rc1 - April 20, 2001
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<randeg@alum.rpi.edu>
|
||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
@ -3061,6 +3061,10 @@ Your replacement memory functions must have prototypes as follows:
|
||||
png_uint_32 size);
|
||||
void free_fn(png_structp png_ptr, png_voidp ptr);
|
||||
|
||||
Your malloc_fn() can return NULL in case of failure. The png_malloc()
|
||||
function will call png_error() if it receives a NULL from the system
|
||||
memory allocator or from your replacement malloc_fn().
|
||||
|
||||
Input/Output in libpng is done through png_read() and png_write(),
|
||||
which currently just call fread() and fwrite(). The FILE * is stored in
|
||||
png_struct and is initialized via png_init_io(). If you wish to change
|
||||
@ -3464,13 +3468,13 @@ application:
|
||||
|
||||
.SH VIII. Y2K Compliance in libpng
|
||||
|
||||
April 15, 2001
|
||||
April 20, 2001
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.0.11beta3 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.11rc1 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
|
||||
@ -3580,6 +3584,7 @@ the first widely used release:
|
||||
1.0.10rc1 1 10010 2.1.0.10rc1
|
||||
1.0.10 1 10010 2.1.0.10
|
||||
1.0.11beta1-3 1 10011 2.1.0.11beta1-3
|
||||
1.0.11rc1 1 10011 2.1.0.11rc1
|
||||
|
||||
Henceforth the source version will match the shared-library minor
|
||||
and patch numbers; the shared-library major version number will be
|
||||
@ -3637,7 +3642,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.0.11beta3 - April 15, 2001:
|
||||
Libpng version 1.0.11rc1 - April 20, 2001:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
|
||||
|
||||
@ -3654,7 +3659,7 @@ included in the libpng distribution, the latter shall prevail.)
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.0.11beta3, April 15, 2001, are
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.0.11rc1, April 20, 2001, are
|
||||
Copyright (c) 2000-2001 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
with the following individuals added to the list of Contributing Authors
|
||||
@ -3746,7 +3751,7 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
randeg@alum.rpi.edu
|
||||
April 15, 2001
|
||||
April 20, 2001
|
||||
|
||||
.\" end of man page
|
||||
|
||||
|
10
libpng.txt
10
libpng.txt
@ -1,6 +1,6 @@
|
||||
libpng.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.0.11beta3 - April 15, 2001
|
||||
libpng version 1.0.11rc1 - April 20, 2001
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<randeg@alum.rpi.edu>
|
||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
@ -2314,6 +2314,10 @@ Your replacement memory functions must have prototypes as follows:
|
||||
png_uint_32 size);
|
||||
void free_fn(png_structp png_ptr, png_voidp ptr);
|
||||
|
||||
Your malloc_fn() can return NULL in case of failure. The png_malloc()
|
||||
function will call png_error() if it receives a NULL from the system
|
||||
memory allocator or from your replacement malloc_fn().
|
||||
|
||||
Input/Output in libpng is done through png_read() and png_write(),
|
||||
which currently just call fread() and fwrite(). The FILE * is stored in
|
||||
png_struct and is initialized via png_init_io(). If you wish to change
|
||||
@ -2717,13 +2721,13 @@ application:
|
||||
|
||||
VIII. Y2K Compliance in libpng
|
||||
|
||||
April 15, 2001
|
||||
April 20, 2001
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.0.11beta3 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.0.11rc1 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
.TH LIBPNGPF 3 "April 15, 2001"
|
||||
.TH LIBPNGPF 3 "April 20, 2001"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11beta3
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11rc1
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB#include <png.h>\fP
|
||||
|
2
png.5
2
png.5
@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "April 15, 2001"
|
||||
.TH PNG 5 "April 20, 2001"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
|
75
png.c
75
png.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* libpng version 1.0.11beta3 - April 15, 2001
|
||||
* libpng version 1.0.11rc1 - April 20, 2001
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -13,14 +13,14 @@
|
||||
#include "png.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_0_11beta3 Your_png_h_is_not_version_1_0_11beta3;
|
||||
typedef version_1_0_11rc1 Your_png_h_is_not_version_1_0_11rc1;
|
||||
|
||||
/* Version information for C files. This had better match the version
|
||||
* string defined in png.h. */
|
||||
|
||||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
||||
const char png_libpng_ver[18] = "1.0.11beta3";
|
||||
const char png_libpng_ver[18] = "1.0.11rc1";
|
||||
|
||||
/* png_sig was changed to a function in version 1.0.5c */
|
||||
/* Place to hold the signature string for a PNG file. */
|
||||
@ -142,18 +142,15 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
||||
png_voidp ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
|
||||
|
||||
#ifndef PNG_NO_ZALLOC_ZERO
|
||||
if (ptr)
|
||||
if (num_bytes > (png_uint_32)0x8000L)
|
||||
{
|
||||
if (num_bytes > (png_uint_32)0x8000L)
|
||||
{
|
||||
png_memset(ptr, 0, (png_size_t)0x8000L);
|
||||
png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0,
|
||||
(png_size_t)(num_bytes - (png_uint_32)0x8000L));
|
||||
}
|
||||
else
|
||||
{
|
||||
png_memset(ptr, 0, (png_size_t)num_bytes);
|
||||
}
|
||||
png_memset(ptr, 0, (png_size_t)0x8000L);
|
||||
png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0,
|
||||
(png_size_t)(num_bytes - (png_uint_32)0x8000L));
|
||||
}
|
||||
else
|
||||
{
|
||||
png_memset(ptr, 0, (png_size_t)num_bytes);
|
||||
}
|
||||
#endif
|
||||
return ((voidpf)ptr);
|
||||
@ -285,7 +282,8 @@ png_data_freer(png_structp png_ptr, png_infop info_ptr,
|
||||
#endif
|
||||
|
||||
void PNGAPI
|
||||
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num)
|
||||
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
|
||||
int num)
|
||||
{
|
||||
png_debug(1, "in png_free_data\n");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
@ -584,31 +582,27 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
||||
sizeof(char)));
|
||||
}
|
||||
|
||||
if (png_ptr->time_buffer == NULL)
|
||||
png_warning(png_ptr, "Malloc of buffer for tIME chunk failed");
|
||||
else
|
||||
{
|
||||
#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);
|
||||
}
|
||||
{
|
||||
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];
|
||||
sprintf(near_time_buf, "%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);
|
||||
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
||||
29*sizeof(char));
|
||||
}
|
||||
{
|
||||
char near_time_buf[29];
|
||||
sprintf(near_time_buf, "%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);
|
||||
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
||||
29*sizeof(char));
|
||||
}
|
||||
#else
|
||||
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
|
||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||
@ -616,7 +610,6 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
||||
ptime->second % 61);
|
||||
#endif
|
||||
#endif /* _WIN32_WCE */
|
||||
}
|
||||
return ((png_charp)png_ptr->time_buffer);
|
||||
}
|
||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
||||
@ -634,7 +627,7 @@ png_charp PNGAPI
|
||||
png_get_copyright(png_structp png_ptr)
|
||||
{
|
||||
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
|
||||
return ((png_charp) "\n libpng version 1.0.11beta3 - April 15, 2001\n\
|
||||
return ((png_charp) "\n libpng version 1.0.11rc1 - April 20, 2001\n\
|
||||
Copyright (c) 1998-2001 Glenn Randers-Pehrson\n\
|
||||
Copyright (c) 1996, 1997 Andreas Dilger\n\
|
||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n");
|
||||
@ -652,8 +645,8 @@ png_get_libpng_ver(png_structp png_ptr)
|
||||
{
|
||||
/* Version of *.c files used when building libpng */
|
||||
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||
return((png_charp) "1.0.11beta3");
|
||||
return((png_charp) "1.0.11beta3");
|
||||
return((png_charp) "1.0.11rc1");
|
||||
return((png_charp) "1.0.11rc1");
|
||||
}
|
||||
|
||||
png_charp PNGAPI
|
||||
|
23
png.h
23
png.h
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.0.11beta3 - April 15, 2001
|
||||
* libpng version 1.0.11rc1 - April 20, 2001
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -9,7 +9,7 @@
|
||||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.0.11beta3 - April 15, 2001: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.0.11rc1 - April 20, 2001: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@ -68,6 +68,7 @@
|
||||
* 1.0.10rc1 1 10010 2.1.0.10rc1
|
||||
* 1.0.10 1 10010 2.1.0.10
|
||||
* 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
|
||||
* 1.0.11rc1 1 10011 2.1.0.11rc1
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -97,7 +98,7 @@
|
||||
* If you modify libpng you may insert additional notices immediately following
|
||||
* this sentence.
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000, through 1.0.11beta3, April 15, 2001, are
|
||||
* libpng versions 1.0.7, July 1, 2000, through 1.0.11rc1, April 20, 2001, are
|
||||
* Copyright (c) 2000, 2001 Glenn Randers-Pehrson, and are
|
||||
* distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
* with the following individuals added to the list of Contributing Authors
|
||||
@ -202,13 +203,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* April 15, 2001
|
||||
* April 20, 2001
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.0.11beta3 are Y2K compliant. It is my belief that earlier
|
||||
* upward through 1.0.11rc1 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
|
||||
@ -264,7 +265,7 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.0.11beta3"
|
||||
#define PNG_LIBPNG_VER_STRING "1.0.11rc1"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 2
|
||||
#define PNG_LIBPNG_VER_DLLNUM %DLLNUM%
|
||||
@ -276,7 +277,7 @@
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
|
||||
|
||||
#define PNG_LIBPNG_VER_BUILD 3
|
||||
#define PNG_LIBPNG_VER_BUILD 1
|
||||
|
||||
#define PNG_LIBPNG_BUILD_ALPHA 1
|
||||
#define PNG_LIBPNG_BUILD_BETA 2
|
||||
@ -284,7 +285,7 @@
|
||||
#define PNG_LIBPNG_BUILD_STABLE 4
|
||||
#define PNG_LIBPNG_BUILD_TYPEMASK 7
|
||||
#define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with STABLE only */
|
||||
#define PNG_LIBPNG_BUILD_TYPE 2
|
||||
#define PNG_LIBPNG_BUILD_TYPE 3
|
||||
|
||||
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
||||
* We must not include leading zeros.
|
||||
@ -1185,9 +1186,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.11beta3
|
||||
and png.h are both at * version 1.0.11rc1
|
||||
*/
|
||||
typedef png_structp version_1_0_11beta3;
|
||||
typedef png_structp version_1_0_11rc1;
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
@ -2235,7 +2236,7 @@ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
|
||||
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
|
||||
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.0.11beta3 - April 15, 2001 (header)\n"
|
||||
" libpng version 1.0.11rc1 - April 20, 2001 (header)\n"
|
||||
|
||||
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||
/* With these routines we avoid an integer divide, which will be slower on
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* pngasmrd.h - assembler version of utilities to read a PNG file
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 2001 Glenn Randers-Pehrson
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -61,11 +61,12 @@ png_warning(png_structp png_ptr, png_const_charp message)
|
||||
*/
|
||||
#define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||
static PNG_CONST char png_digit[16] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
|
||||
};
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
|
||||
'F' };
|
||||
|
||||
static void /* PRIVATE */
|
||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp message)
|
||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||
message)
|
||||
{
|
||||
int iout = 0, iin = 0;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
|
||||
* for Intel's performance analysis of the MMX vs. non-MMX code.
|
||||
*
|
||||
* libpng version 1.0.11beta3 - April 15, 2001
|
||||
* libpng version 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998, Intel Corporation
|
||||
|
4
pngget.c
4
pngget.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -137,7 +137,7 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
||||
#if defined(PNG_pHYs_SUPPORTED)
|
||||
if (info_ptr->valid & PNG_INFO_pHYs)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
|
||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
|
||||
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
||||
return (0);
|
||||
else return (info_ptr->y_pixels_per_unit);
|
||||
|
20
pngmem.c
20
pngmem.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -119,7 +119,12 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if(png_ptr->malloc_fn != NULL)
|
||||
return ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
|
||||
{
|
||||
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
|
||||
if (ret == NULL)
|
||||
png_error(png_ptr, "Out of memory!");
|
||||
return (ret);
|
||||
}
|
||||
else
|
||||
return png_malloc_default(png_ptr, size);
|
||||
}
|
||||
@ -373,15 +378,18 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
|
||||
png_voidp PNGAPI
|
||||
png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||
{
|
||||
#ifndef PNG_USER_MEM_SUPPORTED
|
||||
png_voidp ret;
|
||||
#endif
|
||||
if (png_ptr == NULL || size == 0)
|
||||
return ((png_voidp)NULL);
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if(png_ptr->malloc_fn != NULL)
|
||||
return ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
|
||||
{
|
||||
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
|
||||
if (ret == NULL)
|
||||
png_error(png_ptr, "Out of Memory!");
|
||||
return (ret);
|
||||
}
|
||||
else
|
||||
return (png_malloc_default(png_ptr, size));
|
||||
}
|
||||
@ -407,9 +415,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
||||
#endif
|
||||
|
||||
if (ret == NULL)
|
||||
{
|
||||
png_error(png_ptr, "Out of Memory");
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
168
pngpread.c
168
pngpread.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -585,18 +585,9 @@ png_push_save_buffer(png_structp png_ptr)
|
||||
old_buffer = png_ptr->save_buffer;
|
||||
png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)new_max);
|
||||
if (png_ptr->save_buffer == (png_bytep)NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Malloc of save buffer failed");
|
||||
png_ptr->save_buffer=old_buffer;
|
||||
png_ptr->current_buffer_size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||
png_free(png_ptr, old_buffer);
|
||||
png_ptr->save_buffer_max = new_max;
|
||||
}
|
||||
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||
png_free(png_ptr, old_buffer);
|
||||
png_ptr->save_buffer_max = new_max;
|
||||
}
|
||||
if (png_ptr->current_buffer_size)
|
||||
{
|
||||
@ -1004,7 +995,8 @@ png_read_push_finish_row(png_structp png_ptr)
|
||||
|
||||
#if defined(PNG_READ_tEXt_SUPPORTED)
|
||||
void /* PRIVATE */
|
||||
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length)
|
||||
{
|
||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||
{
|
||||
@ -1016,7 +1008,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
png_ptr->skip_length = 0; /* This may not be necessary */
|
||||
|
||||
if (length > (png_uint_32)65535L) /* Can't hold the entire string in memory */
|
||||
if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
|
||||
{
|
||||
png_warning(png_ptr, "tEXt chunk too large to fit in memory");
|
||||
png_ptr->skip_length = length - (png_uint_32)65535L;
|
||||
@ -1026,12 +1018,6 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
|
||||
|
||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||
(png_uint_32)(length+1));
|
||||
if (png_ptr->current_text == (png_charp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "malloc of current text failed");
|
||||
png_ptr->skip_length=length;
|
||||
return;
|
||||
}
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
@ -1083,11 +1069,6 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
||||
text++;
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||
if (text_ptr == (png_textp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "malloc of text buffer failed");
|
||||
return;
|
||||
}
|
||||
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text_ptr->key = key;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
@ -1106,7 +1087,8 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
||||
|
||||
#if defined(PNG_READ_zTXt_SUPPORTED)
|
||||
void /* PRIVATE */
|
||||
png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length)
|
||||
{
|
||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||
{
|
||||
@ -1130,12 +1112,6 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
|
||||
|
||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||
(png_uint_32)(length+1));
|
||||
if (png_ptr->current_text == (png_charp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "malloc of zTXt buffer failed");
|
||||
png_push_crc_skip(png_ptr, length);
|
||||
return;
|
||||
}
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
@ -1224,19 +1200,14 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
if (text == NULL)
|
||||
{
|
||||
text = (png_charp)png_malloc(png_ptr,
|
||||
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out +
|
||||
key_size + 1));
|
||||
if (text == (png_charp)NULL)
|
||||
png_warning(png_ptr, "Malloc of text block failed");
|
||||
else
|
||||
{
|
||||
png_memcpy(text + key_size, png_ptr->zbuf,
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||
png_memcpy(text, key, key_size);
|
||||
text_size = key_size + png_ptr->zbuf_size -
|
||||
png_ptr->zstream.avail_out;
|
||||
*(text + text_size) = '\0';
|
||||
}
|
||||
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out
|
||||
+ key_size + 1));
|
||||
png_memcpy(text + key_size, png_ptr->zbuf,
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||
png_memcpy(text, key, key_size);
|
||||
text_size = key_size + png_ptr->zbuf_size -
|
||||
png_ptr->zstream.avail_out;
|
||||
*(text + text_size) = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1246,17 +1217,12 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
text = (png_charp)png_malloc(png_ptr, text_size +
|
||||
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out
|
||||
+ 1));
|
||||
if (text != (png_charp)NULL)
|
||||
png_warning(png_ptr, "Malloc of new text block failed");
|
||||
else
|
||||
{
|
||||
png_memcpy(text, tmp, text_size);
|
||||
png_free(png_ptr, tmp);
|
||||
png_memcpy(text + text_size, png_ptr->zbuf,
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||
*(text + text_size) = '\0';
|
||||
}
|
||||
png_memcpy(text, tmp, text_size);
|
||||
png_free(png_ptr, tmp);
|
||||
png_memcpy(text + text_size, png_ptr->zbuf,
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||
*(text + text_size) = '\0';
|
||||
}
|
||||
if (ret != Z_STREAM_END)
|
||||
{
|
||||
@ -1288,30 +1254,26 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
text += key_size;
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||
if (text_ptr == (png_textp)NULL)
|
||||
png_warning (png_ptr, "Malloc of iTXt failed");
|
||||
else
|
||||
{
|
||||
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||
text_ptr->key = key;
|
||||
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||
text_ptr->key = key;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
text_ptr->lang = (char *)NULL;
|
||||
text_ptr->lang_key = (char *)NULL;
|
||||
text_ptr->lang = (char *)NULL;
|
||||
text_ptr->lang_key = (char *)NULL;
|
||||
#endif
|
||||
text_ptr->text = text;
|
||||
text_ptr->text = text;
|
||||
|
||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||
|
||||
png_free(png_ptr, text_ptr);
|
||||
}
|
||||
png_free(png_ptr, key);
|
||||
png_free(png_ptr, text_ptr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_iTXt_SUPPORTED)
|
||||
void /* PRIVATE */
|
||||
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length)
|
||||
{
|
||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||
{
|
||||
@ -1323,7 +1285,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
png_ptr->skip_length = 0; /* This may not be necessary */
|
||||
|
||||
if (length > (png_uint_32)65535L) /* Can't hold the entire string in memory */
|
||||
if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
|
||||
{
|
||||
png_warning(png_ptr, "iTXt chunk too large to fit in memory");
|
||||
png_ptr->skip_length = length - (png_uint_32)65535L;
|
||||
@ -1333,16 +1295,11 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
|
||||
|
||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||
(png_uint_32)(length+1));
|
||||
if (png_ptr->current_text == (png_charp)NULL)
|
||||
png_warning (png_ptr, "malloc of iTXt buffer failed");
|
||||
else
|
||||
{
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
png_ptr->current_text_left = (png_size_t)length;
|
||||
png_ptr->process_mode = PNG_READ_iTXt_MODE;
|
||||
}
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
png_ptr->current_text_left = (png_size_t)length;
|
||||
png_ptr->process_mode = PNG_READ_iTXt_MODE;
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
@ -1406,10 +1363,6 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
text++;
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||
if(text_ptr == (png_textp)NULL)
|
||||
png_warning (png_ptr, "Malloc of iTXt pointer failed");
|
||||
else
|
||||
{
|
||||
text_ptr->compression = comp_flag + 2;
|
||||
text_ptr->key = key;
|
||||
text_ptr->lang = lang;
|
||||
@ -1421,7 +1374,6 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||
|
||||
png_free(png_ptr, text_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1431,7 +1383,8 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
* name or a critical chunk), the chunk is (currently) silently ignored.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length)
|
||||
{
|
||||
png_uint_32 skip=0;
|
||||
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
||||
@ -1442,7 +1395,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
|
||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
HANDLE_CHUNK_ALWAYS
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
&& png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL
|
||||
&& png_ptr->read_user_chunk_fn == NULL
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
@ -1469,30 +1422,25 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
|
||||
|
||||
png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
||||
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
||||
if (chunk.data == (png_bytep)NULL)
|
||||
png_warning (png_ptr, "Malloc of unknown chunk data failed");
|
||||
else
|
||||
{
|
||||
png_crc_read(png_ptr, chunk.data, length);
|
||||
chunk.size = length;
|
||||
png_crc_read(png_ptr, chunk.data, length);
|
||||
chunk.size = length;
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
if(png_ptr->read_user_chunk_fn != (png_user_chunk_ptr)NULL)
|
||||
{
|
||||
/* callback to user unknown chunk handler */
|
||||
if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
|
||||
{
|
||||
if (!(png_ptr->chunk_name[0] & 0x20))
|
||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
HANDLE_CHUNK_ALWAYS)
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
}
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
||||
png_free(png_ptr, chunk.data);
|
||||
if(png_ptr->read_user_chunk_fn != NULL)
|
||||
{
|
||||
/* callback to user unknown chunk handler */
|
||||
if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
|
||||
{
|
||||
if (!(png_ptr->chunk_name[0] & 0x20))
|
||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
HANDLE_CHUNK_ALWAYS)
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
}
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
||||
png_free(png_ptr, chunk.data);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
23
pngread.c
23
pngread.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -115,8 +115,6 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)png_ptr->zbuf_size);
|
||||
if (png_ptr->zbuf == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate zbuf");
|
||||
png_ptr->zstream.zalloc = png_zalloc;
|
||||
png_ptr->zstream.zfree = png_zfree;
|
||||
png_ptr->zstream.opaque = (voidpf)png_ptr;
|
||||
@ -199,8 +197,6 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)png_ptr->zbuf_size);
|
||||
if (png_ptr->zbuf == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate zbuf");
|
||||
png_ptr->zstream.zalloc = png_zalloc;
|
||||
png_ptr->zstream.zfree = png_zfree;
|
||||
png_ptr->zstream.opaque = (voidpf)png_ptr;
|
||||
@ -719,7 +715,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||
* not called png_set_interlace_handling(), the display_row buffer will
|
||||
* be ignored, so pass NULL to it.
|
||||
*
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11beta3
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11rc1
|
||||
*/
|
||||
|
||||
void PNGAPI
|
||||
@ -768,7 +764,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
|
||||
* only call this function once. If you desire to have an image for
|
||||
* each pass of a interlaced image, use png_read_rows() instead.
|
||||
*
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11beta3
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11rc1
|
||||
*/
|
||||
void PNGAPI
|
||||
png_read_image(png_structp png_ptr, png_bytepp image)
|
||||
@ -1322,8 +1318,6 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
{
|
||||
info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
|
||||
info_ptr->height * sizeof(png_bytep));
|
||||
if (info_ptr->row_pointers)
|
||||
png_error(png_ptr, "png_read_png could not allocate row pointers");
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_ROWS;
|
||||
#endif
|
||||
@ -1331,15 +1325,6 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
{
|
||||
info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
|
||||
png_get_rowbytes(png_ptr, info_ptr));
|
||||
if (info_ptr->row_pointers)
|
||||
{
|
||||
int allocated_row;
|
||||
for (allocated_row=0; allocated_row < row; allocated_row++)
|
||||
png_free(png_ptr, info_ptr->row_pointers[allocated_row]);
|
||||
if (info_ptr->free_me & !(PNG_FREE_ROWS))
|
||||
png_free (png_ptr, info_ptr->row_pointers);
|
||||
png_error(png_ptr, "png_read_png could not allocate row pointer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1349,7 +1334,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
||||
png_read_end(png_ptr, info_ptr);
|
||||
|
||||
if(transforms == 0 || params == (voidp)NULL)
|
||||
if(transforms == 0 || params == NULL)
|
||||
/* quiet compiler warnings */ return;
|
||||
|
||||
}
|
||||
|
2
pngrio.c
2
pngrio.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
113
pngrtran.c
113
pngrtran.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -155,11 +155,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
|
||||
png_ptr->dither_index = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)(num_palette * sizeof (png_byte)));
|
||||
if (png_ptr->dither_index == (png_bytep)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Malloc of dither index failed");
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < num_palette; i++)
|
||||
png_ptr->dither_index[i] = (png_byte)i;
|
||||
}
|
||||
@ -177,12 +172,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
/* initialize an array to sort colors */
|
||||
sort = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_palette
|
||||
* sizeof (png_byte)));
|
||||
if (sort == (png_bytep)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Malloc of sort array for dither failed");
|
||||
png_free (png_ptr, png_ptr->dither_index);
|
||||
return;
|
||||
}
|
||||
|
||||
/* initialize the sort array */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
@ -313,14 +302,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
(png_uint_32)(num_palette * sizeof (png_byte)));
|
||||
palette_to_index = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)(num_palette * sizeof (png_byte)));
|
||||
if (index_to_palette == (png_bytep)NULL || palette_to_index ==
|
||||
(png_bytep)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Malloc of index array for dither failed");
|
||||
png_free (png_ptr, index_to_palette);
|
||||
png_free (png_ptr, png_ptr->dither_index);
|
||||
return;
|
||||
}
|
||||
|
||||
/* initialize the sort array */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
@ -331,14 +312,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
|
||||
hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 *
|
||||
sizeof (png_dsortp)));
|
||||
if (hash == (png_dsortpp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Malloc of hash array for dither failed");
|
||||
png_free (png_ptr, palette_to_index);
|
||||
png_free (png_ptr, index_to_palette);
|
||||
png_free (png_ptr, png_ptr->dither_index);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < 769; i++)
|
||||
hash[i] = NULL;
|
||||
/* png_memset(hash, 0, 769 * sizeof (png_dsortp)); */
|
||||
@ -373,13 +346,10 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
|
||||
t = (png_dsortp)png_malloc(png_ptr, (png_uint_32)(sizeof
|
||||
(png_dsort)));
|
||||
if (t != (png_dsortp)NULL)
|
||||
{
|
||||
t->next = hash[d];
|
||||
t->left = (png_byte)i;
|
||||
t->right = (png_byte)j;
|
||||
hash[d] = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -486,25 +456,16 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
|
||||
png_ptr->palette_lookup = (png_bytep )png_malloc(png_ptr,
|
||||
(png_uint_32)(num_entries * sizeof (png_byte)));
|
||||
if (png_ptr->palette_lookup == (png_bytep)NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Malloc of palette_lookup for dither failed");
|
||||
}
|
||||
else
|
||||
png_memset(png_ptr->palette_lookup, 0, num_entries * sizeof (png_byte));
|
||||
|
||||
png_memset(png_ptr->palette_lookup, 0, num_entries * sizeof (png_byte));
|
||||
|
||||
distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
|
||||
sizeof(png_byte)));
|
||||
if (distance == (png_bytep)NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Malloc of distance array for dither failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
png_memset(distance, 0xff, num_entries * sizeof(png_byte));
|
||||
|
||||
for (i = 0; i < num_palette; i++)
|
||||
{
|
||||
png_memset(distance, 0xff, num_entries * sizeof(png_byte));
|
||||
|
||||
for (i = 0; i < num_palette; i++)
|
||||
{
|
||||
int ir, ig, ib;
|
||||
int r = (palette[i].red >> (8 - PNG_DITHER_RED_BITS));
|
||||
int g = (palette[i].green >> (8 - PNG_DITHER_GREEN_BITS));
|
||||
@ -535,12 +496,11 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
png_ptr->palette_lookup[d_index] = (png_byte)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
png_free(png_ptr, distance);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -3898,11 +3858,6 @@ png_build_gamma_table(png_structp png_ptr)
|
||||
|
||||
png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)256);
|
||||
if (png_ptr->gamma_table == (png_bytep)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Malloc of gamma table failed");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
@ -3919,11 +3874,6 @@ png_build_gamma_table(png_structp png_ptr)
|
||||
|
||||
png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)256);
|
||||
if (png_ptr->gamma_to_1 == (png_bytep)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Malloc of gamma_to_1 table failed");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
@ -3934,11 +3884,6 @@ png_build_gamma_table(png_structp png_ptr)
|
||||
|
||||
png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)256);
|
||||
if (png_ptr->gamma_from_1 == (png_bytep)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Malloc of gamma_from_1 table failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if(png_ptr->screen_gamma > 0.000001)
|
||||
g = 1.0 / png_ptr->screen_gamma;
|
||||
@ -4001,11 +3946,6 @@ png_build_gamma_table(png_structp png_ptr)
|
||||
|
||||
png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,
|
||||
(png_uint_32)(num * sizeof (png_uint_16p)));
|
||||
if (png_ptr->gamma_16_table == (png_uint_16pp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Malloc of gamma_16 table failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
|
||||
{
|
||||
@ -4016,11 +3956,6 @@ png_build_gamma_table(png_structp png_ptr)
|
||||
{
|
||||
png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(256 * sizeof (png_uint_16)));
|
||||
if (png_ptr->gamma_16_table[i] == (png_uint_16p)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Malloc of gamma_16 table entry failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g = 1.0 / g;
|
||||
@ -4051,11 +3986,6 @@ png_build_gamma_table(png_structp png_ptr)
|
||||
{
|
||||
png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(256 * sizeof (png_uint_16)));
|
||||
if (png_ptr->gamma_16_table[i] == (png_uint_16p)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Malloc of gamma_16 table entry failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4);
|
||||
for (j = 0; j < 256; j++)
|
||||
@ -4076,22 +4006,11 @@ png_build_gamma_table(png_structp png_ptr)
|
||||
|
||||
png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,
|
||||
(png_uint_32)(num * sizeof (png_uint_16p )));
|
||||
if (png_ptr->gamma_16_to_1 == (png_uint_16pp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Malloc of gamma_16_to_1 table failed");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(256 * sizeof (png_uint_16)));
|
||||
if (png_ptr->gamma_16_to_1[i] == (png_uint_16p)NULL)
|
||||
{
|
||||
png_warning (png_ptr,
|
||||
"Malloc of gamma_16_to_1 table entry failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ig = (((png_uint_32)i *
|
||||
(png_uint_32)png_gamma_shift[shift]) >> 4);
|
||||
@ -4110,23 +4029,11 @@ png_build_gamma_table(png_structp png_ptr)
|
||||
|
||||
png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,
|
||||
(png_uint_32)(num * sizeof (png_uint_16p)));
|
||||
if (png_ptr->gamma_16_from_1 == (png_uint_16pp)NULL)
|
||||
{
|
||||
png_warning (png_ptr,
|
||||
"Malloc of gamma_16_from_1 table failed");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(256 * sizeof (png_uint_16)));
|
||||
if (png_ptr->gamma_16_from_1[i] == (png_uint_16p)NULL)
|
||||
{
|
||||
png_warning (png_ptr,
|
||||
"Malloc of gamma_16_from_1 table failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ig = (((png_uint_32)i *
|
||||
(png_uint_32)png_gamma_shift[shift]) >> 4);
|
||||
|
205
pngrutil.c
205
pngrutil.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -201,19 +201,15 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
{
|
||||
text_size = prefix_size + sizeof(msg) + 1;
|
||||
text = (png_charp)png_malloc(png_ptr, text_size);
|
||||
if (text != NULL)
|
||||
png_memcpy(text, chunkdata, prefix_size);
|
||||
png_memcpy(text, chunkdata, prefix_size);
|
||||
}
|
||||
|
||||
if (text != NULL)
|
||||
{
|
||||
text[text_size - 1] = 0x00;
|
||||
text[text_size - 1] = 0x00;
|
||||
|
||||
/* Copy what we can of the error message into the text chunk */
|
||||
text_size = (png_size_t)(chunklength - (text - chunkdata) - 1);
|
||||
text_size = sizeof(msg) > text_size ? text_size : sizeof(msg);
|
||||
png_memcpy(text + prefix_size, msg, text_size + 1);
|
||||
}
|
||||
/* Copy what we can of the error message into the text chunk */
|
||||
text_size = (png_size_t)(chunklength - (text - chunkdata) - 1);
|
||||
text_size = sizeof(msg) > text_size ? text_size : sizeof(msg);
|
||||
png_memcpy(text + prefix_size, msg, text_size + 1);
|
||||
break;
|
||||
}
|
||||
if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END)
|
||||
@ -223,13 +219,10 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
text_size = prefix_size +
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||
text = (png_charp)png_malloc(png_ptr, text_size + 1);
|
||||
if (text != NULL)
|
||||
{
|
||||
png_memcpy(text + prefix_size, png_ptr->zbuf,
|
||||
text_size - prefix_size);
|
||||
png_memcpy(text, chunkdata, prefix_size);
|
||||
*(text + text_size) = 0x00;
|
||||
}
|
||||
png_memcpy(text + prefix_size, png_ptr->zbuf,
|
||||
text_size - prefix_size);
|
||||
png_memcpy(text, chunkdata, prefix_size);
|
||||
*(text + text_size) = 0x00;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -238,20 +231,12 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
tmp = text;
|
||||
text = (png_charp)png_malloc(png_ptr, (png_uint_32)(text_size +
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
|
||||
if (text != NULL)
|
||||
{
|
||||
png_memcpy(text, tmp, text_size);
|
||||
png_free(png_ptr, tmp);
|
||||
png_memcpy(text + text_size, png_ptr->zbuf,
|
||||
(png_ptr->zbuf_size - png_ptr->zstream.avail_out));
|
||||
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||
*(text + text_size) = 0x00;
|
||||
}
|
||||
else
|
||||
{
|
||||
png_warning (png_ptr, "Could not malloc text buffer");
|
||||
text=tmp;
|
||||
}
|
||||
}
|
||||
if (ret == Z_STREAM_END)
|
||||
break;
|
||||
@ -285,13 +270,9 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
if (text == NULL)
|
||||
{
|
||||
text = (png_charp)png_malloc(png_ptr, text_size+1);
|
||||
if (text != NULL)
|
||||
png_memcpy(text, chunkdata, prefix_size);
|
||||
else
|
||||
png_warning(png_ptr, "Could not malloc text chunkdata");
|
||||
png_memcpy(text, chunkdata, prefix_size);
|
||||
}
|
||||
if (text != NULL)
|
||||
*(text + text_size) = 0x00;
|
||||
*(text + text_size) = 0x00;
|
||||
}
|
||||
|
||||
inflateReset(&png_ptr->zstream);
|
||||
@ -1002,14 +983,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
|
||||
chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
||||
slength = (png_size_t)length;
|
||||
if (chunkdata != (png_charp)NULL)
|
||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||
else
|
||||
{
|
||||
png_warning(png_ptr, "Could not allocate memory for iCCP chunk");
|
||||
png_crc_finish(png_ptr, slength);
|
||||
return;
|
||||
}
|
||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||
|
||||
if (png_crc_finish(png_ptr, skip))
|
||||
{
|
||||
@ -1105,16 +1079,8 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
#endif
|
||||
|
||||
chunkdata = (png_bytep)png_malloc(png_ptr, length + 1);
|
||||
if (chunkdata != (png_bytep)NULL)
|
||||
{
|
||||
slength = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||
}
|
||||
else
|
||||
{
|
||||
png_warning(png_ptr, "Could not allocate memory for sPLT chunk");
|
||||
skip = (png_size_t)length;
|
||||
}
|
||||
slength = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||
|
||||
if (png_crc_finish(png_ptr, skip))
|
||||
{
|
||||
@ -1151,12 +1117,6 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
new_palette.nentries = data_length / entry_size;
|
||||
new_palette.entries = (png_sPLT_entryp)png_malloc(
|
||||
png_ptr, new_palette.nentries * sizeof(png_sPLT_entry));
|
||||
if (new_palette.entries == (png_sPLT_entryp)NULL)
|
||||
{
|
||||
png_free(png_ptr, chunkdata);
|
||||
png_warning (png_ptr, "Could not allocate sPLT entries");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef PNG_NO_POINTER_INDEXING
|
||||
for (i = 0; i < new_palette.nentries; i++)
|
||||
@ -1566,12 +1526,6 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)\n",
|
||||
length + 1);
|
||||
purpose = (png_charp)png_malloc(png_ptr, length + 1);
|
||||
if (purpose == (png_charp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for pCAL purpose");
|
||||
png_crc_finish(png_ptr, length);
|
||||
return;
|
||||
}
|
||||
slength = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)purpose, slength);
|
||||
|
||||
@ -1628,11 +1582,6 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_debug(3, "Allocating pCAL parameters array\n");
|
||||
params = (png_charpp)png_malloc(png_ptr, (png_uint_32)(nparams
|
||||
*sizeof(png_charp))) ;
|
||||
if (params == (png_charpp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate pCAL parameters array");
|
||||
nparams=0;
|
||||
}
|
||||
|
||||
/* Get pointers to the start of each parameter string. */
|
||||
for (i = 0; i < (int)nparams; i++)
|
||||
@ -1697,12 +1646,6 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)\n",
|
||||
length + 1);
|
||||
buffer = (png_charp)png_malloc(png_ptr, length + 1);
|
||||
if (buffer == (png_charp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for sCAL buffer");
|
||||
png_crc_finish(png_ptr, length);
|
||||
return;
|
||||
}
|
||||
slength = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)buffer, slength);
|
||||
|
||||
@ -1726,8 +1669,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
#else
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
swidth = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1);
|
||||
if (swidth != (png_charp)NULL)
|
||||
png_memcpy(swidth, ep, (png_size_t)png_strlen(ep));
|
||||
png_memcpy(swidth, ep, (png_size_t)png_strlen(ep));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -1745,8 +1687,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
#else
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
sheight = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1);
|
||||
if (sheight != (png_charp)NULL)
|
||||
png_memcpy(sheight, ep, (png_size_t)png_strlen(ep));
|
||||
png_memcpy(sheight, ep, (png_size_t)png_strlen(ep));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -1855,14 +1796,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
|
||||
key = (png_charp)png_malloc(png_ptr, length + 1);
|
||||
slength = (png_size_t)length;
|
||||
if (key == (png_charp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for tEXt chunk");
|
||||
png_crc_finish(png_ptr, slength);
|
||||
return;
|
||||
}
|
||||
else
|
||||
png_crc_read(png_ptr, (png_bytep)key, slength);
|
||||
png_crc_read(png_ptr, (png_bytep)key, slength);
|
||||
|
||||
if (png_crc_finish(png_ptr, skip))
|
||||
{
|
||||
@ -1879,8 +1813,6 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
text++;
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||
if (text_ptr != (png_textp)NULL)
|
||||
{
|
||||
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text_ptr->key = key;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
@ -1893,11 +1825,8 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
|
||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||
|
||||
png_free(png_ptr, text_ptr);
|
||||
}
|
||||
else
|
||||
png_warning(png_ptr, "Could not allocate iTXt pointer");
|
||||
png_free(png_ptr, key);
|
||||
png_free(png_ptr, text_ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1931,17 +1860,8 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
#endif
|
||||
|
||||
chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
||||
if (chunkdata != (png_charp)NULL)
|
||||
{
|
||||
slength = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||
}
|
||||
else
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for zTXt chunk data");
|
||||
png_crc_finish(png_ptr, length);
|
||||
return;
|
||||
}
|
||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||
if (png_crc_finish(png_ptr, 0))
|
||||
{
|
||||
png_free(png_ptr, chunkdata);
|
||||
@ -1975,24 +1895,19 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
(png_size_t)length, prefix_len, &data_len);
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||
if (text_ptr != (png_textp)NULL)
|
||||
{
|
||||
text_ptr->compression = comp_type;
|
||||
text_ptr->key = chunkdata;
|
||||
text_ptr->compression = comp_type;
|
||||
text_ptr->key = chunkdata;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
text_ptr->lang = NULL;
|
||||
text_ptr->lang_key = NULL;
|
||||
text_ptr->itxt_length = 0;
|
||||
text_ptr->lang = NULL;
|
||||
text_ptr->lang_key = NULL;
|
||||
text_ptr->itxt_length = 0;
|
||||
#endif
|
||||
text_ptr->text = chunkdata + prefix_len;
|
||||
text_ptr->text_length = data_len;
|
||||
text_ptr->text = chunkdata + prefix_len;
|
||||
text_ptr->text_length = data_len;
|
||||
|
||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||
|
||||
png_free(png_ptr, text_ptr);
|
||||
}
|
||||
else
|
||||
png_warning (png_ptr, "Could not allocate memory for zTXt data");
|
||||
png_free(png_ptr, text_ptr);
|
||||
png_free(png_ptr, chunkdata);
|
||||
}
|
||||
#endif
|
||||
@ -2029,17 +1944,8 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
#endif
|
||||
|
||||
chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
||||
if (chunkdata != (png_charp)NULL)
|
||||
{
|
||||
slength = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||
}
|
||||
else
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for iTXt chunk data");
|
||||
png_crc_finish(png_ptr, length);
|
||||
return;
|
||||
}
|
||||
slength = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||
if (png_crc_finish(png_ptr, 0))
|
||||
{
|
||||
png_free(png_ptr, chunkdata);
|
||||
@ -2084,22 +1990,17 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
else
|
||||
data_len=png_strlen(chunkdata + prefix_len);
|
||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||
if (text_ptr != (png_textp)NULL)
|
||||
{
|
||||
text_ptr->compression = (int)comp_flag + 1;
|
||||
text_ptr->lang_key = chunkdata+(lang_key-key);
|
||||
text_ptr->lang = chunkdata+(lang-key);
|
||||
text_ptr->itxt_length = data_len;
|
||||
text_ptr->text_length = 0;
|
||||
text_ptr->key = chunkdata;
|
||||
text_ptr->text = chunkdata + prefix_len;
|
||||
text_ptr->compression = (int)comp_flag + 1;
|
||||
text_ptr->lang_key = chunkdata+(lang_key-key);
|
||||
text_ptr->lang = chunkdata+(lang-key);
|
||||
text_ptr->itxt_length = data_len;
|
||||
text_ptr->text_length = 0;
|
||||
text_ptr->key = chunkdata;
|
||||
text_ptr->text = chunkdata + prefix_len;
|
||||
|
||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||
|
||||
png_free(png_ptr, text_ptr);
|
||||
}
|
||||
else
|
||||
png_warning (png_ptr, "Could not allocate memory for iTXt chunk data");
|
||||
png_free(png_ptr, text_ptr);
|
||||
png_free(png_ptr, chunkdata);
|
||||
}
|
||||
#endif
|
||||
@ -2133,7 +2034,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
HANDLE_CHUNK_ALWAYS
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
&& png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL
|
||||
&& png_ptr->read_user_chunk_fn == NULL
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
@ -2155,19 +2056,10 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
#endif
|
||||
png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
||||
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
||||
if (chunk.data != (png_bytep)NULL)
|
||||
{
|
||||
chunk.size = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)chunk.data, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for iTXt chunk data");
|
||||
png_crc_finish(png_ptr, length);
|
||||
return;
|
||||
}
|
||||
chunk.size = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)chunk.data, length);
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
if(png_ptr->read_user_chunk_fn != (png_user_chunk_ptr)NULL)
|
||||
if(png_ptr->read_user_chunk_fn != NULL)
|
||||
{
|
||||
/* callback to user unknown chunk handler */
|
||||
if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
|
||||
@ -3072,8 +2964,6 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
png_error(png_ptr, "This image requires a row greater than 64KB");
|
||||
#endif
|
||||
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, row_bytes);
|
||||
if (png_ptr->row_buf == (png_bytep)NULL)
|
||||
png_error (png_ptr, "Could not allocate memory for row buffer");
|
||||
png_ptr->row_buf_size = row_bytes;
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
@ -3082,11 +2972,6 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
#endif
|
||||
png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)(
|
||||
png_ptr->rowbytes + 1));
|
||||
if (png_ptr->prev_row == (png_bytep)NULL)
|
||||
{
|
||||
png_free (png_ptr, png_ptr->row_buf);
|
||||
png_error (png_ptr, "Could not allocate memory for previous row buffer");
|
||||
}
|
||||
|
||||
png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
|
||||
|
||||
|
130
pngset.c
130
pngset.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -154,11 +154,6 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
|
||||
#endif
|
||||
png_ptr->hist = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(info_ptr->num_palette * sizeof (png_uint_16)));
|
||||
if (png_ptr->hist == (png_uint_16p)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for histogram");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < info_ptr->num_palette; i++)
|
||||
png_ptr->hist[i] = hist[i];
|
||||
@ -300,11 +295,6 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
length = png_strlen(purpose) + 1;
|
||||
png_debug1(3, "allocating purpose for info (%lu bytes)\n", length);
|
||||
info_ptr->pcal_purpose = (png_charp)png_malloc(png_ptr, length);
|
||||
if (info_ptr->pcal_purpose == (png_charp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for pCAL");
|
||||
return;
|
||||
}
|
||||
png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length);
|
||||
|
||||
png_debug(3, "storing X0, X1, type, and nparams in info\n");
|
||||
@ -316,23 +306,10 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
length = png_strlen(units) + 1;
|
||||
png_debug1(3, "allocating units for info (%lu bytes)\n", length);
|
||||
info_ptr->pcal_units = (png_charp)png_malloc(png_ptr, length);
|
||||
if (info_ptr->pcal_units == (png_charp)NULL)
|
||||
{
|
||||
png_free (png_ptr, info_ptr->pcal_purpose);
|
||||
png_warning (png_ptr, "Could not allocate memory for pCAL units");
|
||||
return;
|
||||
}
|
||||
png_memcpy(info_ptr->pcal_units, units, (png_size_t)length);
|
||||
|
||||
info_ptr->pcal_params = (png_charpp)png_malloc(png_ptr,
|
||||
(png_uint_32)((nparams + 1) * sizeof(png_charp)));
|
||||
if (info_ptr->pcal_params == (png_charpp)NULL)
|
||||
{
|
||||
png_free (png_ptr, info_ptr->pcal_purpose);
|
||||
png_free (png_ptr, info_ptr->pcal_units);
|
||||
png_warning (png_ptr, "Could not allocate memory for pCAL params");
|
||||
return;
|
||||
}
|
||||
|
||||
info_ptr->pcal_params[nparams] = NULL;
|
||||
|
||||
@ -341,13 +318,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
length = png_strlen(params[i]) + 1;
|
||||
png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, length);
|
||||
info_ptr->pcal_params[i] = (png_charp)png_malloc(png_ptr, length);
|
||||
if (info_ptr->pcal_params[i] == (png_charp)NULL)
|
||||
{
|
||||
nparams=i;
|
||||
png_warning (png_ptr, "Could not allocate memory for pCAL params");
|
||||
}
|
||||
else
|
||||
png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length);
|
||||
png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length);
|
||||
}
|
||||
|
||||
info_ptr->valid |= PNG_INFO_pCAL;
|
||||
@ -390,14 +361,12 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
||||
length = png_strlen(swidth) + 1;
|
||||
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
|
||||
info_ptr->scal_s_width = (png_charp)png_malloc(png_ptr, length);
|
||||
if (info_ptr->scal_s_width != (png_charp)NULL)
|
||||
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
|
||||
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
|
||||
|
||||
length = png_strlen(sheight) + 1;
|
||||
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
|
||||
info_ptr->scal_s_height = (png_charp)png_malloc(png_ptr, length);
|
||||
if (info_ptr->scal_s_height != (png_charp)NULL)
|
||||
png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length);
|
||||
png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length);
|
||||
|
||||
info_ptr->valid |= PNG_INFO_sCAL;
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
@ -443,11 +412,6 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
||||
#endif
|
||||
png_ptr->palette = (png_colorp)png_zalloc(png_ptr, (uInt)num_palette,
|
||||
sizeof (png_color));
|
||||
if (png_ptr->palette == (png_colorp)NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Unable to allocate palette");
|
||||
return;
|
||||
}
|
||||
png_memcpy(png_ptr->palette, palette, num_palette * sizeof (png_color));
|
||||
info_ptr->palette = png_ptr->palette;
|
||||
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
||||
@ -572,19 +536,8 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
|
||||
return;
|
||||
|
||||
new_iccp_name = (png_charp)png_malloc(png_ptr, png_strlen(name)+1);
|
||||
if (new_iccp_name == (png_charp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for ICC profile name");
|
||||
return;
|
||||
}
|
||||
png_strcpy(new_iccp_name, name);
|
||||
new_iccp_profile = (png_charp)png_malloc(png_ptr, proflen);
|
||||
if (new_iccp_profile == (png_charp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for ICC profile");
|
||||
png_free (png_ptr, new_iccp_name);
|
||||
return;
|
||||
}
|
||||
png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
|
||||
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
|
||||
@ -630,12 +583,6 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
old_text = info_ptr->text;
|
||||
info_ptr->text = (png_textp)png_malloc(png_ptr,
|
||||
(png_uint_32)(info_ptr->max_text * sizeof (png_text)));
|
||||
if (info_ptr->text == (png_textp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for text");
|
||||
info_ptr->text = old_text;
|
||||
return;
|
||||
}
|
||||
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
|
||||
sizeof(png_text)));
|
||||
png_free(png_ptr, old_text);
|
||||
@ -646,11 +593,6 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
info_ptr->num_text = 0;
|
||||
info_ptr->text = (png_textp)png_malloc(png_ptr,
|
||||
(png_uint_32)(info_ptr->max_text * sizeof (png_text)));
|
||||
if (info_ptr->text == (png_textp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for text");
|
||||
return;
|
||||
}
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_TEXT;
|
||||
#endif
|
||||
@ -664,7 +606,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
png_size_t lang_len,lang_key_len;
|
||||
png_textp textp = &(info_ptr->text[info_ptr->num_text]);
|
||||
|
||||
if (text_ptr[i].key == (png_charp)NULL)
|
||||
if (text_ptr[i].key == NULL)
|
||||
continue;
|
||||
|
||||
key_len = png_strlen(text_ptr[i].key);
|
||||
@ -678,11 +620,11 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
{
|
||||
/* set iTXt data */
|
||||
if (text_ptr[i].key != (png_charp)NULL)
|
||||
if (text_ptr[i].key != NULL)
|
||||
lang_len = png_strlen(text_ptr[i].lang);
|
||||
else
|
||||
lang_len = 0;
|
||||
if (text_ptr[i].lang_key != (png_charp)NULL)
|
||||
if (text_ptr[i].lang_key != NULL)
|
||||
lang_key_len = png_strlen(text_ptr[i].lang_key);
|
||||
else
|
||||
lang_key_len = 0;
|
||||
@ -694,7 +636,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (text_ptr[i].text == (png_charp)NULL || text_ptr[i].text[0] == '\0')
|
||||
if (text_ptr[i].text == NULL || text_ptr[i].text[0] == '\0')
|
||||
{
|
||||
text_length = 0;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
@ -712,11 +654,6 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
|
||||
textp->key = (png_charp)png_malloc(png_ptr,
|
||||
(png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4));
|
||||
if (textp->key == (png_charp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for text pointer");
|
||||
return;
|
||||
}
|
||||
png_debug2(2, "Allocated %d bytes at %x in png_set_text\n",
|
||||
key_len + lang_len + lang_key_len + text_length + 4, (int)textp->key);
|
||||
|
||||
@ -804,11 +741,6 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
|
||||
#endif
|
||||
png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr,
|
||||
num_trans);
|
||||
if (png_ptr->trans == (png_bytep)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for tRNS array");
|
||||
return;
|
||||
}
|
||||
png_memcpy(info_ptr->trans, trans, num_trans);
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
info_ptr->free_me |= PNG_FREE_TRNS;
|
||||
@ -839,11 +771,6 @@ png_set_sPLT(png_structp png_ptr,
|
||||
|
||||
np = (png_sPLT_tp)png_malloc(png_ptr,
|
||||
(info_ptr->splt_palettes_num + nentries) * sizeof(png_sPLT_t));
|
||||
if (np == (png_sPLT_tp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for sPLT");
|
||||
return;
|
||||
}
|
||||
|
||||
png_memcpy(np, info_ptr->splt_palettes,
|
||||
info_ptr->splt_palettes_num * sizeof(png_sPLT_t));
|
||||
@ -860,18 +787,10 @@ png_set_sPLT(png_structp png_ptr,
|
||||
png_strcpy(to->name, from->name);
|
||||
to->entries = (png_sPLT_entryp)png_malloc(png_ptr,
|
||||
from->nentries * sizeof(png_sPLT_t));
|
||||
if (to->entries == (png_sPLT_entryp)NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Could not allocate memory for sPLT entry");
|
||||
nentries=i;
|
||||
}
|
||||
else
|
||||
{
|
||||
png_memcpy(to->entries, from->entries,
|
||||
from->nentries * sizeof(png_sPLT_t));
|
||||
to->nentries = from->nentries;
|
||||
to->depth = from->depth;
|
||||
}
|
||||
png_memcpy(to->entries, from->entries,
|
||||
from->nentries * sizeof(png_sPLT_t));
|
||||
to->nentries = from->nentries;
|
||||
to->depth = from->depth;
|
||||
}
|
||||
|
||||
info_ptr->splt_palettes = np;
|
||||
@ -897,11 +816,6 @@ png_set_unknown_chunks(png_structp png_ptr,
|
||||
np = (png_unknown_chunkp)png_malloc(png_ptr,
|
||||
(info_ptr->unknown_chunks_num + num_unknowns) *
|
||||
sizeof(png_unknown_chunk));
|
||||
if (np == (png_unknown_chunkp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate memory for unknown chunk");
|
||||
return;
|
||||
}
|
||||
|
||||
png_memcpy(np, info_ptr->unknown_chunks,
|
||||
info_ptr->unknown_chunks_num * sizeof(png_unknown_chunk));
|
||||
@ -915,19 +829,11 @@ png_set_unknown_chunks(png_structp png_ptr,
|
||||
|
||||
png_strcpy((png_charp)to->name, (png_charp)from->name);
|
||||
to->data = (png_bytep)png_malloc(png_ptr, from->size);
|
||||
if (to->data == (png_bytep)NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Could not allocate memory for unknown entry");
|
||||
num_unknowns=i;
|
||||
}
|
||||
else
|
||||
{
|
||||
png_memcpy(to->data, from->data, from->size);
|
||||
to->size = from->size;
|
||||
png_memcpy(to->data, from->data, from->size);
|
||||
to->size = from->size;
|
||||
|
||||
/* note our location in the read or write sequence */
|
||||
to->location = (png_byte)(png_ptr->mode & 0xff);
|
||||
}
|
||||
/* note our location in the read or write sequence */
|
||||
to->location = (png_byte)(png_ptr->mode & 0xff);
|
||||
}
|
||||
|
||||
info_ptr->unknown_chunks = np;
|
||||
@ -999,7 +905,7 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
|
||||
return;
|
||||
old_num_chunks=png_ptr->num_chunk_list;
|
||||
new_list=(png_bytep)png_malloc(png_ptr,5*(num_chunks+old_num_chunks));
|
||||
if(png_ptr->chunk_list != (png_bytep)NULL)
|
||||
if(png_ptr->chunk_list != NULL)
|
||||
{
|
||||
png_memcpy(new_list, png_ptr->chunk_list, 5*old_num_chunks);
|
||||
png_free(png_ptr, png_ptr->chunk_list);
|
||||
@ -1051,8 +957,6 @@ png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size)
|
||||
png_free(png_ptr, png_ptr->zbuf);
|
||||
png_ptr->zbuf_size = (png_size_t)size;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
|
||||
if(!png_ptr->zbuf)
|
||||
png_error(png_ptr,"Unable to malloc zbuf");
|
||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
}
|
||||
|
16
pngtest.c
16
pngtest.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -1028,18 +1028,6 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
row_buf = (png_bytep)png_malloc(read_ptr,
|
||||
png_get_rowbytes(read_ptr, read_info_ptr));
|
||||
png_debug1(0, "0x%08lx\n\n", (unsigned long)row_buf);
|
||||
if (row_buf == NULL)
|
||||
{
|
||||
fprintf(STDERR, "No memory to allocate row buffer\n");
|
||||
png_destroy_read_struct(&read_ptr, &read_info_ptr, (png_infopp)NULL);
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
png_destroy_info_struct(write_ptr, &write_end_info_ptr);
|
||||
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
||||
#endif
|
||||
FCLOSE(fpin);
|
||||
FCLOSE(fpout);
|
||||
return (1);
|
||||
}
|
||||
#endif /* SINGLE_ROWBUF_ALLOC */
|
||||
png_debug(0, "Writing row data\n");
|
||||
|
||||
@ -1523,4 +1511,4 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_0_11beta3 your_png_h_is_not_version_1_0_11beta3;
|
||||
typedef version_1_0_11rc1 your_png_h_is_not_version_1_0_11rc1;
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* For Intel x86 CPU and Microsoft Visual C++ compiler
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998, Intel Corporation
|
||||
|
2
pngwio.c
2
pngwio.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwio.c - functions for data output
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
44
pngwrite.c
44
pngwrite.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -512,8 +512,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)png_ptr->zbuf_size);
|
||||
if (png_ptr->zbuf == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate zbuf for writing");
|
||||
|
||||
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
||||
|
||||
@ -583,8 +581,6 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)png_ptr->zbuf_size);
|
||||
if (png_ptr->zbuf == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate zbuf for writing");
|
||||
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
||||
|
||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||
@ -1033,8 +1029,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
||||
{
|
||||
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
if (png_ptr->sub_row == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate sub_row");
|
||||
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
|
||||
}
|
||||
|
||||
@ -1049,10 +1043,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
||||
{
|
||||
png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
if (png_ptr->up_row == (png_bytep)NULL)
|
||||
{
|
||||
png_error(png_ptr, "Could not allocate sub_row");
|
||||
}
|
||||
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
|
||||
}
|
||||
}
|
||||
@ -1068,8 +1058,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
||||
{
|
||||
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
if (png_ptr->avg_row == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate avg_row");
|
||||
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
|
||||
}
|
||||
}
|
||||
@ -1086,8 +1074,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
||||
{
|
||||
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
if (png_ptr->paeth_row == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate avg_row");
|
||||
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||
}
|
||||
}
|
||||
@ -1143,13 +1129,10 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
||||
png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)(sizeof(png_byte) * num_weights));
|
||||
|
||||
if (png_ptr->prev_filters != (png_bytep)NULL)
|
||||
/* To make sure that the weighting starts out fairly */
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
/* To make sure that the weighting starts out fairly */
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
png_ptr->prev_filters[i] = 255;
|
||||
}
|
||||
png_ptr->prev_filters[i] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1160,22 +1143,11 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
||||
|
||||
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(sizeof(png_uint_16) * num_weights));
|
||||
if (png_ptr->inv_filter_weights == (png_uint_16p)NULL)
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->filter_weights);
|
||||
png_ptr->filter_weights = NULL;
|
||||
png_ptr->inv_filter_weights[i] =
|
||||
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
|
||||
}
|
||||
if (png_ptr->filter_weights != (png_uint_16p)NULL &&
|
||||
png_ptr->inv_filter_weights != (png_uint_16p)NULL)
|
||||
{
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
png_ptr->inv_filter_weights[i] =
|
||||
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
|
||||
}
|
||||
}
|
||||
else
|
||||
num_weights=0;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_weights; i++)
|
||||
@ -1387,7 +1359,7 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
|
||||
/* It is REQUIRED to call this to finish writing the rest of the file */
|
||||
png_write_end(png_ptr, info_ptr);
|
||||
|
||||
if(transforms == 0 || params == (voidp)NULL)
|
||||
if(transforms == 0 || params == NULL)
|
||||
/* quiet compiler warnings */ return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
58
pngwutil.c
58
pngwutil.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* libpng 1.0.11beta3 - April 15, 2001
|
||||
* libpng 1.0.11rc1 - April 20, 2001
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -235,11 +235,6 @@ png_text_compress(png_structp png_ptr,
|
||||
old_ptr = comp->output_ptr;
|
||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||
(png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
|
||||
if (comp->output_ptr == (png_charpp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Cannot allocate compression buffer");
|
||||
comp->output_ptr=old_ptr;
|
||||
}
|
||||
png_memcpy(comp->output_ptr, old_ptr, old_max
|
||||
* sizeof (png_charp));
|
||||
png_free(png_ptr, old_ptr);
|
||||
@ -247,23 +242,14 @@ png_text_compress(png_structp png_ptr,
|
||||
else
|
||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||
(png_uint_32)(comp->max_output_ptr * sizeof (png_charp)));
|
||||
if (comp->output_ptr == (png_charpp)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Cannot allocate compression buffer");
|
||||
}
|
||||
}
|
||||
|
||||
/* save the data */
|
||||
comp->output_ptr[comp->num_output_ptr] = (png_charp)png_malloc(png_ptr,
|
||||
(png_uint_32)png_ptr->zbuf_size);
|
||||
if (comp->output_ptr[comp->num_output_ptr] == (png_charp)NULL)
|
||||
png_warning (png_ptr, "Cannot allocate compression buffer");
|
||||
else
|
||||
{
|
||||
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
|
||||
png_ptr->zbuf_size);
|
||||
comp->num_output_ptr++;
|
||||
}
|
||||
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
|
||||
png_ptr->zbuf_size);
|
||||
comp->num_output_ptr++;
|
||||
|
||||
/* and reset the buffer */
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
@ -298,8 +284,7 @@ png_text_compress(png_structp png_ptr,
|
||||
/* This could be optimized to realloc() */
|
||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||
(png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
|
||||
if (comp->output_ptr != (png_charpp)NULL)
|
||||
png_memcpy(comp->output_ptr, old_ptr,
|
||||
png_memcpy(comp->output_ptr, old_ptr,
|
||||
old_max * sizeof (png_charp));
|
||||
png_free(png_ptr, old_ptr);
|
||||
}
|
||||
@ -311,14 +296,9 @@ png_text_compress(png_structp png_ptr,
|
||||
/* save off the data */
|
||||
comp->output_ptr[comp->num_output_ptr] =
|
||||
(png_charp)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size);
|
||||
if (comp->output_ptr[comp->num_output_ptr] == (png_charp)NULL)
|
||||
png_warning (png_ptr, "Cannot allocate compression buffer");
|
||||
else
|
||||
{
|
||||
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
|
||||
png_ptr->zbuf_size);
|
||||
comp->num_output_ptr++;
|
||||
}
|
||||
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
|
||||
png_ptr->zbuf_size);
|
||||
comp->num_output_ptr++;
|
||||
|
||||
/* and reset the buffer pointers */
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
@ -1130,12 +1110,6 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
||||
|
||||
*new_key = (png_charp)png_malloc(png_ptr, (png_uint_32)(key_len + 2));
|
||||
|
||||
if (*new_key == (png_charp)NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Could not allocate new key; keyword not checked");
|
||||
return key_len;
|
||||
}
|
||||
|
||||
/* Replace non-printing characters with a blank and print a warning */
|
||||
for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++)
|
||||
{
|
||||
@ -1451,12 +1425,6 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
|
||||
params_len = (png_uint_32p)png_malloc(png_ptr, (png_uint_32)(nparams
|
||||
*sizeof(png_uint_32)));
|
||||
|
||||
if (params_len == (png_uint_32p)NULL)
|
||||
{
|
||||
png_warning (png_ptr, "Could not allocate params for pCAL");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find the length of each parameter, making sure we don't count the
|
||||
null terminator for the last parameter. */
|
||||
for (i = 0; i < nparams; i++)
|
||||
@ -1640,8 +1608,6 @@ png_write_start_row(png_structp png_ptr)
|
||||
|
||||
/* set up row buffer */
|
||||
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size);
|
||||
if (png_ptr->row_buf == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate row buffer");
|
||||
png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
|
||||
|
||||
/* set up filtering buffer, if using this filter */
|
||||
@ -1649,8 +1615,6 @@ png_write_start_row(png_structp png_ptr)
|
||||
{
|
||||
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
if (png_ptr->sub_row == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate sub row buffer");
|
||||
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
|
||||
}
|
||||
|
||||
@ -1665,8 +1629,6 @@ png_write_start_row(png_structp png_ptr)
|
||||
{
|
||||
png_ptr->up_row = (png_bytep )png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
if (png_ptr->up_row == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate up row buffer");
|
||||
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
|
||||
}
|
||||
|
||||
@ -1674,8 +1636,6 @@ png_write_start_row(png_structp png_ptr)
|
||||
{
|
||||
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
if (png_ptr->avg_row == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate avg row buffer");
|
||||
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
|
||||
}
|
||||
|
||||
@ -1683,8 +1643,6 @@ png_write_start_row(png_structp png_ptr)
|
||||
{
|
||||
png_ptr->paeth_row = (png_bytep )png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
if (png_ptr->paeth_row == (png_bytep)NULL)
|
||||
png_error(png_ptr, "Could not allocate paeth row buffer");
|
||||
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
Microsoft Developer Studio Build File, Format Version 6.00 for
|
||||
libpng 1.0.11beta3 (April 15, 2001) and zlib
|
||||
libpng 1.0.11rc1 (April 20, 2001) and zlib
|
||||
|
||||
Copyright (C) 2000 Simon-Pierre Cadieux
|
||||
For conditions of distribution and use, see copyright notice in png.h
|
||||
|
@ -6,7 +6,7 @@ LIBRARY
|
||||
DESCRIPTION "PNG image compression library for Windows"
|
||||
|
||||
EXPORTS
|
||||
;Version 1.0.11beta3
|
||||
;Version 1.0.11rc1
|
||||
png_build_grayscale_palette @1
|
||||
png_check_sig @2
|
||||
png_chunk_error @3
|
||||
|
@ -8,9 +8,9 @@ libpng for WindowsCE Rel.1.0
|
||||
|
||||
Introduction
|
||||
============
|
||||
This is libpng 1.0.11beta3 ported to WindowsCE 2.0 and 2.11.
|
||||
libpng 1.0.11beta3 is a PNG reference library.
|
||||
See README, a document of original libpng 1.0.11beta3.
|
||||
This is libpng 1.0.11rc1 ported to WindowsCE 2.0 and 2.11.
|
||||
libpng 1.0.11rc1 is a PNG reference library.
|
||||
See README, a document of original libpng 1.0.11rc1.
|
||||
|
||||
zlib for WindowsCE
|
||||
==================
|
||||
@ -23,7 +23,7 @@ This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
See README and LICENSE, documents of original libpng 1.0.11beta3, for conditions
|
||||
See README and LICENSE, documents of original libpng 1.0.11rc1, for conditions
|
||||
of use and distribution.
|
||||
|
||||
Files
|
||||
|
@ -24,7 +24,7 @@ libpng
|
||||
になったいかなる被害についても、作者、配布者、その他利用者以外の人物、
|
||||
団体に責任をとる義務はないものとします。
|
||||
|
||||
その他、このソフトウェアの利用条件については、原版である libpng 1.0.11beta3に
|
||||
その他、このソフトウェアの利用条件については、原版である libpng 1.0.11rc1に
|
||||
準拠するものとします。詳しくは、付属の README,LICENSE をお読みください。
|
||||
|
||||
収録内容
|
||||
|
@ -5,7 +5,7 @@
|
||||
LIBRARY lpngce
|
||||
|
||||
EXPORTS
|
||||
;Version 1.0.11beta3
|
||||
;Version 1.0.11rc1
|
||||
png_build_grayscale_palette @1
|
||||
png_check_sig @2
|
||||
png_chunk_error @3
|
||||
|
@ -18,7 +18,7 @@ RM = rm -f
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 2
|
||||
PNGMIN = 1.0.11beta3
|
||||
PNGMIN = 1.0.11rc1
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
prefix=/usr/local
|
||||
|
@ -13,7 +13,7 @@ ZLIBINC=/usr/local/include
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 2
|
||||
PNGMIN = 1.0.11beta3
|
||||
PNGMIN = 1.0.11rc1
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
ALIGN=
|
||||
|
@ -39,8 +39,8 @@ CFLAGS=-I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
|
||||
# have to change it.
|
||||
PNGMAJ = 2
|
||||
#PNGDLL = $1# msvc
|
||||
PNGDLL = 2# cygwin 1.0.11beta3
|
||||
PNGMIN = 1.0.11beta3
|
||||
PNGDLL = 2# cygwin 1.0.11rc1
|
||||
PNGMIN = 1.0.11rc1
|
||||
PNGMIN_BASE = 1.0.11
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
|
@ -17,7 +17,7 @@ ZLIBINC=../zlib
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 2
|
||||
PNGMIN = 1.0.11beta3
|
||||
PNGMIN = 1.0.11rc1
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
CC=cc
|
||||
|
@ -51,7 +51,7 @@ RANLIB=ranlib
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 2
|
||||
PNGMIN = 1.0.11beta3
|
||||
PNGMIN = 1.0.11rc1
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
|
@ -34,7 +34,7 @@ RANLIB=ranlib
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 2
|
||||
PNGMIN = 1.0.11beta3
|
||||
PNGMIN = 1.0.11rc1
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
|
@ -19,7 +19,7 @@ RANLIB=ranlib
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 2
|
||||
PNGMIN = 1.0.11beta3
|
||||
PNGMIN = 1.0.11rc1
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# where make install puts libpng.a and png.h
|
||||
|
@ -34,7 +34,7 @@ RANLIB=ranlib
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 2
|
||||
PNGMIN = 1.0.11beta3
|
||||
PNGMIN = 1.0.11rc1
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
|
89
scripts/makefile.netbsd
Normal file
89
scripts/makefile.netbsd
Normal file
@ -0,0 +1,89 @@
|
||||
# makefile for libpng on NetBSD
|
||||
# Copyright (C) 2001 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
# For conditions of distribution and use, see copyright notice in png.h
|
||||
|
||||
# where make install puts libpng.a and png.h
|
||||
# pkgsrc will want prefix=${PREFIX}
|
||||
prefix=/usr/local
|
||||
INCPATH=$(prefix)/include
|
||||
LIBPATH=$(prefix)/lib
|
||||
|
||||
# The zlib library and include files are part of the standard system
|
||||
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 2
|
||||
PNGMIN = 1.0.11rc1
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
CC=cc
|
||||
# You can define PNG_ASSEMBLER_CODE_SUPPORTED if building for Intel x86
|
||||
CFLAGS=-O2 -DPNG_USE_PNGGCCRD # -DPNG_ASSEMBLER_CODE_SUPPORTED -g -DPNG_DEBUG=1
|
||||
LDFLAGS=-Wl,-R${LIBPATH} -L. -lpng -lz -lm
|
||||
|
||||
#RANLIB=echo
|
||||
RANLIB=ranlib
|
||||
|
||||
OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||
|
||||
all: libpng.so libpng.a pngtest
|
||||
|
||||
libpng.a: $(OBJS)
|
||||
ar rc $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
libpng.so: libpng.so.$(PNGMAJ)
|
||||
ln -f -s libpng.so.$(PNGMAJ) libpng.so
|
||||
|
||||
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
||||
ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
||||
|
||||
libpng.so.$(PNGVER): $(OBJS)
|
||||
$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) -lz -lm
|
||||
|
||||
pngtest: pngtest.o libpng.a
|
||||
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||
|
||||
test: pngtest
|
||||
./pngtest
|
||||
|
||||
install: libpng.a libpng.so.$(PNGVER)
|
||||
-@mkdir $(INCPATH)
|
||||
-@mkdir $(LIBPATH)
|
||||
cp png.h $(INCPATH)
|
||||
cp pngconf.h $(INCPATH)
|
||||
chmod 644 $(INCPATH)/png.h
|
||||
chmod 644 $(INCPATH)/pngconf.h
|
||||
cp libpng.a $(LIBPATH)
|
||||
cp libpng.so.$(PNGVER) $(LIBPATH)
|
||||
chmod 644 $(LIBPATH)/libpng.a
|
||||
chmod 644 $(LIBPATH)/libpng.so.$(PNGVER)
|
||||
-@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
|
||||
(cd $(LIBPATH); ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
||||
ln -f -s libpng.so.$(PNGMAJ) libpng.so)
|
||||
|
||||
clean:
|
||||
rm -f *.o libpng.a pngtest pngout.png libpng.so*
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
pnggccrd.o: png.h pngconf.h
|
||||
png.o: png.h pngconf.h
|
||||
pngerror.o: png.h pngconf.h
|
||||
pngrio.o: png.h pngconf.h
|
||||
pngwio.o: png.h pngconf.h
|
||||
pngmem.o: png.h pngconf.h
|
||||
pngset.o: png.h pngconf.h
|
||||
pngget.o: png.h pngconf.h
|
||||
pngread.o: png.h pngconf.h
|
||||
pngrtran.o: png.h pngconf.h
|
||||
pngrutil.o: png.h pngconf.h
|
||||
pngtest.o: png.h pngconf.h
|
||||
pngtrans.o: png.h pngconf.h
|
||||
pngwrite.o: png.h pngconf.h
|
||||
pngwtran.o: png.h pngconf.h
|
||||
pngwutil.o: png.h pngconf.h
|
||||
pngpread.o: png.h pngconf.h
|
@ -25,7 +25,7 @@ RANLIB=echo
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 2
|
||||
PNGMIN = 1.0.11beta3
|
||||
PNGMIN = 1.0.11rc1
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
|
@ -19,8 +19,8 @@ CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
|
||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||
LDSHARED=gcc -shared
|
||||
|
||||
VER=1.0.11beta3
|
||||
LIBS=libpng.so.1.0.11beta3
|
||||
VER=1.0.11rc1
|
||||
LIBS=libpng.so.1.0.11rc1
|
||||
SHAREDLIB=libpng.so
|
||||
libdir=$(prefix)/lib32
|
||||
|
||||
|
@ -25,7 +25,7 @@ CFLAGS=-I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
|
||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||
LDSHARED=cc -shared
|
||||
|
||||
VER=1.0.11beta3
|
||||
VER=1.0.11rc1
|
||||
SONUM=2
|
||||
SHAREDLIB=libpng.so
|
||||
libdir=$(prefix)
|
||||
|
@ -31,7 +31,7 @@ RANLIB=echo
|
||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||
# have to change it.
|
||||
PNGMAJ = 2
|
||||
PNGMIN = 1.0.11beta3
|
||||
PNGMIN = 1.0.11rc1
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
|
@ -7,7 +7,7 @@ unit pngdef;
|
||||
interface
|
||||
|
||||
const
|
||||
PNG_LIBPNG_VER_STRING = '1.0.11beta3';
|
||||
PNG_LIBPNG_VER_STRING = '1.0.11rc1';
|
||||
PNG_LIBPNG_VER = 10011;
|
||||
|
||||
type
|
||||
|
@ -2,7 +2,7 @@
|
||||
; PNG.LIB module definition file for OS/2
|
||||
;----------------------------------------
|
||||
|
||||
; Version 1.0.11beta3
|
||||
; Version 1.0.11rc1
|
||||
|
||||
LIBRARY PNG
|
||||
DESCRIPTION "PNG image compression library for OS/2"
|
||||
|
Reference in New Issue
Block a user