From b9ba8d6a57d7c8cedf1e0d89d81e3ee3e0eea705 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sun, 16 Aug 2015 23:32:04 -0500 Subject: [PATCH] [libpng16] Mention in manual that 16-bit platform support has been dropped. --- CHANGES | 13 +++++++------ libpng-manual.txt | 6 +++--- libpng.3 | 6 +++--- png.c | 10 +++++----- pngrtran.c | 6 +++--- pngrutil.c | 12 ++++++------ 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/CHANGES b/CHANGES index 7593cac3c..7de2db25e 100644 --- a/CHANGES +++ b/CHANGES @@ -3803,12 +3803,13 @@ Version 1.6.0beta01 [December 15, 2011] (the other two required headers aren't used). Non-ANSI systems that don't have stddef.h or limits.h will have to provide an appropriate fake containing the relevant types and #defines. - The use of FAR/far has been eliminated and the definition of png_alloc_size_t - is now controlled by a flag so that 'small size_t' systems can select it - if necessary. Libpng 1.6 may not currently work on such systems -- it - seems likely that it will ask 'malloc' for more than 65535 bytes with any - image that has a sufficiently large row size (rather than simply failing - to read such images). + Dropped support for 16-bit platforms. The use of FAR/far has been eliminated + and the definition of png_alloc_size_t is now controlled by a flag so + that 'small size_t' systems can select it if necessary. Libpng 1.6 may + not currently work on such systems -- it seems likely that it will + ask 'malloc' for more than 65535 bytes with any image that has a + sufficiently large row size (rather than simply failing to read such + images). New tools directory containing tools used to generate libpng code. Fixed race conditions in parallel make builds. With higher degrees of parallelism during 'make' the use of the same temporary file names such diff --git a/libpng-manual.txt b/libpng-manual.txt index b06a77bcb..07a339cf5 100644 --- a/libpng-manual.txt +++ b/libpng-manual.txt @@ -5046,9 +5046,9 @@ The signatures of many exported functions were changed, such that png_infop became png_inforp or png_const_inforp where "rp" indicates a "restricted pointer". -The support for FAR/far types has been eliminated and the definition of -png_alloc_size_t is now controlled by a flag so that 'small size_t' systems -can select it if necessary. +Dropped support for 16-bit platforms. The support for FAR/far types has +been eliminated and the definition of png_alloc_size_t is now controlled +by a flag so that 'small size_t' systems can select it if necessary. Error detection in some chunks has improved; in particular the iCCP chunk reader now does pretty complete validation of the basic format. Some bad diff --git a/libpng.3 b/libpng.3 index 14b1ac828..6d2894390 100644 --- a/libpng.3 +++ b/libpng.3 @@ -5554,9 +5554,9 @@ The signatures of many exported functions were changed, such that png_infop became png_inforp or png_const_inforp where "rp" indicates a "restricted pointer". -The support for FAR/far types has been eliminated and the definition of -png_alloc_size_t is now controlled by a flag so that 'small size_t' systems -can select it if necessary. +Dropped support for 16-bit platforms. The support for FAR/far types has +been eliminated and the definition of png_alloc_size_t is now controlled +by a flag so that 'small size_t' systems can select it if necessary. Error detection in some chunks has improved; in particular the iCCP chunk reader now does pretty complete validation of the basic format. Some bad diff --git a/png.c b/png.c index 8af9dc0ec..0f1cfc1ff 100644 --- a/png.c +++ b/png.c @@ -1512,10 +1512,10 @@ png_XYZ_normalize(png_XYZ *XYZ) * safe. */ Y = XYZ->red_Y; - if (0x7fffffff - Y < XYZ->green_X) + if (0x7fffffffL - Y < XYZ->green_X) return 1; Y += XYZ->green_Y; - if (0x7fffffff - Y < XYZ->blue_X) + if (0x7fffffffL - Y < XYZ->blue_X) return 1; Y += XYZ->blue_Y; @@ -3673,10 +3673,10 @@ for (i=11;i>=0;--i){ print i, " ", (1 - e(-(2^i)/65536*l(2))) * 2^(32-i), "\n"} static png_uint_32 png_exp(png_fixed_point x) { - if (x > 0 && x <= 0xfffff) /* Else overflow or zero (underflow) */ + if (x > 0 && x <= 0xfffffUL) /* Else overflow or zero (underflow) */ { /* Obtain a 4-bit approximation */ - png_uint_32 e = png_32bit_exp[(x >> 12) & 0xf]; + png_uint_32 e = png_32bit_exp[(x >> 12) & 0x0f]; /* Incorporate the low 12 bits - these decrease the returned value by * multiplying by a number less than 1 if the bit is set. The multiplier @@ -3729,7 +3729,7 @@ png_exp8bit(png_fixed_point lg2) * step. */ x -= x >> 8; - return (png_byte)(((x + 0x7fffff) >> 24) & 0xff); + return (png_byte)(((x + 0x7fffffUL) >> 24) & 0xff); } #ifdef PNG_16BIT_SUPPORTED diff --git a/pngrtran.c b/pngrtran.c index ad25dc86f..e396abc18 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -3314,7 +3314,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) if ((png_uint_16)((*sp >> shift) & 0x0f) == png_ptr->trans_color.gray) { - unsigned int tmp = *sp & (0xf0f >> (4 - shift)); + unsigned int tmp = *sp & (0x0f0f >> (4 - shift)); tmp |= png_ptr->background.gray << shift; *sp = (png_byte)(tmp & 0xff); } @@ -3324,7 +3324,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) unsigned int p = (*sp >> shift) & 0x0f; unsigned int g = (gamma_table[p | (p << 4)] >> 4) & 0x0f; - unsigned int tmp = *sp & (0xf0f >> (4 - shift)); + unsigned int tmp = *sp & (0x0f0f >> (4 - shift)); tmp |= g << shift; *sp = (png_byte)(tmp & 0xff); } @@ -3350,7 +3350,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) if ((png_uint_16)((*sp >> shift) & 0x0f) == png_ptr->trans_color.gray) { - unsigned int tmp = *sp & (0xf0f >> (4 - shift)); + unsigned int tmp = *sp & (0x0f0f >> (4 - shift)); tmp |= png_ptr->background.gray << shift; *sp = (png_byte)(tmp & 0xff); } diff --git a/pngrutil.c b/pngrutil.c index 4927d14dd..96298d328 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -85,10 +85,10 @@ png_int_32 (PNGAPI png_get_int_32)(png_const_bytep buf) { png_uint_32 uval = png_get_uint_32(buf); - if ((uval & 0x80000000) == 0) /* non-negative */ + if ((uval & 0x80000000UL) == 0) /* non-negative */ return uval; - uval = (uval ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */ + uval = (uval ^ 0xffffffffUL) + 1; /* 2's complement: -x = ~x+1 */ return -(png_int_32)uval; } @@ -3120,10 +3120,10 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) # define PNG_LSR(x,s) ((x)>>(s)) # define PNG_LSL(x,s) ((x)<<(s)) # endif -# define S_COPY(p,x) (((p)<4 ? PNG_LSR(0x80088822,(3-(p))*8+(7-(x))) :\ - PNG_LSR(0xaa55ff00,(7-(p))*8+(7-(x)))) & 1) -# define B_COPY(p,x) (((p)<4 ? PNG_LSR(0xff0fff33,(3-(p))*8+(7-(x))) :\ - PNG_LSR(0xff55ff00,(7-(p))*8+(7-(x)))) & 1) +# define S_COPY(p,x) (((p)<4 ? PNG_LSR(0x80088822UL,(3-(p))*8+(7-(x))) :\ + PNG_LSR(0xaa55ff00UL,(7-(p))*8+(7-(x)))) & 1) +# define B_COPY(p,x) (((p)<4 ? PNG_LSR(0xff0fff33UL,(3-(p))*8+(7-(x))) :\ + PNG_LSR(0xff55ff00UL,(7-(p))*8+(7-(x)))) & 1) /* Return a mask for pass 'p' pixel 'x' at depth 'd'. The mask is * little endian - the first pixel is at bit 0 - however the extra