[lipng17] Do not build png_product2() when it is unused and work around

one more Coverity-scan dead-code warning.
This commit is contained in:
Glenn Randers-Pehrson
2015-02-07 08:54:07 -06:00
parent d7312be749
commit 6ce2d220b4
5 changed files with 45 additions and 39 deletions

View File

@@ -2991,18 +2991,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++)
{
png_uint_16 red, green, blue, w;
#if 0 /* Coverity doesn't like this */
red = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
green = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
blue = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
#else
png_byte hi,lo;
hi=*(sp)++; lo=*(sp)++; red = (png_uint_16)((hi << 8) | (lo));
hi=*(sp)++; lo=*(sp)++; green = (png_uint_16)((hi << 8) | (lo));
hi=*(sp)++; lo=*(sp)++; blue = (png_uint_16)((hi << 8) | (lo));
#endif
if (red == green && red == blue)
{
@@ -3047,10 +3040,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++)
{
png_uint_16 red, green, blue, gray16;
png_byte hi,lo;
red = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
green = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
blue = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
hi=*(sp)++; lo=*(sp)++; red = (png_uint_16)((hi << 8) | (lo));
hi=*(sp)++; lo=*(sp)++; green = (png_uint_16)((hi << 8) | (lo));
hi=*(sp)++; lo=*(sp)++; blue = (png_uint_16)((hi << 8) | (lo));
if (red != green || red != blue)
rgb_error |= 1;