summaryrefslogtreecommitdiff
path: root/pngwutil.c
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2016-02-13 12:01:35 -0600
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2016-02-13 12:01:35 -0600
commitbaf301d122ac3d0aa076cc9682ef4f01bbe0caeb (patch)
treeaff1b2c70fb8f1f45b602c17568a7018b743a338 /pngwutil.c
parent08bd7654bc15ee53a6f3c6199aedfab636027588 (diff)
downloadlibpng-baf301d122ac3d0aa076cc9682ef4f01bbe0caeb.tar.gz
[libpng16] Restored "& 0xff" in png_save_uint_16() and png_save_uint_32() that
were accidentally removed from libpng-1.6.17.
Diffstat (limited to 'pngwutil.c')
-rw-r--r--pngwutil.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pngwutil.c b/pngwutil.c
index 4aa7ffa03..aa5bda3c0 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -23,10 +23,10 @@
void PNGAPI
png_save_uint_32(png_bytep buf, png_uint_32 i)
{
- buf[0] = (png_byte)(i >> 24);
- buf[1] = (png_byte)(i >> 16);
- buf[2] = (png_byte)(i >> 8);
- buf[3] = (png_byte)(i );
+ buf[0] = (png_byte)((i >> 24) & 0xffU);
+ buf[1] = (png_byte)((i >> 16) & 0xffU);
+ buf[2] = (png_byte)((i >> 8) & 0xffU);
+ buf[3] = (png_byte)( i & 0xffU);
}
/* Place a 16-bit number into a buffer in PNG byte order.
@@ -36,8 +36,8 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
void PNGAPI
png_save_uint_16(png_bytep buf, unsigned int i)
{
- buf[0] = (png_byte)(i >> 8);
- buf[1] = (png_byte)(i );
+ buf[0] = (png_byte)((i >> 8) & 0xffU);
+ buf[1] = (png_byte)( i & 0xffU);
}
#endif