mirror of
				https://git.code.sf.net/p/libpng/code.git
				synced 2025-07-10 18:04:09 +02:00 
			
		
		
		
	[libpng16] Removed need for -Wno-cast-align with clang. clang correctly warns
on alignment increasing pointer casts when -Wcast-align is passed. This fixes the cases clang warns about either (pngread.c) by eliminating the casts from png_bytep to png_uint_16p or, for pngrutil.c where the cast is previously verified or pngstest.c where it is OK by introducing new png_aligncast macros to do the cast in a way that clang accepts.
This commit is contained in:
		
							parent
							
								
									040575c80b
								
							
						
					
					
						commit
						b45416921b
					
				
							
								
								
									
										10
									
								
								ANNOUNCE
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								ANNOUNCE
									
									
									
									
									
								
							@ -1,5 +1,5 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Libpng 1.6.0beta22 - April 28, 2012
 | 
					Libpng 1.6.0beta22 - April 30, 2012
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This is not intended to be a public release.  It will be replaced
 | 
					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.
 | 
					within a few weeks by a public version or by another test version.
 | 
				
			||||||
@ -360,7 +360,13 @@ Version 1.6.0beta21 [April 27, 2012]
 | 
				
			|||||||
  Added -lssp_nonshared in a comment in scripts/makefile.freebsd
 | 
					  Added -lssp_nonshared in a comment in scripts/makefile.freebsd
 | 
				
			||||||
    and changed deprecated NOOBJ and NOPROFILE to NO_OBJ and NO_PROFILE.
 | 
					    and changed deprecated NOOBJ and NOPROFILE to NO_OBJ and NO_PROFILE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Version 1.6.0beta22 [April 28, 2012]
 | 
					Version 1.6.0beta22 [April 30, 2012]
 | 
				
			||||||
 | 
					  Removed need for -Wno-cast-align with clang.  clang correctly warns on
 | 
				
			||||||
 | 
					    alignment increasing pointer casts when -Wcast-align is passed. This
 | 
				
			||||||
 | 
					    fixes the cases clang warns about either (pngread.c) by eliminating the
 | 
				
			||||||
 | 
					    casts from png_bytep to png_uint_16p or, for pngrutil.c where the cast
 | 
				
			||||||
 | 
					    is previously verified or pngstest.c where it is OK by introducing new
 | 
				
			||||||
 | 
					    png_aligncast macros to do the cast in a way that clang accepts.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										8
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								CHANGES
									
									
									
									
									
								
							@ -4111,7 +4111,13 @@ Version 1.6.0beta21 [April 27, 2012]
 | 
				
			|||||||
  Added -lssp_nonshared in a comment in scripts/makefile.freebsd
 | 
					  Added -lssp_nonshared in a comment in scripts/makefile.freebsd
 | 
				
			||||||
    and changed deprecated NOOBJ and NOPROFILE to NO_OBJ and NO_PROFILE.
 | 
					    and changed deprecated NOOBJ and NOPROFILE to NO_OBJ and NO_PROFILE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Version 1.6.0beta22 [April 28, 2012]
 | 
					Version 1.6.0beta22 [April 30, 2012]
 | 
				
			||||||
 | 
					  Removed need for -Wno-cast-align with clang.  clang correctly warns on
 | 
				
			||||||
 | 
					    alignment increasing pointer casts when -Wcast-align is passed. This
 | 
				
			||||||
 | 
					    fixes the cases clang warns about either (pngread.c) by eliminating the
 | 
				
			||||||
 | 
					    casts from png_bytep to png_uint_16p or, for pngrutil.c where the cast
 | 
				
			||||||
 | 
					    is previously verified or pngstest.c where it is OK by introducing new
 | 
				
			||||||
 | 
					    png_aligncast macros to do the cast in a way that clang accepts.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								png.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								png.c
									
									
									
									
									
								
							@ -747,13 +747,13 @@ png_get_copyright(png_const_structrp png_ptr)
 | 
				
			|||||||
#else
 | 
					#else
 | 
				
			||||||
