[devel] Added a typecast in png_get_int_32() to avoid compiler warning.

This commit is contained in:
Glenn Randers-Pehrson 2010-07-30 09:58:34 -05:00
parent 1e7d7d3cbf
commit 53c7502663
3 changed files with 8 additions and 2 deletions

View File

@ -307,8 +307,11 @@ version 1.5.0beta36 [July 29, 2010]
converting the values to the fixed point form used in the PNG file.
The standard headers no longer include zlib.h, which is currently only
required for pngstruct.h and can therefore be internal.
Revised png_get_int_32 to undo the PNG two's complement representation of
negative numbers.
version 1.5.0beta37 [July 30, 2010]
Added a typecast in png_get_int_32() to avoid compiler warning.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit

View File

@ -2789,8 +2789,11 @@ version 1.5.0beta36 [July 29, 2010]
converting the values to the fixed point form used in the PNG file.
The standard headers no longer include zlib.h, which is currently only
required for pngstruct.h and can therefore be internal.
Revised png_get_int_32 to undo the PNG two's complement representation of
negative numbers.
version 1.5.0beta37 [July 30, 2010]
Added a typecast in png_get_int_32() to avoid compiler warning.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -77,11 +77,11 @@ png_int_32 (PNGAPI
png_get_int_32)(png_bytep buf)
{
png_uint_32 u = png_get_uint_32(buf);
if ((u & 0x80000000) == 0) /* negative */
if ((u & 0x80000000) == 0) /* non-negative */
return u;
u = (u ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
return -u;
return -(png_int_32)u;
}
/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */