mirror of
				https://git.code.sf.net/p/libpng/code.git
				synced 2025-07-10 18:04:09 +02:00 
			
		
		
		
	[libpng16] Reverted "& 0xff" additions of version 1.6.17beta01. Libpng passes
the Coverity scan without them.
This commit is contained in:
		
							parent
							
								
									2b66107abb
								
							
						
					
					
						commit
						c5370ede95
					
				
							
								
								
									
										6
									
								
								ANNOUNCE
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								ANNOUNCE
									
									
									
									
									
								
							@ -1,4 +1,4 @@
 | 
				
			|||||||
Libpng 1.6.17rc05 - March 18, 2015
 | 
					Libpng 1.6.17rc05 - March 21, 2015
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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.
 | 
				
			||||||
@ -85,10 +85,12 @@ Version 1.6.17rc04 [March 16, 2015]
 | 
				
			|||||||
  Fix bug in calculation of maxbits, in png_write_sBIT, introduced
 | 
					  Fix bug in calculation of maxbits, in png_write_sBIT, introduced
 | 
				
			||||||
    in libpng-1.6.17beta01 (John Bowler).
 | 
					    in libpng-1.6.17beta01 (John Bowler).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Version 1.6.17rc05 [March 18, 2015]
 | 
					Version 1.6.17rc05 [March 21, 2015]
 | 
				
			||||||
  Define PNG_FILTER_* and PNG_FILTER_VALUE_* in png.h even when WRITE
 | 
					  Define PNG_FILTER_* and PNG_FILTER_VALUE_* in png.h even when WRITE
 | 
				
			||||||
    is not supported (John Bowler).  This fixes an error introduced in
 | 
					    is not supported (John Bowler).  This fixes an error introduced in
 | 
				
			||||||
    libpng-1.6.17beta06.
 | 
					    libpng-1.6.17beta06.
 | 
				
			||||||
 | 
					  Reverted "& 0xff" additions of version 1.6.17beta01. Libpng passes
 | 
				
			||||||
 | 
					    the Coverity scan without them.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								CHANGES
									
									
									
									
									
								
							@ -5186,10 +5186,12 @@ Version 1.6.17rc04 [March 16, 2015]
 | 
				
			|||||||
  Fix bug in calculation of maxbits, in png_write_sBIT, introduced
 | 
					  Fix bug in calculation of maxbits, in png_write_sBIT, introduced
 | 
				
			||||||
    in libpng-1.6.17beta01 (John Bowler).
 | 
					    in libpng-1.6.17beta01 (John Bowler).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Version 1.6.17rc05 [March 18, 2015]
 | 
					Version 1.6.17rc05 [March 21, 2015]
 | 
				
			||||||
  Define PNG_FILTER_* and PNG_FILTER_VALUE_* in png.h even when WRITE
 | 
					  Define PNG_FILTER_* and PNG_FILTER_VALUE_* in png.h even when WRITE
 | 
				
			||||||
    is not supported (John Bowler).  This fixes an error introduced in
 | 
					    is not supported (John Bowler).  This fixes an error introduced in
 | 
				
			||||||
    libpng-1.6.17beta06.
 | 
					    libpng-1.6.17beta06.
 | 
				
			||||||
 | 
					  Reverted "& 0xff" additions of version 1.6.17beta01. Libpng passes
 | 
				
			||||||
 | 
					    the Coverity scan without them.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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
									
									
									
									
									
								
							@ -766,13 +766,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.17rc05 - March 17, 2015" PNG_STRING_NEWLINE \
 | 
					     "libpng version 1.6.17rc05 - March 21, 2015" PNG_STRING_NEWLINE \
 | 
				
			||||||
     "Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
 | 
					     "Copyright (c) 1998-2015 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.17rc05 - March 17, 2015\
 | 
					      return "libpng version 1.6.17rc05 - March 21, 2015\
 | 
				
			||||||
      Copyright (c) 1998-2015 Glenn Randers-Pehrson\
 | 
					      Copyright (c) 1998-2015 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.17rc05, March 18, 2015
 | 
					 * libpng version 1.6.17rc05, March 21, 2015
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Copyright (c) 1998-2015 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)
 | 
				
			||||||
@ -12,7 +12,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.17rc05, March 18, 2015: Glenn
 | 
					 *   libpng versions 0.97, January 1998, through 1.6.17rc05, March 21, 2015: Glenn
 | 
				
			||||||
 *   See also "Contributing Authors", below.
 | 
					 *   See also "Contributing Authors", below.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Note about libpng version numbers:
 | 
					 * Note about libpng version numbers:
 | 
				
			||||||
@ -246,7 +246,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.17rc05, March 18, 2015, are
 | 
					 * libpng versions 1.2.6, August 15, 2004, through 1.6.17rc05, March 21, 2015, are
 | 
				
			||||||
 * Copyright (c) 2004, 2006-2015 Glenn Randers-Pehrson, and are
 | 
					 * Copyright (c) 2004, 2006-2015 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:
 | 
				
			||||||
@ -358,7 +358,7 @@
 | 
				
			|||||||
 * Y2K compliance in libpng:
 | 
					 * Y2K compliance in libpng:
 | 
				
			||||||
 * =========================
 | 
					 * =========================
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *    March 18, 2015
 | 
					 *    March 21, 2015
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *    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.
 | 
				
			||||||
@ -428,7 +428,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.17rc05"
 | 
					#define PNG_LIBPNG_VER_STRING "1.6.17rc05"
 | 
				
			||||||
#define PNG_HEADER_VERSION_STRING \
 | 
					#define PNG_HEADER_VERSION_STRING \
 | 
				
			||||||
     " libpng version 1.6.17rc05 - March 18, 2015\n"
 | 
					     " libpng version 1.6.17rc05 - March 21, 2015\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
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								pngget.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								pngget.c
									
									
									
									
									
								
							@ -1123,7 +1123,7 @@ png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr,
 | 
				
			|||||||
png_byte PNGAPI
 | 
					png_byte PNGAPI
 | 
				
			||||||
png_get_rgb_to_gray_status (png_const_structrp png_ptr)
 | 
					png_get_rgb_to_gray_status (png_const_structrp png_ptr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
   return (png_byte)((png_ptr ? png_ptr->rgb_to_gray_status : 0) & 0xff);
 | 
					   return (png_byte)(png_ptr ? png_ptr->rgb_to_gray_status : 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -168,7 +168,7 @@ png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]),
 | 
					   png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]),
 | 
				
			||||||
       num_to_check);
 | 
					       num_to_check);
 | 
				
			||||||
   png_ptr->sig_bytes = (png_byte)((png_ptr->sig_bytes + num_to_check) & 0xff);
 | 
					   png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
 | 
					   if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
 | 
				
			|||||||
@ -2052,7 +2052,7 @@ make_rgb_colormap(png_image_read_control *display)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* Return a palette index to the above palette given three 8-bit sRGB values. */
 | 
					/* Return a palette index to the above palette given three 8-bit sRGB values. */
 | 
				
			||||||
#define PNG_RGB_INDEX(r,g,b) \
 | 
					#define PNG_RGB_INDEX(r,g,b) \
 | 
				
			||||||
   ((png_byte)(0xff & (6 * (6 * PNG_DIV51(r) + PNG_DIV51(g)) + PNG_DIV51(b))))
 | 
					   ((png_byte)(6 * (6 * PNG_DIV51(r) + PNG_DIV51(g)) + PNG_DIV51(b)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
png_image_read_colormap(png_voidp argument)
 | 
					png_image_read_colormap(png_voidp argument)
 | 
				
			||||||
@ -3025,8 +3025,7 @@ png_image_read_and_map(png_voidp argument)
 | 
				
			|||||||
                        *outrow = gray;
 | 
					                        *outrow = gray;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     else
 | 
					                     else
 | 
				
			||||||
                        *outrow =
 | 
					                        *outrow = (png_byte)(PNG_CMAP_TRANS_BACKGROUND+1);
 | 
				
			||||||
                            (png_byte)(0xff & (PNG_CMAP_TRANS_BACKGROUND+1));
 | 
					 | 
				
			||||||
                  }
 | 
					                  }
 | 
				
			||||||
                  break;
 | 
					                  break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										195
									
								
								pngrtran.c
									
									
									
									
									
								
							
							
						
						
									
										195
									
								
								pngrtran.c
									
									
									
									
									
								
							@ -143,7 +143,7 @@ png_set_background_fixed(png_structrp png_ptr,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   png_ptr->background = *background_color;
 | 
					   png_ptr->background = *background_color;
 | 
				
			||||||
   png_ptr->background_gamma = background_gamma;
 | 
					   png_ptr->background_gamma = background_gamma;
 | 
				
			||||||
   png_ptr->background_gamma_type = (png_byte)(0xff & background_gamma_code);
 | 
					   png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
 | 
				
			||||||
   if (need_expand != 0)
 | 
					   if (need_expand != 0)
 | 
				
			||||||
      png_ptr->transformations |= PNG_BACKGROUND_EXPAND;
 | 
					      png_ptr->transformations |= PNG_BACKGROUND_EXPAND;
 | 
				
			||||||
   else
 | 
					   else
 | 
				
			||||||
@ -1176,8 +1176,8 @@ png_init_palette_transformations(png_structrp png_ptr)
 | 
				
			|||||||
              int i, istop = png_ptr->num_trans;
 | 
					              int i, istop = png_ptr->num_trans;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              for (i=0; i<istop; i++)
 | 
					              for (i=0; i<istop; i++)
 | 
				
			||||||
                 png_ptr->trans_alpha[i] = (png_byte)(0xff & (255 -
 | 
					                 png_ptr->trans_alpha[i] = (png_byte)(255 -
 | 
				
			||||||
                    png_ptr->trans_alpha[i]));
 | 
					                    png_ptr->trans_alpha[i]);
 | 
				
			||||||
           }
 | 
					           }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
#endif /* READ_INVERT_ALPHA */
 | 
					#endif /* READ_INVERT_ALPHA */
 | 
				
			||||||
