mirror of
				https://git.code.sf.net/p/libpng/code.git
				synced 2025-07-10 18:04:09 +02:00 
			
		
		
		
	[libpng16] Do not build png_product2() when it is unused.
Work around more Coverity-scan dead-code warnings.
This commit is contained in:
		
							parent
							
								
									8f0e2729dd
								
							
						
					
					
						commit
						8cd78da8b3
					
				
							
								
								
									
										6
									
								
								ANNOUNCE
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								ANNOUNCE
									
									
									
									
									
								
							@ -1,4 +1,4 @@
 | 
				
			|||||||
Libpng 1.6.17beta02 - January 29, 2015
 | 
					Libpng 1.6.17beta02 - February 7, 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.
 | 
				
			||||||
@ -40,7 +40,9 @@ Version 1.6.17beta01 [January 29, 2015]
 | 
				
			|||||||
  Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
 | 
					  Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
 | 
				
			||||||
    pngset.c to avoid warnings about dead code.
 | 
					    pngset.c to avoid warnings about dead code.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Version 1.6.17beta02 [January 29, 2015]
 | 
					Version 1.6.17beta02 [February 7, 2015]
 | 
				
			||||||
 | 
					  Work around one more Coverity-scan dead-code warning.
 | 
				
			||||||
 | 
					  Do not build png_product2() when it is unused.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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
									
									
									
									
									
								
							@ -5141,7 +5141,9 @@ Version 1.6.17beta01 [January 29, 2015]
 | 
				
			|||||||
  Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
 | 
					  Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
 | 
				
			||||||
    pngset.c to avoid warnings about dead code.
 | 
					    pngset.c to avoid warnings about dead code.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Version 1.6.17beta02 [January 29, 2015]
 | 
					Version 1.6.17beta02 [February 7, 2015]
 | 
				
			||||||
 | 
					  Work around one more Coverity-scan dead-code warning.
 | 
				
			||||||
 | 
					  Do not build png_product2() when it is unused.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										11
									
								
								png.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								png.c
									
									
									
									
									
								
							@ -772,13 +772,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.17beta02 - February 4, 2015" PNG_STRING_NEWLINE \
 | 
					     "libpng version 1.6.17beta02 - February 7, 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.17beta02 - February 4, 2015\
 | 
					      return "libpng version 1.6.17beta02 - February 7, 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.";
 | 
				
			||||||
@ -3404,7 +3404,7 @@ png_gamma_significant(png_fixed_point gamma_val)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef PNG_READ_GAMMA_SUPPORTED
 | 
					#ifdef PNG_READ_GAMMA_SUPPORTED
 | 
				
			||||||
#if defined(PNG_16BIT_SUPPORTED) || !defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
 | 
					#ifdef PNG_16BIT_SUPPORTED
 | 
				
			||||||
/* A local convenience routine. */
 | 
					/* A local convenience routine. */
 | 
				
			||||||
static png_fixed_point
 | 
					static png_fixed_point
 | 
				
			||||||
png_product2(png_fixed_point a, png_fixed_point b)
 | 
					png_product2(png_fixed_point a, png_fixed_point b)
 | 
				
			||||||
@ -3426,7 +3426,7 @@ png_product2(png_fixed_point a, png_fixed_point b)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   return 0; /* overflow */
 | 
					   return 0; /* overflow */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif /* 16BIT || !FLOATING_ARITHMETIC */
 | 
					#endif /* 16BIT */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* The inverse of the above. */
 | 
					/* The inverse of the above. */
 | 
				
			||||||
png_fixed_point
 | 
					png_fixed_point
 | 
				
			||||||
@ -3434,12 +3434,15 @@ png_reciprocal2(png_fixed_point a, png_fixed_point b)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
   /* The required result is 1/a * 1/b; the following preserves accuracy. */
 | 
					   /* The required result is 1/a * 1/b; the following preserves accuracy. */
 | 
				
			||||||