#  ifdef __STDC__
 | 
					#  ifdef __STDC__
 | 
				
			||||||
   return PNG_STRING_NEWLINE \
 | 
					   return PNG_STRING_NEWLINE \
 | 
				
			||||||
     "libpng version 1.6.0beta22 - April 28, 2012" PNG_STRING_NEWLINE \
 | 
					     "libpng version 1.6.0beta22 - April 30, 2012" PNG_STRING_NEWLINE \
 | 
				
			||||||
     "Copyright (c) 1998-2012 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
 | 
					     "Copyright (c) 1998-2012 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
 | 
				
			||||||
     "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
 | 
					     "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
 | 
				
			||||||
     "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
 | 
					     "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
 | 
				
			||||||
     PNG_STRING_NEWLINE;
 | 
					     PNG_STRING_NEWLINE;
 | 
				
			||||||
#  else
 | 
					#  else
 | 
				
			||||||
      return "libpng version 1.6.0beta22 - April 28, 2012\
 | 
					      return "libpng version 1.6.0beta22 - April 30, 2012\
 | 
				
			||||||
      Copyright (c) 1998-2012 Glenn Randers-Pehrson\
 | 
					      Copyright (c) 1998-2012 Glenn Randers-Pehrson\
 | 
				
			||||||
      Copyright (c) 1996-1997 Andreas Dilger\
 | 
					      Copyright (c) 1996-1997 Andreas Dilger\
 | 
				
			||||||
      Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
 | 
					      Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								png.h
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								png.h
									
									
									
									
									
								
							@ -1,7 +1,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* png.h - header file for PNG reference library
 | 
					/* png.h - header file for PNG reference library
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * libpng version 1.6.0beta22 - April 28, 2012
 | 
					 * libpng version 1.6.0beta22 - April 30, 2012
 | 
				
			||||||
 * Copyright (c) 1998-2012 Glenn Randers-Pehrson
 | 
					 * Copyright (c) 1998-2012 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.)
 | 
				
			||||||
@ -11,7 +11,7 @@
 | 
				
			|||||||
 * Authors and maintainers:
 | 
					 * Authors and maintainers:
 | 
				
			||||||
 *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
 | 
					 *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
 | 
				
			||||||
 *   libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
 | 
					 *   libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
 | 
				
			||||||
 *   libpng versions 0.97, January 1998, through 1.6.0beta22 - April 28, 2012: Glenn
 | 
					 *   libpng versions 0.97, January 1998, through 1.6.0beta22 - April 30, 2012: Glenn
 | 
				
			||||||
 *   See also "Contributing Authors", below.
 | 
					 *   See also "Contributing Authors", below.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Note about libpng version numbers:
 | 
					 * Note about libpng version numbers:
 | 
				
			||||||
@ -198,7 +198,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * This code is released under the libpng license.
 | 
					 * This code is released under the libpng license.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * libpng versions 1.2.6, August 15, 2004, through 1.6.0beta22, April 28, 2012, are
 | 
					 * libpng versions 1.2.6, August 15, 2004, through 1.6.0beta22, April 30, 2012, are
 | 
				
			||||||
 * Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
 | 
					 * Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
 | 
				
			||||||
 * distributed according to the same disclaimer and license as libpng-1.2.5
 | 
					 * distributed according to the same disclaimer and license as libpng-1.2.5
 | 
				
			||||||
 * with the following individual added to the list of Contributing Authors:
 | 
					 * with the following individual added to the list of Contributing Authors:
 | 
				
			||||||
@ -310,7 +310,7 @@
 | 
				
			|||||||
 * Y2K compliance in libpng:
 | 
					 * Y2K compliance in libpng:
 | 
				
			||||||
 * =========================
 | 
					 * =========================
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *    April 28, 2012
 | 
					 *    April 30, 2012
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *    Since the PNG Development group is an ad-hoc body, we can't make
 | 
					 *    Since the PNG Development group is an ad-hoc body, we can't make
 | 
				
			||||||
 *    an official declaration.
 | 
					 *    an official declaration.
 | 
				
			||||||
@ -376,7 +376,7 @@
 | 
				
			|||||||
/* Version information for png.h - this should match the version in png.c */
 | 
					/* Version information for png.h - this should match the version in png.c */
 | 
				
			||||||
#define PNG_LIBPNG_VER_STRING "1.6.0beta22"
 | 
					#define PNG_LIBPNG_VER_STRING "1.6.0beta22"
 | 
				
			||||||
