mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Make png_text_struct independent of PNG_iTXt_SUPPORTED
This commit is contained in:
parent
9ba962665d
commit
dd78d526d0
11
ANNOUNCE
11
ANNOUNCE
@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.5.0beta16 - March 17, 2010
|
||||
Libpng 1.5.0beta16 - March 30, 2010
|
||||
|
||||
This is not intended to be a public release. It will be replaced
|
||||
within a few weeks by a public version or by another test version.
|
||||
@ -131,7 +131,14 @@ version 1.5.0beta15 [March 17, 2010]
|
||||
Removed makefile.mingw.
|
||||
Eliminated PNG_NO_EXTERN and PNG_ALL_EXTERN
|
||||
|
||||
version 1.5.0beta16 [March 17, 2010]
|
||||
version 1.5.0beta16 [March 30, 2010]
|
||||
Make png_text_struct independent of PNG_iTXt_SUPPORTED, so that
|
||||
fields are initialized in all configurations. The READ/WRITE
|
||||
macros (PNG_(READ|WRITE)_iTXt_SUPPORTED) still function as
|
||||
before to disable code to actually read or write iTXt chunks
|
||||
and iTXt_SUPPORTED can be used to detect presence of either
|
||||
read or write support (but it is probably better to check for
|
||||
the one actually required - read or write.)
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
9
CHANGES
9
CHANGES
@ -2608,7 +2608,14 @@ version 1.5.0beta15 [March 17, 2010]
|
||||
Removed makefile.mingw.
|
||||
Eliminated PNG_NO_EXTERN and PNG_ALL_EXTERN
|
||||
|
||||
version 1.5.0beta16 [March 17, 2010]
|
||||
version 1.5.0beta16 [March 30, 2010]
|
||||
Make png_text_struct independent of PNG_iTXt_SUPPORTED, so that
|
||||
fields are initialized in all configurations. The READ/WRITE
|
||||
macros (PNG_(READ|WRITE)_iTXt_SUPPORTED) still function as
|
||||
before to disable code to actually read or write iTXt chunks
|
||||
and iTXt_SUPPORTED can be used to detect presence of either
|
||||
read or write support (but it is probably better to check for
|
||||
the one actually required - read or write.)
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
14
example.c
14
example.c
@ -2,7 +2,7 @@
|
||||
#if 0 /* in case someone actually tries to compile this */
|
||||
|
||||
/* example.c - an example of using libpng
|
||||
* Last changed in libpng 1.5.0 [March 17, 2010]
|
||||
* Last changed in libpng 1.5.0 [March 30, 2010]
|
||||
* This file has been placed in the public domain by the authors.
|
||||
* Maintained 1998-2010 Glenn Randers-Pehrson
|
||||
* Maintained 1996, 1997 Andreas Dilger)
|
||||
@ -676,17 +676,21 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
text_ptr[0].key = "Title";
|
||||
text_ptr[0].text = "Mona Lisa";
|
||||
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text_ptr[0].itxt_length = 0;
|
||||
text_ptr[0].lang = NULL;
|
||||
text_ptr[0].lang_key = NULL;
|
||||
text_ptr[1].key = "Author";
|
||||
text_ptr[1].text = "Leonardo DaVinci";
|
||||
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text_ptr[1].itxt_length = 0;
|
||||
text_ptr[1].lang = NULL;
|
||||
text_ptr[1].lang_key = NULL;
|
||||
text_ptr[2].key = "Description";
|
||||
text_ptr[2].text = "<long text>";
|
||||
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
text_ptr[0].lang = NULL;
|
||||
text_ptr[1].lang = NULL;
|
||||
text_ptr[2].itxt_length = 0;
|
||||
text_ptr[2].lang = NULL;
|
||||
#endif
|
||||
text_ptr[2].lang_key = NULL;
|
||||
png_set_text(png_ptr, info_ptr, text_ptr, 3);
|
||||
|
||||
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */
|
||||
|
12
png.h
12
png.h
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.5.0beta16 - March 17, 2010
|
||||
* libpng version 1.5.0beta16 - March 30, 2010
|
||||
* Copyright (c) 1998-2010 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.)
|
||||
@ -11,7 +11,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.5.0beta16 - March 17, 2010: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.5.0beta16 - March 30, 2010: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@ -170,7 +170,7 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.5.0beta16, March 17, 2010, are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.5.0beta16, March 30, 2010, are
|
||||
* Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
|
||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
* with the following individual added to the list of Contributing Authors:
|
||||
@ -282,7 +282,7 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* March 17, 2010
|
||||
* March 30, 2010
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
@ -346,7 +346,7 @@
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.5.0beta16"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.5.0beta16 - March 17, 2010\n"
|
||||
" libpng version 1.5.0beta16 - March 30, 2010\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 15
|
||||
#define PNG_LIBPNG_VER_DLLNUM 15
|
||||
@ -523,13 +523,11 @@ typedef struct png_text_struct
|
||||
png_charp text; /* comment, may be an empty string (ie "")
|
||||
or a NULL pointer */
|
||||
png_size_t text_length; /* length of the text string */
|
||||
# ifdef PNG_iTXt_SUPPORTED
|
||||
png_size_t itxt_length; /* length of the itxt string */
|
||||
png_charp lang; /* language code, 0-79 characters
|
||||
or a NULL pointer */
|
||||
png_charp lang_key; /* keyword translated UTF-8 string, 0 or more
|
||||
chars or a NULL pointer */
|
||||
# endif
|
||||
} png_text;
|
||||
typedef png_text FAR * png_textp;
|
||||
typedef png_text FAR * FAR * png_textpp;
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.5.0 [March 17, 2010]
|
||||
* Last changed in libpng 1.5.0 [March 30, 2010]
|
||||
* Copyright (c) 1998-2010 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.)
|
||||
@ -1235,10 +1235,9 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
||||
png_sizeof(png_text));
|
||||
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text_ptr->key = key;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
text_ptr->itxt_length = 0;
|
||||
text_ptr->lang = NULL;
|
||||
text_ptr->lang_key = NULL;
|
||||
#endif
|
||||
text_ptr->text = text;
|
||||
|
||||
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
|
||||
@ -1437,10 +1436,9 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
png_sizeof(png_text));
|
||||
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||
text_ptr->key = key;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
text_ptr->itxt_length = 0;
|
||||
text_ptr->lang = NULL;
|
||||
text_ptr->lang_key = NULL;
|
||||
#endif
|
||||
text_ptr->text = text;
|
||||
|
||||
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.1 [March 17, 2010]
|
||||
* Last changed in libpng 1.4.1 [March 30, 2010]
|
||||
* Copyright (c) 1998-2010 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.)
|
||||
@ -2051,11 +2051,9 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
}
|
||||
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text_ptr->key = key;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
text_ptr->lang = NULL;
|
||||
text_ptr->lang_key = NULL;
|
||||
text_ptr->itxt_length = 0;
|
||||
#endif
|
||||
text_ptr->text = text;
|
||||
text_ptr->text_length = png_strlen(text);
|
||||
|
||||
@ -2172,11 +2170,9 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
}
|
||||
text_ptr->compression = comp_type;
|
||||
text_ptr->key = png_ptr->chunkdata;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
text_ptr->lang = NULL;
|
||||
text_ptr->lang_key = NULL;
|
||||
text_ptr->itxt_length = 0;
|
||||
#endif
|
||||
text_ptr->text = png_ptr->chunkdata + prefix_len;
|
||||
text_ptr->text_length = data_len;
|
||||
|
||||
|
11
pngset.c
11
pngset.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.5.0 [March 17, 2010]
|
||||
* Last changed in libpng 1.5.0 [March 30, 2010]
|
||||
* Copyright (c) 1998-2010 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.)
|
||||
@ -697,8 +697,8 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
lang_key_len = 0;
|
||||
}
|
||||
|
||||
else
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
else
|
||||
{
|
||||
/* Set iTXt data */
|
||||
|
||||
@ -747,7 +747,6 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
|
||||
png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len));
|
||||
*(textp->key + key_len) = '\0';
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
if (text_ptr[i].compression > 0)
|
||||
{
|
||||
textp->lang = textp->key + key_len + 1;
|
||||
@ -759,12 +758,9 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
textp->text = textp->lang_key + lang_key_len + 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
textp->lang=NULL;
|
||||
textp->lang_key=NULL;
|
||||
#endif
|
||||
textp->text = textp->key + key_len + 1;
|
||||
}
|
||||
if (text_length)
|
||||
@ -780,12 +776,9 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
{
|
||||
textp->text_length = text_length;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
textp->itxt_length = 0;
|
||||
#endif
|
||||
}
|
||||
info_ptr->num_text++;
|
||||
png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
|
||||
|
Loading…
x
Reference in New Issue
Block a user