@ -2023,14 +2023,14 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
 | 
					#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
 | 
				
			||||||
   if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0)
 | 
					   if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0)
 | 
				
			||||||
      info_ptr->color_type = (png_byte)(0xff & (info_ptr->color_type |
 | 
					      info_ptr->color_type = (png_byte)(info_ptr->color_type |
 | 
				
			||||||
         PNG_COLOR_MASK_COLOR));
 | 
					         PNG_COLOR_MASK_COLOR);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
 | 
					#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
 | 
				
			||||||
   if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
 | 
					   if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
 | 
				
			||||||
      info_ptr->color_type = (png_byte)(0xff & (info_ptr->color_type &
 | 
					      info_ptr->color_type = (png_byte)(info_ptr->color_type &
 | 
				
			||||||
         ~PNG_COLOR_MASK_COLOR));
 | 
					         ~PNG_COLOR_MASK_COLOR);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
 | 
					#ifdef PNG_READ_QUANTIZE_SUPPORTED
 | 
				
			||||||
@ -2072,8 +2072,8 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
 | 
				
			|||||||
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
 | 
					#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
 | 
				
			||||||
   if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0)
 | 
					   if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      info_ptr->color_type = (png_byte)(0xff & (info_ptr->color_type &
 | 
					      info_ptr->color_type = (png_byte)(info_ptr->color_type &
 | 
				
			||||||
         ~PNG_COLOR_MASK_ALPHA));
 | 
					         ~PNG_COLOR_MASK_ALPHA);
 | 
				
			||||||
      info_ptr->num_trans = 0;
 | 
					      info_ptr->num_trans = 0;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@ -2106,8 +2106,8 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
 | 
				
			|||||||
   }
 | 
					   }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   info_ptr->pixel_depth = (png_byte)(0xff & (info_ptr->channels *
 | 
					   info_ptr->pixel_depth = (png_byte)(info_ptr->channels *
 | 
				
			||||||
       info_ptr->bit_depth));
 | 
					       info_ptr->bit_depth);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, info_ptr->width);
 | 
					   info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, info_ptr->width);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2218,7 +2218,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      row_info->bit_depth = 8;
 | 
					      row_info->bit_depth = 8;
 | 
				
			||||||
      row_info->pixel_depth = (png_byte)(0xff & (8 * row_info->channels));
 | 
					      row_info->pixel_depth = (png_byte)(8 * row_info->channels);
 | 
				
			||||||
      row_info->rowbytes = row_width * row_info->channels;
 | 
					      row_info->rowbytes = row_width * row_info->channels;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -2356,8 +2356,8 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
 | 
				
			|||||||
               value >>= shift[channel];
 | 
					               value >>= shift[channel];
 | 
				
			||||||
               if (++channel >= channels)
 | 
					               if (++channel >= channels)
 | 
				
			||||||
                  channel = 0;
 | 
					                  channel = 0;
 | 
				
			||||||
               *bp++ = (png_byte)(0xff & (value >> 8));
 | 
					               *bp++ = (png_byte)(value >> 8);
 | 
				
			||||||
               *bp++ = (png_byte)(0xff & value);
 | 
					               *bp++ = (png_byte)(value & 0xff);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
@ -2420,7 +2420,7 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      row_info->bit_depth = 8;
 | 
					      row_info->bit_depth = 8;
 | 
				
			||||||
      row_info->pixel_depth = (png_byte)(0xff & (8 * row_info->channels));
 | 
					      row_info->pixel_depth = (png_byte)(8 * row_info->channels);
 | 
				
			||||||
      row_info->rowbytes = row_info->width * row_info->channels;
 | 
					      row_info->rowbytes = row_info->width * row_info->channels;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -2448,7 +2448,7 @@ png_do_chop(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      row_info->bit_depth = 8;
 | 
					      row_info->bit_depth = 8;
 | 
				
			||||||
      row_info->pixel_depth = (png_byte)(0xff & (8 * row_info->channels));
 | 
					      row_info->pixel_depth = (png_byte)(8 * row_info->channels);
 | 
				
			||||||
      row_info->rowbytes = row_info->width * row_info->channels;
 | 
					      row_info->rowbytes = row_info->width * row_info->channels;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -2570,7 +2570,7 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
         for (i = 0; i < row_width; i++)
 | 
					         for (i = 0; i < row_width; i++)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            *(--dp) = (png_byte)(0xff & (255 - *(--sp)));
 | 
					            *(--dp) = (png_byte)(255 - *(--sp));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*          This does nothing:
 | 
					/*          This does nothing:
 | 
				
			||||||
            *(--dp) = *(--sp);
 | 
					            *(--dp) = *(--sp);
 | 
				
			||||||
@ -2593,8 +2593,8 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
         for (i = 0; i < row_width; i++)
 | 
					         for (i = 0; i < row_width; i++)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            *(--dp) = (png_byte)(0xff & (255 - *(--sp)));
 | 
					            *(--dp) = (png_byte)(255 - *(--sp));
 | 
				
			||||||
            *(--dp) = (png_byte)(0xff & (255 - *(--sp)));
 | 
					            *(--dp) = (png_byte)(255 - *(--sp));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*          This does nothing:
 | 
					/*          This does nothing:
 | 
				
			||||||
            *(--dp) = *(--sp);
 | 
					            *(--dp) = *(--sp);
 | 
				
			||||||
@ -2622,7 +2622,7 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
         for (i = 0; i < row_width; i++)
 | 
					         for (i = 0; i < row_width; i++)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            *(--dp) = (png_byte)(0xff & (255 - *(--sp)));
 | 
					            *(--dp) = (png_byte)(255 - *(--sp));
 | 
				
			||||||
            *(--dp) = *(--sp);
 | 
					            *(--dp) = *(--sp);
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -2637,8 +2637,8 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
         for (i = 0; i < row_width; i++)
 | 
					         for (i = 0; i < row_width; i++)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            *(--dp) = (png_byte)(0xff & (255 - *(--sp)));
 | 
					            *(--dp) = (png_byte)(255 - *(--sp));
 | 
				
			||||||
            *(--dp) = (png_byte)(0xff & (255 - *(--sp)));
 | 
					            *(--dp) = (png_byte)(255 - *(--sp));
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
            *(--dp) = *(--sp);
 | 
					            *(--dp) = *(--sp);
 | 
				
			||||||
            *(--dp) = *(--sp);
 | 
					            *(--dp) = *(--sp);
 | 
				
			||||||
@ -2918,10 +2918,10 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      row_info->channels = (png_byte)(0xff & (row_info->channels + 2));
 | 
					      row_info->channels = (png_byte)(row_info->channels + 2);
 | 
				
			||||||
      row_info->color_type |= PNG_COLOR_MASK_COLOR;
 | 
					      row_info->color_type |= PNG_COLOR_MASK_COLOR;
 | 
				
			||||||
      row_info->pixel_depth = (png_byte)(0xff & (row_info->channels *
 | 
					      row_info->pixel_depth = (png_byte)(row_info->channels *
 | 
				
			||||||
          row_info->bit_depth));
 | 
					          row_info->bit_depth);
 | 
				
			||||||
      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
 | 
					      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -3063,8 +3063,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
                  /* NOTE: this is the historical approach which simply
 | 
					                  /* NOTE: this is the historical approach which simply
 | 
				
			||||||
                   * truncates the results.
 | 
					                   * truncates the results.
 | 
				
			||||||
                   */
 | 
					                   */
 | 
				
			||||||
                  *(dp++) =
 | 
					                  *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15);
 | 
				
			||||||
                      (png_byte)(0xff & ((rc*red + gc*green + bc*blue)>>15));
 | 
					 | 
				
			||||||
               }
 | 
					               }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
               else
 | 
					               else
 | 
				
			||||||
@ -3167,11 +3166,11 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
         }
 | 
					         }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      row_info->channels = (png_byte)(0xff & (row_info->channels - 2));
 | 
					      row_info->channels = (png_byte)(row_info->channels - 2);
 | 
				
			||||||
      row_info->color_type = (png_byte)(0xff & (row_info->color_type &
 | 
					      row_info->color_type = (png_byte)(row_info->color_type &
 | 
				
			||||||
          ~PNG_COLOR_MASK_COLOR));
 | 
					          ~PNG_COLOR_MASK_COLOR);
 | 
				
			||||||
      row_info->pixel_depth = (png_byte)(0xff & (row_info->channels *
 | 
					      row_info->pixel_depth = (png_byte)(row_info->channels *
 | 
				
			||||||
          row_info->bit_depth));
 | 
					          row_info->bit_depth);
 | 
				
			||||||
      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
 | 
					      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
   return rgb_error;
 | 
					   return rgb_error;
 | 
				
			||||||
@ -3413,10 +3412,10 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
 | 
				
			|||||||
                        if (v == png_ptr->trans_color.gray)
 | 
					                        if (v == png_ptr->trans_color.gray)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                           /* Background is already in screen gamma */
 | 
					                           /* Background is already in screen gamma */
 | 
				
			||||||
                           *sp = (png_byte)(0xff &
 | 
					                           *sp = (png_byte)((png_ptr->background.gray >> 8)
 | 
				
			||||||
                                (png_ptr->background.gray >> 8));
 | 
					                                & 0xff);
 | 
				
			||||||
                           *(sp + 1) = (png_byte)(0xff &
 | 
					                           *(sp + 1) = (png_byte)(png_ptr->background.gray
 | 
				
			||||||
                                png_ptr->background.gray);
 | 
					                                & 0xff);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        else
 | 
					                        else
 | 
				
			||||||
@ -3439,10 +3438,10 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        if (v == png_ptr->trans_color.gray)
 | 
					                        if (v == png_ptr->trans_color.gray)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                           *sp = (png_byte)(0xff &
 | 
					                           *sp = (png_byte)((png_ptr->background.gray >> 8)
 | 
				
			||||||
                               (png_ptr->background.gray >> 8));
 | 
					                                & 0xff);
 | 
				
			||||||
                           *(sp + 1) = (png_byte)(0xff &
 | 
					                           *(sp + 1) = (png_byte)(png_ptr->background.gray
 | 
				
			||||||
                                png_ptr->background.gray);
 | 
					                                & 0xff);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                     }
 | 
					                     }
 | 
				
			||||||
                  }
 | 
					                  }
 | 
				
			||||||
