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:
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
|
||||
{
|
||||
mask = 0x80;
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
dp++;
|
||||
v = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask != 0x80)
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 6;
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
dp++;
|
||||
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)
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 4;
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
dp++;
|
||||
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)
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -150,9 +150,8 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
break;
|
||||
}
|
||||
|
||||
row_info->bit_depth = (png_byte)(bit_depth & 0xff);
|
||||
row_info->pixel_depth =
|
||||
(png_byte)((bit_depth * row_info->channels) & 0xff);
|
||||
row_info->bit_depth = (png_byte)bit_depth;
|
||||
row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels);
|
||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
|
||||
row_info->width);
|
||||
}
|
||||
@@ -423,7 +422,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
*(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++);
|
||||
*/
|
||||
sp+=6; dp = sp;
|
||||
*(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
|
||||
*(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
}
|
||||
}
|
||||
#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++)
|
||||
{
|
||||
*(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++);
|
||||
*/
|
||||
sp+=2; dp = sp;
|
||||
*(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
|
||||
*(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
}
|
||||
}
|
||||
#endif /* WRITE_16BIT */
|
||||
|
||||
Reference in New Issue
Block a user