mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[lbpng14] Quieted some harmless warnings from Coverity-scan.
This commit is contained in:
46
pngrtran.c
46
pngrtran.c
@@ -1,8 +1,8 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.4.13 [February 6, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.4.15 [%RDATE%]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@@ -2370,10 +2370,14 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
png_uint_16 red, green, blue, w;
|
||||
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)
|
||||
w = red;
|
||||
@@ -2405,10 +2409,14 @@ png_do_rgb_to_gray(png_structp 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;
|
||||
@@ -2468,10 +2476,14 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
png_uint_16 red, green, blue, w;
|
||||
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)
|
||||
w = red;
|
||||
@@ -2505,9 +2517,15 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
png_uint_16 red, green, blue, gray16;
|
||||
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;
|
||||
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));
|
||||
|
||||
if (red != green || red != blue)
|
||||
rgb_error |= 1;
|
||||
gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15);
|
||||
|
||||
Reference in New Issue
Block a user