@ -3520,18 +3519,15 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
 | 
				
			|||||||
                         b == png_ptr->trans_color.blue)
 | 
					                         b == png_ptr->trans_color.blue)
 | 
				
			||||||
                     {
 | 
					                     {
 | 
				
			||||||
                        /* Background is already in screen gamma */
 | 
					                        /* Background is already in screen gamma */
 | 
				
			||||||
                        *sp = (png_byte)(0xff &
 | 
					                        *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
 | 
				
			||||||
                            (png_ptr->background.red >> 8));
 | 
					                        *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
 | 
				
			||||||
                        *(sp + 1) = (png_byte)(0xff &
 | 
					                        *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
 | 
				
			||||||
                            png_ptr->background.red);
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 2) = (png_byte)(0xff &
 | 
					                        *(sp + 3) = (png_byte)(png_ptr->background.green
 | 
				
			||||||
                            (png_ptr->background.green >> 8));
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 3) = (png_byte)(0xff &
 | 
					                        *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
 | 
				
			||||||
                            png_ptr->background.green);
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 4) = (png_byte)(0xff &
 | 
					                        *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
 | 
				
			||||||
                            (png_ptr->background.blue >> 8));
 | 
					 | 
				
			||||||
                        *(sp + 5) = (png_byte)(0xff &
 | 
					 | 
				
			||||||
                            png_ptr->background.blue);
 | 
					 | 
				
			||||||
                     }
 | 
					                     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     else
 | 
					                     else
 | 
				
			||||||
@ -3569,15 +3565,15 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
 | 
				
			|||||||
                         g == png_ptr->trans_color.green &&
 | 
					                         g == png_ptr->trans_color.green &&
 | 
				
			||||||
                         b == png_ptr->trans_color.blue)
 | 
					                         b == png_ptr->trans_color.blue)
 | 
				
			||||||
                     {
 | 
					                     {
 | 
				
			||||||
                        *sp = (png_byte)(0xff & (png_ptr->background.red >> 8));
 | 
					                        *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
 | 
				
			||||||
                        *(sp + 1) = (png_byte)(0xff & png_ptr->background.red);
 | 
					                        *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
 | 
				
			||||||
                        *(sp + 2) = (png_byte)(0xff &
 | 
					                        *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
 | 
				
			||||||
                            (png_ptr->background.green >> 8));
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 3) = (png_byte)(0xff &
 | 
					                        *(sp + 3) = (png_byte)(png_ptr->background.green
 | 
				
			||||||
                             png_ptr->background.green);
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 4) = (png_byte)(0xff &
 | 
					                        *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
 | 
				
			||||||
                             (png_ptr->background.blue >> 8));
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 5) = (png_byte)(0xff & png_ptr->background.blue);
 | 
					                        *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
 | 
				
			||||||
                     }
 | 
					                     }
 | 
				
			||||||
                  }
 | 
					                  }
 | 
				
			||||||
               }
 | 
					               }
 | 
				
			||||||
@ -3659,9 +3655,9 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
 | 
				
			|||||||
                     else if (a == 0)
 | 
					                     else if (a == 0)
 | 
				
			||||||
                     {
 | 
					                     {
 | 
				
			||||||
                        /* Background is already in screen gamma */
 | 
					                        /* Background is already in screen gamma */
 | 
				
			||||||
                        *sp = (png_byte)(0xff &
 | 
					                        *sp = (png_byte)((png_ptr->background.gray >> 8)
 | 
				
			||||||
                            (png_ptr->background.gray >> 8));
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 1) = (png_byte)(0xff & png_ptr->background.gray);
 | 
					                        *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
 | 
				
			||||||
                     }
 | 
					                     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     else
 | 
					                     else
 | 
				
			||||||
@ -3690,9 +3686,9 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                     if (a == 0)
 | 
					                     if (a == 0)
 | 
				
			||||||
                     {
 | 
					                     {
 | 
				
			||||||
                        *sp = (png_byte)(0xff &
 | 
					                        *sp = (png_byte)((png_ptr->background.gray >> 8)
 | 
				
			||||||
                            (png_ptr->background.gray >> 8));
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 1) = (png_byte)(0xff & png_ptr->background.gray);
 | 
					                        *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
 | 
				
			||||||
                     }
 | 
					                     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     else if (a < 0xffff)
 | 
					                     else if (a < 0xffff)
 | 
				
			||||||
@ -3819,15 +3815,15 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
 | 
				
			|||||||
                     else if (a == 0)
 | 
					                     else if (a == 0)
 | 
				
			||||||
                     {
 | 
					                     {
 | 
				
			||||||
                        /* Background is already in screen gamma */
 | 
					                        /* Background is already in screen gamma */
 | 
				
			||||||
                        *sp = (png_byte)(0xff & (png_ptr->background.red >> 8));
 | 
					                        *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
 | 
				
			||||||
                        *(sp + 1) = (png_byte)(0xff & png_ptr->background.red );
 | 
					                        *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
 | 
				
			||||||
                        *(sp + 2) = (png_byte)(0xff &
 | 
					                        *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
 | 
				
			||||||
                             (png_ptr->background.green >> 8));
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 3) = (png_byte)(0xff &
 | 
					                        *(sp + 3) = (png_byte)(png_ptr->background.green
 | 
				
			||||||
                                png_ptr->background.green);
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 4) = (png_byte)(0xff &
 | 
					                        *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
 | 
				
			||||||
                               (png_ptr->background.blue >> 8));
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 5) = (png_byte)(0xff & png_ptr->background.blue);
 | 
					                        *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
 | 
				
			||||||
                     }
 | 
					                     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     else
 | 
					                     else
 | 
				
			||||||
@ -3837,8 +3833,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
 | 
				
			|||||||
                        v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
 | 
					                        v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
 | 
				
			||||||
                        png_composite_16(w, v, a, png_ptr->background_1.red);
 | 
					                        png_composite_16(w, v, a, png_ptr->background_1.red);
 | 
				
			||||||
                        if (optimize == 0)
 | 
					                        if (optimize == 0)
 | 
				
			||||||
                           w = gamma_16_from_1[((w & 0xff) >>
 | 
					                           w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
 | 
				
			||||||
                                gamma_shift)][w >> 8];
 | 
					                                8];
 | 
				
			||||||
                        *sp = (png_byte)((w >> 8) & 0xff);
 | 
					                        *sp = (png_byte)((w >> 8) & 0xff);
 | 
				
			||||||
                        *(sp + 1) = (png_byte)(w & 0xff);
 | 
					                        *(sp + 1) = (png_byte)(w & 0xff);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3874,16 +3870,15 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                     if (a == 0)
 | 
					                     if (a == 0)
 | 
				
			||||||
                     {
 | 
					                     {
 | 
				
			||||||
                        *sp = (png_byte)(0xff & (png_ptr->background.red >> 8));
 | 
					                        *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
 | 
				
			||||||
                        *(sp + 1) = (png_byte)(0xff & png_ptr->background.red);
 | 
					                        *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
 | 
				
			||||||
                        *(sp + 2) = (png_byte)(0xff &
 | 
					                        *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
 | 
				
			||||||
                               (png_ptr->background.green >> 8));
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 3) = (png_byte)(0xff &
 | 
					                        *(sp + 3) = (png_byte)(png_ptr->background.green
 | 
				
			||||||
                                png_ptr->background.green);
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 4) = (png_byte)(0xff &
 | 
					                        *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
 | 
				
			||||||
                                (png_ptr->background.blue >> 8));
 | 
					                                & 0xff);
 | 
				
			||||||
                        *(sp + 5) = (png_byte)(0xff &
 | 
					                        *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
 | 
				
			||||||
                                png_ptr->background.blue & 0xff);
 | 
					 | 
				
			||||||
                     }
 | 
					                     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                     else if (a < 0xffff)
 | 
					                     else if (a < 0xffff)
 | 
				
			||||||
