[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:
parent
cb75699dff
commit
92ef313c77
9
ANNOUNCE
9
ANNOUNCE
@ -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
|
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.
|
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
|
Added LSR() macro to defend against buggy compilers that evaluate non-taken
|
||||||
code branches and complain about out-of-range shifts.
|
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.
|
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:
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
7
CHANGES
7
CHANGES
@ -3657,8 +3657,13 @@ Version 1.5.6rc02 [October 27, 2011]
|
|||||||
Added LSR() macro to defend against buggy compilers that evaluate non-taken
|
Added LSR() macro to defend against buggy compilers that evaluate non-taken
|
||||||
code branches and complain about out-of-range shifts.
|
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.
|
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
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
12
pngrtran.c
12
pngrtran.c
@ -2484,8 +2484,8 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
|
|||||||
|
|
||||||
while (bp < bp_end)
|
while (bp < bp_end)
|
||||||
{
|
{
|
||||||
int byte = (*bp >> 1) & 0x55;
|
int b = (*bp >> 1) & 0x55;
|
||||||
*bp++ = (png_byte)byte;
|
*bp++ = (png_byte)b;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2503,8 +2503,8 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
|
|||||||
|
|
||||||
while (bp < bp_end)
|
while (bp < bp_end)
|
||||||
{
|
{
|
||||||
int byte = (*bp >> gray_shift) & mask;
|
int b = (*bp >> gray_shift) & mask;
|
||||||
*bp++ = (png_byte)byte;
|
*bp++ = (png_byte)b;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2518,10 +2518,10 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
|
|||||||
|
|
||||||
while (bp < bp_end)
|
while (bp < bp_end)
|
||||||
{
|
{
|
||||||
int byte = *bp >> shift[channel];
|
int b = *bp >> shift[channel];
|
||||||
if (++channel >= channels)
|
if (++channel >= channels)
|
||||||
channel = 0;
|
channel = 0;
|
||||||
*bp++ = (png_byte)byte;
|
*bp++ = (png_byte)b;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
16
pngrutil.c
16
pngrutil.c
@ -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'
|
* copied in the pass, 0 if not. 'S' is for the sparkle method, 'B'
|
||||||
* for the block method.
|
* for the block method.
|
||||||
*
|
*
|
||||||
* With Microsoft Visual C and potentially other compilers the shifts
|
* With some compilers a compile time expression of the general form:
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* 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_LSR(x,s) ((x)>>((s) & 0x1f))
|
||||||
# define PNG_LSL(x,s) ((x)<<((s) & 0x1f))
|
# define PNG_LSL(x,s) ((x)<<((s) & 0x1f))
|
||||||
# else
|
# else
|
||||||
|
Loading…
Reference in New Issue
Block a user