提交 29b738b4 编写于 作者: G Glenn Randers-Pehrson

[master] Enabled iTXt support by default.

    To ensure binary compatibility with
    previous versions, the "lang" and "lang_key" members will be assumed
    to be omitted from previous versions unless the current libpng
    version was built with PNG_iTXt_SUPPORTED (which is otherwise no
    longer necessary to gain iTXt support), as a signal that the user has
    been building previous versions with PNG_iTXt_SUPPORTED as well.
上级 602d314b
......@@ -92,6 +92,12 @@ version 1.2.41beta09 [November 1, 2009]
Merged libpng-1.2.41.txt with libpng-1.4.0.txt where appropriate.
version 1.2.41beta10 [November 1, 2009]
Enabled iTXt support by default. To ensure binary compatibility with
previous versions, the "lang" and "lang_key" members will be assumed
to be omitted from previous versions unless the current libpng
version was built with PNG_iTXt_SUPPORTED (which is otherwise no
longer necessary to gain iTXt support), as a signal that the user has
been building previous versions with PNG_iTXt_SUPPORTED as well.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
......
......@@ -2522,6 +2522,12 @@ version 1.2.41beta09 [November 1, 2009]
Merged libpng-1.2.41.txt with libpng-1.4.0.txt where appropriate.
version 1.2.41beta10 [November 1, 2009]
Enabled iTXt support by default. To ensure binary compatibility with
previous versions, the "lang" and "lang_key" members will be assumed
to be omitted from previous versions unless the current libpng
version was built with PNG_iTXt_SUPPORTED (which is otherwise no
longer necessary to gain iTXt support), as a signal that the user has
been building previous versions with PNG_iTXt_SUPPORTED as well.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
......
......@@ -2950,6 +2950,13 @@ accomplish this, the functions png_create_read_struct_2(),
png_create_write_struct_2(), png_set_mem_fn(), png_get_mem_ptr(),
png_malloc_default(), and png_free_default() were added.
Support for the iTXt chunk has been enabled by default as of
version 1.2.41. If you have been defining PNG_iTXt_SUPPORTED
already, please continue to do so, as a signal to libpng that your
previous versions also supported iTXt. If you have not been defining
PNG_iTXt_SUPPORTED, please don't start now; it will be enabled for
you by default.
Support for certain MNG features was enabled.
Support for numbered error messages was added. However, we never got
......
......@@ -526,6 +526,18 @@
* will be turned on by default in libpng-1.4.0.
*/
/* If you have previously been defining PNG_iTXt_SUPPORTED, please
* continue to do so in libpng-1.2.41 and later, until you switch to
* libpng-1.4.0, even though it is not necessary now to gain iTXt support.
* Your PNG_iTXt_SUPPORTED definition will be interpreted in png_set_text()
* as a signal that you have defined it in your builds of previous libpng
* versions that did not support iTXt by default.
*/
#if !defined(PNG_iTXt_SUPPORTED) && !defined(PNG_READ_iTXt_SUPPORTED) && \
!defined(PNG_WRITE_iTXt_SUPPORTED)
# define PNG_iTXt_NOT_PREVIOUSLY_SUPPORTED
#endif
#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
# ifndef PNG_iTXt_SUPPORTED
# ifndef PNG_NO_iTXt_SUPPORTED
......
......@@ -653,6 +653,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
int num_text)
{
int i;
int caller_no_itxt = 0;
png_debug1(1, "in %s storage function", ((png_ptr == NULL ||
png_ptr->chunk_name[0] == '\0') ?
......@@ -661,6 +662,19 @@ 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)
return(0);
#ifdef PNG_iTXt_NOT_PREVIOUSLY_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. If you build
* this library with PNG_iTXt_SUPPORTED explicitly defined,
* then we assume that your older library was also built with
* PNG_iTXt_SUPPORTED defined and the complete png_textp structure
* has existed all along and it's safe to access them. See pngconf.h.
*/
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
caller_no_itxt = 1;
#endif
/* Make sure we have enough space in the "text" array in info_struct
* to hold all of the incoming text_ptr objects.
*/
......@@ -721,17 +735,28 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
#ifdef PNG_iTXt_SUPPORTED
{
/* Set iTXt data */
if (text_ptr[i].lang != NULL)
lang_len = png_strlen(text_ptr[i].lang);
else
if (caller_no_itxt == 0)
{
if (text_ptr[i].lang != NULL)
lang_len = png_strlen(text_ptr[i].lang);
else
lang_len = 0;
if (text_ptr[i].lang_key != NULL)
lang_key_len = png_strlen(text_ptr[i].lang_key);
else
lang_key_len = 0;
}
else /* Caller does not support iTXt */
{
lang_len = 0;
if (text_ptr[i].lang_key != NULL)
lang_key_len = png_strlen(text_ptr[i].lang_key);
else
lang_key_len = 0;
png_warning(png_ptr,
"iTXt lang and lang_key not available from application");
}
}
#else
#else /* PNG_iTXt_SUPPORTED */
{
png_warning(png_ptr, "iTXt chunk not supported.");
continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册