[libpng12] Fix typecast in a png_debug2() statement in png_set_text_2() to

avoid a compiler warning in PNG_DEBUG builds.  Fixed printf formats in
pngtest.c to avoid compiler warnings and a Coverity warning in PNG_DEBUG builds.
This commit is contained in:
Glenn Randers-Pehrson 2015-05-09 21:21:29 -05:00
parent 4d5bdd83f6
commit 34f3ad266e
4 changed files with 21 additions and 12 deletions

View File

@ -44,6 +44,10 @@ Other information:
Changes since the last public release (1.2.53): Changes since the last public release (1.2.53):
version 1.2.54beta01 [May 9, 2015] version 1.2.54beta01 [May 9, 2015]
Fix typecast in a png_debug2() statement in png_set_text_2() to
avoid a compiler warning in PNG_DEBUG builds.
Fixed printf formats in pngtest.c to avoid compiler warnings and a
Coverity warning in PNG_DEBUG builds.
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

View File

@ -2853,6 +2853,10 @@ versions 1.0.63 and 1.2.53 [February 26, 2015]
No changes. No changes.
version 1.2.54beta01 [May 9, 2015] version 1.2.54beta01 [May 9, 2015]
Fixed typecast in a png_debug2() statement in png_set_text_2() to
avoid a compiler warning in PNG_DEBUG builds.
Fixed printf formats in pngtest.c to avoid compiler warnings and a
Coverity warning in PNG_DEBUG builds.
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

View File

@ -773,10 +773,10 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
(key_len + text_length + lang_len + lang_key_len + 4)); (key_len + text_length + lang_len + lang_key_len + 4));
if (textp->key == NULL) if (textp->key == NULL)
return(1); return(1);
png_debug2(2, "Allocated %lu bytes at %x in png_set_text", png_debug2(2, "Allocated %lu bytes at %p in png_set_text",
(png_uint_32) (png_uint_32)
(key_len + lang_len + lang_key_len + text_length + 4), (key_len + lang_len + lang_key_len + text_length + 4),
(int)textp->key); textp->key);
png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len)); png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len));
*(textp->key + key_len) = '\0'; *(textp->key + key_len) = '\0';

View File

@ -2,7 +2,7 @@
/* pngtest.c - a simple test program to test libpng /* pngtest.c - a simple test program to test libpng
* *
* Last changed in libpng 1.2.53 [February 26, 2015] * Last changed in libpng 1.2.53 [February 26, 2015]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -557,7 +557,7 @@ png_debug_malloc(png_structp png_ptr, png_uint_32 size)
/* Make sure the caller isn't assuming zeroed memory. */ /* Make sure the caller isn't assuming zeroed memory. */
png_memset(pinfo->pointer, 0xdd, pinfo->size); png_memset(pinfo->pointer, 0xdd, pinfo->size);
if (verbose) if (verbose)
printf("png_malloc %lu bytes at %x\n", (unsigned long)size, printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
pinfo->pointer); pinfo->pointer);
return (png_voidp)(pinfo->pointer); return (png_voidp)(pinfo->pointer);
} }
@ -578,6 +578,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
} }
/* Unlink the element from the list. */ /* Unlink the element from the list. */
if (pinformation != NULL)
{ {
memory_infop FAR *ppinfo = &pinformation; memory_infop FAR *ppinfo = &pinformation;
for (;;) for (;;)
@ -598,7 +599,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
} }
if (pinfo->next == NULL) if (pinfo->next == NULL)
{ {
fprintf(STDERR, "Pointer %x not found\n", (unsigned int)ptr); fprintf(STDERR, "Pointer %p not found\n", ptr);
break; break;
} }
ppinfo = &pinfo->next; ppinfo = &pinfo->next;
@ -607,7 +608,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
/* Finally free the data. */ /* Finally free the data. */
if (verbose) if (verbose)
printf("Freeing %x\n", ptr); printf("Freeing %p\n", ptr);
png_free_default(png_ptr, ptr); png_free_default(png_ptr, ptr);
ptr = NULL; ptr = NULL;
} }
@ -1230,7 +1231,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
{ {
#ifndef SINGLE_ROWBUF_ALLOC #ifndef SINGLE_ROWBUF_ALLOC
png_debug2(0, "Allocating row buffer (pass %d, y = %ld)...", pass, y); png_debug2(0, "Allocating row buffer (pass %d, y = %lu)...", pass, y);
row_buf = (png_bytep)png_malloc(read_ptr, row_buf = (png_bytep)png_malloc(read_ptr,
png_get_rowbytes(read_ptr, read_info_ptr)); png_get_rowbytes(read_ptr, read_info_ptr));
png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf, png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf,
@ -1253,7 +1254,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif /* PNG_WRITE_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */
#ifndef SINGLE_ROWBUF_ALLOC #ifndef SINGLE_ROWBUF_ALLOC
png_debug2(0, "Freeing row buffer (pass %d, y = %ld)", pass, y); png_debug2(0, "Freeing row buffer (pass %d, y = %lu)", pass, y);
png_free(read_ptr, row_buf); png_free(read_ptr, row_buf);
row_buf = NULL; row_buf = NULL;
#endif /* !SINGLE_ROWBUF_ALLOC */ #endif /* !SINGLE_ROWBUF_ALLOC */
@ -1586,9 +1587,9 @@ main(int argc, char *argv[])
current_allocation); current_allocation);
while (pinfo != NULL) while (pinfo != NULL)
{ {
fprintf(STDERR, " %lu bytes at %x\n", fprintf(STDERR, " %lu bytes at %p\n",
(unsigned long)pinfo->size, (unsigned long)pinfo->size,
(unsigned int) pinfo->pointer); pinfo->pointer);
pinfo = pinfo->next; pinfo = pinfo->next;
} }
} }
@ -1663,8 +1664,8 @@ main(int argc, char *argv[])
current_allocation); current_allocation);
while (pinfo != NULL) while (pinfo != NULL)
{ {
fprintf(STDERR, " %lu bytes at %x\n", fprintf(STDERR, " %lu bytes at %p\n",
(unsigned long)pinfo->size, (unsigned int)pinfo->pointer); (unsigned long)pinfo->size, pinfo->pointer);
pinfo = pinfo->next; pinfo = pinfo->next;
} }
} }