summaryrefslogtreecommitdiff
path: root/pngrutil.c
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2010-05-03 21:27:33 -0500
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2010-05-03 21:28:50 -0500
commitcc0bff446be85cd59269c765886de0329ee66422 (patch)
treee21df0933c109536e1bade4f835ec4074801ae21 /pngrutil.c
parent9b8ddff5b7e30f8cbdd97bf5b9c96c56aa87943f (diff)
downloadlibpng-cc0bff446be85cd59269c765886de0329ee66422.tar.gz
[master] Changed a typecast in pngrutil.c to stifle compiler warning
in the calculation of the png_ptr->rowbuf pointer into png_ptr->big_row_buf.
Diffstat (limited to 'pngrutil.c')
-rw-r--r--pngrutil.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/pngrutil.c b/pngrutil.c
index 1898f30d0..af2250be0 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -3312,6 +3312,11 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
if (row_bytes + 48 > png_ptr->old_big_row_buf_size)
{
+#ifdef PNG_ALIGNED_MEMORY_SUPPORTED
+ png_size_t big_row_buf_address;
+ int row_buf_offset;
+#endif
+
png_free(png_ptr, png_ptr->big_row_buf);
if (png_ptr->interlaced)
png_ptr->big_row_buf = (png_bytep)png_calloc(png_ptr,
@@ -3325,10 +3330,12 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
/* Use 16-byte aligned memory for row_buf with at least 16 bytes
* of padding before and after row_buf.
*/
- png_ptr->row_buf = png_ptr->big_row_buf + 32
- - (((png_alloc_size_t)&(png_ptr->big_row_buf[0])
- + (png_alloc_size_t)15) % 16);
- png_ptr->old_big_row_buf_size = row_bytes + 48;
+ {
+ big_row_buf_address = (png_size_t)png_ptr->big_row_buf;
+ row_buf_offset = 32 - ((big_row_buf_address + 15) & 0x0F);
+ png_ptr->row_buf = png_ptr->big_row_buf + row_buf_offset;
+ }
+ png_ptr->old_big_row_buf_size = row_bytes + 48;
#else
/* Use 32 bytes of padding before and 16 bytes after row_buf. */
png_ptr->row_buf = png_ptr->big_row_buf + 32;