From cc0bff446be85cd59269c765886de0329ee66422 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 3 May 2010 21:27:33 -0500 Subject: [PATCH] [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. --- ANNOUNCE | 4 ++-- CHANGES | 2 +- pngrutil.c | 15 +++++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 516018dfa..d9c8da04e 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.4.2rc06 - May 3, 2010 +Libpng 1.4.2rc06 - May 4, 2010 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -60,7 +60,7 @@ version 1.4.2rc05 [April 29, 2010] png.h is removed if both READ and WRITE USER_TRANSFORM are turned off but was left defined in pngtrans.c -version 1.4.2rc06 [May 3, 2010] +version 1.4.2rc06 [May 4, 2010] Moved declarations of umsg[] inside the proper #ifdef blocks in pngrutil.c Added a typecast in pngrutil.c to stifle compiler warning in the calculation of the png_ptr->rowbuf pointer into png_ptr->big_row_buf. diff --git a/CHANGES b/CHANGES index 18bdf636f..b1ae7ec7a 100644 --- a/CHANGES +++ b/CHANGES @@ -2571,7 +2571,7 @@ version 1.4.2rc05 [April 29, 2010] png.h is removed if both READ and WRITE USER_TRANSFORM are turned off but was left defined in pngtrans.c -version 1.4.2rc06 [May 3, 2010] +version 1.4.2rc06 [May 4, 2010] Moved declarations of umsg[] inside the proper #ifdef blocks in pngrutil.c Added a typecast in pngrutil.c to stifle compiler warning in the calculation of the png_ptr->rowbuf pointer into png_ptr->big_row_buf. 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;