@ -4070,12 +4065,11 @@ png_do_gamma(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
 | 
				
			|||||||
                  int c = *sp & 0x0c;
 | 
					                  int c = *sp & 0x0c;
 | 
				
			||||||
                  int d = *sp & 0x03;
 | 
					                  int d = *sp & 0x03;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                  *sp = (png_byte)(0xff &
 | 
					                  *sp = (png_byte)(
 | 
				
			||||||
                      (((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)])  ) & 0xc0)|
 | 
					                      ((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)])   ) & 0xc0)|
 | 
				
			||||||
                      ((((int)gamma_table[(b<<2)|b|(b>>2)|(b>>4)])>>2) & 0x30)|
 | 
					                      ((((int)gamma_table[(b<<2)|b|(b>>2)|(b>>4)])>>2) & 0x30)|
 | 
				
			||||||
                      ((((int)gamma_table[(c<<4)|(c<<2)|c|(c>>2)])>>4) & 0x0c)|
 | 
					                      ((((int)gamma_table[(c<<4)|(c<<2)|c|(c>>2)])>>4) & 0x0c)|
 | 
				
			||||||
                      ((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) & 0xff))
 | 
					                      ((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) ));
 | 
				
			||||||
                      );
 | 
					 | 
				
			||||||
                  sp++;
 | 
					                  sp++;
 | 
				
			||||||
               }
 | 
					               }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -4406,8 +4400,8 @@ png_do_expand(png_row_infop row_info, png_bytep row,
 | 
				
			|||||||
                  for (i = 0; i < row_width; i++)
 | 
					                  for (i = 0; i < row_width; i++)
 | 
				
			||||||
                  {
 | 
					                  {
 | 
				
			||||||
                     value = (*sp >> shift) & 0x03;
 | 
					                     value = (*sp >> shift) & 0x03;
 | 
				
			||||||
                     *dp = (png_byte)(0xff & (value | (value << 2) |
 | 
					                     *dp = (png_byte)(value | (value << 2) | (value << 4) |
 | 
				
			||||||
                        (value << 4) | (value << 6)));
 | 
					                        (value << 6));
 | 
				
			||||||
                     if (shift == 6)
 | 
					                     if (shift == 6)
 | 
				
			||||||
                     {
 | 
					                     {
 | 
				
			||||||
                        shift = 0;
 | 
					                        shift = 0;
 | 
				
			||||||
@ -4431,7 +4425,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
 | 
				
			|||||||
                  for (i = 0; i < row_width; i++)
 | 
					                  for (i = 0; i < row_width; i++)
 | 
				
			||||||
                  {
 | 
					                  {
 | 
				
			||||||
                     value = (*sp >> shift) & 0x0f;
 | 
					                     value = (*sp >> shift) & 0x0f;
 | 
				
			||||||
                     *dp = (png_byte)(0xff & (value | (value << 4)));
 | 
					                     *dp = (png_byte)(value | (value << 4));
 | 
				
			||||||
                     if (shift == 4)
 | 
					                     if (shift == 4)
 | 
				
			||||||
                     {
 | 
					                     {
 | 
				
			||||||
                        shift = 0;
 | 
					                        shift = 0;
 | 
				
			||||||
@ -4502,8 +4496,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            row_info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
 | 
					            row_info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
 | 
				
			||||||
            row_info->channels = 2;
 | 
					            row_info->channels = 2;
 | 
				
			||||||
            row_info->pixel_depth =
 | 
					            row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1);
 | 
				
			||||||
               (png_byte)(0xff & (row_info->bit_depth << 1));
 | 
					 | 
				
			||||||
            row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
 | 
					            row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
 | 
				
			||||||
               row_width);
 | 
					               row_width);
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
@ -4570,7 +4563,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
 | 
				
			|||||||
         }
 | 
					         }
 | 
				
			||||||
         row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
 | 
					         row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
 | 
				
			||||||
         row_info->channels = 4;
 | 
					         row_info->channels = 4;
 | 
				
			||||||
         row_info->pixel_depth = (png_byte)(0xff & (row_info->bit_depth << 2));
 | 
					         row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2);
 | 
				
			||||||
         row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
 | 
					         row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
@ -4603,7 +4596,7 @@ png_do_expand_16(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      row_info->rowbytes *= 2;
 | 
					      row_info->rowbytes *= 2;
 | 
				
			||||||
      row_info->bit_depth = 16;
 | 
					      row_info->bit_depth = 16;
 | 
				
			||||||
      row_info->pixel_depth = (png_byte)(0xff & (row_info->channels * 16));
 | 
					      row_info->pixel_depth = (png_byte)(row_info->channels * 16);
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@ -4991,8 +4984,8 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
      if (png_ptr->user_transform_channels != 0)
 | 
					      if (png_ptr->user_transform_channels != 0)
 | 
				
			||||||
         row_info->channels = png_ptr->user_transform_channels;
 | 
					         row_info->channels = png_ptr->user_transform_channels;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
      row_info->pixel_depth = (png_byte)(0xff & (row_info->bit_depth *
 | 
					      row_info->pixel_depth = (png_byte)(row_info->bit_depth *
 | 
				
			||||||
          row_info->channels));
 | 
					          row_info->channels);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_info->width);
 | 
					      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_info->width);
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										44
									
								
								pngrutil.c
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								pngrutil.c
									
									
									
									
									
								
							@ -822,13 +822,13 @@ png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 | 
				
			|||||||
   /* Set internal variables */
 | 
					   /* Set internal variables */
 | 
				
			||||||
   png_ptr->width = width;
 | 
					   png_ptr->width = width;
 | 
				
			||||||
   png_ptr->height = height;
 | 
					   png_ptr->height = height;
 | 
				
			||||||
   png_ptr->bit_depth = (png_byte)(bit_depth & 0xff);
 | 
					   png_ptr->bit_depth = (png_byte)bit_depth;
 | 
				
			||||||
   png_ptr->interlaced = (png_byte)(interlace_type & 0xff);
 | 
					   png_ptr->interlaced = (png_byte)interlace_type;
 | 
				
			||||||
   png_ptr->color_type = (png_byte)(color_type & 0xff);
 | 
					   png_ptr->color_type = (png_byte)color_type;
 | 
				
			||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
 | 
					#ifdef PNG_MNG_FEATURES_SUPPORTED
 | 
				
			||||||
   png_ptr->filter_type = (png_byte)(filter_type & 0xff);
 | 
					   png_ptr->filter_type = (png_byte)filter_type;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
   png_ptr->compression_type = (png_byte)(compression_type & 0xff);
 | 
					   png_ptr->compression_type = (png_byte)compression_type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   /* Find number of channels */
 | 
					   /* Find number of channels */
 | 
				
			||||||
   switch (png_ptr->color_type)
 | 
					   switch (png_ptr->color_type)
 | 
				
			||||||
@ -853,8 +853,7 @@ png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 | 
				
			|||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   /* Set up other useful info */
 | 
					   /* Set up other useful info */
 | 
				
			||||||
   png_ptr->pixel_depth =
 | 
					   png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth * png_ptr->channels);
 | 
				
			||||||
       (png_byte)(0xff & (png_ptr->bit_depth * png_ptr->channels));
 | 
					 | 
				
			||||||
   png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width);
 | 
					   png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width);
 | 
				
			||||||
   png_debug1(3, "bit_depth = %d", png_ptr->bit_depth);
 | 
					   png_debug1(3, "bit_depth = %d", png_ptr->bit_depth);
 | 
				
			||||||
   png_debug1(3, "channels = %d", png_ptr->channels);
 | 
					   png_debug1(3, "channels = %d", png_ptr->channels);
 | 
				
			||||||
@ -2732,8 +2731,7 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
 | 
				
			|||||||
      /* The following is safe because of the PNG_SIZE_MAX init above */
 | 
					      /* The following is safe because of the PNG_SIZE_MAX init above */
 | 
				
			||||||
      png_ptr->unknown_chunk.size = (png_size_t)length/*SAFE*/;
 | 
					      png_ptr->unknown_chunk.size = (png_size_t)length/*SAFE*/;
 | 
				
			||||||
      /* 'mode' is a flag array, only the bottom four bits matter here */
 | 
					      /* 'mode' is a flag array, only the bottom four bits matter here */
 | 
				
			||||||
      png_ptr->unknown_chunk.location =
 | 
					      png_ptr->unknown_chunk.location = (png_byte)png_ptr->mode/*SAFE*/;
 | 
				
			||||||
          (png_byte)(0xff & png_ptr->mode/*SAFE*/);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (length == 0)
 | 
					      if (length == 0)
 | 
				
			||||||
         png_ptr->unknown_chunk.data = NULL;
 | 
					         png_ptr->unknown_chunk.data = NULL;
 | 
				
			||||||
@ -3230,7 +3228,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
 | 
				
			|||||||
            if (m != 0) /* something to copy */
 | 
					            if (m != 0) /* something to copy */
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
               if (m != 0xff)
 | 
					               if (m != 0xff)
 | 
				
			||||||
                  *dp = (png_byte)(((*dp & ~m) | (*sp & m)) & 0xff);
 | 
					                  *dp = (png_byte)((*dp & ~m) | (*sp & m));
 | 
				
			||||||
               else
 | 
					               else
 | 
				
			||||||
                  *dp = *sp;
 | 
					                  *dp = *sp;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -3482,8 +3480,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   /* Restore the overwritten bits from the last byte if necessary. */
 | 
					   /* Restore the overwritten bits from the last byte if necessary. */
 | 
				
			||||||
   if (end_ptr != NULL)
 | 
					   if (end_ptr != NULL)
 | 
				
			||||||
      *end_ptr =
 | 
					      *end_ptr = (png_byte)((end_byte & end_mask) | (*end_ptr & ~end_mask));
 | 
				
			||||||
          (png_byte)(0xff & ((end_byte & end_mask) | (*end_ptr & ~end_mask)));
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
 | 
					#ifdef PNG_READ_INTERLACING_SUPPORTED
 | 
				
			||||||