#define PNG_HEADER_VERSION_STRING \
 | 
					#define PNG_HEADER_VERSION_STRING \
 | 
				
			||||||
     " libpng version 1.6.0beta22 - April 28, 2012\n"
 | 
					     " libpng version 1.6.0beta22 - April 30, 2012\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PNG_LIBPNG_VER_SONUM   16
 | 
					#define PNG_LIBPNG_VER_SONUM   16
 | 
				
			||||||
#define PNG_LIBPNG_VER_DLLNUM  16
 | 
					#define PNG_LIBPNG_VER_DLLNUM  16
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* pngconf.h - machine configurable file for libpng
 | 
					/* pngconf.h - machine configurable file for libpng
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * libpng version 1.6.0beta22 - April 28, 2012
 | 
					 * libpng version 1.6.0beta22 - April 30, 2012
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Copyright (c) 1998-2012 Glenn Randers-Pehrson
 | 
					 * Copyright (c) 1998-2012 Glenn Randers-Pehrson
 | 
				
			||||||
 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
 | 
					 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
 | 
				
			||||||
 | 
				
			|||||||
@ -312,9 +312,15 @@ typedef const png_uint_16p * png_const_uint_16pp;
 | 
				
			|||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
#  define png_voidcast(type, value) static_cast<type>(value)
 | 
					#  define png_voidcast(type, value) static_cast<type>(value)
 | 
				
			||||||
#  define png_constcast(type, value) const_cast<type>(value)
 | 
					#  define png_constcast(type, value) const_cast<type>(value)
 | 
				
			||||||
 | 
					#  define png_aligncast(type, value) \
 | 
				
			||||||
 | 
					   static_cast<type>(static_cast<void*>(value))
 | 
				
			||||||
 | 
					#  define png_aligncastconst(type, value) \
 | 
				
			||||||
 | 
					   static_cast<type>(static_cast<const void*>(value))
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#  define png_voidcast(type, value) (value)
 | 
					#  define png_voidcast(type, value) (value)
 | 
				
			||||||
#  define png_constcast(type, value) ((type)(value))
 | 
					#  define png_constcast(type, value) ((type)(value))
 | 
				
			||||||
 | 
					#  define png_aligncast(type, value) ((void*)(value))
 | 
				
			||||||
 | 
					#  define png_aligncastconst(type, value) ((const void*)(value))
 | 
				
			||||||
#endif /* __cplusplus */
 | 
					#endif /* __cplusplus */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Some fixed point APIs are still required even if not exported because
 | 
					/* Some fixed point APIs are still required even if not exported because
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										74
									
								
								pngread.c
									
									
									
									
									
								
							
							
						
						
									
										74
									
								
								pngread.c
									
									
									
									
									
								
							@ -1145,8 +1145,8 @@ typedef struct
 | 
				
			|||||||
   png_voidp  colormap;
 | 
					   png_voidp  colormap;
 | 
				
			||||||
   png_const_colorp background;
 | 
					   png_const_colorp background;
 | 
				
			||||||
   /* Local variables: */
 | 
					   /* Local variables: */
 | 
				
			||||||
   png_bytep       local_row;
 | 
					   png_voidp       local_row;
 | 
				
			||||||
   png_bytep       first_row;
 | 
					   png_voidp       first_row;
 | 
				
			||||||
   ptrdiff_t       row_bytes;           /* step between rows */
 | 
					   ptrdiff_t       row_bytes;           /* step between rows */
 | 
				
			||||||
   int             file_encoding;       /* E_ values above */
 | 
					   int             file_encoding;       /* E_ values above */
 | 
				
			||||||
   png_fixed_point gamma_to_linear;     /* For E_FILE, reciprocal of gamma */
 | 
					   png_fixed_point gamma_to_linear;     /* For E_FILE, reciprocal of gamma */
 | 
				
			||||||
