mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[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:
committed by
Glenn Randers-Pehrson
parent
cb75699dff
commit
92ef313c77
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'
|
||||
* 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
|
||||
|
||||
Reference in New Issue
Block a user