mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[master] Store user's user_png_ver in new png_ptr->user_png_ver element.
Revised iTXt support. To ensure binary compatibility with previous versions, the "lang" and "lang_key" members will be assumed to be omitted from versions prior to 1.2.41beta11 whenever there is a library mismatch.
This commit is contained in:
36
pngset.c
36
pngset.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.2.41 [November 1, 2009]
|
||||
* Last changed in libpng 1.2.41 [November 2, 2009]
|
||||
* Copyright (c) 1998-2009 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.)
|
||||
@@ -653,7 +653,9 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
int num_text)
|
||||
{
|
||||
int i;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
int caller_no_itxt = 0;
|
||||
#endif
|
||||
|
||||
png_debug1(1, "in %s storage function", ((png_ptr == NULL ||
|
||||
png_ptr->chunk_name[0] == '\0') ?
|
||||
@@ -662,6 +664,7 @@ 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_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
|
||||
@@ -670,12 +673,35 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
* 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.
|
||||
*
|
||||
* To do: accept mismatched libraries when both are version 1.2.41
|
||||
* or later.
|
||||
*/
|
||||
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
|
||||
caller_no_itxt = 1;
|
||||
{
|
||||
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
|
||||
* to hold all of the incoming text_ptr objects.
|
||||
|
||||
Reference in New Issue
Block a user