mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Consistently use png_memset(), png_memcpy(), and png_memcmp(),
except in pngtest.c and example.c where these macros are not visible.
This commit is contained in:
2
ANNOUNCE
2
ANNOUNCE
@@ -431,6 +431,8 @@ Version 1.6.0beta27 [August 10, 2012]
|
|||||||
and cause it not to fail at the comparison step if libpng lacks support
|
and cause it not to fail at the comparison step if libpng lacks support
|
||||||
for writing chunks that it reads from the input (currently only implemented
|
for writing chunks that it reads from the input (currently only implemented
|
||||||
for compressed text chunks).
|
for compressed text chunks).
|
||||||
|
Consistently use png_memset(), png_memcpy(), and png_memcmp(), except in
|
||||||
|
pngtest.c and example.c where these macros are not visible.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
|||||||
2
CHANGES
2
CHANGES
@@ -4182,6 +4182,8 @@ Version 1.6.0beta27 [August 10, 2012]
|
|||||||
and cause it not to fail at the comparison step if libpng lacks support
|
and cause it not to fail at the comparison step if libpng lacks support
|
||||||
for writing chunks that it reads from the input (currently only implemented
|
for writing chunks that it reads from the input (currently only implemented
|
||||||
for compressed text chunks).
|
for compressed text chunks).
|
||||||
|
Consistently use png_memset(), png_memcpy(), and png_memcmp(), except in
|
||||||
|
pngtest.c and example.c where these macros are not visible.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
|||||||
2
pngmem.c
2
pngmem.c
@@ -30,7 +30,7 @@ png_destroy_png_struct(png_structrp png_ptr)
|
|||||||
* png_get_mem_ptr, so fake a temporary png_struct to support this.
|
* png_get_mem_ptr, so fake a temporary png_struct to support this.
|
||||||
*/
|
*/
|
||||||
png_struct dummy_struct = *png_ptr;
|
png_struct dummy_struct = *png_ptr;
|
||||||
memset(png_ptr, 0, (sizeof *png_ptr));
|
png_memset(png_ptr, 0, (sizeof *png_ptr));
|
||||||
png_free(&dummy_struct, png_ptr);
|
png_free(&dummy_struct, png_ptr);
|
||||||
|
|
||||||
# ifdef PNG_SETJMP_SUPPORTED
|
# ifdef PNG_SETJMP_SUPPORTED
|
||||||
|
|||||||
@@ -1169,7 +1169,7 @@ png_image_read_init(png_imagep image)
|
|||||||
/* And set the rest of the structure to NULL to ensure that the various
|
/* And set the rest of the structure to NULL to ensure that the various
|
||||||
* fields are consistent.
|
* fields are consistent.
|
||||||
*/
|
*/
|
||||||
memset(image, 0, (sizeof *image));
|
png_memset(image, 0, (sizeof *image));
|
||||||
image->version = PNG_IMAGE_VERSION;
|
image->version = PNG_IMAGE_VERSION;
|
||||||
|
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
@@ -2527,7 +2527,7 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
* PNG_CMAP_RGB algorithm will use. If the two entries don't
|
* PNG_CMAP_RGB algorithm will use. If the two entries don't
|
||||||
* match, add the new one and set this as the background index.
|
* match, add the new one and set this as the background index.
|
||||||
*/
|
*/
|
||||||
if (memcmp((png_const_bytep)display->colormap +
|
if (png_memcmp((png_const_bytep)display->colormap +
|
||||||
sample_size * cmap_entries,
|
sample_size * cmap_entries,
|
||||||
(png_const_bytep)display->colormap +
|
(png_const_bytep)display->colormap +
|
||||||
sample_size * PNG_RGB_INDEX(r,g,b),
|
sample_size * PNG_RGB_INDEX(r,g,b),
|
||||||
|
|||||||
@@ -1438,7 +1438,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
if (profile != NULL)
|
if (profile != NULL)
|
||||||
{
|
{
|
||||||
memcpy(profile, profile_header,
|
png_memcpy(profile, profile_header,
|
||||||
(sizeof profile_header));
|
(sizeof profile_header));
|
||||||
|
|
||||||
size = 12 * tag_count;
|
size = 12 * tag_count;
|
||||||
@@ -1508,7 +1508,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||||||
keyword_length+1));
|
keyword_length+1));
|
||||||
if (info_ptr->iccp_name != NULL)
|
if (info_ptr->iccp_name != NULL)
|
||||||
{
|
{
|
||||||
memcpy(info_ptr->iccp_name, keyword,
|
png_memcpy(info_ptr->iccp_name, keyword,
|
||||||
keyword_length+1);
|
keyword_length+1);
|
||||||
info_ptr->iccp_proflen =
|
info_ptr->iccp_proflen =
|
||||||
profile_length;
|
profile_length;
|
||||||
|
|||||||
@@ -1907,8 +1907,8 @@ png_image_set_PLTE(png_image_write_control *display)
|
|||||||
png_color palette[256];
|
png_color palette[256];
|
||||||
png_byte tRNS[256];
|
png_byte tRNS[256];
|
||||||
|
|
||||||
memset(tRNS, 255, (sizeof tRNS));
|
png_memset(tRNS, 255, (sizeof tRNS));
|
||||||
memset(palette, 0, (sizeof palette));
|
png_memset(palette, 0, (sizeof palette));
|
||||||
|
|
||||||
for (i=num_trans=0; i<entries; ++i)
|
for (i=num_trans=0; i<entries; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1663,7 +1663,7 @@ png_write_zTXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
|
|||||||
|
|
||||||
/* Compute the compressed data; do it now for the length */
|
/* Compute the compressed data; do it now for the length */
|
||||||
png_text_compress_init(&comp, (png_const_bytep)text,
|
png_text_compress_init(&comp, (png_const_bytep)text,
|
||||||
text == NULL ? 0 : strlen(text));
|
text == NULL ? 0 : png_strlen(text));
|
||||||
|
|
||||||
if (png_text_compress(png_ptr, png_zTXt, &comp, key_len) != Z_OK)
|
if (png_text_compress(png_ptr, png_zTXt, &comp, key_len) != Z_OK)
|
||||||
png_error(png_ptr, png_ptr->zstream.msg);
|
png_error(png_ptr, png_ptr->zstream.msg);
|
||||||
@@ -1731,9 +1731,9 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
|
|||||||
* TODO: validate the language tag correctly (see the spec.)
|
* TODO: validate the language tag correctly (see the spec.)
|
||||||
*/
|
*/
|
||||||
if (lang == NULL) lang = ""; /* empty language is valid */
|
if (lang == NULL) lang = ""; /* empty language is valid */
|
||||||
lang_len = strlen(lang)+1;
|
lang_len = png_strlen(lang)+1;
|
||||||
if (lang_key == NULL) lang_key = ""; /* may be empty */
|
if (lang_key == NULL) lang_key = ""; /* may be empty */
|
||||||
lang_key_len = strlen(lang_key)+1;
|
lang_key_len = png_strlen(lang_key)+1;
|
||||||
if (text == NULL) text = ""; /* may be empty */
|
if (text == NULL) text = ""; /* may be empty */
|
||||||
|
|
||||||
prefix_len = key_len;
|
prefix_len = key_len;
|
||||||
@@ -1747,7 +1747,7 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
|
|||||||
else
|
else
|
||||||
prefix_len = (png_uint_32)(prefix_len + lang_key_len);
|
prefix_len = (png_uint_32)(prefix_len + lang_key_len);
|
||||||
|
|
||||||
png_text_compress_init(&comp, (png_const_bytep)text, strlen(text));
|
png_text_compress_init(&comp, (png_const_bytep)text, png_strlen(text));
|
||||||
|
|
||||||
if (compression)
|
if (compression)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user