提交 26849f46 编写于 作者: G Glenn Randers-Pehrson

[libpng16] Consistently use png_memset(), png_memcpy(), and png_memcmp(),

except in pngtest.c and example.c where these macros are not visible.
上级 ad5a9939
......@@ -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
for writing chunks that it reads from the input (currently only implemented
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
(subscription required; visit
......
......@@ -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
for writing chunks that it reads from the input (currently only implemented
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
(subscription required; visit
......
......@@ -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_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);
# 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
* fields are consistent.
*/
memset(image, 0, (sizeof *image));
png_memset(image, 0, (sizeof *image));
image->version = PNG_IMAGE_VERSION;
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
* 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,
(png_const_bytep)display->colormap +
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)
{
memcpy(profile, profile_header,
png_memcpy(profile, profile_header,
(sizeof profile_header));
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));
if (info_ptr->iccp_name != NULL)
{
memcpy(info_ptr->iccp_name, keyword,
png_memcpy(info_ptr->iccp_name, keyword,
keyword_length+1);
info_ptr->iccp_proflen =
profile_length;
......
......@@ -1907,8 +1907,8 @@ png_image_set_PLTE(png_image_write_control *display)
png_color palette[256];
png_byte tRNS[256];
memset(tRNS, 255, (sizeof tRNS));
memset(palette, 0, (sizeof palette));
png_memset(tRNS, 255, (sizeof tRNS));
png_memset(palette, 0, (sizeof palette));
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 */
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)
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.)
*/
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 */
lang_key_len = strlen(lang_key)+1;
lang_key_len = png_strlen(lang_key)+1;
if (text == NULL) text = ""; /* may be empty */
prefix_len = key_len;
......@@ -1747,7 +1747,7 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
else
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)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册