[libpng15] Fixed compiler warnings with Intel and MSYS compilers.

The logical shift fix for Microsoft Visual C is required by other compilers,
so this enables that fix for all compilers when using compile-time constants.
Under MSYS 'byte' is a name declared in a system header file, so we
changed the name of a local variable to avoid the warnings that result.
This commit is contained in:
John Bowler 2011-10-27 19:36:08 -05:00 committed by Glenn Randers-Pehrson
parent cb75699dff
commit 92ef313c77
4 changed files with 29 additions and 15 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.6rc03 - October 27, 2011
Libpng 1.5.6rc03 - October 28, 2011
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.
@ -96,8 +96,13 @@ Version 1.5.6rc02 [October 27, 2011]
Added LSR() macro to defend against buggy compilers that evaluate non-taken
code branches and complain about out-of-range shifts.
Version 1.5.6rc03 [October 27, 2011]
Version 1.5.6rc03 [October 28, 2011]
Renamed the LSR() macro to PNG_LSR() and added PNG_LSL() macro.
Fixed compiler warnings with Intel and MSYS compilers. The logical shift
fix for Microsoft Visual C is required by other compilers, so this
enables that fix for all compilers when using compile-time constants.
Under MSYS 'byte' is a name declared in a system header file, so we
changed the name of a local variable to avoid the warnings that result.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit

View File

@ -3657,8 +3657,13 @@ Version 1.5.6rc02 [October 27, 2011]
Added LSR() macro to defend against buggy compilers that evaluate non-taken
code branches and complain about out-of-range shifts.
Version 1.5.6rc03 [October 27, 2011]
Version 1.5.6rc03 [October 28, 2011]
Renamed the LSR() macro to PNG_LSR() and added PNG_LSL() macro.
Fixed compiler warnings with Intel and MSYS compilers. The logical shift
fix for Microsoft Visual C is required by other compilers, so this
enables that fix for all compilers when using compile-time constants.
Under MSYS 'byte' is a name declared in a system header file, so we
changed the name of a local variable to avoid the warnings that result.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -2484,8 +2484,8 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
while (bp < bp_end)
{
int byte = (*bp >> 1) & 0x55;
*bp++ = (png_byte)byte;
int b = (*bp >> 1) & 0x55;
*bp++ = (png_byte)b;
}
break;
}
@ -2503,8 +2503,8 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
while (bp < bp_end)
{
int byte = (*bp >> gray_shift) & mask;
*bp++ = (png_byte)byte;
int b = (*bp >> gray_shift) & mask;
*bp++ = (png_byte)b;
}
break;
}
@ -2518,10 +2518,10 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
while (bp < bp_end)
{
int byte = *bp >> shift[channel];
int b = *bp >> shift[channel];
if (++channel >= channels)
channel = 0;
*bp++ = (png_byte)byte;
*bp++ = (png_byte)b;
}
break;
}

View File

@ -2876,14 +2876,18 @@ png_combine_row(png_structp png_ptr, png_bytep dp, int display)
* copied in the pass, 0 if not. 'S' is for the sparkle method, 'B'
* for the block method.
*
* With Microsoft Visual C and potentially other compilers the shifts
* below to extract the relevant fields from a 64 bit value are faulted
* if evaluated at compile time because the non-taken branch has an
* invalid shift (negative or more than 31), hence the following.
* With some compilers a compile time expression of the general form:
*
* TO DO: Also identify the Intel C compiler here.
* (shift >= 32) ? (a >> (shift-32)) : (b >> shift)
*
* Produces warnings with values of 'shift' in the range 33 to 63
* because the right hand side of the ?: expression is evalulated by
* the compiler even though it isn't used. Microsoft Visual C (various
* versions) and the Intel C compiler are known to do this. To avoid
* this the following macros are used in 1.5.6. This is a temporary
* solution to avoid destablizing the code during the release process.
*/
# if defined PNG_USE_COMPILE_TIME_MASKS && defined _MSC_VER
# if PNG_USE_COMPILE_TIME_MASKS
# define PNG_LSR(x,s) ((x)>>((s) & 0x1f))
# define PNG_LSL(x,s) ((x)<<((s) & 0x1f))
# else