mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng15] Constant changes for 64-bit compatibility (removal of L suffixes).
The 16-bit cases still use "L" as we don't have a 16-bit test system.
This commit is contained in:
parent
f0c19e6455
commit
751561218f
2
ANNOUNCE
2
ANNOUNCE
@ -94,6 +94,8 @@ Version 1.5.5beta08 [September 9, 2011]
|
||||
world. This produces potential truncation errors which the
|
||||
compiler correctly flags.
|
||||
Relocated new HAVE_SOLARIS_LD definition in configure.ac
|
||||
Constant changes for 64-bit compatibility (removal of L suffixes). The
|
||||
16-bit cases still use "L" as we don't have a 16-bit test system.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
|
||||
(subscription required; visit
|
||||
|
||||
2
CHANGES
2
CHANGES
@ -3578,6 +3578,8 @@ Version 1.5.5beta08 [September 9, 2011]
|
||||
world. This produces potential truncation errors which the
|
||||
compiler correctly flags.
|
||||
Relocated new HAVE_SOLARIS_LD definition in configure.ac
|
||||
Constant changes for 64-bit compatibility (removal of L suffixes). The
|
||||
16-bit cases still use "L" as we don't have a 16-bit test system.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
||||
22
png.c
22
png.c
@ -1722,18 +1722,30 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
|
||||
size -= cdigits;
|
||||
|
||||
*ascii++ = 69, --size; /* 'E': PLUS 1 TOTAL 2+precision */
|
||||
|
||||
/* The following use of an unsigned temporary avoids ambiguities in
|
||||
* the signed arithmetic on exp_b10 and permits GCC at least to do
|
||||
* better optimization.
|
||||
*/
|
||||
{
|
||||
unsigned int uexp_b10;
|
||||
|
||||
if (exp_b10 < 0)
|
||||
{
|
||||
*ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */
|
||||
exp_b10 = -exp_b10;
|
||||
uexp_b10 = -exp_b10;
|
||||
}
|
||||
|
||||
else
|
||||
uexp_b10 = exp_b10;
|
||||
|
||||
cdigits = 0;
|
||||
|
||||
while (exp_b10 > 0)
|
||||
while (uexp_b10 > 0)
|
||||
{
|
||||
exponent[cdigits++] = (char)(48 + exp_b10 % 10);
|
||||
exp_b10 /= 10;
|
||||
exponent[cdigits++] = (char)(48 + uexp_b10 % 10);
|
||||
uexp_b10 /= 10;
|
||||
}
|
||||
}
|
||||
|
||||
/* Need another size check here for the exponent digits, so
|
||||
@ -1791,7 +1803,7 @@ png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size,
|
||||
else
|
||||
num = fp;
|
||||
|
||||
if (num <= 0x80000000U) /* else overflowed */
|
||||
if (num <= 0x80000000) /* else overflowed */
|
||||
{
|
||||
unsigned int ndigits = 0, first = 16 /* flag value */;
|
||||
char digits[10];
|
||||
|
||||
12
png.h
12
png.h
@ -2515,14 +2515,14 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
|
||||
{ png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
|
||||
* (png_uint_16)(alpha) \
|
||||
+ (png_uint_16)(bg)*(png_uint_16)(255 \
|
||||
- (png_uint_16)(alpha)) + (png_uint_16)128); \
|
||||
- (png_uint_16)(alpha)) + 128); \
|
||||
(composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
|
||||
|
||||
# define png_composite_16(composite, fg, alpha, bg) \
|
||||
{ png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
|
||||
* (png_uint_32)(alpha) \
|
||||
+ (png_uint_32)(bg)*(png_uint_32)(65535L \
|
||||
- (png_uint_32)(alpha)) + (png_uint_32)32768L); \
|
||||
+ (png_uint_32)(bg)*(65535 \
|
||||
- (png_uint_32)(alpha)) + 32768); \
|
||||
(composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
|
||||
|
||||
#else /* Standard method using integer division */
|
||||
@ -2530,12 +2530,12 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
|
||||
# define png_composite(composite, fg, alpha, bg) \
|
||||
(composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
|
||||
(png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
|
||||
(png_uint_16)127) / 255)
|
||||
127) / 255)
|
||||
|
||||
# define png_composite_16(composite, fg, alpha, bg) \
|
||||
(composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
|
||||
(png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \
|
||||
(png_uint_32)32767) / (png_uint_32)65535L)
|
||||
(png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
|
||||
32767) / 65535)
|
||||
#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
|
||||
|
||||
#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
|
||||
|
||||
2
pngget.c
2
pngget.c
@ -1066,7 +1066,7 @@ png_get_user_chunk_ptr(png_const_structp png_ptr)
|
||||
png_size_t PNGAPI
|
||||
png_get_compression_buffer_size(png_const_structp png_ptr)
|
||||
{
|
||||
return (png_ptr ? png_ptr->zbuf_size : 0L);
|
||||
return (png_ptr ? png_ptr->zbuf_size : 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -973,8 +973,8 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
|
||||
* overwrites the coefficients, regardless of whether they have been
|
||||
* defaulted or set already.
|
||||
*/
|
||||
red_int = (png_uint_16)(((png_uint_32)red*32768L)/100000L);
|
||||
green_int = (png_uint_16)(((png_uint_32)green*32768L)/100000L);
|
||||
red_int = (png_uint_16)(((png_uint_32)red*32768)/100000);
|
||||
green_int = (png_uint_16)(((png_uint_32)green*32768)/100000);
|
||||
|
||||
png_ptr->rgb_to_gray_red_coeff = red_int;
|
||||
png_ptr->rgb_to_gray_green_coeff = green_int;
|
||||
@ -4917,8 +4917,8 @@ png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
|
||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
||||
png_uint_32 red = (png_uint_32)((s0 + s1 + 65536L) & 0xffffL);
|
||||
png_uint_32 blue = (png_uint_32)((s2 + s1 + 65536L) & 0xffffL);
|
||||
png_uint_32 red = (s0 + s1 + 65536) & 0xffff;
|
||||
png_uint_32 blue = (s2 + s1 + 65536) & 0xffff;
|
||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
||||
*(rp + 1) = (png_byte)(red & 0xff);
|
||||
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
|
||||
|
||||
12
pngrutil.c
12
pngrutil.c
@ -827,7 +827,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
# ifdef PNG_READ_sRGB_SUPPORTED
|
||||
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB))
|
||||
{
|
||||
if (PNG_OUT_OF_RANGE(igamma, 45500L, 500))
|
||||
if (PNG_OUT_OF_RANGE(igamma, 45500, 500))
|
||||
{
|
||||
PNG_WARNING_PARAMETERS(p)
|
||||
png_warning_parameter_signed(p, 1, PNG_NUMBER_FORMAT_fixed, igamma);
|
||||
@ -994,10 +994,10 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
{
|
||||
if (PNG_OUT_OF_RANGE(x_white, 31270, 1000) ||
|
||||
PNG_OUT_OF_RANGE(y_white, 32900, 1000) ||
|
||||
PNG_OUT_OF_RANGE(x_red, 64000L, 1000) ||
|
||||
PNG_OUT_OF_RANGE(x_red, 64000, 1000) ||
|
||||
PNG_OUT_OF_RANGE(y_red, 33000, 1000) ||
|
||||
PNG_OUT_OF_RANGE(x_green, 30000, 1000) ||
|
||||
PNG_OUT_OF_RANGE(y_green, 60000L, 1000) ||
|
||||
PNG_OUT_OF_RANGE(y_green, 60000, 1000) ||
|
||||
PNG_OUT_OF_RANGE(x_blue, 15000, 1000) ||
|
||||
PNG_OUT_OF_RANGE(y_blue, 6000, 1000))
|
||||
{
|
||||
@ -1159,7 +1159,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
#if defined(PNG_READ_gAMA_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED)
|
||||
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA))
|
||||
{
|
||||
if (PNG_OUT_OF_RANGE(info_ptr->gamma, 45500L, 500))
|
||||
if (PNG_OUT_OF_RANGE(info_ptr->gamma, 45500, 500))
|
||||
{
|
||||
PNG_WARNING_PARAMETERS(p)
|
||||
|
||||
@ -1176,10 +1176,10 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
|
||||
if (PNG_OUT_OF_RANGE(info_ptr->x_white, 31270, 1000) ||
|
||||
PNG_OUT_OF_RANGE(info_ptr->y_white, 32900, 1000) ||
|
||||
PNG_OUT_OF_RANGE(info_ptr->x_red, 64000L, 1000) ||
|
||||
PNG_OUT_OF_RANGE(info_ptr->x_red, 64000, 1000) ||
|
||||
PNG_OUT_OF_RANGE(info_ptr->y_red, 33000, 1000) ||
|
||||
PNG_OUT_OF_RANGE(info_ptr->x_green, 30000, 1000) ||
|
||||
PNG_OUT_OF_RANGE(info_ptr->y_green, 60000L, 1000) ||
|
||||
PNG_OUT_OF_RANGE(info_ptr->y_green, 60000, 1000) ||
|
||||
PNG_OUT_OF_RANGE(info_ptr->x_blue, 15000, 1000) ||
|
||||
PNG_OUT_OF_RANGE(info_ptr->y_blue, 6000, 1000))
|
||||
{
|
||||
|
||||
8
pngset.c
8
pngset.c
@ -602,10 +602,10 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||
# ifdef PNG_cHRM_SUPPORTED
|
||||
png_set_cHRM_fixed(png_ptr, info_ptr,
|
||||
/* color x y */
|
||||
/* white */ 31270L, 32900L,
|
||||
/* red */ 64000L, 33000L,
|
||||
/* green */ 30000L, 60000L,
|
||||
/* blue */ 15000L, 6000L
|
||||
/* white */ 31270, 32900,
|
||||
/* red */ 64000, 33000,
|
||||
/* green */ 30000, 60000,
|
||||
/* blue */ 15000, 6000
|
||||
);
|
||||
# endif /* cHRM */
|
||||
}
|
||||
|
||||
@ -2217,7 +2217,7 @@ modifier_crc(png_bytep buffer)
|
||||
* the buffer, at the start.
|
||||
*/
|
||||
uInt datalen = png_get_uint_32(buffer);
|
||||
uLong crc = crc32(0L, buffer+4, datalen+4);
|
||||
uLong crc = crc32(0, buffer+4, datalen+4);
|
||||
/* The cast to png_uint_32 is safe because a crc32 is always a 32 bit value.
|
||||
*/
|
||||
png_save_uint_32(buffer+datalen+8, (png_uint_32)crc);
|
||||
|
||||
@ -267,10 +267,10 @@ option SET_USER_LIMITS enables SET_CHUNK_CACHE_LIMIT
|
||||
option SET_USER_LIMITS enables SET_CHUNK_MALLOC_LIMIT
|
||||
|
||||
# Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGs no matter
|
||||
# how large, set these two limits to 0x7fffffffL
|
||||
# how large, set these two limits to 0x7fffffff
|
||||
|
||||
setting USER_WIDTH_MAX default 1000000L
|
||||
setting USER_HEIGHT_MAX default 1000000L
|
||||
setting USER_WIDTH_MAX default 1000000
|
||||
setting USER_HEIGHT_MAX default 1000000
|
||||
|
||||
# Added at libpng-1.2.43. To accept all valid PNGs no matter
|
||||
# how large, set these two limits to 0.
|
||||
|
||||
@ -33,8 +33,8 @@
|
||||
#define PNG_sCAL_PRECISION 5
|
||||
#define PNG_USER_CHUNK_CACHE_MAX 0
|
||||
#define PNG_USER_CHUNK_MALLOC_MAX 0
|
||||
#define PNG_USER_HEIGHT_MAX 1000000L
|
||||
#define PNG_USER_WIDTH_MAX 1000000L
|
||||
#define PNG_USER_HEIGHT_MAX 1000000
|
||||
#define PNG_USER_WIDTH_MAX 1000000
|
||||
#define PNG_WEIGHT_SHIFT 8
|
||||
#define PNG_ZBUF_SIZE 8192
|
||||
/* end of settings */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user