#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
 | 
					#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
 | 
				
			||||||
 | 
					   if (a != 0 && b != 0)
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
      double r = 1E15/a;
 | 
					      double r = 1E15/a;
 | 
				
			||||||
      r /= b;
 | 
					      r /= b;
 | 
				
			||||||
      r = floor(r+.5);
 | 
					      r = floor(r+.5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (r <= 2147483647. && r >= -2147483648.)
 | 
					      if (r <= 2147483647. && r >= -2147483648.)
 | 
				
			||||||
         return (png_fixed_point)r;
 | 
					         return (png_fixed_point)r;
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
   /* This may overflow because the range of png_fixed_point isn't symmetric,
 | 
					   /* This may overflow because the range of png_fixed_point isn't symmetric,
 | 
				
			||||||
    * but this API is only used for the product of file and screen gamma so it
 | 
					    * but this API is only used for the product of file and screen gamma so it
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										17
									
								
								pngread.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								pngread.c
									
									
									
									
									
								
							@ -2285,8 +2285,14 @@ png_image_read_colormap(png_voidp argument)
 | 
				
			|||||||
                     output_processing = PNG_CMAP_NONE;
 | 
					                     output_processing = PNG_CMAP_NONE;
 | 
				
			||||||
                     break;
 | 
					                     break;
 | 
				
			||||||
                  }
 | 
					                  }
 | 
				
			||||||
 | 
					#ifdef __COVERITY__
 | 
				
			||||||
 | 
					                 /* Coverity claims that output_encoding cannot be 2 (P_LINEAR)
 | 
				
			||||||
 | 
					                  * here.
 | 
				
			||||||
 | 
					                  */
 | 
				
			||||||
 | 
					                  back_alpha = 255;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
                  back_alpha = output_encoding == P_LINEAR ? 65535 : 255;
 | 
					                  back_alpha = output_encoding == P_LINEAR ? 65535 : 255;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
               }
 | 
					               }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
               /* output_processing means that the libpng-processed row will be
 | 
					               /* output_processing means that the libpng-processed row will be
 | 
				
			||||||
@ -2411,7 +2417,14 @@ png_image_read_colormap(png_voidp argument)
 | 
				
			|||||||
                */
 | 
					                */
 | 
				
			||||||
               background_index = i;
 | 
					               background_index = i;
 | 
				
			||||||
               png_create_colormap_entry(display, i++, back_r, back_g, back_b,
 | 
					               png_create_colormap_entry(display, i++, back_r, back_g, back_b,
 | 
				
			||||||
                  output_encoding == P_LINEAR ? 65535U : 255U, output_encoding);
 | 
					#ifdef __COVERITY__
 | 
				
			||||||
 | 
					                 /* Coverity claims that output_encoding cannot be 2 (P_LINEAR)
 | 
				
			||||||
 | 
					                  * here.
 | 
				
			||||||
 | 
					                  */ 255U,
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					                  output_encoding == P_LINEAR ? 65535U : 255U,
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					                  output_encoding);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
               /* For non-opaque input composite on the sRGB background - this
 | 
					               /* For non-opaque input composite on the sRGB background - this
 | 
				
			||||||
                * requires inverting the encoding for each component.  The input
 | 
					                * requires inverting the encoding for each component.  The input
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								pngrio.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								pngrio.c
									
									
									
									
									
								
							@ -1,8 +1,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* pngrio.c - functions for data input
 | 
					/* pngrio.c - functions for data input
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Last changed in libpng 1.6.15 [November 20, 2014]
 | 
					 * Last changed in libpng 1.6.17 [(PENDING RELEASE)]
 | 
				
			||||||
 * Copyright (c) 1998-2014 Glenn Randers-Pehrson
 | 
					 * Copyright (c) 1998-2015 Glenn Randers-Pehrson
 | 
				
			||||||
 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
 | 
					 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
 | 
				
			||||||
 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
 | 
					 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										14
									
								
								pngrtran.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								pngrtran.c
									
									
									
									
									
								
							@ -3087,10 +3087,11 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
            for (i = 0; i < row_width; i++)
 | 
					            for (i = 0; i < row_width; i++)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
               png_uint_16 red, green, blue, w;
 | 
					               png_uint_16 red, green, blue, w;
 | 
				
			||||||
 | 
					               png_byte hi,lo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
               red   = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
 | 
					               hi=*(sp)++; lo=*(sp)++; red   = (png_uint_16)((hi << 8) | (lo));
 | 
				
			||||||
               green = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
 | 
					               hi=*(sp)++; lo=*(sp)++; green = (png_uint_16)((hi << 8) | (lo));
 | 
				
			||||||
               blue  = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
 | 
					               hi=*(sp)++; lo=*(sp)++; blue  = (png_uint_16)((hi << 8) | (lo));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
               if (red == green && red == blue)
 | 
					               if (red == green && red == blue)
 | 
				
			||||||
               {
 | 
					               {
 | 
				
			||||||
@ -3138,10 +3139,11 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
 | 
				
			|||||||
            for (i = 0; i < row_width; i++)
 | 
					            for (i = 0; i < row_width; i++)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
               png_uint_16 red, green, blue, gray16;
 | 
					               png_uint_16 red, green, blue, gray16;
 | 
				
			||||||
 | 
					               png_byte hi,lo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
               red   = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
 | 
					               hi=*(sp)++; lo=*(sp)++; red   = (png_uint_16)((hi << 8) | (lo));
 | 
				
			||||||
               green = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
 | 
					               hi=*(sp)++; lo=*(sp)++; green = (png_uint_16)((hi << 8) | (lo));
 | 
				
			||||||
               blue  = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
 | 
					               hi=*(sp)++; lo=*(sp)++; blue  = (png_uint_16)((hi << 8) | (lo));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
               if (red != green || red != blue)
 | 
					               if (red != green || red != blue)
 | 
				
			||||||
                  rgb_error |= 1;
 | 
					                  rgb_error |= 1;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								pngtest.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								pngtest.c
									
									
									
									
									
								
							@ -1,8 +1,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* pngtest.c - a simple test program to test libpng
 | 
					/* pngtest.c - a simple test program to test libpng
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Last changed in libpng 1.6.15 [November 20, 2014]
 | 
					 * Last changed in libpng 1.6.17 [(PENDING RELEASE)]
 | 
				
			||||||
 * Copyright (c) 1998-2014 Glenn Randers-Pehrson
 | 
					 * Copyright (c) 1998-2015 Glenn Randers-Pehrson
 | 
				
			||||||
 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
 | 
					 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
 | 
				
			||||||
 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
 | 
					 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@ -377,7 +377,7 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
 | 
				
			|||||||
   io_ptr = png_get_io_ptr(png_ptr);
 | 
					   io_ptr = png_get_io_ptr(png_ptr);
 | 
				
			||||||
   if (io_ptr != NULL)
 | 
					   if (io_ptr != NULL)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      check = fread(data, 1, length, (png_FILE_p)io_ptr);
 | 
					      check = fread(data, (sizeof (png_byte)), length, (png_FILE_p)io_ptr);
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   if (check != length)
 | 
					   if (check != length)
 | 
				
			||||||
@ -1610,8 +1610,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
 | 
				
			|||||||
         png_size_t num_in, num_out;
 | 
					         png_size_t num_in, num_out;
 | 
				
			||||||
         char inbuf[256], outbuf[256];
 | 
					         char inbuf[256], outbuf[256];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         num_in = fread(inbuf, 1, sizeof inbuf, fpin);
 | 
					         num_in = fread(inbuf, 1, (sizeof inbuf), fpin);
 | 
				
			||||||
         num_out = fread(outbuf, 1, sizeof outbuf, fpout);
 | 
					         num_out = fread(outbuf, 1, (sizeof outbuf), fpout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         if (num_in != num_out)
 | 
					         if (num_in != num_out)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user