@ -3777,14 +3774,16 @@ png_read_filter_row_avg(png_row_infop row_info, png_bytep row,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   for (i = 0; i < bpp; i++)
 | 
					   for (i = 0; i < bpp; i++)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      *rp = (png_byte)(((int)(*rp) + ((int)(*pp++) / 2 )) & 0xff);
 | 
					      *rp = (png_byte)(((int)(*rp) +
 | 
				
			||||||
 | 
					         ((int)(*pp++) / 2 )) & 0xff);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      rp++;
 | 
					      rp++;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   for (i = 0; i < istop; i++)
 | 
					   for (i = 0; i < istop; i++)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      *rp = (png_byte)(((int)(*rp) + (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);
 | 
					      *rp = (png_byte)(((int)(*rp) +
 | 
				
			||||||
 | 
					         (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      rp++;
 | 
					      rp++;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
@ -3800,7 +3799,7 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
 | 
				
			|||||||
   /* First pixel/byte */
 | 
					   /* First pixel/byte */
 | 
				
			||||||
   c = *prev_row++;
 | 
					   c = *prev_row++;
 | 
				
			||||||
   a = *row + c;
 | 
					   a = *row + c;
 | 
				
			||||||
   *row++ = (png_byte)(a & 0xff);
 | 
					   *row++ = (png_byte)a;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   /* Remainder */
 | 
					   /* Remainder */
 | 
				
			||||||
   while (row < rp_end)
 | 
					   while (row < rp_end)
 | 
				
			||||||
@ -3834,7 +3833,7 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
 | 
				
			|||||||
       */
 | 
					       */
 | 
				
			||||||
      c = b;
 | 
					      c = b;
 | 
				
			||||||
      a += *row;
 | 
					      a += *row;
 | 
				
			||||||
      *row++ = (png_byte)(a & 0xff);
 | 
					      *row++ = (png_byte)a;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3851,7 +3850,7 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
 | 
				
			|||||||
   while (row < rp_end)
 | 
					   while (row < rp_end)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      int a = *row + *prev_row++;
 | 
					      int a = *row + *prev_row++;
 | 
				
			||||||
      *row++ = (png_byte)(a & 0xff);
 | 
					      *row++ = (png_byte)a;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   /* Remainder */
 | 
					   /* Remainder */
 | 
				
			||||||
@ -3882,7 +3881,7 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
 | 
				
			|||||||
      if (pc < pa) a = c;
 | 
					      if (pc < pa) a = c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      a += *row;
 | 
					      a += *row;
 | 
				
			||||||
      *row++ = (png_byte)(a & 0xff);
 | 
					      *row++ = (png_byte)a;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -4375,7 +4374,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
 | 
				
			|||||||
   /* This value is stored in png_struct and double checked in the row read
 | 
					   /* This value is stored in png_struct and double checked in the row read
 | 
				
			||||||
    * code.
 | 
					    * code.
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
   png_ptr->maximum_pixel_depth = (png_byte)(max_pixel_depth & 0xff);
 | 
					   png_ptr->maximum_pixel_depth = (png_byte)max_pixel_depth;
 | 
				
			||||||
   png_ptr->transformed_pixel_depth = 0; /* calculated on demand */
 | 
					   png_ptr->transformed_pixel_depth = 0; /* calculated on demand */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   /* Align the width on the next larger 8 pixels.  Mainly used
 | 
					   /* Align the width on the next larger 8 pixels.  Mainly used
 | 
				
			||||||
@ -4447,11 +4446,8 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
 | 
				
			|||||||
   png_debug1(3, "height = %u,", png_ptr->height);
 | 
					   png_debug1(3, "height = %u,", png_ptr->height);
 | 
				
			||||||
   png_debug1(3, "iwidth = %u,", png_ptr->iwidth);
 | 
					   png_debug1(3, "iwidth = %u,", png_ptr->iwidth);
 | 
				
			||||||
   png_debug1(3, "num_rows = %u,", png_ptr->num_rows);
 | 
					   png_debug1(3, "num_rows = %u,", png_ptr->num_rows);
 | 
				
			||||||
   png_debug1(3, "row_bytes = %lu,", (unsigned long)row_bytes);
 | 
					   png_debug1(3, "rowbytes = %lu,", (unsigned long)png_ptr->rowbytes);
 | 
				
			||||||
   png_debug1(3, "png_ptr->rowbytes = %lu,", (unsigned long)png_ptr->rowbytes);
 | 
					   png_debug1(3, "irowbytes = %lu",
 | 
				
			||||||
   png_debug1(3, "png_ptr->info_rowbytes = %lu,",
 | 
					 | 
				
			||||||
       (unsigned long)png_ptr->info_rowbytes);
 | 
					 | 
				
			||||||
   png_debug1(3, "PNG_ROWBYTES = %lu",
 | 
					 | 
				
			||||||
       (unsigned long)PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1);
 | 
					       (unsigned long)PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   /* The sequential reader needs a buffer for IDAT, but the progressive reader
 | 
					   /* The sequential reader needs a buffer for IDAT, but the progressive reader
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										13
									
								
								pngtrans.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								pngtrans.c
									
									
									
									
									
								
							@ -273,7 +273,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      for (i = 0; i < istop; i++)
 | 
					      for (i = 0; i < istop; i++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         *rp = (png_byte)((~(*rp)) & 0xff);
 | 
					         *rp = (png_byte)(~(*rp));
 | 
				
			||||||
         rp++;
 | 
					         rp++;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
@ -287,7 +287,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      for (i = 0; i < istop; i += 2)
 | 
					      for (i = 0; i < istop; i += 2)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         *rp = (png_byte)((~(*rp)) & 0xff);
 | 
					         *rp = (png_byte)(~(*rp));
 | 
				
			||||||
         rp += 2;
 | 
					         rp += 2;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
@ -302,8 +302,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      for (i = 0; i < istop; i += 4)
 | 
					      for (i = 0; i < istop; i += 4)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         *rp = (png_byte)((~(*rp)) & 0xff);
 | 
					         *rp = (png_byte)(~(*rp));
 | 
				
			||||||
         *(rp + 1) = (png_byte)((~(*(rp + 1))) & 0xff);
 | 
					         *(rp + 1) = (png_byte)(~(*(rp + 1)));
 | 
				
			||||||
         rp += 4;
 | 
					         rp += 4;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
@ -803,9 +803,8 @@ png_set_user_transform_info(png_structrp png_ptr, png_voidp
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   png_ptr->user_transform_ptr = user_transform_ptr;
 | 
					   png_ptr->user_transform_ptr = user_transform_ptr;
 | 
				
			||||||
   png_ptr->user_transform_depth = (png_byte)(user_transform_depth & 0xff);
 | 
					   png_ptr->user_transform_depth = (png_byte)user_transform_depth;
 | 
				
			||||||
   png_ptr->user_transform_channels =
 | 
					   png_ptr->user_transform_channels = (png_byte)user_transform_channels;
 | 
				
			||||||
       (png_byte)(user_transform_channels & 0xff);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										63
									
								
								pngwrite.c
									
									
									
									
									
								
							
							
						
						
									
										63
									
								
								pngwrite.c
									
									
									
									
									
								
							@ -219,7 +219,7 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
 | 
				
			|||||||
         int j;
 | 
					         int j;
 | 
				
			||||||
         for (j = 0; j<(int)info_ptr->num_trans; j++)
 | 
					         for (j = 0; j<(int)info_ptr->num_trans; j++)
 | 
				
			||||||
            info_ptr->trans_alpha[j] =
 | 
					            info_ptr->trans_alpha[j] =
 | 
				
			||||||
               (png_byte)((255 - info_ptr->trans_alpha[j]) & 0xff);
 | 
					               (png_byte)(255 - info_ptr->trans_alpha[j]);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
      png_write_tRNS(png_ptr, info_ptr->trans_alpha, &(info_ptr->trans_color),
 | 
					      png_write_tRNS(png_ptr, info_ptr->trans_alpha, &(info_ptr->trans_color),
 | 
				
			||||||
@ -457,11 +457,11 @@ png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm * ttime)
 | 
				
			|||||||
   png_debug(1, "in png_convert_from_struct_tm");
 | 
					   png_debug(1, "in png_convert_from_struct_tm");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   ptime->year = (png_uint_16)(1900 + ttime->tm_year);
 | 
					   ptime->year = (png_uint_16)(1900 + ttime->tm_year);
 | 
				
			||||||
   ptime->month = (png_byte)((ttime->tm_mon + 1) & 0xff);
 | 
					   ptime->month = (png_byte)(ttime->tm_mon + 1);
 | 
				
			||||||
   ptime->day = (png_byte)(ttime->tm_mday & 0xff);
 | 
					   ptime->day = (png_byte)ttime->tm_mday;
 | 
				
			||||||
   ptime->hour = (png_byte)(ttime->tm_hour & 0xff);
 | 
					   ptime->hour = (png_byte)ttime->tm_hour;
 | 
				
			||||||
   ptime->minute = (png_byte)(ttime->tm_min & 0xff);
 | 
					   ptime->minute = (png_byte)ttime->tm_min;
 | 
				
			||||||
   ptime->second = (png_byte)(ttime->tm_sec & 0xff);
 | 
					   ptime->second = (png_byte)ttime->tm_sec;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void PNGAPI
 | 
					void PNGAPI
 | 
				
			||||||
@ -638,8 +638,8 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
         for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
 | 
					         for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            *(rp)     = (png_byte)((*rp       - *(rp + 1)) & 0xff);
 | 
					            *(rp)     = (png_byte)(*rp       - *(rp + 1));
 | 
				
			||||||
            *(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
 | 
					            *(rp + 2) = (png_byte)(*(rp + 2) - *(rp + 1));
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -665,10 +665,10 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
            png_uint_32 s2   = (*(rp + 4) << 8) | *(rp + 5);
 | 
					            png_uint_32 s2   = (*(rp + 4) << 8) | *(rp + 5);
 | 
				
			||||||
            png_uint_32 red  = (png_uint_32)((s0 - s1) & 0xffffL);
 | 
					            png_uint_32 red  = (png_uint_32)((s0 - s1) & 0xffffL);
 | 
				
			||||||
            png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
 | 
					            png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
 | 
				
			||||||
            *(rp    ) = (png_byte)((red >> 8) & 0xff);
 | 
					            *(rp    ) = (png_byte)(red >> 8);
 | 
				
			||||||
            *(rp + 1) = (png_byte)(red & 0xff);
 | 
					            *(rp + 1) = (png_byte)red;
 | 
				
			||||||
            *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
 | 
					            *(rp + 4) = (png_byte)(blue >> 8);
 | 
				
			||||||
            *(rp + 5) = (png_byte)(blue & 0xff);
 | 
					            *(rp + 5) = (png_byte)blue;
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
#endif /* WRITE_16BIT */
 | 
					#endif /* WRITE_16BIT */
 | 
				
			||||||
@ -811,8 +811,7 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
 | 
				
			|||||||
   row_info.width = png_ptr->usr_width;
 | 
					   row_info.width = png_ptr->usr_width;
 | 
				
			||||||
   row_info.channels = png_ptr->usr_channels;
 | 
					   row_info.channels = png_ptr->usr_channels;
 | 
				
			||||||
   row_info.bit_depth = png_ptr->usr_bit_depth;
 | 
					   row_info.bit_depth = png_ptr->usr_bit_depth;
 | 
				
			||||||
   row_info.pixel_depth =
 | 
					   row_info.pixel_depth = (png_byte)(row_info.bit_depth * row_info.channels);
 | 
				
			||||||
       (png_byte)(0xff & (row_info.bit_depth * row_info.channels));
 | 
					 | 
				
			||||||
   row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width);
 | 
					   row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   png_debug1(3, "row_info->color_type = %d", row_info.color_type);
 | 
					   png_debug1(3, "row_info->color_type = %d", row_info.color_type);
 | 
				
			||||||
@ -1038,7 +1037,7 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
 | 
				
			|||||||
            png_ptr->do_filter = PNG_FILTER_PAETH; break;
 | 
					            png_ptr->do_filter = PNG_FILTER_PAETH; break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         default:
 | 
					         default:
 | 
				
			||||||
            png_ptr->do_filter = (png_byte)(filters & 0xff); break;
 | 
					            png_ptr->do_filter = (png_byte)filters; break;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
         default:
 | 
					         default:
 | 
				
			||||||
            png_app_error(png_ptr, "Unknown row filter for method 0");
 | 
					            png_app_error(png_ptr, "Unknown row filter for method 0");
 | 
				
			||||||
@ -1071,8 +1070,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
 | 
				
			|||||||
            if (png_ptr->prev_row == NULL)
 | 
					            if (png_ptr->prev_row == NULL)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
               png_warning(png_ptr, "Can't add Up filter after starting");
 | 
					               png_warning(png_ptr, "Can't add Up filter after starting");
 | 
				
			||||||
               png_ptr->do_filter =
 | 
					               png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
 | 
				
			||||||
                  (png_byte)((png_ptr->do_filter & ~PNG_FILTER_UP) & 0xff);
 | 
					                   ~PNG_FILTER_UP);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
@ -1089,8 +1088,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
 | 
				
			|||||||
            if (png_ptr->prev_row == NULL)
 | 
					            if (png_ptr->prev_row == NULL)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
               png_warning(png_ptr, "Can't add Average filter after starting");
 | 
					               png_warning(png_ptr, "Can't add Average filter after starting");
 | 
				
			||||||
               png_ptr->do_filter =
 | 
					               png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
 | 
				
			||||||
                   (png_byte)((png_ptr->do_filter & ~PNG_FILTER_AVG) & 0xff);
 | 
					                   ~PNG_FILTER_AVG);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
@ -1107,7 +1106,7 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
 | 
				
			|||||||
            if (png_ptr->prev_row == NULL)
 | 
					            if (png_ptr->prev_row == NULL)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
               png_warning(png_ptr, "Can't add Paeth filter after starting");
 | 
					               png_warning(png_ptr, "Can't add Paeth filter after starting");
 | 
				
			||||||
               png_ptr->do_filter &= (png_byte)((~PNG_FILTER_PAETH) & 0xff);
 | 
					               png_ptr->do_filter &= (png_byte)(~PNG_FILTER_PAETH);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
@ -1211,7 +1210,7 @@ png_init_filter_heuristics(png_structrp png_ptr, int heuristic_method,
 | 
				
			|||||||
         }
 | 
					         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         /* Safe to set this now */
 | 
					         /* Safe to set this now */
 | 
				
			||||||
         png_ptr->num_prev_filters = (png_byte)(num_weights & 0xff);
 | 
					         png_ptr->num_prev_filters = (png_byte)num_weights;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      /* If, in the future, there are other filter methods, this would
 | 
					      /* If, in the future, there are other filter methods, this would
 | 
				
			||||||
@ -1891,7 +1890,7 @@ png_unpremultiply(png_uint_32 component, png_uint_32 alpha,
 | 
				
			|||||||
         component *= 255;
 | 
					         component *= 255;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      /* Convert the component to sRGB. */
 | 
					      /* Convert the component to sRGB. */
 | 
				
			||||||
      return (png_byte)(PNG_sRGB_FROM_LINEAR(component) & 0xff);
 | 
					      return (png_byte)PNG_sRGB_FROM_LINEAR(component);
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   else
 | 
					   else
 | 
				
			||||||
@ -1940,7 +1939,7 @@ png_write_image_8bit(png_voidp argument)
 | 
				
			|||||||
         while (out_ptr < row_end)
 | 
					         while (out_ptr < row_end)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            png_uint_16 alpha = in_ptr[aindex];
 | 
					            png_uint_16 alpha = in_ptr[aindex];
 | 
				
			||||||
            png_byte alphabyte = (png_byte)(PNG_DIV257(alpha) & 0xff);
 | 
					            png_byte alphabyte = (png_byte)PNG_DIV257(alpha);
 | 
				
			||||||
            png_uint_32 reciprocal = 0;
 | 
					            png_uint_32 reciprocal = 0;
 | 
				
			||||||
            int c;
 | 
					            int c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1983,7 +1982,7 @@ png_write_image_8bit(png_voidp argument)
 | 
				
			|||||||
            png_uint_32 component = *in_ptr++;
 | 
					            png_uint_32 component = *in_ptr++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            component *= 255;
 | 
					            component *= 255;
 | 
				
			||||||
            *out_ptr++ = (png_byte)(PNG_sRGB_FROM_LINEAR(component) & 0xff);
 | 
					            *out_ptr++ = (png_byte)PNG_sRGB_FROM_LINEAR(component);
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         png_write_row(png_ptr, output_row);
 | 
					         png_write_row(png_ptr, output_row);
 | 
				
			||||||
@ -2042,23 +2041,23 @@ png_image_set_PLTE(png_image_write_control *display)
 | 
				
			|||||||
         {
 | 
					         {
 | 
				
			||||||
            if (channels >= 3) /* RGB */
 | 
					            if (channels >= 3) /* RGB */
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
               palette[i].blue = (png_byte)(0xff & PNG_sRGB_FROM_LINEAR(255 *
 | 
					               palette[i].blue = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
 | 
				
			||||||
                  entry[(2 ^ bgr)]));
 | 
					                  entry[(2 ^ bgr)]);
 | 
				
			||||||
               palette[i].green = (png_byte)(0xff & PNG_sRGB_FROM_LINEAR(255 *
 | 
					               palette[i].green = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
 | 
				
			||||||
                  entry[1]));
 | 
					                  entry[1]);
 | 
				
			||||||
               palette[i].red = (png_byte)(0xff & PNG_sRGB_FROM_LINEAR(255 *
 | 
					               palette[i].red = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
 | 
				
			||||||
                  entry[bgr]));
 | 
					                  entry[bgr]);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            else /* Gray */
 | 
					            else /* Gray */
 | 
				
			||||||
               palette[i].blue = palette[i].red = palette[i].green =
 | 
					               palette[i].blue = palette[i].red = palette[i].green =
 | 
				
			||||||
                  (png_byte)(PNG_sRGB_FROM_LINEAR((255 * *entry)) & 0xff);
 | 
					                  (png_byte)PNG_sRGB_FROM_LINEAR(255 * *entry);
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         else /* alpha */
 | 
					         else /* alpha */
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
            png_uint_16 alpha = entry[afirst ? 0 : channels-1];
 | 
					            png_uint_16 alpha = entry[afirst ? 0 : channels-1];
 | 
				
			||||||
            png_byte alphabyte = (png_byte)(PNG_DIV257(alpha) & 0xff);
 | 
					            png_byte alphabyte = (png_byte)PNG_DIV257(alpha);
 | 
				
			||||||
            png_uint_32 reciprocal = 0;
 | 
					            png_uint_32 reciprocal = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Calculate a reciprocal, as in the png_write_image_8bit code above
 | 
					            /* Calculate a reciprocal, as in the png_write_image_8bit code above
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										29
									
								
								pngwtran.c
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								pngwtran.c
									
									
									
									
									
								
							@ -56,14 +56,14 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
 | 
				
			|||||||
               else
 | 
					               else
 | 
				
			||||||
               {
 | 
					               {
 | 
				
			||||||
                  mask = 0x80;
 | 
					                  mask = 0x80;
 | 
				
			||||||
                  *dp = (png_byte)(v & 0xff);
 | 
					                  *dp = (png_byte)v;
 | 
				
			||||||
                  dp++;
 | 
					                  dp++;
 | 
				
			||||||
                  v = 0;
 | 
					                  v = 0;
 | 
				
			||||||
               }
 | 
					               }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (mask != 0x80)
 | 
					            if (mask != 0x80)
 | 
				
			||||||
               *dp = (png_byte)(v & 0xff);
 | 
					               *dp = (png_byte)v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
@ -90,7 +90,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
 | 
				
			|||||||
               if (shift == 0)
 | 
					               if (shift == 0)
 | 
				
			||||||
               {
 | 
					               {
 | 
				
			||||||
                  shift = 6;
 | 
					                  shift = 6;
 | 
				
			||||||
                  *dp = (png_byte)(v & 0xff);
 | 
					                  *dp = (png_byte)v;
 | 
				
			||||||
                  dp++;
 | 
					                  dp++;
 | 
				
			||||||
                  v = 0;
 | 
					                  v = 0;
 | 
				
			||||||
               }
 | 
					               }
 | 
				
			||||||
@ -102,7 +102,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (shift != 6)
 | 
					            if (shift != 6)
 | 
				
			||||||
               *dp = (png_byte)(v & 0xff);
 | 
					               *dp = (png_byte)v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
@ -129,7 +129,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
 | 
				
			|||||||
               if (shift == 0)
 | 
					               if (shift == 0)
 | 
				
			||||||
               {
 | 
					               {
 | 
				
			||||||
                  shift = 4;
 | 
					                  shift = 4;
 | 
				
			||||||
                  *dp = (png_byte)(v & 0xff);
 | 
					                  *dp = (png_byte)v;
 | 
				
			||||||
                  dp++;
 | 
					                  dp++;
 | 
				
			||||||
                  v = 0;
 | 
					                  v = 0;
 | 
				
			||||||
               }
 | 
					               }
 | 
				
			||||||
@ -141,7 +141,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (shift != 4)
 | 
					            if (shift != 4)
 | 
				
			||||||
               *dp = (png_byte)(v & 0xff);
 | 
					               *dp = (png_byte)v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
@ -150,9 +150,8 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      row_info->bit_depth = (png_byte)(bit_depth & 0xff);
 | 
					      row_info->bit_depth = (png_byte)bit_depth;
 | 
				
			||||||
      row_info->pixel_depth =
 | 
					      row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels);
 | 
				
			||||||
          (png_byte)((bit_depth * row_info->channels) & 0xff);
 | 
					 | 
				
			||||||
      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
 | 
					      row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
 | 
				
			||||||
          row_info->width);
 | 
					          row_info->width);
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
@ -423,7 +422,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
               *(dp++) = *(sp++);
 | 
					               *(dp++) = *(sp++);
 | 
				
			||||||
               */
 | 
					               */
 | 
				
			||||||
               sp+=3; dp = sp;
 | 
					               sp+=3; dp = sp;
 | 
				
			||||||
               *(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
 | 
					               *(dp++) = (png_byte)(255 - *(sp++));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -446,8 +445,8 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
               *(dp++) = *(sp++);
 | 
					               *(dp++) = *(sp++);
 | 
				
			||||||
               */
 | 
					               */
 | 
				
			||||||
               sp+=6; dp = sp;
 | 
					               sp+=6; dp = sp;
 | 
				
			||||||
               *(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
 | 
					               *(dp++) = (png_byte)(255 - *(sp++));
 | 
				
			||||||
               *(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
 | 
					               *(dp++) = (png_byte)(255 - *(sp++));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
#endif /* WRITE_16BIT */
 | 
					#endif /* WRITE_16BIT */
 | 
				
			||||||
@ -465,7 +464,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
            for (i = 0, sp = dp = row; i < row_width; i++)
 | 
					            for (i = 0, sp = dp = row; i < row_width; i++)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
               *(dp++) = *(sp++);
 | 
					               *(dp++) = *(sp++);
 | 
				
			||||||
               *(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
 | 
					               *(dp++) = (png_byte)(255 - *(sp++));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -484,8 +483,8 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
               *(dp++) = *(sp++);
 | 
					               *(dp++) = *(sp++);
 | 
				
			||||||
               */
 | 
					               */
 | 
				
			||||||
               sp+=2; dp = sp;
 | 
					               sp+=2; dp = sp;
 | 
				
			||||||
               *(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
 | 
					               *(dp++) = (png_byte)(255 - *(sp++));
 | 
				
			||||||
               *(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
 | 
					               *(dp++) = (png_byte)(255 - *(sp++));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
#endif /* WRITE_16BIT */
 | 
					#endif /* WRITE_16BIT */
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										110
									
								
								pngwutil.c
									
									
									
									
									
								
							
							
						
						
									
										110
									
								
								pngwutil.c
									
									
									
									
									
								
							@ -23,10 +23,10 @@
 | 
				
			|||||||
void PNGAPI
 | 
					void PNGAPI
 | 
				
			||||||
png_save_uint_32(png_bytep buf, png_uint_32 i)
 | 
					png_save_uint_32(png_bytep buf, png_uint_32 i)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
   buf[0] = (png_byte)((i >> 24) & 0xff);
 | 
					   buf[0] = (png_byte)(i >> 24);
 | 
				
			||||||
   buf[1] = (png_byte)((i >> 16) & 0xff);
 | 
					   buf[1] = (png_byte)(i >> 16);
 | 
				
			||||||
   buf[2] = (png_byte)((i >> 8) & 0xff);
 | 
					   buf[2] = (png_byte)(i >> 8);
 | 
				
			||||||
   buf[3] = (png_byte)(i & 0xff);
 | 
					   buf[3] = (png_byte)(i     );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Place a 16-bit number into a buffer in PNG byte order.
 | 
					/* Place a 16-bit number into a buffer in PNG byte order.
 | 
				
			||||||
@ -36,8 +36,8 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
 | 
				
			|||||||
void PNGAPI
 | 
					void PNGAPI
 | 
				
			||||||
png_save_uint_16(png_bytep buf, unsigned int i)
 | 
					png_save_uint_16(png_bytep buf, unsigned int i)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
   buf[0] = (png_byte)((i >> 8) & 0xff);
 | 
					   buf[0] = (png_byte)(i >> 8);
 | 
				
			||||||
   buf[1] = (png_byte)(i & 0xff);
 | 
					   buf[1] = (png_byte)(i     );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -278,10 +278,10 @@ optimize_cmf(png_bytep data, png_alloc_size_t data_size)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4);
 | 
					            z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            data[0] = (png_byte)(z_cmf & 0xff);
 | 
					            data[0] = (png_byte)z_cmf;
 | 
				
			||||||
            tmp = data[1] & 0xe0;
 | 
					            tmp = data[1] & 0xe0;
 | 
				
			||||||
            tmp += 0x1f - ((z_cmf << 8) + tmp) % 0x1f;
 | 
					            tmp += 0x1f - ((z_cmf << 8) + tmp) % 0x1f;
 | 
				
			||||||
            data[1] = (png_byte)(tmp & 0xff);
 | 
					            data[1] = (png_byte)tmp;
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
@ -695,7 +695,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   while (*key && key_len < 79)
 | 
					   while (*key && key_len < 79)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      png_byte ch = (png_byte)(0xff & *key++);
 | 
					      png_byte ch = (png_byte)*key++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
 | 
					      if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
 | 
				
			||||||
         *new_key++ = ch, ++key_len, space = 0;
 | 
					         *new_key++ = ch, ++key_len, space = 0;
 | 
				
			||||||
@ -872,17 +872,17 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   /* Save the relevant information */
 | 
					   /* Save the relevant information */
 | 
				
			||||||
   png_ptr->bit_depth = (png_byte)(bit_depth & 0xff);
 | 
					   png_ptr->bit_depth = (png_byte)bit_depth;
 | 
				
			||||||
   png_ptr->color_type = (png_byte)(color_type & 0xff);
 | 
					   png_ptr->color_type = (png_byte)color_type;
 | 
				
			||||||
   png_ptr->interlaced = (png_byte)(interlace_type & 0xff);
 | 
					   png_ptr->interlaced = (png_byte)interlace_type;
 | 
				
			||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
 | 
					#ifdef PNG_MNG_FEATURES_SUPPORTED
 | 
				
			||||||
   png_ptr->filter_type = (png_byte)(filter_type & 0xff);
 | 
					   png_ptr->filter_type = (png_byte)filter_type;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
   png_ptr->compression_type = (png_byte)(compression_type & 0xff);
 | 
					   png_ptr->compression_type = (png_byte)compression_type;
 | 
				
			||||||
   png_ptr->width = width;
 | 
					   png_ptr->width = width;
 | 
				
			||||||
   png_ptr->height = height;
 | 
					   png_ptr->height = height;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   png_ptr->pixel_depth = (png_byte)((bit_depth * png_ptr->channels) & 0xff);
 | 
					   png_ptr->pixel_depth = (png_byte)(bit_depth * png_ptr->channels);
 | 
				
			||||||
   png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width);
 | 
					   png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width);
 | 
				
			||||||
   /* Set the usr info, so any transformations can modify it */
 | 
					   /* Set the usr info, so any transformations can modify it */
 | 
				
			||||||
   png_ptr->usr_width = png_ptr->width;
 | 
					   png_ptr->usr_width = png_ptr->width;
 | 
				
			||||||
@ -892,11 +892,11 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
 | 
				
			|||||||
   /* Pack the header information into the buffer */
 | 
					   /* Pack the header information into the buffer */
 | 
				
			||||||
   png_save_uint_32(buf, width);
 | 
					   png_save_uint_32(buf, width);
 | 
				
			||||||
   png_save_uint_32(buf + 4, height);
 | 
					   png_save_uint_32(buf + 4, height);
 | 
				
			||||||
   buf[8] = (png_byte)(bit_depth & 0xff);
 | 
					   buf[8] = (png_byte)bit_depth;
 | 
				
			||||||
   buf[9] = (png_byte)(color_type & 0xff);
 | 
					   buf[9] = (png_byte)color_type;
 | 
				
			||||||
   buf[10] = (png_byte)(compression_type & 0xff);
 | 
					   buf[10] = (png_byte)compression_type;
 | 
				
			||||||
   buf[11] = (png_byte)(filter_type & 0xff);
 | 
					   buf[11] = (png_byte)filter_type;
 | 
				
			||||||
   buf[12] = (png_byte)(interlace_type & 0xff);
 | 
					   buf[12] = (png_byte)interlace_type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   /* Write the chunk */
 | 
					   /* Write the chunk */
 | 
				
			||||||
   png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
 | 
					   png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
 | 
				
			||||||
@ -1181,7 +1181,7 @@ png_write_sRGB(png_structrp png_ptr, int srgb_intent)
 | 
				
			|||||||
      png_warning(png_ptr,
 | 
					      png_warning(png_ptr,
 | 
				
			||||||
          "Invalid sRGB rendering intent specified");
 | 
					          "Invalid sRGB rendering intent specified");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   buf[0]=(png_byte)(srgb_intent & 0xff);
 | 
					   buf[0]=(png_byte)srgb_intent;
 | 
				
			||||||
   png_write_complete_chunk(png_ptr, png_sRGB, buf, (png_size_t)1);
 | 
					   png_write_complete_chunk(png_ptr, png_sRGB, buf, (png_size_t)1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@ -1285,10 +1285,10 @@ png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
 | 
				
			|||||||
   {
 | 
					   {
 | 
				
			||||||
      if (spalette->depth == 8)
 | 
					      if (spalette->depth == 8)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         entrybuf[0] = (png_byte)(ep->red & 0xff);
 | 
					         entrybuf[0] = (png_byte)ep->red;
 | 
				
			||||||
         entrybuf[1] = (png_byte)(ep->green & 0xff);
 | 
					         entrybuf[1] = (png_byte)ep->green;
 | 
				
			||||||
         entrybuf[2] = (png_byte)(ep->blue & 0xff);
 | 
					         entrybuf[2] = (png_byte)ep->blue;
 | 
				
			||||||
         entrybuf[3] = (png_byte)(ep->alpha & 0xff);
 | 
					         entrybuf[3] = (png_byte)ep->alpha;
 | 
				
			||||||
         png_save_uint_16(entrybuf + 4, ep->frequency);
 | 
					         png_save_uint_16(entrybuf + 4, ep->frequency);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1309,10 +1309,10 @@ png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
 | 
				
			|||||||
   {
 | 
					   {
 | 
				
			||||||
      if (spalette->depth == 8)
 | 
					      if (spalette->depth == 8)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         entrybuf[0] = (png_byte)(ep[i].red & 0xff);
 | 
					         entrybuf[0] = (png_byte)ep[i].red;
 | 
				
			||||||
         entrybuf[1] = (png_byte)(ep[i].green & 0xff);
 | 
					         entrybuf[1] = (png_byte)ep[i].green;
 | 
				
			||||||
         entrybuf[2] = (png_byte)(ep[i].blue & 0xff);
 | 
					         entrybuf[2] = (png_byte)ep[i].blue;
 | 
				
			||||||
         entrybuf[3] = (png_byte)(ep[i].alpha & 0xff);
 | 
					         entrybuf[3] = (png_byte)ep[i].alpha;
 | 
				
			||||||
         png_save_uint_16(entrybuf + 4, ep[i].frequency);
 | 
					         png_save_uint_16(entrybuf + 4, ep[i].frequency);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1348,8 +1348,8 @@ png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
 | 
				
			|||||||
   {
 | 
					   {
 | 
				
			||||||
      png_byte maxbits;
 | 
					      png_byte maxbits;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      maxbits = (png_byte)((color_type==PNG_COLOR_TYPE_PALETTE ? 8 :
 | 
					      maxbits = (png_byte)(color_type==PNG_COLOR_TYPE_PALETTE ? 8 :
 | 
				
			||||||
          png_ptr->usr_bit_depth) & 0xff);
 | 
					          png_ptr->usr_bit_depth);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (sbit->red == 0 || sbit->red > maxbits ||
 | 
					      if (sbit->red == 0 || sbit->red > maxbits ||
 | 
				
			||||||
          sbit->green == 0 || sbit->green > maxbits ||
 | 
					          sbit->green == 0 || sbit->green > maxbits ||
 | 
				
			||||||
@ -1786,7 +1786,7 @@ png_write_oFFs(png_structrp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   png_save_int_32(buf, x_offset);
 | 
					   png_save_int_32(buf, x_offset);
 | 
				
			||||||
   png_save_int_32(buf + 4, y_offset);
 | 
					   png_save_int_32(buf + 4, y_offset);
 | 
				
			||||||
   buf[8] = (png_byte)(unit_type & 0xff);
 | 
					   buf[8] = (png_byte)unit_type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   png_write_complete_chunk(png_ptr, png_oFFs, buf, (png_size_t)9);
 | 
					   png_write_complete_chunk(png_ptr, png_oFFs, buf, (png_size_t)9);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1841,8 +1841,8 @@ png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0,
 | 
				
			|||||||
   png_write_chunk_data(png_ptr, new_purpose, purpose_len);
 | 
					   png_write_chunk_data(png_ptr, new_purpose, purpose_len);
 | 
				
			||||||
   png_save_int_32(buf, X0);
 | 
					   png_save_int_32(buf, X0);
 | 
				
			||||||
   png_save_int_32(buf + 4, X1);
 | 
					   png_save_int_32(buf + 4, X1);
 | 
				
			||||||
   buf[8] = (png_byte)(type & 0xff);
 | 
					   buf[8] = (png_byte)type;
 | 
				
			||||||
   buf[9] = (png_byte)(nparams & 0xff);
 | 
					   buf[9] = (png_byte)nparams;
 | 
				
			||||||
   png_write_chunk_data(png_ptr, buf, (png_size_t)10);
 | 
					   png_write_chunk_data(png_ptr, buf, (png_size_t)10);
 | 
				
			||||||
   png_write_chunk_data(png_ptr, (png_const_bytep)units, (png_size_t)units_len);
 | 
					   png_write_chunk_data(png_ptr, (png_const_bytep)units, (png_size_t)units_len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1877,7 +1877,7 @@ png_write_sCAL_s(png_structrp png_ptr, int unit, png_const_charp width,
 | 
				
			|||||||
      return;
 | 
					      return;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   buf[0] = (png_byte)(unit & 0xff);
 | 
					   buf[0] = (png_byte)unit;
 | 
				
			||||||
   memcpy(buf + 1, width, wlen + 1);      /* Append the '\0' here */
 | 
					   memcpy(buf + 1, width, wlen + 1);      /* Append the '\0' here */
 | 
				
			||||||
   memcpy(buf + wlen + 2, height, hlen);  /* Do NOT append the '\0' here */
 | 
					   memcpy(buf + wlen + 2, height, hlen);  /* Do NOT append the '\0' here */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1902,7 +1902,7 @@ png_write_pHYs(png_structrp png_ptr, png_uint_32 x_pixels_per_unit,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   png_save_uint_32(buf, x_pixels_per_unit);
 | 
					   png_save_uint_32(buf, x_pixels_per_unit);
 | 
				
			||||||
   png_save_uint_32(buf + 4, y_pixels_per_unit);
 | 
					   png_save_uint_32(buf + 4, y_pixels_per_unit);
 | 
				
			||||||
   buf[8] = (png_byte)(unit_type & 0xff);
 | 
					   buf[8] = (png_byte)unit_type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   png_write_complete_chunk(png_ptr, png_pHYs, buf, (png_size_t)9);
 | 
					   png_write_complete_chunk(png_ptr, png_pHYs, buf, (png_size_t)9);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1968,7 +1968,7 @@ png_write_start_row(png_structrp png_ptr)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   /* 1.5.6: added to allow checking in the row write code. */
 | 
					   /* 1.5.6: added to allow checking in the row write code. */
 | 
				
			||||||
   png_ptr->transformed_pixel_depth = png_ptr->pixel_depth;
 | 
					   png_ptr->transformed_pixel_depth = png_ptr->pixel_depth;
 | 
				
			||||||
   png_ptr->maximum_pixel_depth = (png_byte)(usr_pixel_depth & 0xff);
 | 
					   png_ptr->maximum_pixel_depth = (png_byte)usr_pixel_depth;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   /* Set up row buffer */
 | 
					   /* Set up row buffer */
 | 
				
			||||||
   png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, buf_size);
 | 
					   png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, buf_size);
 | 
				
			||||||
@ -2180,7 +2180,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
 | 
				
			|||||||
               if (shift == 0)
 | 
					               if (shift == 0)
 | 
				
			||||||
               {
 | 
					               {
 | 
				
			||||||
                  shift = 7;
 | 
					                  shift = 7;
 | 
				
			||||||
                  *dp++ = (png_byte)(d & 0xff);
 | 
					                  *dp++ = (png_byte)d;
 | 
				
			||||||
                  d = 0;
 | 
					                  d = 0;
 | 
				
			||||||
               }
 | 
					               }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2189,7 +2189,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (shift != 7)
 | 
					            if (shift != 7)
 | 
				
			||||||
               *dp = (png_byte)(d & 0xff);
 | 
					               *dp = (png_byte)d;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
@ -2218,7 +2218,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
 | 
				
			|||||||
               if (shift == 0)
 | 
					               if (shift == 0)
 | 
				
			||||||
               {
 | 
					               {
 | 
				
			||||||
                  shift = 6;
 | 
					                  shift = 6;
 | 
				
			||||||
                  *dp++ = (png_byte)(d & 0xff);
 | 
					                  *dp++ = (png_byte)d;
 | 
				
			||||||
                  d = 0;
 | 
					                  d = 0;
 | 
				
			||||||
               }
 | 
					               }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2226,7 +2226,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
 | 
				
			|||||||
                  shift -= 2;
 | 
					                  shift -= 2;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (shift != 6)
 | 
					            if (shift != 6)
 | 
				
			||||||
               *dp = (png_byte)(d & 0xff);
 | 
					               *dp = (png_byte)d;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
@ -2254,7 +2254,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
 | 
				
			|||||||
               if (shift == 0)
 | 
					               if (shift == 0)
 | 
				
			||||||
               {
 | 
					               {
 | 
				
			||||||
                  shift = 4;
 | 
					                  shift = 4;
 | 
				
			||||||
                  *dp++ = (png_byte)(d & 0xff);
 | 
					                  *dp++ = (png_byte)d;
 | 
				
			||||||
                  d = 0;
 | 
					                  d = 0;
 | 
				
			||||||
               }
 | 
					               }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2262,7 +2262,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
 | 
				
			|||||||
                  shift -= 4;
 | 
					                  shift -= 4;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (shift != 4)
 | 
					            if (shift != 4)
 | 
				
			||||||
               *dp = (png_byte)(d & 0xff);
 | 
					               *dp = (png_byte)d;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
@ -2453,7 +2453,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
      for (lp = row_buf + 1; i < row_bytes;
 | 
					      for (lp = row_buf + 1; i < row_bytes;
 | 
				
			||||||
         i++, rp++, lp++, dp++)
 | 
					         i++, rp++, lp++, dp++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
 | 
					         *dp = (png_byte)((int)*rp - (int)*lp);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      best_row = png_ptr->sub_row;
 | 
					      best_row = png_ptr->sub_row;
 | 
				
			||||||
@ -2515,7 +2515,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
      for (lp = row_buf + 1; i < row_bytes;
 | 
					      for (lp = row_buf + 1; i < row_bytes;
 | 
				
			||||||
         i++, rp++, lp++, dp++)
 | 
					         i++, rp++, lp++, dp++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
 | 
					         v = *dp = (png_byte)((int)*rp - (int)*lp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         sum += (v < 128) ? v : 256 - v;
 | 
					         sum += (v < 128) ? v : 256 - v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2574,7 +2574,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
          pp = prev_row + 1; i < row_bytes;
 | 
					          pp = prev_row + 1; i < row_bytes;
 | 
				
			||||||
          i++, rp++, pp++, dp++)
 | 
					          i++, rp++, pp++, dp++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
 | 
					         *dp = (png_byte)((int)*rp - (int)*pp);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      best_row = png_ptr->up_row;
 | 
					      best_row = png_ptr->up_row;
 | 
				
			||||||
@ -2625,7 +2625,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
      for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
 | 
					      for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
 | 
				
			||||||
          pp = prev_row + 1; i < row_bytes; i++)
 | 
					          pp = prev_row + 1; i < row_bytes; i++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
 | 
					         v = *dp++ = (png_byte)((int)*rp++ - (int)*pp++);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         sum += (v < 128) ? v : 256 - v;
 | 
					         sum += (v < 128) ? v : 256 - v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2683,13 +2683,13 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
      for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
 | 
					      for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
 | 
				
			||||||
           pp = prev_row + 1; i < bpp; i++)
 | 
					           pp = prev_row + 1; i < bpp; i++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
 | 
					         *dp++ = (png_byte)((int)*rp++ - ((int)*pp++ / 2));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      for (lp = row_buf + 1; i < row_bytes; i++)
 | 
					      for (lp = row_buf + 1; i < row_bytes; i++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         *dp++ =
 | 
					         *dp++ =
 | 
				
			||||||
             (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) & 0xff);
 | 
					             (png_byte)((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      best_row = png_ptr->avg_row;
 | 
					      best_row = png_ptr->avg_row;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
@ -2738,7 +2738,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
      for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
 | 
					      for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
 | 
				
			||||||
           pp = prev_row + 1; i < bpp; i++)
 | 
					           pp = prev_row + 1; i < bpp; i++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
 | 
					         v = *dp++ = (png_byte)((int)*rp++ - ((int)*pp++ / 2));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         sum += (v < 128) ? v : 256 - v;
 | 
					         sum += (v < 128) ? v : 256 - v;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -2746,7 +2746,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
      for (lp = row_buf + 1; i < row_bytes; i++)
 | 
					      for (lp = row_buf + 1; i < row_bytes; i++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         v = *dp++ =
 | 
					         v = *dp++ =
 | 
				
			||||||
             (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) & 0xff);
 | 
					             (png_byte)(((int)*rp++ - ((int)*pp++ + (int)*lp++) / 2));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         sum += (v < 128) ? v : 256 - v;
 | 
					         sum += (v < 128) ? v : 256 - v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2804,7 +2804,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
      for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
 | 
					      for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
 | 
				
			||||||
          pp = prev_row + 1; i < bpp; i++)
 | 
					          pp = prev_row + 1; i < bpp; i++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
 | 
					         *dp++ = (png_byte)((int)*rp++ - (int)*pp++);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++)
 | 
					      for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++)
 | 
				
			||||||
@ -2830,7 +2830,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
         p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
 | 
					         p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
 | 
					         *dp++ = (png_byte)((int)*rp++ - p);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      best_row = png_ptr->paeth_row;
 | 
					      best_row = png_ptr->paeth_row;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
@ -2879,7 +2879,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
      for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
 | 
					      for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
 | 
				
			||||||
          pp = prev_row + 1; i < bpp; i++)
 | 
					          pp = prev_row + 1; i < bpp; i++)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
 | 
					         v = *dp++ = (png_byte)((int)*rp++ - (int)*pp++);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         sum += (v < 128) ? v : 256 - v;
 | 
					         sum += (v < 128) ? v : 256 - v;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -2921,7 +2921,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
 | 
				
			|||||||
            p = c;
 | 
					            p = c;
 | 
				
			||||||
#endif /* SLOW_PAETH */
 | 
					#endif /* SLOW_PAETH */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
 | 
					         v = *dp++ = (png_byte)((int)*rp++ - p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         sum += (v < 128) ? v : 256 - v;
 | 
					         sum += (v < 128) ? v : 256 - v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user