mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Merge branch 'libpng15' of git://github.com/jbowler/libpng into libpng15
This commit is contained in:
commit
80d36775d4
@ -4010,8 +4010,11 @@ check_interlace_type(int const interlace_type)
|
||||
# define do_own_interlace 1
|
||||
#endif /* WRITE_INTERLACING tests */
|
||||
|
||||
#define CAN_WRITE_INTERLACE\
|
||||
PNG_LIBPNG_VER >= 10700 || defined PNG_WRITE_INTERLACING_SUPPORTED
|
||||
#if PNG_LIBPNG_VER >= 10700 || defined PNG_WRITE_INTERLACING_SUPPORTED
|
||||
# define CAN_WRITE_INTERLACE 1
|
||||
#else
|
||||
# define CAN_WRITE_INTERLACE 0
|
||||
#endif
|
||||
|
||||
/* Do the same thing for read interlacing; this controls whether read tests do
|
||||
* their own de-interlace or use libpng.
|
||||
|
||||
31
png.c
31
png.c
@ -776,6 +776,8 @@ png_access_version_number(void)
|
||||
|
||||
/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */
|
||||
# ifdef PNG_CHECK_cHRM_SUPPORTED
|
||||
static void png_64bit_product(long v1, long v2, long *hi_product,
|
||||
unsigned long *lo_product);
|
||||
|
||||
int /* PRIVATE */
|
||||
png_check_cHRM_fixed(png_structp png_ptr,
|
||||
@ -784,7 +786,8 @@ png_check_cHRM_fixed(png_structp png_ptr,
|
||||
png_fixed_point blue_x, png_fixed_point blue_y)
|
||||
{
|
||||
int ret = 1;
|
||||
unsigned long xy_hi,xy_lo,yx_hi,yx_lo;
|
||||
long xy_hi,yx_hi;
|
||||
unsigned long xy_lo,yx_lo;
|
||||
|
||||
png_debug(1, "in function png_check_cHRM_fixed");
|
||||
|
||||
@ -2169,29 +2172,31 @@ png_reciprocal2(png_fixed_point a, png_fixed_point b)
|
||||
* A and D, and X || Y is (X << 16) + Y.
|
||||
*/
|
||||
|
||||
void /* PRIVATE */
|
||||
png_64bit_product (long v1, long v2, unsigned long *hi_product,
|
||||
static void
|
||||
png_64bit_product(long v1, long v2, long *hi_product,
|
||||
unsigned long *lo_product)
|
||||
{
|
||||
int a, b, c, d;
|
||||
long lo, hi, x, y;
|
||||
long a, b, c, d;
|
||||
unsigned long lo;
|
||||
long hi, x, y;
|
||||
|
||||
a = (v1 >> 16) & 0xffff;
|
||||
a = v1 >> 16;
|
||||
b = v1 & 0xffff;
|
||||
c = (v2 >> 16) & 0xffff;
|
||||
c = v2 >> 16;
|
||||
d = v2 & 0xffff;
|
||||
|
||||
lo = b * d; /* BD */
|
||||
lo = b;
|
||||
lo *= d; /* BD */
|
||||
x = a * d + c * b; /* AD + CB */
|
||||
y = ((lo >> 16) & 0xffff) + x;
|
||||
y = (lo >> 16) + x;
|
||||
|
||||
lo = (lo & 0xffff) | ((y & 0xffff) << 16);
|
||||
hi = (y >> 16) & 0xffff;
|
||||
lo = (lo & 0xffff) | ((y & 0xffffU) << 16);
|
||||
|
||||
hi = y >> 16;
|
||||
hi += a * c; /* AC */
|
||||
|
||||
*hi_product = (unsigned long)hi;
|
||||
*lo_product = (unsigned long)lo;
|
||||
*hi_product = hi;
|
||||
*lo_product = lo;
|
||||
}
|
||||
#endif /* CHECK_cHRM */
|
||||
|
||||
|
||||
@ -1362,13 +1362,6 @@ PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
|
||||
png_fixed_point int_blue_y));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_CHECK_cHRM_SUPPORTED
|
||||
/* Added at libpng version 1.2.34 and 1.4.0 */
|
||||
/* Currently only used by png_check_cHRM_fixed */
|
||||
PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,
|
||||
unsigned long *hi_product, unsigned long *lo_product));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_cHRM_SUPPORTED
|
||||
/* Added at libpng version 1.5.5 */
|
||||
typedef struct png_xy
|
||||
|
||||
14
pngtrans.c
14
pngtrans.c
@ -629,12 +629,16 @@ png_do_check_palette_indexes(png_structp png_ptr, png_row_infop row_info)
|
||||
png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */
|
||||
{
|
||||
/* Calculations moved outside switch in an attempt to stop different
|
||||
* compiler warnings. 'padding' is in *bits* within the last byte, it is
|
||||
* an 'int' because pixel_depth becomes an 'int' in the expression below,
|
||||
* and this calculation is used because it avoids warnings that other
|
||||
* forms produced on either GCC or MSVC.
|
||||
* compiler warnings.
|
||||
*
|
||||
* 1.5.28: This rewritten version attempts to remove the unsigned integer
|
||||
* overflow from the prior version. While this was well defined it
|
||||
* resulted in unsigned overflow detection in clang. Since the result is
|
||||
* always in the range 0..7 only the low three bits of of the various
|
||||
* intermediates are every required, so:
|
||||
*/
|
||||
int padding = (-row_info->pixel_depth * row_info->width) & 7;
|
||||
unsigned int padding =
|
||||
((8 - (row_info->pixel_depth & 7)) * (row_info->width & 7)) & 7;
|
||||
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
|
||||
|
||||
switch (row_info->bit_depth)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user