[master] Moved declarations of umsg[] inside the proper #ifdef blocks

in pngrutil.c
This commit is contained in:
Glenn Randers-Pehrson 2010-05-04 09:32:02 -05:00
parent e0f6c7d90b
commit a310a3b398
3 changed files with 71 additions and 62 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.4.2rc05 - April 29, 2010
Libpng 1.4.2rc06 - May 4, 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.
@ -9,20 +9,20 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
1.4.2rc05.tar.xz (LZMA-compressed, recommended)
1.4.2rc05.tar.gz
1.4.2rc05.tar.bz2
1.4.2rc06.tar.xz (LZMA-compressed, recommended)
1.4.2rc06.tar.gz
1.4.2rc06.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
lp142r05.zip
lp142r05.7z
lp142r06.zip
lp142r06.7z
Other information:
1.4.2rc05-README.txt
1.4.2rc05-LICENSE.txt
1.4.2rc06-README.txt
1.4.2rc06-LICENSE.txt
Changes since the last public release (1.4.1):
@ -60,6 +60,9 @@ version 1.4.2rc05 [April 29, 2010]
png.h is removed if both READ and WRITE USER_TRANSFORM are turned off
but was left defined in pngtrans.c
version 1.4.2rc06 [May 4, 2010]
Moved declarations of umsg[] inside the proper #ifdef blocks in pngrutil.c
Send comments/corrections/commendations to glennrp at users.sourceforge.net
or to png-mng-implement at lists.sf.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement).

View File

@ -2571,6 +2571,9 @@ version 1.4.2rc05 [April 29, 2010]
png.h is removed if both READ and WRITE USER_TRANSFORM are turned off
but was left defined in pngtrans.c
version 1.4.2rc06 [May 4, 2010]
Moved declarations of umsg[] inside the proper #ifdef blocks in pngrutil.c
Send comments/corrections/commendations to glennrp at users.sourceforge.net
or to png-mng-implement at lists.sf.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement).

View File

@ -203,7 +203,7 @@ png_crc_error(png_structp png_ptr)
defined(PNG_READ_iCCP_SUPPORTED)
static png_size_t
png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
png_bytep output, png_size_t output_size)
png_bytep output, png_size_t output_size)
{
png_size_t count = 0;
@ -229,11 +229,11 @@ png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
if ((ret == Z_OK || ret == Z_STREAM_END) && avail > 0)
{
if (output != 0 && output_size > count)
{
int copy = output_size - count;
if (avail < copy) copy = avail;
png_memcpy(output + count, png_ptr->zbuf, copy);
}
{
int copy = output_size - count;
if (avail < copy) copy = avail;
png_memcpy(output + count, png_ptr->zbuf, copy);
}
count += avail;
}
@ -254,31 +254,33 @@ png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
* buffer if available.
*/
{
char *msg, umsg[52];
if (png_ptr->zstream.msg != 0)
msg = png_ptr->zstream.msg;
else
{
char *msg;
if (png_ptr->zstream.msg != 0)
msg = png_ptr->zstream.msg;
else
{
#ifdef PNG_STDIO_SUPPORTED
switch (ret)
{
case Z_BUF_ERROR:
msg = "Buffer error in compressed datastream in %s chunk";
break;
case Z_DATA_ERROR:
msg = "Data error in compressed datastream in %s chunk";
break;
default:
msg = "Incomplete compressed datastream in %s chunk";
break;
}
char umsg[52];
png_snprintf(umsg, sizeof umsg, msg, png_ptr->chunk_name);
msg = umsg;
switch (ret)
{
case Z_BUF_ERROR:
msg = "Buffer error in compressed datastream in %s chunk";
break;
case Z_DATA_ERROR:
msg = "Data error in compressed datastream in %s chunk";
break;
default:
msg = "Incomplete compressed datastream in %s chunk";
break;
}
png_snprintf(umsg, sizeof umsg, msg, png_ptr->chunk_name);
msg = umsg;
#else
msg = "Damaged compressed datastream in chunk other than IDAT";
msg = "Damaged compressed datastream in chunk other than IDAT";
#endif
}
}
png_warning(png_ptr, msg);
}
@ -313,9 +315,9 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
else if (comp_type == PNG_COMPRESSION_TYPE_BASE)
{
png_size_t expanded_size = png_inflate(png_ptr,
(png_bytep)(png_ptr->chunkdata + prefix_size),
(png_bytep)(png_ptr->chunkdata + prefix_size),
chunklength - prefix_size,
0/*output*/, 0/*output size*/);
0/*output*/, 0/*output size*/);
/* Now check the limits on this chunk - if the limit fails the
* compressed data will be removed, the prefix will remain.
@ -341,41 +343,42 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
if (expanded_size > 0)
{
/* Success (maybe) - really uncompress the chunk. */
png_size_t new_size = 0;
png_charp text = png_malloc_warn(png_ptr,
prefix_size + expanded_size + 1);
png_size_t new_size = 0;
png_charp text = png_malloc_warn(png_ptr,
prefix_size + expanded_size + 1);
if (text != NULL)
{
png_memcpy(text, png_ptr->chunkdata, prefix_size);
new_size = png_inflate(png_ptr,
png_memcpy(text, png_ptr->chunkdata, prefix_size);
new_size = png_inflate(png_ptr,
(png_bytep)(png_ptr->chunkdata + prefix_size),
chunklength - prefix_size,
chunklength - prefix_size,
(png_bytep)(text + prefix_size), expanded_size);
text[prefix_size + expanded_size] = 0; /* just in case */
text[prefix_size + expanded_size] = 0; /* just in case */
if (new_size == expanded_size)
{
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = text;
*newlength = prefix_size + expanded_size;
return; /* The success return! */
}
if (new_size == expanded_size)
{
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = text;
*newlength = prefix_size + expanded_size;
return; /* The success return! */
}
png_warning(png_ptr, "png_inflate logic error");
png_free(png_ptr, text);
}
else
png_warning(png_ptr, "png_inflate logic error");
png_free(png_ptr, text);
}
else
png_warning(png_ptr, "Not enough memory to decompress chunk");
}
}
else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
{
#ifdef PNG_STDIO_SUPPORTED
char umsg[50];
#ifdef PNG_STDIO_SUPPORTED
png_snprintf(umsg, sizeof umsg, "Unknown zTXt compression type %d", comp_type);
png_snprintf(umsg, sizeof umsg, "Unknown zTXt compression type %d",
comp_type);
png_warning(png_ptr, umsg);
#else
png_warning(png_ptr, "Unknown zTXt compression type");
@ -392,13 +395,13 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
png_charp text = png_malloc_warn(png_ptr, prefix_size + 1);
if (text != NULL)
{
if (prefix_size > 0)
if (prefix_size > 0)
png_memcpy(text, png_ptr->chunkdata, prefix_size);
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = text;
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = text;
/* This is an extra zero in the 'uncompressed' part. */
*(png_ptr->chunkdata + prefix_size) = 0x00;
/* This is an extra zero in the 'uncompressed' part. */
*(png_ptr->chunkdata + prefix_size) = 0x00;
}
/* Ignore a malloc error here - it is safe. */
}