[master] Reverted iTXt compatibility stuff
from 1.2.41beta05, 1.2.41beta11, and 1.2.41beta12.
This commit is contained in:
parent
87480bf6d4
commit
f748fda0ed
@ -1,6 +1,6 @@
|
|||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.2.41beta14 - November 3, 2009
|
libpng version 1.2.41beta14 - November 8, 2009
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
@ -11,7 +11,7 @@ libpng.txt - A description on how to use and modify libpng
|
|||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.2.41beta14 - November 3, 2009
|
libpng versions 0.97, January 1998, through 1.2.41beta14 - November 8, 2009
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
|
|
||||||
@ -3028,13 +3028,13 @@ They have been replaced, respectively, by:
|
|||||||
PNG_MAX_UINT was replaced with PNG_UINT_31_MAX. It has been
|
PNG_MAX_UINT was replaced with PNG_UINT_31_MAX. It has been
|
||||||
deprecated since libpng-1.0.16 and libpng-1.2.6.
|
deprecated since libpng-1.0.16 and libpng-1.2.6.
|
||||||
|
|
||||||
The function
|
The deprecated function
|
||||||
png_check_sig(sig, num)
|
png_check_sig(sig, num)
|
||||||
was replaced with
|
was replaced with
|
||||||
!png_sig_cmp(sig, 0, num)
|
!png_sig_cmp(sig, 0, num)
|
||||||
It has been deprecated since libpng-0.90.
|
It has been deprecated since libpng-0.90.
|
||||||
|
|
||||||
The function
|
The deprecated function
|
||||||
png_set_gray_1_2_4_to_8()
|
png_set_gray_1_2_4_to_8()
|
||||||
which also expands tRNS to alpha was replaced with
|
which also expands tRNS to alpha was replaced with
|
||||||
png_set_expand_gray_1_2_4_to_8()
|
png_set_expand_gray_1_2_4_to_8()
|
||||||
@ -3209,7 +3209,7 @@ source.
|
|||||||
|
|
||||||
XIII. Y2K Compliance in libpng
|
XIII. Y2K Compliance in libpng
|
||||||
|
|
||||||
November 3, 2009
|
November 8, 2009
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
18
libpng.3
18
libpng.3
@ -1,4 +1,4 @@
|
|||||||
.TH LIBPNG 3 "November 3, 2009"
|
.TH LIBPNG 3 "November 8, 2009"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.41beta14
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.41beta14
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -821,7 +821,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
|
|||||||
.SH LIBPNG.TXT
|
.SH LIBPNG.TXT
|
||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.2.41beta14 - November 3, 2009
|
libpng version 1.2.41beta14 - November 8, 2009
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
@ -832,7 +832,7 @@ libpng.txt - A description on how to use and modify libpng
|
|||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.2.41beta14 - November 3, 2009
|
libpng versions 0.97, January 1998, through 1.2.41beta14 - November 8, 2009
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
|
|
||||||
@ -3849,13 +3849,13 @@ They have been replaced, respectively, by:
|
|||||||
PNG_MAX_UINT was replaced with PNG_UINT_31_MAX. It has been
|
PNG_MAX_UINT was replaced with PNG_UINT_31_MAX. It has been
|
||||||
deprecated since libpng-1.0.16 and libpng-1.2.6.
|
deprecated since libpng-1.0.16 and libpng-1.2.6.
|
||||||
|
|
||||||
The function
|
The deprecated function
|
||||||
png_check_sig(sig, num)
|
png_check_sig(sig, num)
|
||||||
was replaced with
|
was replaced with
|
||||||
!png_sig_cmp(sig, 0, num)
|
!png_sig_cmp(sig, 0, num)
|
||||||
It has been deprecated since libpng-0.90.
|
It has been deprecated since libpng-0.90.
|
||||||
|
|
||||||
The function
|
The deprecated function
|
||||||
png_set_gray_1_2_4_to_8()
|
png_set_gray_1_2_4_to_8()
|
||||||
which also expands tRNS to alpha was replaced with
|
which also expands tRNS to alpha was replaced with
|
||||||
png_set_expand_gray_1_2_4_to_8()
|
png_set_expand_gray_1_2_4_to_8()
|
||||||
@ -4030,7 +4030,7 @@ source.
|
|||||||
|
|
||||||
.SH XIII. Y2K Compliance in libpng
|
.SH XIII. Y2K Compliance in libpng
|
||||||
|
|
||||||
November 3, 2009
|
November 8, 2009
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
@ -4376,7 +4376,7 @@ possible without all of you.
|
|||||||
|
|
||||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||||
|
|
||||||
Libpng version 1.2.41beta14 - November 3, 2009:
|
Libpng version 1.2.41beta14 - November 8, 2009:
|
||||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||||
|
|
||||||
@ -4399,7 +4399,7 @@ this sentence.
|
|||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.2.6, August 15, 2004, through 1.2.41beta14, November 3, 2009, are
|
libpng versions 1.2.6, August 15, 2004, through 1.2.41beta14, November 8, 2009, are
|
||||||
Copyright (c) 2004,2006-2008 Glenn Randers-Pehrson, and are
|
Copyright (c) 2004,2006-2008 Glenn Randers-Pehrson, and are
|
||||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
with the following individual added to the list of Contributing Authors
|
with the following individual added to the list of Contributing Authors
|
||||||
@ -4498,7 +4498,7 @@ certification mark of the Open Source Initiative.
|
|||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
November 3, 2009
|
November 8, 2009
|
||||||
|
|
||||||
.\" end of man page
|
.\" end of man page
|
||||||
|
|
||||||
|
6
png.c
6
png.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -722,13 +722,13 @@ png_get_copyright(png_structp png_ptr)
|
|||||||
#else
|
#else
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
return ((png_charp) PNG_STRING_NEWLINE \
|
return ((png_charp) PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.2.41beta14 - November 3, 2009" PNG_STRING_NEWLINE \
|
"libpng version 1.2.41beta14 - November 8, 2009" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2009 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
"Copyright (c) 1998-2009 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||||
PNG_STRING_NEWLINE);
|
PNG_STRING_NEWLINE);
|
||||||
#else
|
#else
|
||||||
return ((png_charp) "libpng version 1.2.41beta14 - November 3, 2009\
|
return ((png_charp) "libpng version 1.2.41beta14 - November 8, 2009\
|
||||||
Copyright (c) 1998-2009 Glenn Randers-Pehrson\
|
Copyright (c) 1998-2009 Glenn Randers-Pehrson\
|
||||||
Copyright (c) 1996-1997 Andreas Dilger\
|
Copyright (c) 1996-1997 Andreas Dilger\
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -285,9 +285,9 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
longjmp(png_ptr->jmpbuf, 1);
|
longjmp(png_ptr->jmpbuf, 1);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
PNG_ABORT();
|
|
||||||
#endif
|
#endif
|
||||||
|
/* Here if not setjmp support or if png_ptr is null. */
|
||||||
|
PNG_ABORT();
|
||||||
#ifndef PNG_CONSOLE_IO_SUPPORTED
|
#ifndef PNG_CONSOLE_IO_SUPPORTED
|
||||||
error_message = error_message; /* Make compiler happy */
|
error_message = error_message; /* Make compiler happy */
|
||||||
#endif
|
#endif
|
||||||
|
23
pngget.c
23
pngget.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -939,27 +939,6 @@ png_get_user_height_max (png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
return (png_ptr? png_ptr->user_height_max : 0);
|
return (png_ptr? png_ptr->user_height_max : 0);
|
||||||
}
|
}
|
||||||
/* This function was added to libpng 1.2.41 */
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_chunk_cache_max (png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return (png_ptr? png_ptr->user_chunk_cache_max? 0x7fffffffL :
|
|
||||||
png_ptr->user_chunk_cache_max - 1 : 0);
|
|
||||||
}
|
|
||||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
|
||||||
png_uint_32 PNGAPI
|
|
||||||
png_get_io_state (png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return png_ptr->io_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_bytep PNGAPI
|
|
||||||
png_get_io_chunk_name (png_structp png_ptr)
|
|
||||||
{
|
|
||||||
return png_ptr->chunk_name;
|
|
||||||
}
|
|
||||||
#endif /* ?PNG_IO_STATE_SUPPORTED */
|
|
||||||
|
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||||
|
39
pngread.c
39
pngread.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -66,8 +66,6 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
|
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
|
||||||
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
|
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
|
||||||
/* Added at libpng-1.2.41 */
|
|
||||||
png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
@ -118,10 +116,6 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
* For versions after libpng 1.0, we will be compatible, so we need
|
* For versions after libpng 1.0, we will be compatible, so we need
|
||||||
* only check the first digit.
|
* only check the first digit.
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
|
||||||
png_size_t length;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
|
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
|
||||||
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
|
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
|
||||||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
|
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
|
||||||
@ -146,26 +140,6 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
png_error(png_ptr,
|
png_error(png_ptr,
|
||||||
"Incompatible libpng version in application and library");
|
"Incompatible libpng version in application and library");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
|
||||||
/* Any library mismatch is trouble for png_set_read() in
|
|
||||||
* libpng-1.2.41 and later 1.2.x, so we store the caller's
|
|
||||||
* library version string.
|
|
||||||
*/
|
|
||||||
|
|
||||||
length = (png_size_t)png_strlen(user_png_ver) + 1;
|
|
||||||
png_debug1(3, "allocating user_png_ver for png_ptr (%lu bytes)",
|
|
||||||
(unsigned long)length);
|
|
||||||
png_ptr->user_png_ver = (png_charp)png_malloc_warn(png_ptr,
|
|
||||||
(png_uint_32)length);
|
|
||||||
|
|
||||||
if (png_ptr->user_png_ver == NULL)
|
|
||||||
png_warning(png_ptr, "Could not store png_ptr->user_png_ver");
|
|
||||||
|
|
||||||
else
|
|
||||||
png_memcpy(png_ptr->user_png_ver, user_png_ver, length);
|
|
||||||
|
|
||||||
#endif /* PNG_iTXt_SUPPORTED */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize zbuf - compression buffer */
|
/* Initialize zbuf - compression buffer */
|
||||||
@ -327,8 +301,6 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
|||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
|
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
|
||||||
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
|
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
|
||||||
/* Added at libpng-1.2.41 */
|
|
||||||
png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize zbuf - compression buffer */
|
/* Initialize zbuf - compression buffer */
|
||||||
@ -377,10 +349,6 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_size_t num_checked = png_ptr->sig_bytes,
|
png_size_t num_checked = png_ptr->sig_bytes,
|
||||||
num_to_check = 8 - num_checked;
|
num_to_check = 8 - num_checked;
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
|
||||||
png_ptr->io_state = PNG_IO_READING | PNG_IO_SIGNATURE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_read_data(png_ptr, &(info_ptr->signature[num_checked]), num_to_check);
|
png_read_data(png_ptr, &(info_ptr->signature[num_checked]), num_to_check);
|
||||||
png_ptr->sig_bytes = 8;
|
png_ptr->sig_bytes = 8;
|
||||||
|
|
||||||
@ -1325,11 +1293,6 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
|
|||||||
#endif /* PNG_TEXT_SUPPORTED */
|
#endif /* PNG_TEXT_SUPPORTED */
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||||
|
|
||||||
/* New member added in libpng-1.2.41, will be removed from 1.4.0 */
|
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
|
||||||
png_free(png_ptr, png_ptr->user_png_ver);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Save the important info out of the png_struct, in case it is
|
/* Save the important info out of the png_struct, in case it is
|
||||||
* being used again.
|
* being used again.
|
||||||
*/
|
*/
|
||||||
|
2
pngrio.c
2
pngrio.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
108
pngrtran.c
108
pngrtran.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -140,22 +140,6 @@ png_set_strip_alpha(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
|
|
||||||
void PNGAPI
|
|
||||||
png_set_premultiply_alpha(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_set_premultiply_alpha");
|
|
||||||
|
|
||||||
if(png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
png_ptr->transformations |=
|
|
||||||
(PNG_PREMULTIPLY_ALPHA | PNG_EXPAND_tRNS);
|
|
||||||
png_ptr->transformations |=
|
|
||||||
PNG_EXPAND; /* This shouldn't be necessary */
|
|
||||||
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_DITHER_SUPPORTED
|
#ifdef PNG_READ_DITHER_SUPPORTED
|
||||||
/* Dither file to 8 bit. Supply a palette, the current number
|
/* Dither file to 8 bit. Supply a palette, the current number
|
||||||
* of elements in the palette, the maximum number of elements
|
* of elements in the palette, the maximum number of elements
|
||||||
@ -607,8 +591,9 @@ png_set_expand(png_structp png_ptr)
|
|||||||
* More to the point, these functions make it obvious what libpng will be
|
* More to the point, these functions make it obvious what libpng will be
|
||||||
* doing, whereas "expand" can (and does) mean any number of things.
|
* doing, whereas "expand" can (and does) mean any number of things.
|
||||||
*
|
*
|
||||||
* GRP 20060307: In libpng-1.4.0, png_set_gray_1_2_4_to_8() was modified
|
* GRP 20060307: In libpng-1.2.9, png_set_gray_1_2_4_to_8() was modified
|
||||||
* to expand only the sample depth but not to expand the tRNS to alpha.
|
* to expand only the sample depth but not to expand the tRNS to alpha
|
||||||
|
* and its name was changed to png_set_expand_gray_1_2_4_to_8().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Expand paletted images to RGB. */
|
/* Expand paletted images to RGB. */
|
||||||
@ -1534,12 +1519,6 @@ png_do_read_transformations(png_structp png_ptr)
|
|||||||
(png_uint_32)png_ptr->filler, png_ptr->flags);
|
(png_uint_32)png_ptr->filler, png_ptr->flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_PREMULTIPLY_ALPHA)
|
|
||||||
png_do_read_premultiply_alpha(&(png_ptr->row_info),
|
|
||||||
png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
|
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
||||||
png_do_read_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
png_do_read_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||||
@ -2043,85 +2022,6 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_read_premultiply_alpha(png_row_infop row_info, png_bytep row)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_read_premultiply_alpha");
|
|
||||||
|
|
||||||
{
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
|
||||||
{
|
|
||||||
/* This premultiplies the pixels with the alpha channel in RGBA */
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_bytep sp = row + row_info->rowbytes;
|
|
||||||
png_bytep dp = sp;
|
|
||||||
png_uint_16 a = 0;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
a = *(--sp); --dp;
|
|
||||||
|
|
||||||
*(--dp) = (*(--sp) * a) / 255;
|
|
||||||
*(--dp) = (*(--sp) * a) / 255;
|
|
||||||
*(--dp) = (*(--sp) * a) / 255;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* This premultiplies the pixels with the alpha channel in RRGGBBAA */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_uint_16p sp = (png_uint_16p)(row + row_info->rowbytes);
|
|
||||||
png_uint_16p dp = sp;
|
|
||||||
png_uint_32 a = 0;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
a = *(--sp); --dp;
|
|
||||||
*(--dp) = (png_uint_16) ((*(--sp) * a) / 65535);
|
|
||||||
*(--dp) = (png_uint_16) ((*(--sp) * a) / 65535);
|
|
||||||
*(--dp) = (png_uint_16) ((*(--sp) * a) / 65535);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
|
||||||
{
|
|
||||||
/* This premultiplies the pixels with the alpha channel in GA */
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_bytep sp = row + row_info->rowbytes;
|
|
||||||
png_bytep dp = sp;
|
|
||||||
png_uint_16 a = 0;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
a = *(--sp); --dp;
|
|
||||||
*(--dp) = (*(--sp) * a) / 255;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* This premultiplies the pixels with the alpha channel in GGAA */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_uint_16p sp = (png_uint_16p) (row + row_info->rowbytes);
|
|
||||||
png_uint_16p dp = sp;
|
|
||||||
png_uint_32 a = 0;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
a = *(--sp); --dp;
|
|
||||||
*(--dp) = (png_uint_16) ((*(--sp) * a) / 65535);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_FILLER_SUPPORTED
|
#ifdef PNG_READ_FILLER_SUPPORTED
|
||||||
/* Add filler channel if we have RGB color */
|
/* Add filler channel if we have RGB color */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
|
122
pngrutil.c
122
pngrutil.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -112,13 +112,6 @@ png_read_chunk_header(png_structp png_ptr)
|
|||||||
png_byte buf[8];
|
png_byte buf[8];
|
||||||
png_uint_32 length;
|
png_uint_32 length;
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
|
||||||
/* Inform the I/O callback that the chunk header is being read.
|
|
||||||
* PNG_IO_CHUNK_HDR requires a single I/O call.
|
|
||||||
*/
|
|
||||||
png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_HDR;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Read the length and the chunk name */
|
/* Read the length and the chunk name */
|
||||||
png_read_data(png_ptr, buf, 8);
|
png_read_data(png_ptr, buf, 8);
|
||||||
length = png_get_uint_31(png_ptr, buf);
|
length = png_get_uint_31(png_ptr, buf);
|
||||||
@ -136,13 +129,6 @@ png_read_chunk_header(png_structp png_ptr)
|
|||||||
/* Check to see if chunk name is valid */
|
/* Check to see if chunk name is valid */
|
||||||
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
|
||||||
/* Inform the I/O callback that chunk data will (possibly) be read.
|
|
||||||
* PNG_IO_CHUNK_DATA does NOT require a specific number of I/O calls.
|
|
||||||
*/
|
|
||||||
png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_DATA;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,12 +203,6 @@ png_crc_error(png_structp png_ptr)
|
|||||||
need_crc = 0;
|
need_crc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
|
||||||
/* Inform the I/O callback that the chunk CRC is being read */
|
|
||||||
/* PNG_IO_CHUNK_CRC requires the I/O to be done at once */
|
|
||||||
png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_CRC;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_read_data(png_ptr, crc_bytes, 4);
|
png_read_data(png_ptr, crc_bytes, 4);
|
||||||
|
|
||||||
if (need_crc)
|
if (need_crc)
|
||||||
@ -322,23 +302,9 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||||||
png_charp tmp;
|
png_charp tmp;
|
||||||
|
|
||||||
tmp = text;
|
tmp = text;
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
|
||||||
if ((png_ptr->user_chunk_cache_max != 0) &&
|
|
||||||
(--png_ptr->user_chunk_cache_max == 0))
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "No space in chunk cache");
|
|
||||||
text = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
text = (png_charp)png_malloc_warn(png_ptr,
|
text = (png_charp)png_malloc_warn(png_ptr,
|
||||||
(png_uint_32)(text_size +
|
(png_uint_32)(text_size +
|
||||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
|
png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (text == NULL)
|
if (text == NULL)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, tmp);
|
png_free(png_ptr, tmp);
|
||||||
@ -1170,24 +1136,6 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
png_debug(1, "in png_handle_sPLT");
|
png_debug(1, "in png_handle_sPLT");
|
||||||
|
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
|
||||||
|
|
||||||
if (png_ptr->user_chunk_cache_max != 0)
|
|
||||||
{
|
|
||||||
if (png_ptr->user_chunk_cache_max == 1)
|
|
||||||
{
|
|
||||||
png_crc_finish(png_ptr, length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (--png_ptr->user_chunk_cache_max == 1)
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "No space in chunk cache for sPLT");
|
|
||||||
png_crc_finish(png_ptr, length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
||||||
png_error(png_ptr, "Missing IHDR before sPLT");
|
png_error(png_ptr, "Missing IHDR before sPLT");
|
||||||
else if (png_ptr->mode & PNG_HAVE_IDAT)
|
else if (png_ptr->mode & PNG_HAVE_IDAT)
|
||||||
@ -1974,23 +1922,6 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
png_debug(1, "in png_handle_tEXt");
|
png_debug(1, "in png_handle_tEXt");
|
||||||
|
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
|
||||||
if (png_ptr->user_chunk_cache_max != 0)
|
|
||||||
{
|
|
||||||
if (png_ptr->user_chunk_cache_max == 1)
|
|
||||||
{
|
|
||||||
png_crc_finish(png_ptr, length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (--png_ptr->user_chunk_cache_max == 1)
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "No space in chunk cache for tEXt");
|
|
||||||
png_crc_finish(png_ptr, length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
||||||
png_error(png_ptr, "Missing IHDR before tEXt");
|
png_error(png_ptr, "Missing IHDR before tEXt");
|
||||||
|
|
||||||
@ -2076,23 +2007,6 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
png_debug(1, "in png_handle_zTXt");
|
png_debug(1, "in png_handle_zTXt");
|
||||||
|
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
|
||||||
if (png_ptr->user_chunk_cache_max != 0)
|
|
||||||
{
|
|
||||||
if (png_ptr->user_chunk_cache_max == 1)
|
|
||||||
{
|
|
||||||
png_crc_finish(png_ptr, length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (--png_ptr->user_chunk_cache_max == 1)
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "No space in chunk cache for zTXt");
|
|
||||||
png_crc_finish(png_ptr, length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
||||||
png_error(png_ptr, "Missing IHDR before zTXt");
|
png_error(png_ptr, "Missing IHDR before zTXt");
|
||||||
|
|
||||||
@ -2197,23 +2111,6 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
png_debug(1, "in png_handle_iTXt");
|
png_debug(1, "in png_handle_iTXt");
|
||||||
|
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
|
||||||
if (png_ptr->user_chunk_cache_max != 0)
|
|
||||||
{
|
|
||||||
if (png_ptr->user_chunk_cache_max == 1)
|
|
||||||
{
|
|
||||||
png_crc_finish(png_ptr, length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (--png_ptr->user_chunk_cache_max == 1)
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "No space in chunk cache for iTXt");
|
|
||||||
png_crc_finish(png_ptr, length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
||||||
png_error(png_ptr, "Missing IHDR before iTXt");
|
png_error(png_ptr, "Missing IHDR before iTXt");
|
||||||
|
|
||||||
@ -2341,23 +2238,6 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
png_debug(1, "in png_handle_unknown");
|
png_debug(1, "in png_handle_unknown");
|
||||||
|
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
|
||||||
if (png_ptr->user_chunk_cache_max != 0)
|
|
||||||
{
|
|
||||||
if (png_ptr->user_chunk_cache_max == 1)
|
|
||||||
{
|
|
||||||
png_crc_finish(png_ptr, length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (--png_ptr->user_chunk_cache_max == 1)
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "No space in chunk cache for unknown chunk");
|
|
||||||
png_crc_finish(png_ptr, length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (png_ptr->mode & PNG_HAVE_IDAT)
|
if (png_ptr->mode & PNG_HAVE_IDAT)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||||
|
68
pngset.c
68
pngset.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -653,9 +653,6 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
int num_text)
|
int num_text)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
|
||||||
int caller_no_itxt = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_debug1(1, "in %s storage function", ((png_ptr == NULL ||
|
png_debug1(1, "in %s storage function", ((png_ptr == NULL ||
|
||||||
png_ptr->chunk_name[0] == '\0') ?
|
png_ptr->chunk_name[0] == '\0') ?
|
||||||
@ -664,45 +661,6 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
if (png_ptr == NULL || info_ptr == NULL || num_text == 0)
|
if (png_ptr == NULL || info_ptr == NULL || num_text == 0)
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
|
||||||
/* If an earlier version of the library was used to build the
|
|
||||||
* application, it might be using a png_textp structure that
|
|
||||||
* does not contain the lang or lang_key elements. Even if you build
|
|
||||||
* this library with PNG_iTXt_SUPPORTED explicitly defined,
|
|
||||||
* and your older library was also built with PNG_iTXt_SUPPORTED
|
|
||||||
* defined, the complete png_textp structure probably has not existed
|
|
||||||
* all along and it's not safe to access them, due to a bug in
|
|
||||||
* pngconf.h from version 1.2.9 to 1.2.40.
|
|
||||||
*/
|
|
||||||
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
png_byte c[12];
|
|
||||||
|
|
||||||
j = 0;
|
|
||||||
for (j = 0; j < 12; j++)
|
|
||||||
c[j] = 0;
|
|
||||||
|
|
||||||
for (j = 0; c[j] && j < 12; j++)
|
|
||||||
c[j] = png_ptr->user_png_ver[j];
|
|
||||||
|
|
||||||
if ((c[5] == '\0') /* 1.2.N */ ||
|
|
||||||
(c[5] == 'b') /* 1.2.NbetaNN */ ||
|
|
||||||
(c[5] == 'r') /* 1.2.NrcNN */ ||
|
|
||||||
(c[4] == '1') /* 1.2.1x */ ||
|
|
||||||
(c[4] == '2') /* 1.2.2x */ ||
|
|
||||||
(c[4] == '3') /* 1.2.3x */ ||
|
|
||||||
((c[4] == '4') /* 1.2.4x */ &&
|
|
||||||
(((c[5] == '0')) /* 1.2.40 */ ||
|
|
||||||
((c[5] == '1') /* 1.2.41x */ &&
|
|
||||||
(((c[6] == 'b') /* 1.2.41betax */ &&
|
|
||||||
((c[10] == '0'))) /* 1.2.41beta0x */ ||
|
|
||||||
((c[10] == '1') /* 1.2.41beta1x */ &&
|
|
||||||
(c[11] == '0'))))))) /* 1.2.41beta10 */
|
|
||||||
caller_no_itxt = 1;
|
|
||||||
}
|
|
||||||
#endif /* PNG_iTXt_SUPPORTED */
|
|
||||||
|
|
||||||
/* Make sure we have enough space in the "text" array in info_struct
|
/* Make sure we have enough space in the "text" array in info_struct
|
||||||
* to hold all of the incoming text_ptr objects.
|
* to hold all of the incoming text_ptr objects.
|
||||||
*/
|
*/
|
||||||
@ -764,8 +722,6 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
{
|
{
|
||||||
/* Set iTXt data */
|
/* Set iTXt data */
|
||||||
|
|
||||||
if (caller_no_itxt == 0)
|
|
||||||
{
|
|
||||||
if (text_ptr[i].lang != NULL)
|
if (text_ptr[i].lang != NULL)
|
||||||
lang_len = png_strlen(text_ptr[i].lang);
|
lang_len = png_strlen(text_ptr[i].lang);
|
||||||
else
|
else
|
||||||
@ -775,15 +731,6 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
else
|
else
|
||||||
lang_key_len = 0;
|
lang_key_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
else /* Caller does not support iTXt */
|
|
||||||
{
|
|
||||||
lang_len = 0;
|
|
||||||
lang_key_len = 0;
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"iTXt lang and lang_key not available from application");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else /* PNG_iTXt_SUPPORTED */
|
#else /* PNG_iTXt_SUPPORTED */
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "iTXt chunk not supported.");
|
png_warning(png_ptr, "iTXt chunk not supported.");
|
||||||
@ -1262,19 +1209,6 @@ png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max,
|
|||||||
png_ptr->user_width_max = user_width_max;
|
png_ptr->user_width_max = user_width_max;
|
||||||
png_ptr->user_height_max = user_height_max;
|
png_ptr->user_height_max = user_height_max;
|
||||||
}
|
}
|
||||||
/* This function was added to libpng 1.2.41 */
|
|
||||||
void PNGAPI
|
|
||||||
png_set_chunk_cache_max (png_structp png_ptr,
|
|
||||||
png_uint_32 user_chunk_cache_max)
|
|
||||||
{
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
png_ptr->user_chunk_cache_max = user_chunk_cache_max;
|
|
||||||
if (user_chunk_cache_max == 0x7fffffffL) /* Unlimited */
|
|
||||||
png_ptr->user_chunk_cache_max = 0;
|
|
||||||
else
|
|
||||||
png_ptr->user_chunk_cache_max = user_chunk_cache_max + 1;
|
|
||||||
}
|
|
||||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
2
pngwio.c
2
pngwio.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
32
pngwrite.c
32
pngwrite.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -534,10 +534,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
|
|
||||||
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
|
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
|
||||||
{
|
{
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
|
||||||
png_size_t length;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
|
/* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
|
||||||
* we must recompile any applications that use any older library version.
|
* we must recompile any applications that use any older library version.
|
||||||
* For versions after libpng 1.0, we will be compatible, so we need
|
* For versions after libpng 1.0, we will be compatible, so we need
|
||||||
@ -567,27 +563,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
png_error(png_ptr,
|
png_error(png_ptr,
|
||||||
"Incompatible libpng version in application and library");
|
"Incompatible libpng version in application and library");
|
||||||
}
|
}
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
|
||||||
|
|
||||||
/* Any library mismatch is trouble for png_set_read() in
|
|
||||||
* libpng-1.2.41 and later 1.2.x, so we store the caller's
|
|
||||||
* library version string.
|
|
||||||
*/
|
|
||||||
|
|
||||||
length = (png_size_t)png_strlen(user_png_ver) + 1;
|
|
||||||
png_debug1(3, "allocating user_png_ver for png_ptr (%lu bytes)",
|
|
||||||
(unsigned long)length);
|
|
||||||
png_ptr->user_png_ver = (png_charp)png_malloc_warn(png_ptr,
|
|
||||||
(png_uint_32)length);
|
|
||||||
|
|
||||||
if (png_ptr->user_png_ver == NULL)
|
|
||||||
png_warning(png_ptr, "Could not store png_ptr->user_png_ver");
|
|
||||||
|
|
||||||
else
|
|
||||||
png_memcpy(png_ptr->user_png_ver, user_png_ver, length);
|
|
||||||
|
|
||||||
#endif /* PNG_iTXt_SUPPORTED */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize zbuf - compression buffer */
|
/* Initialize zbuf - compression buffer */
|
||||||
@ -1177,11 +1152,6 @@ png_write_destroy(png_structp png_ptr)
|
|||||||
free_fn = png_ptr->free_fn;
|
free_fn = png_ptr->free_fn;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* New member added in libpng-1.2.41, will be removed from 1.4.0 */
|
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
|
||||||
png_free(png_ptr, png_ptr->user_png_ver);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_memset(png_ptr, 0, png_sizeof(png_struct));
|
png_memset(png_ptr, 0, png_sizeof(png_struct));
|
||||||
|
|
||||||
png_ptr->error_fn = error_fn;
|
png_ptr->error_fn = error_fn;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
27
pngwutil.c
27
pngwutil.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [November 3, 2009]
|
* Last changed in libpng 1.2.41 [November 8, 2009]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -63,11 +63,6 @@ png_write_sig(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
|
||||||
/* Inform the I/O callback that the signature is being written */
|
|
||||||
png_ptr->io_state = PNG_IO_WRITING | PNG_IO_SIGNATURE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Write the rest of the 8 byte signature */
|
/* Write the rest of the 8 byte signature */
|
||||||
png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes],
|
png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes],
|
||||||
(png_size_t)(8 - png_ptr->sig_bytes));
|
(png_size_t)(8 - png_ptr->sig_bytes));
|
||||||
@ -111,12 +106,6 @@ png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name,
|
|||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
|
||||||
/* Inform the I/O callback that the chunk header is being written.
|
|
||||||
* PNG_IO_CHUNK_HDR requires a single I/O call.
|
|
||||||
*/
|
|
||||||
png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_HDR;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Write the length and the chunk name */
|
/* Write the length and the chunk name */
|
||||||
png_save_uint_32(buf, length);
|
png_save_uint_32(buf, length);
|
||||||
@ -127,13 +116,6 @@ png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name,
|
|||||||
/* Reset the crc and run it over the chunk name */
|
/* Reset the crc and run it over the chunk name */
|
||||||
png_reset_crc(png_ptr);
|
png_reset_crc(png_ptr);
|
||||||
png_calculate_crc(png_ptr, chunk_name, (png_size_t)4);
|
png_calculate_crc(png_ptr, chunk_name, (png_size_t)4);
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
|
||||||
/* Inform the I/O callback that chunk data will (possibly) be written.
|
|
||||||
* PNG_IO_CHUNK_DATA does NOT require a specific number of I/O calls.
|
|
||||||
*/
|
|
||||||
png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_DATA;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the data of a PNG chunk started with png_write_chunk_start().
|
/* Write the data of a PNG chunk started with png_write_chunk_start().
|
||||||
@ -165,13 +147,6 @@ png_write_chunk_end(png_structp png_ptr)
|
|||||||
|
|
||||||
if (png_ptr == NULL) return;
|
if (png_ptr == NULL) return;
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
|
||||||
/* Inform the I/O callback that the chunk CRC is being written.
|
|
||||||
* PNG_IO_CHUNK_CRC requires a single I/O function call.
|
|
||||||
*/
|
|
||||||
png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_CRC;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Write the crc in a single operation */
|
/* Write the crc in a single operation */
|
||||||
png_save_uint_32(buf, png_ptr->crc);
|
png_save_uint_32(buf, png_ptr->crc);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user