From 05f896004ffd286de4c3fcb777ec7049be0dd71a Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Thu, 28 Nov 2013 14:09:12 -0600 Subject: [PATCH] [libpng17] Changed tabs to 3 spaces in png_debug macros and changed '"%s"m' to '"%s" m' to improve portability among compilers. Changed png_free_default() to free() in pngtest.c --- ANNOUNCE | 7 +++++-- CHANGES | 5 ++++- pngdebug.h | 21 +++++++++------------ pngtest.c | 6 ++++-- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 09ed650f8..352ac8e62 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.7.0beta24 - November 25, 2013 +Libpng 1.7.0beta24 - November 28, 2013 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. @@ -437,9 +437,12 @@ Version 1.7.0beta23 [November 24, 2013] This reverts to the previous 'static' implementation and works round the 'unused static function' warning by using PNG_UNUSED(). -Version 1.7.0beta24 [November 25, 2013] +Version 1.7.0beta24 [November 28, 2013] Removed or marked PNG_UNUSED some harmless "dead assignments" reported by clang scan-build. + Changed tabs to 3 spaces in png_debug macros and changed '"%s"m' + to '"%s" m' to improve portability among compilers. + Changed png_free_default() to free() in pngtest.c Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index f6cc2fa5f..2bac4b7ac 100644 --- a/CHANGES +++ b/CHANGES @@ -4726,9 +4726,12 @@ Version 1.7.0beta23 [November 24, 2013] This reverts to the previous 'static' implementation and works round the 'unused static function' warning by using PNG_UNUSED(). -Version 1.7.0beta24 [November 25, 2013] +Version 1.7.0beta24 [November 28, 2013] Removed or marked PNG_UNUSED some harmless "dead assignments" reported by clang scan-build. + Changed tabs to 3 spaces in png_debug macros and changed '"%s"m' + to '"%s" m' to improve portability among compilers. + Changed png_free_default() to free() in pngtest.c Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngdebug.h b/pngdebug.h index 16f81fdd1..45e12760c 100644 --- a/pngdebug.h +++ b/pngdebug.h @@ -1,11 +1,11 @@ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * - * Copyright (c) 1998-2011 Glenn Randers-Pehrson + * Copyright (c) 1998-2013 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.) * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.18 [(PENDING RELEASE)] * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -25,7 +25,7 @@ * (actually ((void)0)). * * level: level of detail of message, starting at 0. A level 'n' - * message is preceded by 'n' tab characters (not implemented + * message is preceded by 'n' 3-space indentations (not implemented * on Microsoft compilers unless PNG_DEBUG_FILE is also * defined, to allow debug DLL compilation with no standard IO). * message: a printf(3) style text string. A trailing '\n' is added @@ -77,32 +77,29 @@ # endif /* PNG_DEBUG_FILE */ # if (PNG_DEBUG > 1) -/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on - * non-ISO compilers - */ # ifdef __STDC__ # ifndef png_debug # define png_debug(l,m) \ do { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ + fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \ + (num_tabs==2 ? " " : (num_tabs>2 ? " " : "")))); \ } while (0) # endif # ifndef png_debug1 # define png_debug1(l,m,p1) \ do { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ + fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \ + (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1); \ } while (0) # endif # ifndef png_debug2 # define png_debug2(l,m,p1,p2) \ do { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ + fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \ + (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1,p2);\ } while (0) # endif # else /* __STDC __ */ diff --git a/pngtest.c b/pngtest.c index 79d6e5507..2680708cc 100644 --- a/pngtest.c +++ b/pngtest.c @@ -570,7 +570,8 @@ png_debug_free(png_structp png_ptr, png_voidp ptr) /* We must free the list element too, but first kill the memory that is to be freed. */ memset(ptr, 0x55, pinfo->size); - png_free_default(png_ptr, pinfo); + if (pinfo) + free(pinfo); pinfo = NULL; break; } @@ -589,7 +590,8 @@ png_debug_free(png_structp png_ptr, png_voidp ptr) if (verbose) printf("Freeing %p\n", ptr); - png_free_default(png_ptr, ptr); + if (ptr) + free(ptr); ptr = NULL; } #endif /* PNG_USER_MEM_SUPPORTED && PNG_DEBUG */