@ -2771,7 +2771,7 @@ png_image_read_and_map(png_voidp argument)
 | 
				
			|||||||
      png_uint_32  height = image->height;
 | 
					      png_uint_32  height = image->height;
 | 
				
			||||||
      png_uint_32  width = image->width;
 | 
					      png_uint_32  width = image->width;
 | 
				
			||||||
      int          proc = display->colormap_processing;
 | 
					      int          proc = display->colormap_processing;
 | 
				
			||||||
      png_bytep    first_row = display->first_row;
 | 
					      png_bytep    first_row = png_voidcast(png_bytep, display->first_row);
 | 
				
			||||||
      ptrdiff_t    step_row = display->row_bytes;
 | 
					      ptrdiff_t    step_row = display->row_bytes;
 | 
				
			||||||
      int pass;
 | 
					      int pass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2801,7 +2801,7 @@ png_image_read_and_map(png_voidp argument)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
         for (; y<height; y += stepy)
 | 
					         for (; y<height; y += stepy)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            png_bytep inrow = display->local_row;
 | 
					            png_bytep inrow = png_voidcast(png_bytep, display->local_row);
 | 
				
			||||||
            png_bytep outrow = first_row + y * step_row;
 | 
					            png_bytep outrow = first_row + y * step_row;
 | 
				
			||||||
            png_const_bytep end_row = outrow + width;
 | 
					            png_const_bytep end_row = outrow + width;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3011,14 +3011,18 @@ png_image_read_colormapped(png_voidp argument)
 | 
				
			|||||||
    * size libpng requires and call the relevant processing routine safely.
 | 
					    * size libpng requires and call the relevant processing routine safely.
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      png_bytep first_row = png_voidcast(png_bytep, display->buffer);
 | 
					      png_voidp first_row = display->buffer;
 | 
				
			||||||
      ptrdiff_t row_bytes = display->row_stride;
 | 
					      ptrdiff_t row_bytes = display->row_stride;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      /* The following expression is designed to work correctly whether it gives
 | 
					      /* The following expression is designed to work correctly whether it gives
 | 
				
			||||||
       * a signed or an unsigned result.
 | 
					       * a signed or an unsigned result.
 | 
				
			||||||
       */
 | 
					       */
 | 
				
			||||||
      if (row_bytes < 0)
 | 
					      if (row_bytes < 0)
 | 
				
			||||||
         first_row += (image->height-1) * (-row_bytes);
 | 
					      {
 | 
				
			||||||
 | 
					         char *ptr = png_voidcast(char*, first_row);
 | 
				
			||||||
 | 
					         ptr += (image->height-1) * (-row_bytes);
 | 
				
			||||||
 | 
					         first_row = png_voidcast(png_voidp, ptr);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      display->first_row = first_row;
 | 
					      display->first_row = first_row;
 | 
				
			||||||
      display->row_bytes = row_bytes;
 | 
					      display->row_bytes = row_bytes;
 | 
				
			||||||
@ -3027,8 +3031,7 @@ png_image_read_colormapped(png_voidp argument)
 | 
				
			|||||||
   if (passes == 0)
 | 
					   if (passes == 0)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      int result;
 | 
					      int result;
 | 
				
			||||||
      png_bytep row = png_voidcast(png_bytep, png_malloc(png_ptr,
 | 
					      png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
 | 
				
			||||||
         png_get_rowbytes(png_ptr, info_ptr)));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      display->local_row = row;
 | 
					      display->local_row = row;
 | 
				
			||||||
      result = png_safe_execute(image, png_image_read_and_map, display);
 | 
					      result = png_safe_execute(image, png_image_read_and_map, display);
 | 
				
			||||||
@ -3045,7 +3048,7 @@ png_image_read_colormapped(png_voidp argument)
 | 
				
			|||||||
      while (--passes >= 0)
 | 
					      while (--passes >= 0)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         png_uint_32      y = image->height;
 | 
					         png_uint_32      y = image->height;
 | 
				
			||||||
         png_bytep        row = display->first_row;
 | 
					         png_bytep        row = png_voidcast(png_bytep, display->first_row);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         while (y-- > 0)
 | 
					         while (y-- > 0)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
@ -3086,7 +3089,6 @@ png_image_read_composite(png_voidp argument)
 | 
				
			|||||||
   {
 | 
					   {
 | 
				
			||||||
      png_uint_32  height = image->height;
 | 
					      png_uint_32  height = image->height;
 | 
				
			||||||
      png_uint_32  width = image->width;
 | 
					      png_uint_32  width = image->width;
 | 
				
			||||||
      png_bytep    first_row = display->first_row;
 | 
					 | 
				
			||||||
      ptrdiff_t    step_row = display->row_bytes;
 | 
					      ptrdiff_t    step_row = display->row_bytes;
 | 
				
			||||||
      unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) ? 3 : 1;
 | 
					      unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) ? 3 : 1;
 | 
				
			||||||
      int pass;
 | 
					      int pass;
 | 
				
			||||||
@ -3118,13 +3120,17 @@ png_image_read_composite(png_voidp argument)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
         for (; y<height; y += stepy)
 | 
					         for (; y<height; y += stepy)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            png_bytep inrow = display->local_row;
 | 
					            png_bytep inrow = png_voidcast(png_bytep, display->local_row);
 | 
				
			||||||
            png_bytep outrow = first_row + y * step_row;
 | 
					            png_bytep outrow;
 | 
				
			||||||
            png_const_bytep end_row = outrow + width * channels;
 | 
					            png_const_bytep end_row;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Read the row, which is packed: */
 | 
					            /* Read the row, which is packed: */
 | 
				
			||||||
            png_read_row(png_ptr, inrow, NULL);
 | 
					            png_read_row(png_ptr, inrow, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            outrow = png_voidcast(png_bytep, display->first_row);
 | 
				
			||||||
 | 
					            outrow += y * step_row;
 | 
				
			||||||
 | 
					            end_row = outrow + width * channels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Now do the composition on each pixel in this row. */
 | 
					            /* Now do the composition on each pixel in this row. */
 | 
				
			||||||
            outrow += startx;
 | 
					            outrow += startx;
 | 
				
			||||||
            for (; outrow < end_row; outrow += stepx)
 | 
					            for (; outrow < end_row; outrow += stepx)
 | 
				
			||||||
@ -3242,12 +3248,13 @@ png_image_read_background(png_voidp argument)
 | 
				
			|||||||
          * Unlike the code above ALPHA_OPTIMIZED has *not* been done.
 | 
					          * Unlike the code above ALPHA_OPTIMIZED has *not* been done.
 | 
				
			||||||
          */
 | 
					          */
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            png_bytep first_row = display->first_row;
 | 
					            png_bytep first_row = png_voidcast(png_bytep, display->first_row);
 | 
				
			||||||
            ptrdiff_t step_row = display->row_bytes;
 | 
					            ptrdiff_t step_row = display->row_bytes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            for (pass = 0; pass < passes; ++pass)
 | 
					            for (pass = 0; pass < passes; ++pass)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
               png_bytep        row = display->first_row;
 | 
					               png_bytep        row = png_voidcast(png_bytep,
 | 
				
			||||||
 | 
					                                                   display->first_row);
 | 
				
			||||||
               unsigned int     startx, stepx, stepy;
 | 
					               unsigned int     startx, stepx, stepy;
 | 
				
			||||||
               png_uint_32      y;
 | 
					               png_uint_32      y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3274,7 +3281,8 @@ png_image_read_background(png_voidp argument)
 | 
				
			|||||||
               {
 | 
					               {
 | 
				
			||||||
                  for (; y<height; y += stepy)
 | 
					                  for (; y<height; y += stepy)
 | 
				
			||||||
                  {
 | 
					                  {
 | 
				
			||||||
                     png_bytep inrow = display->local_row;
 | 
					                     png_bytep inrow = png_voidcast(png_bytep,
 | 
				
			||||||
 | 
					                        display->local_row);
 | 
				
			||||||
                     png_bytep outrow = first_row + y * step_row;
 | 
					                     png_bytep outrow = first_row + y * step_row;
 | 
				
			||||||
                     png_const_bytep end_row = outrow + width;
 | 
					                     png_const_bytep end_row = outrow + width;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3318,7 +3326,8 @@ png_image_read_background(png_voidp argument)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                  for (; y<height; y += stepy)
 | 
					                  for (; y<height; y += stepy)
 | 
				
			||||||
                  {
 | 
					                  {
 | 
				
			||||||
                     png_bytep inrow = display->local_row;
 | 
					                     png_bytep inrow = png_voidcast(png_bytep,
 | 
				
			||||||
 | 
					                        display->local_row);
 | 
				
			||||||
                     png_bytep outrow = first_row + y * step_row;
 | 
					                     png_bytep outrow = first_row + y * step_row;
 | 
				
			||||||
                     png_const_bytep end_row = outrow + width;
 | 
					                     png_const_bytep end_row = outrow + width;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3364,8 +3373,12 @@ png_image_read_background(png_voidp argument)
 | 
				
			|||||||
          * handles the alpha-first option.
 | 
					          * handles the alpha-first option.
 | 
				
			||||||
          */
 | 
					          */
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            png_bytep    first_row = display->first_row;
 | 
					            png_uint_16p first_row = png_voidcast(png_uint_16p,
 | 
				
			||||||
            ptrdiff_t    step_row = display->row_bytes;
 | 
					               display->first_row);
 | 
				
			||||||
 | 
					            /* The division by two is safe because the caller passed in a
 | 
				
			||||||
 | 
					             * stride which was multiplied by 2 (below) to get row_bytes.
 | 
				
			||||||
 | 
					             */
 | 
				
			||||||
 | 
					            ptrdiff_t    step_row = display->row_bytes / 2;
 | 
				
			||||||
            int preserve_alpha = (image->format & PNG_FORMAT_FLAG_ALPHA) != 0;
 | 
					            int preserve_alpha = (image->format & PNG_FORMAT_FLAG_ALPHA) != 0;
 | 
				
			||||||
            unsigned int outchannels = 1+preserve_alpha;
 | 
					            unsigned int outchannels = 1+preserve_alpha;
 | 
				
			||||||
            int swap_alpha = 0;
 | 
					            int swap_alpha = 0;
 | 
				
			||||||
@ -3403,12 +3416,13 @@ png_image_read_background(png_voidp argument)
 | 
				
			|||||||
               for (; y<height; y += stepy)
 | 
					               for (; y<height; y += stepy)
 | 
				
			||||||
               {
 | 
					               {
 | 
				
			||||||
                  png_const_uint_16p inrow;
 | 
					                  png_const_uint_16p inrow;
 | 
				
			||||||
                  png_uint_16p outrow = (png_uint_16p)(first_row + y*step_row);
 | 
					                  png_uint_16p outrow = first_row + y*step_row;
 | 
				
			||||||
                  png_uint_16p end_row = outrow + width * outchannels;
 | 
					                  png_uint_16p end_row = outrow + width * outchannels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                  /* Read the row, which is packed: */
 | 
					                  /* Read the row, which is packed: */
 | 
				
			||||||
                  png_read_row(png_ptr, display->local_row, NULL);
 | 
					                  png_read_row(png_ptr, png_voidcast(png_bytep,
 | 
				
			||||||
                  inrow = (png_const_uint_16p)display->local_row;
 | 
					                     display->local_row), NULL);
 | 
				
			||||||
 | 
					                  inrow = png_voidcast(png_const_uint_16p, display->local_row);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                  /* Now do the pre-multiplication on each pixel in this row.
 | 
					                  /* Now do the pre-multiplication on each pixel in this row.
 | 
				
			||||||
                   */
 | 
					                   */
 | 
				
			||||||
@ -3806,7 +3820,7 @@ png_image_read_direct(png_voidp argument)
 | 
				
			|||||||
    * display acts as a flag.
 | 
					    * display acts as a flag.
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      png_bytep first_row = png_voidcast(png_bytep, display->buffer);
 | 
					      png_voidp first_row = display->buffer;
 | 
				
			||||||
      ptrdiff_t row_bytes = display->row_stride;
 | 
					      ptrdiff_t row_bytes = display->row_stride;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (linear)
 | 
					      if (linear)
 | 
				
			||||||
@ -3816,7 +3830,11 @@ png_image_read_direct(png_voidp argument)
 | 
				
			|||||||
       * a signed or an unsigned result.
 | 
					       * a signed or an unsigned result.
 | 
				
			||||||
       */
 | 
					       */
 | 
				
			||||||
      if (row_bytes < 0)
 | 
					      if (row_bytes < 0)
 | 
				
			||||||
         first_row += (image->height-1) * (-row_bytes);
 | 
					      {
 | 
				
			||||||
 | 
					         char *ptr = png_voidcast(char*, first_row);
 | 
				
			||||||
 | 
					         ptr += (image->height-1) * (-row_bytes);
 | 
				
			||||||
 | 
					         first_row = png_voidcast(png_voidp, ptr);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      display->first_row = first_row;
 | 
					      display->first_row = first_row;
 | 
				
			||||||
      display->row_bytes = row_bytes;
 | 
					      display->row_bytes = row_bytes;
 | 
				
			||||||
@ -3825,8 +3843,7 @@ png_image_read_direct(png_voidp argument)
 | 
				
			|||||||
   if (do_local_compose)
 | 
					   if (do_local_compose)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      int result;
 | 
					      int result;
 | 
				
			||||||
      png_bytep row = png_voidcast(png_bytep, png_malloc(png_ptr,
 | 
					      png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
 | 
				
			||||||
         png_get_rowbytes(png_ptr, info_ptr)));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      display->local_row = row;
 | 
					      display->local_row = row;
 | 
				
			||||||
      result = png_safe_execute(image, png_image_read_composite, display);
 | 
					      result = png_safe_execute(image, png_image_read_composite, display);
 | 
				
			||||||
@ -3839,8 +3856,7 @@ png_image_read_direct(png_voidp argument)
 | 
				
			|||||||
   else if (do_local_background == 2)
 | 
					   else if (do_local_background == 2)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      int result;
 | 
					      int result;
 | 
				
			||||||
      png_bytep row = png_voidcast(png_bytep, png_malloc(png_ptr,
 | 
					      png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
 | 
				
			||||||
         png_get_rowbytes(png_ptr, info_ptr)));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      display->local_row = row;
 | 
					      display->local_row = row;
 | 
				
			||||||
      result = png_safe_execute(image, png_image_read_background, display);
 | 
					      result = png_safe_execute(image, png_image_read_background, display);
 | 
				
			||||||
@ -3857,7 +3873,7 @@ png_image_read_direct(png_voidp argument)
 | 
				
			|||||||
      while (--passes >= 0)
 | 
					      while (--passes >= 0)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         png_uint_32      y = image->height;
 | 
					         png_uint_32      y = image->height;
 | 
				
			||||||
         png_bytep        row = display->first_row;
 | 
					         png_bytep        row = png_voidcast(png_bytep, display->first_row);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         while (y-- > 0)
 | 
					         while (y-- > 0)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								pngrutil.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								pngrutil.c
									
									
									
									
									
								
							@ -3261,8 +3261,9 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
 | 
				
			|||||||
                     bytes_to_copy % sizeof (png_uint_32) == 0 &&
 | 
					                     bytes_to_copy % sizeof (png_uint_32) == 0 &&
 | 
				
			||||||
                     bytes_to_jump % sizeof (png_uint_32) == 0)
 | 
					                     bytes_to_jump % sizeof (png_uint_32) == 0)
 | 
				
			||||||
                  {
 | 
					                  {
 | 
				
			||||||
                     png_uint_32p dp32 = (png_uint_32p)dp;
 | 
					                     png_uint_32p dp32 = png_aligncast(png_uint_32p,dp);
 | 
				
			||||||
                     png_const_uint_32p sp32 = (png_const_uint_32p)sp;
 | 
					                     png_const_uint_32p sp32 = png_aligncastconst(
 | 
				
			||||||
 | 
					                        png_const_uint_32p, sp);
 | 
				
			||||||
                     unsigned int skip = (bytes_to_jump-bytes_to_copy) /
 | 
					                     unsigned int skip = (bytes_to_jump-bytes_to_copy) /
 | 
				
			||||||
                        sizeof (png_uint_32);
 | 
					                        sizeof (png_uint_32);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3302,8 +3303,9 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
 | 
				
			|||||||
                   */
 | 
					                   */
 | 
				
			||||||
                  else
 | 
					                  else
 | 
				
			||||||
                  {
 | 
					                  {
 | 
				
			||||||
                     png_uint_16p dp16 = (png_uint_16p)dp;
 | 
					                     png_uint_16p dp16 = png_aligncast(png_uint_16p, dp);
 | 
				
			||||||
                     png_const_uint_16p sp16 = (png_const_uint_16p)sp;
 | 
					                     png_const_uint_16p sp16 = png_aligncastconst(
 | 
				
			||||||
 | 
					                        png_const_uint_16p, sp);
 | 
				
			||||||
                     unsigned int skip = (bytes_to_jump-bytes_to_copy) /
 | 
					                     unsigned int skip = (bytes_to_jump-bytes_to_copy) /
 | 
				
			||||||
                        sizeof (png_uint_16);
 | 
					                        sizeof (png_uint_16);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user