diff -ru4NwbB libpng-1.5.0/Makefile.am libpng-1.5.1beta08/Makefile.am --- libpng-1.5.0/Makefile.am 2011-01-22 16:39:30.152968768 -0600 +++ libpng-1.5.1beta08/Makefile.am 2011-01-22 20:17:34.468351787 -0600 @@ -80,8 +80,15 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \ config.sub configure depcomp install-sh ltmain.sh missing +# DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe +# other operating systems (NeXT?) the C preprocessor selected by configure +# checks input tokens for validity - effectively it performs part of the ANSI-C +# parsing - and therefore fails with the .df files. configure.ac has special +# checks for this and sets DFNCPP appropriately. +DFNCPP = @DFNCPP@ + SUFFIXES = .chk .dfn .out $(PNGLIB_BASENAME).pc: libpng.pc cp libpng.pc $@ @@ -118,9 +125,9 @@ .dfn.out: rm -f $@ dfn.c dfn?.out test -d scripts || mkdir scripts echo '#include "$<"' >dfn.c - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\ + $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out $(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\ dfn1.out >dfn2.out $(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out diff -ru4NwbB libpng-1.5.0/configure.ac libpng-1.5.1beta08/configure.ac --- libpng-1.5.0/configure.ac 2011-01-22 16:39:30.159759706 -0600 +++ libpng-1.5.1beta08/configure.ac 2011-01-22 20:17:34.475119944 -0600 @@ -33,8 +33,9 @@ AC_CONFIG_SRCDIR([pngget.c]) AM_CONFIG_HEADER(config.h) # Checks for programs. +AC_LANG([C]) AC_PROG_CC AC_PROG_LD AC_PROG_CPP AC_CHECK_TOOL(SED, sed, :) @@ -43,8 +44,30 @@ AC_PROG_LN_S AC_PROG_MAKE_SET LT_INIT([win32-dll]) +# On Solaris 10 and 12 CPP gets set to cc -E, however this still +# does some input parsing. We need strict ANSI-C style tokenization, +# check this: +AC_REQUIRE_CPP +AC_MSG_CHECKING([for a C preprocessor that does not parse its input]) +AC_TRY_CPP([1.5.0 16BIT], + [DFNCPP="$CPP"], + [DFNCPP="" + sav_CPP="$CPP" + for CPP in "${CC-cc} -E" "${CC-cc} -E -traditional-cpp" "/lib/cpp" "cpp"; do + AC_TRY_CPP([1.5.0 16BIT], + [DFNCPP="$CPP"] + [break],,) + done + CPP="$sav_CPP"]) +if test -n "$DFNCPP"; then + AC_MSG_RESULT([$DFNCPP]) + AC_SUBST(DFNCPP) +else + AC_MSG_FAILURE([not found], 1) +fi + # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h]) @@ -75,9 +98,9 @@ # Special case for PE/COFF platforms: ld reports # support for version-script, but doesn't actually # DO anything with it. case $host in -*cygwin* | *mingw32* ) +*cygwin* | *mingw32* | *interix* ) have_ld_version_script=no AC_MSG_RESULT(no) ;; * ) diff -ru4NwbB libpng-1.5.0/png.c libpng-1.5.1beta08/png.c --- libpng-1.5.0/png.c 2011-01-22 16:39:23.155029096 -0600 +++ libpng-1.5.1beta08/png.c 2011-01-22 20:17:27.705166049 -0600 @@ -1,8 +1,8 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -546,9 +546,9 @@ #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ png_const_charp PNGAPI -png_get_copyright(png_structp png_ptr) +png_get_copyright(png_const_structp png_ptr) { PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ #ifdef PNG_STRING_COPYRIGHT return PNG_STRING_COPYRIGHT @@ -577,24 +577,24 @@ * png_get_header_ver(). Due to the version_nn_nn_nn typedef guard, * it is guaranteed that png.c uses the correct version of png.h. */ png_const_charp PNGAPI -png_get_libpng_ver(png_structp png_ptr) +png_get_libpng_ver(png_const_structp png_ptr) { /* Version of *.c files used when building libpng */ return png_get_header_ver(png_ptr); } png_const_charp PNGAPI -png_get_header_ver(png_structp png_ptr) +png_get_header_ver(png_const_structp png_ptr) { /* Version of *.h files used when building libpng */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ return PNG_LIBPNG_VER_STRING; } png_const_charp PNGAPI -png_get_header_version(png_structp png_ptr) +png_get_header_version(png_const_structp png_ptr) { /* Returns longer string containing both version and date */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */ #ifdef __STDC__ @@ -1030,12 +1030,12 @@ int png_check_fp_string(png_const_charp string, png_size_t size) { int state=0; - png_size_t index=0; + png_size_t char_index=0; - return png_check_fp_number(string, size, &state, &index) && - (index == size || string[index] == 0); + return png_check_fp_number(string, size, &state, &char_index) && + (char_index == size || string[char_index] == 0); } #endif /* pCAL or sCAL */ #ifdef PNG_READ_sCAL_SUPPORTED @@ -1107,48 +1107,48 @@ } if (fp >= DBL_MIN && fp <= DBL_MAX) { - int exp; /* A base 10 exponent */ - double base; /* 10^exp */ + int exp_b10; /* A base 10 exponent */ + double base; /* 10^exp_b10 */ /* First extract a base 10 exponent of the number, * the calculation below rounds down when converting * from base 2 to base 10 (multiply by log10(2) - - * 0.3010, but 77/256 is 0.3008, so exp needs to + * 0.3010, but 77/256 is 0.3008, so exp_b10 needs to * be increased. Note that the arithmetic shift * performs a floor() unlike C arithmetic - using a * C multiply would break the following for negative * exponents. */ - (void)frexp(fp, &exp); /* exponent to base 2 */ + (void)frexp(fp, &exp_b10); /* exponent to base 2 */ - exp = (exp * 77) >> 8; /* <= exponent to base 10 */ + exp_b10 = (exp_b10 * 77) >> 8; /* <= exponent to base 10 */ /* Avoid underflow here. */ - base = png_pow10(exp); /* May underflow */ + base = png_pow10(exp_b10); /* May underflow */ while (base < DBL_MIN || base < fp) { /* And this may overflow. */ - double test = png_pow10(exp+1); + double test = png_pow10(exp_b10+1); if (test <= DBL_MAX) - ++exp, base = test; + ++exp_b10, base = test; else break; } - /* Normalize fp and correct exp, after this fp is in the - * range [.1,1) and exp is both the exponent and the digit + /* Normalize fp and correct exp_b10, after this fp is in the + * range [.1,1) and exp_b10 is both the exponent and the digit * *before* which the decimal point should be inserted * (starting with 0 for the first digit). Note that this - * works even if 10^exp is out of range because of the + * works even if 10^exp_b10 is out of range because of the * test on DBL_MAX above. */ fp /= base; - while (fp >= 1) fp /= 10, ++exp; + while (fp >= 1) fp /= 10, ++exp_b10; /* Because of the code above fp may, at this point, be * less than .1, this is ok because the code below can * handle the leading zeros this generates, so no attempt @@ -1161,12 +1161,12 @@ /* Allow up to two leading zeros - this will not lengthen * the number compared to using E-n. */ - if (exp < 0 && exp > -3) /* PLUS 3 TOTAL 4 */ + if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */ { - czero = -exp; /* PLUS 2 digits: TOTAL 3 */ - exp = 0; /* Dot added below before first output. */ + czero = -exp_b10; /* PLUS 2 digits: TOTAL 3 */ + exp_b10 = 0; /* Dot added below before first output. */ } else czero = 0; /* No zeros to add */ @@ -1206,19 +1206,19 @@ while (cdigits > 0 && d > 9) { int ch = *--ascii; - if (exp != (-1)) - ++exp; + if (exp_b10 != (-1)) + ++exp_b10; else if (ch == 46) { ch = *--ascii, ++size; - /* Advance exp to '1', so that the + /* Advance exp_b10 to '1', so that the * decimal point happens after the * previous digit. */ - exp = 1; + exp_b10 = 1; } --cdigits; d = ch - 47; /* I.e. 1+(ch-48) */ @@ -1229,25 +1229,25 @@ * decimal point. */ if (d > 9) /* cdigits == 0 */ { - if (exp == (-1)) + if (exp_b10 == (-1)) { /* Leading decimal point (plus zeros?), if * we lose the decimal point here it must * be reentered below. */ int ch = *--ascii; if (ch == 46) - ++size, exp = 1; + ++size, exp_b10 = 1; - /* Else lost a leading zero, so 'exp' is + /* Else lost a leading zero, so 'exp_b10' is * still ok at (-1) */ } else - ++exp; + ++exp_b10; /* In all cases we output a '1' */ d = 1; } @@ -1268,25 +1268,26 @@ clead = 0; while (czero > 0) { - /* exp == (-1) means we just output the decimal - * place - after the DP don't adjust 'exp' any + /* exp_b10 == (-1) means we just output the decimal + * place - after the DP don't adjust 'exp_b10' any * more! */ - if (exp != (-1)) + if (exp_b10 != (-1)) { - if (exp == 0) *ascii++ = 46, --size; + if (exp_b10 == 0) *ascii++ = 46, --size; /* PLUS 1: TOTAL 4 */ - --exp; + --exp_b10; } *ascii++ = 48, --czero; } - if (exp != (-1)) + if (exp_b10 != (-1)) { - if (exp == 0) *ascii++ = 46, --size; /* counted above */ - --exp; + if (exp_b10 == 0) *ascii++ = 46, --size; /* counted + above */ + --exp_b10; } *ascii++ = (char)(48 + (int)d), ++cdigits; } } @@ -1295,23 +1296,23 @@ /* The total output count (max) is now 4+precision */ /* Check for an exponent, if we don't need one we are * done and just need to terminate the string. At - * this point exp==(-1) is effectively if flag - it got + * this point exp_b10==(-1) is effectively if flag - it got * to '-1' because of the decrement after outputing * the decimal point above (the exponent required is * *not* -1!) */ - if (exp >= (-1) && exp <= 2) + if (exp_b10 >= (-1) && exp_b10 <= 2) { /* The following only happens if we didn't output the * leading zeros above for negative exponent, so this * doest add to the digit requirement. Note that the * two zeros here can only be output if the two leading * zeros were *not* output, so this doesn't increase * the output count. */ - while (--exp >= 0) *ascii++ = 48; + while (--exp_b10 >= 0) *ascii++ = 48; *ascii = 0; /* Total buffer requirement (including the '\0') is @@ -1328,20 +1329,20 @@ */ size -= cdigits; *ascii++ = 69, --size; /* 'E': PLUS 1 TOTAL 2+precision*/ - if (exp < 0) + if (exp_b10 < 0) { *ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */ - exp = -exp; + exp_b10 = -exp_b10; } cdigits = 0; - while (exp > 0) + while (exp_b10 > 0) { - exponent[cdigits++] = (char)(48 + exp % 10); - exp /= 10; + exponent[cdigits++] = (char)(48 + exp_b10 % 10); + exp_b10 /= 10; } /* Need another size check here for the exponent digits, so * this need not be considered above. @@ -1458,13 +1459,12 @@ png_fixed(png_structp png_ptr, double fp, png_const_charp text) { double r = floor(100000 * fp + .5); - if (r <= 2147483647. && r >= -2147483648.) - return (png_fixed_point)r; - + if (r > 2147483647. || r < -2147483648.) png_fixed_error(png_ptr, text); - /*NOT REACHED*/ + + return (png_fixed_point)r; } #endif #if defined(PNG_READ_GAMMA_SUPPORTED) || \ @@ -1476,12 +1476,12 @@ * the result, a boolean - true on success, false on overflow. */ int png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, - png_int_32 div) + png_int_32 divisor) { - /* Return a * times / div, rounded. */ - if (div != 0) + /* Return a * times / divisor, rounded. */ + if (divisor != 0) { if (a == 0 || times == 0) { *res = 0; @@ -1491,9 +1491,9 @@ { #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED double r = a; r *= times; - r /= div; + r /= divisor; r = floor(r+.5); /* A png_fixed_point is a 32 bit integer. */ if (r <= 2147483647. && r >= -2147483648.) @@ -1515,12 +1515,12 @@ negative = !negative, T = -times; else T = times; - if (div < 0) - negative = !negative, D = -div; + if (divisor < 0) + negative = !negative, D = -divisor; else - D = div; + D = divisor; /* Following can't overflow because the arguments only * have 31 bits each, however the result may be 32 bits. */ @@ -1595,13 +1595,13 @@ * result. */ png_fixed_point png_muldiv_warn(png_structp png_ptr, png_fixed_point a, png_int_32 times, - png_int_32 div) + png_int_32 divisor) { png_fixed_point result; - if (png_muldiv(&result, a, times, div)) + if (png_muldiv(&result, a, times, divisor)) return result; png_warning(png_ptr, "fixed point overflow ignored"); return 0; @@ -1790,9 +1790,9 @@ static png_int_32 png_log8bit(unsigned int x) { - unsigned int log = 0; + unsigned int lg2 = 0; /* Each time 'x' is multiplied by 2, 1 must be subtracted off the final log, * because the log is actually negate that means adding 1. The final * returned value thus has the range 0 (for 255 input) to 7.994 (for 1 * input), return 7.99998 for the overflow (log 0) case - so the result is @@ -1801,18 +1801,18 @@ if ((x &= 0xff) == 0) return 0xffffffff; if ((x & 0xf0) == 0) - log = 4, x <<= 4; + lg2 = 4, x <<= 4; if ((x & 0xc0) == 0) - log += 2, x <<= 2; + lg2 += 2, x <<= 2; if ((x & 0x80) == 0) - log += 1, x <<= 1; + lg2 += 1, x <<= 1; /* result is at most 19 bits, so this cast is safe: */ - return (png_int_32)((log << 16) + ((png_8bit_l2[x-128]+32768)>>16)); + return (png_int_32)((lg2 << 16) + ((png_8bit_l2[x-128]+32768)>>16)); } /* The above gives exact (to 16 binary places) log2 values for 8 bit images, * for 16 bit images we use the most significant 8 bits of the 16 bit value to @@ -1846,31 +1846,31 @@ */ static png_int_32 png_log16bit(png_uint_32 x) { - unsigned int log = 0; + unsigned int lg2 = 0; /* As above, but now the input has 16 bits. */ if ((x &= 0xffff) == 0) return 0xffffffff; if ((x & 0xff00) == 0) - log = 8, x <<= 8; + lg2 = 8, x <<= 8; if ((x & 0xf000) == 0) - log += 4, x <<= 4; + lg2 += 4, x <<= 4; if ((x & 0xc000) == 0) - log += 2, x <<= 2; + lg2 += 2, x <<= 2; if ((x & 0x8000) == 0) - log += 1, x <<= 1; + lg2 += 1, x <<= 1; /* Calculate the base logarithm from the top 8 bits as a 28 bit fractional * value. */ - log <<= 28; - log += (png_8bit_l2[(x>>8)-128]+8) >> 4; + lg2 <<= 28; + lg2 += (png_8bit_l2[(x>>8)-128]+8) >> 4; /* Now we need to interpolate the factor, this requires a division by the top * 8 bits. Do this with maximum precision. */ @@ -1879,21 +1879,21 @@ /* Since we divided by the top 8 bits of 'x' there will be a '1' at 1<<24, * the value at 1<<16 (ignoring this) will be 0 or 1; this gives us exactly * 16 bits to interpolate to get the low bits of the result. Round the * answer. Note that the end point values are scaled by 64 to retain overall - * precision and that 'log' is current scaled by an extra 12 bits, so adjust + * precision and that 'lg2' is current scaled by an extra 12 bits, so adjust * the overall scaling by 6-12. Round at every step. */ x -= 1U << 24; if (x <= 65536U) /* <= '257' */ - log += ((23591U * (65536U-x)) + (1U << (16+6-12-1))) >> (16+6-12); + lg2 += ((23591U * (65536U-x)) + (1U << (16+6-12-1))) >> (16+6-12); else - log -= ((23499U * (x-65536U)) + (1U << (16+6-12-1))) >> (16+6-12); + lg2 -= ((23499U * (x-65536U)) + (1U << (16+6-12-1))) >> (16+6-12); /* Safe, because the result can't have more than 20 bits: */ - return (png_int_32)((log + 2048) >> 12); + return (png_int_32)((lg2 + 2048) >> 12); } /* The 'exp()' case must invert the above, taking a 20 bit fixed point * logarithmic value and returning a 16 or 8 bit number as appropriate. In @@ -1986,12 +1986,12 @@ return 0; } static png_byte -png_exp8bit(png_fixed_point log) +png_exp8bit(png_fixed_point lg2) { /* Get a 32 bit value: */ - png_uint_32 x = png_exp(log); + png_uint_32 x = png_exp(lg2); /* Convert the 32 bit value to 0..255 by multiplying by 256-1, note that the * second, rounding, step can't overflow because of the first, subtraction, * step. @@ -2000,32 +2000,32 @@ return (png_byte)((x + 0x7fffffU) >> 24); } static png_uint_16 -png_exp16bit(png_fixed_point log) +png_exp16bit(png_fixed_point lg2) { /* Get a 32 bit value: */ - png_uint_32 x = png_exp(log); + png_uint_32 x = png_exp(lg2); /* Convert the 32 bit value to 0..65535 by multiplying by 65536-1: */ x -= x >> 16; return (png_uint_16)((x + 32767U) >> 16); } #endif /* FLOATING_ARITHMETIC */ png_byte -png_gamma_8bit_correct(unsigned int value, png_fixed_point gamma) +png_gamma_8bit_correct(unsigned int value, png_fixed_point gamma_val) { if (value > 0 && value < 255) { # ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED - double r = floor(255*pow(value/255.,gamma*.00001)+.5); + double r = floor(255*pow(value/255.,gamma_val*.00001)+.5); return (png_byte)r; # else - png_int_32 log = png_log8bit(value); + png_int_32 lg2 = png_log8bit(value); png_fixed_point res; - if (png_muldiv(&res, gamma, log, PNG_FP_1)) + if (png_muldiv(&res, gamma_val, lg2, PNG_FP_1)) return png_exp8bit(res); /* Overflow. */ value = 0; @@ -2035,20 +2035,20 @@ return (png_byte)value; } png_uint_16 -png_gamma_16bit_correct(unsigned int value, png_fixed_point gamma) +png_gamma_16bit_correct(unsigned int value, png_fixed_point gamma_val) { if (value > 0 && value < 65535) { # ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED - double r = floor(65535*pow(value/65535.,gamma*.00001)+.5); + double r = floor(65535*pow(value/65535.,gamma_val*.00001)+.5); return (png_uint_16)r; # else - png_int_32 log = png_log16bit(value); + png_int_32 lg2 = png_log16bit(value); png_fixed_point res; - if (png_muldiv(&res, gamma, log, PNG_FP_1)) + if (png_muldiv(&res, gamma_val, lg2, PNG_FP_1)) return png_exp16bit(res); /* Overflow. */ value = 0; @@ -2064,25 +2064,25 @@ * 8 bit (as are the arguments.) */ png_uint_16 /* PRIVATE */ png_gamma_correct(png_structp png_ptr, unsigned int value, - png_fixed_point gamma) + png_fixed_point gamma_val) { if (png_ptr->bit_depth == 8) - return png_gamma_8bit_correct(value, gamma); + return png_gamma_8bit_correct(value, gamma_val); else - return png_gamma_16bit_correct(value, gamma); + return png_gamma_16bit_correct(value, gamma_val); } /* This is the shared test on whether a gamma value is 'significant' - whether * it is worth doing gamma correction. */ int /* PRIVATE */ -png_gamma_significant(png_fixed_point gamma) +png_gamma_significant(png_fixed_point gamma_val) { - return gamma < PNG_FP_1 - PNG_GAMMA_THRESHOLD_FIXED || - gamma > PNG_FP_1 + PNG_GAMMA_THRESHOLD_FIXED; + return gamma_val < PNG_FP_1 - PNG_GAMMA_THRESHOLD_FIXED || + gamma_val > PNG_FP_1 + PNG_GAMMA_THRESHOLD_FIXED; } /* Internal function to build a single 16 bit table - the table consists of * 'num' 256 entry subtables, where 'num' is determined by 'shift' - the amount @@ -2093,9 +2093,9 @@ * should be somewhere that will be cleaned. */ static void png_build_16bit_table(png_structp png_ptr, png_uint_16pp *ptable, - PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma) + PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val) { /* Various values derived from 'shift': */ PNG_CONST unsigned int num = 1U << (8U - shift); PNG_CONST unsigned int max = (1U << (16U - shift))-1U; @@ -2112,9 +2112,9 @@ /* The 'threshold' test is repeated here because it can arise for one of * the 16 bit tables even if the others don't hit it. */ - if (png_gamma_significant(gamma)) + if (png_gamma_significant(gamma_val)) { /* The old code would overflow at the end and this would cause the * 'pow' function to return a result >1, resulting in an * arithmetic error. This code follows the spec exactly; ig is @@ -2128,15 +2128,15 @@ { png_uint_32 ig = (j << (8-shift)) + i; # ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED /* Inline the 'max' scaling operation: */ - double d = floor(65535*pow(ig/(double)max, gamma*.00001)+.5); + double d = floor(65535*pow(ig/(double)max, gamma_val*.00001)+.5); sub_table[j] = (png_uint_16)d; # else if (shift) ig = (ig * 65535U + max_by_2)/max; - sub_table[j] = png_gamma_16bit_correct(ig, gamma); + sub_table[j] = png_gamma_16bit_correct(ig, gamma_val); # endif } } else @@ -2161,9 +2161,9 @@ * required. */ static void png_build_16to8_table(png_structp png_ptr, png_uint_16pp *ptable, - PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma) + PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val) { PNG_CONST unsigned int num = 1U << (8U - shift); PNG_CONST unsigned int max = (1U << (16U - shift))-1U; unsigned int i; @@ -2179,9 +2179,9 @@ for (i = 0; i < num; i++) table[i] = (png_uint_16p)png_malloc(png_ptr, 256 * png_sizeof(png_uint_16)); - /* 'gamma' is set to the reciprocal of the value calculated above, so + /* 'gamma_val' is set to the reciprocal of the value calculated above, so * pow(out,g) is an *input* value. 'last' is the last input value set. * * In the loop 'i' is used to find output values. Since the output is 8 * bit there are only 256 possible values. The tables are set up to @@ -2202,9 +2202,9 @@ /* Find the corresponding maximum input value */ png_uint_16 out = (png_uint_16)(i * 257U); /* 16 bit output value */ /* Find the boundary value in 16 bits: */ - png_uint_32 bound = png_gamma_16bit_correct(out+128U, gamma); + png_uint_32 bound = png_gamma_16bit_correct(out+128U, gamma_val); /* Adjust (round) to (16-shift) bits: */ bound = (bound * max + 32768U)/65535U + 1U; @@ -2228,15 +2228,15 @@ * (apparently contrary to the spec) so a 256 entry table is always generated. */ static void png_build_8bit_table(png_structp png_ptr, png_bytepp ptable, - PNG_CONST png_fixed_point gamma) + PNG_CONST png_fixed_point gamma_val) { unsigned int i; png_bytep table = *ptable = (png_bytep)png_malloc(png_ptr, 256); - if (png_gamma_significant(gamma)) for (i=0; i<256; i++) - table[i] = png_gamma_8bit_correct(i, gamma); + if (png_gamma_significant(gamma_val)) for (i=0; i<256; i++) + table[i] = png_gamma_8bit_correct(i, gamma_val); else for (i=0; i<256; ++i) table[i] = (png_byte)i; } diff -ru4NwbB libpng-1.5.0/png.h libpng-1.5.1beta08/png.h --- libpng-1.5.0/png.h 2011-01-22 16:39:23.104799847 -0600 +++ libpng-1.5.1beta08/png.h 2011-01-22 20:17:27.655761309 -0600 @@ -143,8 +143,9 @@ * 1.4.4 14 10404 14.so.14.4[.0] * 1.5.0beta01-58 15 10500 15.so.15.0[.0] * 1.5.0rc01-07 15 10500 15.so.15.0[.0] * 1.5.0 15 10500 15.so.15.0[.0] + * 1.5.1beta01-06 15 10501 15.so.15.1[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be * used for changes in backward compatibility, as it is intended. The @@ -661,8 +662,9 @@ #endif typedef struct png_info_def png_info; typedef png_info FAR * png_infop; +typedef PNG_CONST png_info FAR * png_const_infop; typedef png_info FAR * FAR * png_infopp; /* Maximum positive integer used in PNG is (2^31)-1 */ #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL) @@ -788,8 +790,9 @@ * modify the buffer it is passed. The 'read' function, on the other hand, is * expected to return the read data in the buffer. */ typedef struct png_struct_def png_struct; +typedef PNG_CONST png_struct FAR * png_const_structp; typedef png_struct FAR * png_structp; typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp), ); typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t), ); @@ -943,9 +946,9 @@ png_error_ptr warn_fn), PNG_ALLOCATED); PNG_EXPORT(6, png_size_t, png_get_compression_buffer_size, - (png_structp png_ptr)); + (png_const_structp png_ptr)); PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structp png_ptr, png_size_t size)); @@ -1070,9 +1073,10 @@ int error_action, double red, double green)); PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structp png_ptr, int error_action, png_fixed_point red, png_fixed_point green)); -PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_structp png_ptr)); +PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structp + png_ptr)); #endif PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, png_colorp palette)); @@ -1407,9 +1411,9 @@ (png_structp png_ptr, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); /* Return the user pointer associated with the error functions */ -PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_structp png_ptr)); +PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structp png_ptr)); /* Replace the default data output functions with a user supplied one(s). * If buffered output is not used, then output_flush_fn can be set to NULL. * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time @@ -1440,9 +1444,9 @@ /* Replace the default memory allocation functions with user supplied one(s). */ PNG_EXPORT(82, void, png_set_mem_fn, (png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); /* Return the user pointer associated with the memory functions */ -PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_structp png_ptr)); +PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structp png_ptr)); #endif #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED PNG_EXPORT(84, void, png_set_read_user_transform_fn, (png_structp png_ptr, @@ -1453,21 +1457,33 @@ PNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structp png_ptr, png_user_transform_ptr write_user_transform_fn)); #endif -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED PNG_EXPORT(86, void, png_set_user_transform_info, (png_structp png_ptr, png_voidp user_transform_ptr, int user_transform_depth, int user_transform_channels)); /* Return the user pointer associated with the user transform functions */ -PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr, (png_structp png_ptr)); +PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr, + (png_const_structp png_ptr)); +#endif + +#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED +/* Return information about the row currently being processed. Note that these + * APIs do not fail but will return unexpected results if called outside a user + * transform callback. Also note that when transforming an interlaced image the + * row number is still the row in the final, de-interlaced, image but the row + * only contains the data of the current pass - consult png_row_info for the + * actual width of the row! + */ +PNG_EXPORT(217, png_uint_32, png_get_current_row_number, (png_const_structp)); +PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structp)); #endif #ifdef PNG_USER_CHUNKS_SUPPORTED PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structp png_ptr, png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); -PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_structp png_ptr)); +PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structp png_ptr)); #endif #ifdef PNG_PROGRESSIVE_READ_SUPPORTED /* Sets the function callbacks for the push reader, and a pointer to a @@ -1477,15 +1493,32 @@ png_voidp progressive_ptr, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)); /* Returns the user pointer associated with the push read functions */ -PNG_EXPORT(91, png_voidp, png_get_progressive_ptr, (png_structp png_ptr)); +PNG_EXPORT(91, png_voidp, png_get_progressive_ptr, (png_const_structp png_ptr)); /* Function to be called when data becomes available */ PNG_EXPORT(92, void, png_process_data, (png_structp png_ptr, png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); +/* A function which may be called *only* within png_process_data to stop the + * processing of any more data. The function returns the number of bytes + * remaining, excluding any that libpng has cached internally. A subsequent + * call to png_process_data must supply these bytes again. If the argument + * 'save' is set to true the routine will first save all the pending data and + * will always return 0. + */ +PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structp, int save)); + +/* A function which may be called *only* outside (after) a call to + * png_process_data. It returns the number of bytes of data to skip in the + * input. Normally it will return 0, but if it returns a non-zero value the + * application must skip than number of bytes of input data and pass the + * following data to the next call to png_process_data. + */ +PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structp)); + /* Function that combines rows. 'new_row' is a flag that should come from * the callback and be non-NULL if anything needs to be done; the library * stores its own version of the new data internally and ignores the passed * in value. @@ -1603,94 +1636,94 @@ * png_info_struct. */ /* Returns "flag" if chunk data is valid in info_ptr. */ PNG_EXPORT(110, png_uint_32, png_get_valid, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 flag)); /* Returns number of bytes needed to hold a transformed row. */ -PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structp png_ptr, + png_const_infop info_ptr)); #ifdef PNG_INFO_IMAGE_SUPPORTED /* Returns row_pointers, which is an array of pointers to scanlines that was * returned from png_read_png(). */ PNG_EXPORT(112, png_bytepp, png_get_rows, - (png_structp png_ptr, png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); /* Set row_pointers, which is an array of pointers to scanlines for use * by png_write_png(). */ -PNG_EXPORT(113, void, png_set_rows, (png_structp png_ptr, png_infop info_ptr, - png_bytepp row_pointers)); +PNG_EXPORT(113, void, png_set_rows, (png_structp png_ptr, + png_infop info_ptr, png_bytepp row_pointers)); #endif /* Returns number of color channels in image. */ PNG_EXPORT(114, png_byte, png_get_channels, - (png_structp png_ptr, png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); #ifdef PNG_EASY_ACCESS_SUPPORTED /* Returns image width in pixels. */ -PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image height in pixels. */ -PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image bit_depth. */ PNG_EXPORT(117, png_byte, png_get_bit_depth, - (png_structp png_ptr, png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image color_type. */ -PNG_EXPORT(118, png_byte, png_get_color_type, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image filter_type. */ -PNG_EXPORT(119, png_byte, png_get_filter_type, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image interlace_type. */ -PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image compression_type. */ -PNG_EXPORT(121, png_byte, png_get_compression_type, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structp png_ptr, + png_const_infop info_ptr)); /* Returns image resolution in pixels per meter, from pHYs chunk data. */ -PNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter, (png_structp png_ptr, - png_infop info_ptr)); -PNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter, (png_structp png_ptr, - png_infop info_ptr)); -PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter, + (png_const_structp png_ptr, png_const_infop info_ptr)); +PNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter, + (png_const_structp png_ptr, png_const_infop info_ptr)); +PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter, + (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns pixel aspect ratio, computed from pHYs chunk data. */ -PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio, (png_structp png_ptr, - png_infop info_ptr)); +PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio, + (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, - (png_structp png_ptr, png_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)); /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ -PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, (png_structp png_ptr, - png_infop info_ptr)); -PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels, (png_structp png_ptr, - png_infop info_ptr)); -PNG_EXPORT(128, png_int_32, png_get_x_offset_microns, (png_structp png_ptr, - png_infop info_ptr)); -PNG_EXPORT(129, png_int_32, png_get_y_offset_microns, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, + (png_const_structp png_ptr, png_const_infop info_ptr)); +PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels, + (png_const_structp png_ptr, png_const_infop info_ptr)); +PNG_EXPORT(128, png_int_32, png_get_x_offset_microns, + (png_const_structp png_ptr, png_const_infop info_ptr)); +PNG_EXPORT(129, png_int_32, png_get_y_offset_microns, + (png_const_structp png_ptr, png_const_infop info_ptr)); #endif /* PNG_EASY_ACCESS_SUPPORTED */ /* Returns pointer to signature string read from PNG header */ -PNG_EXPORT(130, png_const_bytep, png_get_signature, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(130, png_const_bytep, png_get_signature, + (png_const_structp png_ptr, png_infop info_ptr)); #ifdef PNG_bKGD_SUPPORTED PNG_EXPORT(131, png_uint_32, png_get_bKGD, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_infop info_ptr, png_color_16p *background)); #endif #ifdef PNG_bKGD_SUPPORTED @@ -1698,15 +1731,16 @@ png_const_color_16p background)); #endif #ifdef PNG_cHRM_SUPPORTED -PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_structp png_ptr, - png_infop info_ptr, double *white_x, double *white_y, double *red_x, +PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structp png_ptr, + png_const_infop info_ptr, double *white_x, double *white_y, double *red_x, double *red_y, double *green_x, double *green_y, double *blue_x, double *blue_y)); #ifdef PNG_FIXED_POINT_SUPPORTED /* Otherwise not implemented */ -PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, (png_structp png_ptr, - png_infop info_ptr, png_fixed_point *int_white_x, +PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, + (png_const_structp png_ptr, + png_const_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point *int_blue_x, png_fixed_point *int_blue_y)); @@ -1727,30 +1761,31 @@ #endif #ifdef PNG_gAMA_SUPPORTED PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, double *file_gamma)); -PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed, (png_structp png_ptr, - png_infop info_ptr, png_fixed_point *int_file_gamma)); +PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed, + (png_const_structp png_ptr, png_const_infop info_ptr, + png_fixed_point *int_file_gamma)); #endif #ifdef PNG_gAMA_SUPPORTED -PNG_FP_EXPORT(139, void, png_set_gAMA, (png_structp png_ptr, png_infop info_ptr, - double file_gamma)); +PNG_FP_EXPORT(139, void, png_set_gAMA, (png_structp png_ptr, + png_infop info_ptr, double file_gamma)); PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_structp png_ptr, png_infop info_ptr, png_fixed_point int_file_gamma)); #endif #ifdef PNG_hIST_SUPPORTED PNG_EXPORT(141, png_uint_32, png_get_hIST, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_uint_16p *hist)); #endif #ifdef PNG_hIST_SUPPORTED -PNG_EXPORT(142, void, png_set_hIST, (png_structp png_ptr, png_infop info_ptr, - png_const_uint_16p hist)); +PNG_EXPORT(142, void, png_set_hIST, (png_structp png_ptr, + png_infop info_ptr, png_const_uint_16p hist)); #endif PNG_EXPORT(143, png_uint_32, png_get_IHDR, (png_structp png_ptr, png_infop info_ptr, @@ -1763,9 +1798,9 @@ int interlace_method, int compression_method, int filter_method)); #ifdef PNG_oFFs_SUPPORTED PNG_EXPORT(145, png_uint_32, png_get_oFFs, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)); #endif #ifdef PNG_oFFs_SUPPORTED @@ -1775,23 +1810,24 @@ #endif #ifdef PNG_pCAL_SUPPORTED PNG_EXPORT(147, png_uint_32, png_get_pCAL, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *units, png_charpp *params)); #endif #ifdef PNG_pCAL_SUPPORTED -PNG_EXPORT(148, void, png_set_pCAL, (png_structp png_ptr, png_infop info_ptr, +PNG_EXPORT(148, void, png_set_pCAL, (png_structp png_ptr, + png_infop info_ptr, png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, png_const_charp units, png_charpp params)); #endif #ifdef PNG_pHYs_SUPPORTED PNG_EXPORT(149, png_uint_32, png_get_pHYs, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); #endif #ifdef PNG_pHYs_SUPPORTED @@ -1800,18 +1836,18 @@ png_uint_32 res_x, png_uint_32 res_y, int unit_type)); #endif PNG_EXPORT(151, png_uint_32, png_get_PLTE, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_colorp *palette, int *num_palette)); PNG_EXPORT(152, void, png_set_PLTE, (png_structp png_ptr, png_infop info_ptr, png_const_colorp palette, int num_palette)); #ifdef PNG_sBIT_SUPPORTED PNG_EXPORT(153, png_uint_32, png_get_sBIT, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)); #endif #ifdef PNG_sBIT_SUPPORTED @@ -1819,10 +1855,10 @@ (png_structp png_ptr, png_infop info_ptr, png_const_color_8p sig_bit)); #endif #ifdef PNG_sRGB_SUPPORTED -PNG_EXPORT(155, png_uint_32, png_get_sRGB, - (png_structp png_ptr, png_infop info_ptr, int *intent)); +PNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structp png_ptr, + png_const_infop info_ptr, int *intent)); #endif #ifdef PNG_sRGB_SUPPORTED PNG_EXPORT(156, void, png_set_sRGB, @@ -1832,9 +1868,9 @@ #endif #ifdef PNG_iCCP_SUPPORTED PNG_EXPORT(158, png_uint_32, png_get_iCCP, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_charpp name, int *compression_type, png_bytepp profile, png_uint_32 *proflen)); #endif @@ -1846,9 +1882,9 @@ #endif #ifdef PNG_sPLT_SUPPORTED PNG_EXPORT(160, png_uint_32, png_get_sPLT, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_sPLT_tpp entries)); #endif #ifdef PNG_sPLT_SUPPORTED @@ -1859,9 +1895,9 @@ #ifdef PNG_TEXT_SUPPORTED /* png_get_text also returns the number of text chunks in *num_text */ PNG_EXPORT(162, png_uint_32, png_get_text, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, png_textp *text_ptr, int *num_text)); #endif /* Note while png_set_text() will accept a structure whose text, @@ -1878,9 +1914,9 @@ #endif #ifdef PNG_tIME_SUPPORTED PNG_EXPORT(164, png_uint_32, png_get_tIME, - (png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)); + (png_const_structp png_ptr, png_infop info_ptr, png_timep *mod_time)); #endif #ifdef PNG_tIME_SUPPORTED PNG_EXPORT(165, void, png_set_tIME, @@ -1888,9 +1924,9 @@ #endif #ifdef PNG_tRNS_SUPPORTED PNG_EXPORT(166, png_uint_32, png_get_tRNS, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_infop info_ptr, png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)); #endif #ifdef PNG_tRNS_SUPPORTED @@ -1901,23 +1937,24 @@ #endif #ifdef PNG_sCAL_SUPPORTED PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, - (png_structp png_ptr, png_infop info_ptr, + (png_const_structp png_ptr, png_const_infop info_ptr, int *unit, double *width, double *height)); #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED /* NOTE: this API is currently implemented using floating point arithmetic, * consequently it can only be used on systems with floating point support. * In any case the range of values supported by png_fixed_point is small and it * is highly recommended that png_get_sCAL_s be used instead. */ -PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed, (png_structp png_ptr, - png_infop info_ptr, int *unit, png_fixed_point *width, +PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed, + (png_structp png_ptr, png_const_infop info_ptr, int *unit, + png_fixed_point *width, png_fixed_point *height)); #endif PNG_EXPORT(169, png_uint_32, png_get_sCAL_s, - (png_structp png_ptr, - png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); + (png_const_structp png_ptr, png_const_infop info_ptr, + int *unit, png_charpp swidth, png_charpp sheight)); PNG_FP_EXPORT(170, void, png_set_sCAL, (png_structp png_ptr, png_infop info_ptr, int unit, double width, double height)); @@ -1946,13 +1983,14 @@ png_const_bytep chunk_name)); #endif #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED PNG_EXPORT(174, void, png_set_unknown_chunks, (png_structp png_ptr, - png_infop info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)); -PNG_EXPORT(175, void, png_set_unknown_chunk_location, (png_structp png_ptr, - png_infop info_ptr, int chunk, int location)); -PNG_EXPORT(176, int, png_get_unknown_chunks, (png_structp png_ptr, - png_infop info_ptr, png_unknown_chunkpp entries)); + png_infop info_ptr, png_const_unknown_chunkp unknowns, + int num_unknowns)); +PNG_EXPORT(175, void, png_set_unknown_chunk_location, + (png_structp png_ptr, png_infop info_ptr, int chunk, int location)); +PNG_EXPORT(176, int, png_get_unknown_chunks, (png_const_structp png_ptr, + png_const_infop info_ptr, png_unknown_chunkpp entries)); #endif /* Png_free_data() will turn off the "valid" flag for anything it frees. * If you need to turn it off for a chunk that your application has freed, @@ -1968,12 +2006,16 @@ PNG_EXPORT(179, void, png_write_png, (png_structp png_ptr, png_infop info_ptr, int transforms, png_voidp params)); #endif -PNG_EXPORT(180, png_const_charp, png_get_copyright, (png_structp png_ptr)); -PNG_EXPORT(181, png_const_charp, png_get_header_ver, (png_structp png_ptr)); -PNG_EXPORT(182, png_const_charp, png_get_header_version, (png_structp png_ptr)); -PNG_EXPORT(183, png_const_charp, png_get_libpng_ver, (png_structp png_ptr)); +PNG_EXPORT(180, png_const_charp, png_get_copyright, + (png_const_structp png_ptr)); +PNG_EXPORT(181, png_const_charp, png_get_header_ver, + (png_const_structp png_ptr)); +PNG_EXPORT(182, png_const_charp, png_get_header_version, + (png_const_structp png_ptr)); +PNG_EXPORT(183, png_const_charp, png_get_libpng_ver, + (png_const_structp png_ptr)); #ifdef PNG_MNG_FEATURES_SUPPORTED PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structp png_ptr, png_uint_32 mng_features_permitted)); @@ -1997,57 +2039,63 @@ /* Added in libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED PNG_EXPORT(186, void, png_set_user_limits, (png_structp png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); -PNG_EXPORT(187, png_uint_32, png_get_user_width_max, (png_structp png_ptr)); -PNG_EXPORT(188, png_uint_32, png_get_user_height_max, (png_structp png_ptr)); +PNG_EXPORT(187, png_uint_32, png_get_user_width_max, + (png_const_structp png_ptr)); +PNG_EXPORT(188, png_uint_32, png_get_user_height_max, + (png_const_structp png_ptr)); /* Added in libpng-1.4.0 */ PNG_EXPORT(189, void, png_set_chunk_cache_max, (png_structp png_ptr, png_uint_32 user_chunk_cache_max)); -PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max, (png_structp png_ptr)); +PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max, + (png_const_structp png_ptr)); /* Added in libpng-1.4.1 */ PNG_EXPORT(191, void, png_set_chunk_malloc_max, (png_structp png_ptr, png_alloc_size_t user_chunk_cache_max)); PNG_EXPORT(192, png_alloc_size_t, png_get_chunk_malloc_max, - (png_structp png_ptr)); + (png_const_structp png_ptr)); #endif #if defined(PNG_INCH_CONVERSIONS_SUPPORTED) -PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch, + (png_const_structp png_ptr, png_const_infop info_ptr)); -PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch, + (png_const_structp png_ptr, png_const_infop info_ptr)); -PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch, (png_structp png_ptr, - png_infop info_ptr)); +PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch, + (png_const_structp png_ptr, png_const_infop info_ptr)); -PNG_FP_EXPORT(196, float, png_get_x_offset_inches, (png_structp png_ptr, - png_infop info_ptr)); +PNG_FP_EXPORT(196, float, png_get_x_offset_inches, + (png_const_structp png_ptr, png_const_infop info_ptr)); #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed, - (png_structp png_ptr, png_infop info_ptr)); + (png_structp png_ptr, png_const_infop info_ptr)); #endif -PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_structp png_ptr, - png_infop info_ptr)); +PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structp png_ptr, + png_const_infop info_ptr)); #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed, - (png_structp png_ptr, png_infop info_ptr)); + (png_structp png_ptr, png_const_infop info_ptr)); #endif # ifdef PNG_pHYs_SUPPORTED -PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_structp png_ptr, - png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, +PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structp png_ptr, + png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); # endif /* PNG_pHYs_SUPPORTED */ #endif /* PNG_INCH_CONVERSIONS_SUPPORTED */ /* Added in libpng-1.4.0 */ #ifdef PNG_IO_STATE_SUPPORTED PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_structp png_ptr)); -PNG_EXPORT(200, png_const_bytep, png_get_io_chunk_name, (png_structp png_ptr)); +PNG_EXPORTA(200, png_const_bytep, png_get_io_chunk_name, + (png_structp png_ptr), PNG_DEPRECATED); +PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type, + (png_const_structp png_ptr)); /* The flags returned by png_get_io_state() are the following: */ # define PNG_IO_NONE 0x0000 /* no I/O at this moment */ # define PNG_IO_READING 0x0001 /* currently reading */ @@ -2211,12 +2259,13 @@ * defs */ /* The last ordinal number (this is the *last* one already used; the next - * one to use is one more than this.) + * one to use is one more than this.) Maintainer, remember to add an entry to + * scripts/symbols.def as well. */ #ifdef PNG_EXPORT_LAST_ORDINAL - PNG_EXPORT_LAST_ORDINAL(215); + PNG_EXPORT_LAST_ORDINAL(220); #endif #ifdef __cplusplus } diff -ru4NwbB libpng-1.5.0/pngerror.c libpng-1.5.1beta08/pngerror.c --- libpng-1.5.0/pngerror.c 2011-01-22 16:39:23.161174716 -0600 +++ libpng-1.5.1beta08/pngerror.c 2011-01-22 20:17:27.711137316 -0600 @@ -1,8 +1,8 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -422,9 +422,9 @@ * functions. The application should free any memory associated with this * pointer before png_write_destroy and png_read_destroy are called. */ png_voidp PNGAPI -png_get_error_ptr(png_structp png_ptr) +png_get_error_ptr(png_const_structp png_ptr) { if (png_ptr == NULL) return NULL; diff -ru4NwbB libpng-1.5.0/pngget.c libpng-1.5.1beta08/pngget.c --- libpng-1.5.0/pngget.c 2011-01-22 16:39:23.168514822 -0600 +++ libpng-1.5.1beta08/pngget.c 2011-01-22 20:17:27.718555009 -0600 @@ -1,8 +1,8 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -16,18 +16,19 @@ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) png_uint_32 PNGAPI -png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag) +png_get_valid(png_const_structp png_ptr, png_const_infop info_ptr, + png_uint_32 flag) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->valid & flag); return(0); } png_size_t PNGAPI -png_get_rowbytes(png_structp png_ptr, png_infop info_ptr) +png_get_rowbytes(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->rowbytes); @@ -35,9 +36,9 @@ } #ifdef PNG_INFO_IMAGE_SUPPORTED png_bytepp PNGAPI -png_get_rows(png_structp png_ptr, png_infop info_ptr) +png_get_rows(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->row_pointers); @@ -47,72 +48,72 @@ #ifdef PNG_EASY_ACCESS_SUPPORTED /* Easy access to info, added in libpng-0.99 */ png_uint_32 PNGAPI -png_get_image_width(png_structp png_ptr, png_infop info_ptr) +png_get_image_width(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->width; return (0); } png_uint_32 PNGAPI -png_get_image_height(png_structp png_ptr, png_infop info_ptr) +png_get_image_height(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->height; return (0); } png_byte PNGAPI -png_get_bit_depth(png_structp png_ptr, png_infop info_ptr) +png_get_bit_depth(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->bit_depth; return (0); } png_byte PNGAPI -png_get_color_type(png_structp png_ptr, png_infop info_ptr) +png_get_color_type(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->color_type; return (0); } png_byte PNGAPI -png_get_filter_type(png_structp png_ptr, png_infop info_ptr) +png_get_filter_type(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->filter_type; return (0); } png_byte PNGAPI -png_get_interlace_type(png_structp png_ptr, png_infop info_ptr) +png_get_interlace_type(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->interlace_type; return (0); } png_byte PNGAPI -png_get_compression_type(png_structp png_ptr, png_infop info_ptr) +png_get_compression_type(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return info_ptr->compression_type; return (0); } png_uint_32 PNGAPI -png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) +png_get_x_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) { @@ -127,9 +128,9 @@ return (0); } png_uint_32 PNGAPI -png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) +png_get_y_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) { @@ -144,9 +145,9 @@ return (0); } png_uint_32 PNGAPI -png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) +png_get_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) { @@ -162,9 +163,9 @@ } #ifdef PNG_FLOATING_POINT_SUPPORTED float PNGAPI -png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr) +png_get_pixel_aspect_ratio(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_READ_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) { @@ -181,9 +182,10 @@ #endif #ifdef PNG_FIXED_POINT_SUPPORTED png_fixed_point PNGAPI -png_get_pixel_aspect_ratio_fixed(png_structp png_ptr, png_infop info_ptr) +png_get_pixel_aspect_ratio_fixed(png_const_structp png_ptr, + png_const_infop info_ptr) { #ifdef PNG_READ_pHYs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) && info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 @@ -207,9 +209,9 @@ } #endif png_int_32 PNGAPI -png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr) +png_get_x_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_oFFs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) { @@ -223,9 +225,9 @@ return (0); } png_int_32 PNGAPI -png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr) +png_get_y_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_oFFs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) { @@ -239,9 +241,9 @@ return (0); } png_int_32 PNGAPI -png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr) +png_get_x_offset_pixels(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_oFFs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) { @@ -255,9 +257,9 @@ return (0); } png_int_32 PNGAPI -png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr) +png_get_y_offset_pixels(png_const_structp png_ptr, png_const_infop info_ptr) { #ifdef PNG_oFFs_SUPPORTED if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) { @@ -304,21 +306,21 @@ #endif } png_uint_32 PNGAPI -png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) +png_get_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr) { return ppi_from_ppm(png_get_pixels_per_meter(png_ptr, info_ptr)); } png_uint_32 PNGAPI -png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) +png_get_x_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr) { return ppi_from_ppm(png_get_x_pixels_per_meter(png_ptr, info_ptr)); } png_uint_32 PNGAPI -png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) +png_get_y_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr) { return ppi_from_ppm(png_get_y_pixels_per_meter(png_ptr, info_ptr)); } @@ -334,27 +336,29 @@ return png_muldiv_warn(png_ptr, microns, 500, 127); } png_fixed_point PNGAPI -png_get_x_offset_inches_fixed(png_structp png_ptr, png_infop info_ptr) +png_get_x_offset_inches_fixed(png_structp png_ptr, + png_const_infop info_ptr) { return png_fixed_inches_from_microns(png_ptr, png_get_x_offset_microns(png_ptr, info_ptr)); } #endif #ifdef PNG_FIXED_POINT_SUPPORTED png_fixed_point PNGAPI -png_get_y_offset_inches_fixed(png_structp png_ptr, png_infop info_ptr) +png_get_y_offset_inches_fixed(png_structp png_ptr, + png_const_infop info_ptr) { return png_fixed_inches_from_microns(png_ptr, png_get_y_offset_microns(png_ptr, info_ptr)); } #endif #ifdef PNG_FLOATING_POINT_SUPPORTED float PNGAPI -png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr) +png_get_x_offset_inches(png_const_structp png_ptr, png_const_infop info_ptr) { /* To avoid the overflow do the conversion directly in floating * point. */ @@ -363,9 +367,9 @@ #endif #ifdef PNG_FLOATING_POINT_SUPPORTED float PNGAPI -png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr) +png_get_y_offset_inches(png_const_structp png_ptr, png_const_infop info_ptr) { /* To avoid the overflow do the conversion directly in floating * point. */ @@ -374,9 +378,9 @@ #endif #ifdef PNG_pHYs_SUPPORTED png_uint_32 PNGAPI -png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr, +png_get_pHYs_dpi(png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) { png_uint_32 retval = 0; @@ -418,18 +422,18 @@ #endif /* PNG_EASY_ACCESS_SUPPORTED */ png_byte PNGAPI -png_get_channels(png_structp png_ptr, png_infop info_ptr) +png_get_channels(png_const_structp png_ptr, png_const_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->channels); return (0); } png_const_bytep PNGAPI -png_get_signature(png_structp png_ptr, png_infop info_ptr) +png_get_signature(png_const_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->signature); @@ -437,9 +441,9 @@ } #ifdef PNG_bKGD_SUPPORTED png_uint_32 PNGAPI -png_get_bKGD(png_structp png_ptr, png_infop info_ptr, +png_get_bKGD(png_const_structp png_ptr, png_infop info_ptr, png_color_16p *background) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) && background != NULL) @@ -456,9 +460,9 @@ #ifdef PNG_cHRM_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED png_uint_32 PNGAPI -png_get_cHRM(png_structp png_ptr, png_infop info_ptr, +png_get_cHRM(png_const_structp png_ptr, png_const_infop info_ptr, double *white_x, double *white_y, double *red_x, double *red_y, double *green_x, double *green_y, double *blue_x, double *blue_y) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) @@ -489,9 +493,9 @@ # endif # ifdef PNG_FIXED_POINT_SUPPORTED png_uint_32 PNGAPI -png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, +png_get_cHRM_fixed(png_const_structp png_ptr, png_const_infop info_ptr, png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x, png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y, png_fixed_point *blue_x, png_fixed_point *blue_y) { @@ -524,9 +528,9 @@ #endif #ifdef PNG_gAMA_SUPPORTED png_uint_32 PNGFAPI -png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, +png_get_gAMA_fixed(png_const_structp png_ptr, png_const_infop info_ptr, png_fixed_point *file_gamma) { png_debug1(1, "in %s retrieval function", "gAMA"); @@ -540,9 +544,10 @@ return (0); } # ifdef PNG_FLOATING_POINT_SUPPORTED png_uint_32 PNGAPI -png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma) +png_get_gAMA(png_const_structp png_ptr, png_const_infop info_ptr, + double *file_gamma) { png_fixed_point igamma; png_uint_32 ok = png_get_gAMA_fixed(png_ptr, info_ptr, &igamma); @@ -556,9 +561,10 @@ #endif #ifdef PNG_sRGB_SUPPORTED png_uint_32 PNGAPI -png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent) +png_get_sRGB(png_const_structp png_ptr, png_const_infop info_ptr, + int *file_srgb_intent) { png_debug1(1, "in %s retrieval function", "sRGB"); if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB) @@ -573,9 +579,9 @@ #endif #ifdef PNG_iCCP_SUPPORTED png_uint_32 PNGAPI -png_get_iCCP(png_structp png_ptr, png_infop info_ptr, +png_get_iCCP(png_const_structp png_ptr, png_const_infop info_ptr, png_charpp name, int *compression_type, png_bytepp profile, png_uint_32 *proflen) { png_debug1(1, "in %s retrieval function", "iCCP"); @@ -598,9 +604,9 @@ #endif #ifdef PNG_sPLT_SUPPORTED png_uint_32 PNGAPI -png_get_sPLT(png_structp png_ptr, png_infop info_ptr, +png_get_sPLT(png_const_structp png_ptr, png_const_infop info_ptr, png_sPLT_tpp spalettes) { if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) { @@ -613,9 +619,10 @@ #endif #ifdef PNG_hIST_SUPPORTED png_uint_32 PNGAPI -png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist) +png_get_hIST(png_const_structp png_ptr, png_const_infop info_ptr, + png_uint_16p *hist) { png_debug1(1, "in %s retrieval function", "hIST"); if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) @@ -669,9 +676,9 @@ } #ifdef PNG_oFFs_SUPPORTED png_uint_32 PNGAPI -png_get_oFFs(png_structp png_ptr, png_infop info_ptr, +png_get_oFFs(png_const_structp png_ptr, png_const_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type) { png_debug1(1, "in %s retrieval function", "oFFs"); @@ -689,9 +696,9 @@ #endif #ifdef PNG_pCAL_SUPPORTED png_uint_32 PNGAPI -png_get_pCAL(png_structp png_ptr, png_infop info_ptr, +png_get_pCAL(png_const_structp png_ptr, png_const_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *units, png_charpp *params) { png_debug1(1, "in %s retrieval function", "pCAL"); @@ -717,9 +724,9 @@ #ifdef PNG_sCAL_SUPPORTED # ifdef PNG_FIXED_POINT_SUPPORTED # ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED png_uint_32 PNGAPI -png_get_sCAL_fixed(png_structp png_ptr, png_infop info_ptr, +png_get_sCAL_fixed(png_structp png_ptr, png_const_infop info_ptr, int *unit, png_fixed_point *width, png_fixed_point *height) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL)) @@ -737,9 +744,9 @@ # endif /* FLOATING_ARITHMETIC */ # endif /* FIXED_POINT */ # ifdef PNG_FLOATING_POINT_SUPPORTED png_uint_32 PNGAPI -png_get_sCAL(png_structp png_ptr, png_infop info_ptr, +png_get_sCAL(png_const_structp png_ptr, png_const_infop info_ptr, int *unit, double *width, double *height) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL)) @@ -753,9 +760,9 @@ return(0); } # endif /* FLOATING POINT */ png_uint_32 PNGAPI -png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr, +png_get_sCAL_s(png_const_structp png_ptr, png_const_infop info_ptr, int *unit, png_charpp width, png_charpp height) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL)) @@ -771,9 +778,9 @@ #endif /* sCAL */ #ifdef PNG_pHYs_SUPPORTED png_uint_32 PNGAPI -png_get_pHYs(png_structp png_ptr, png_infop info_ptr, +png_get_pHYs(png_const_structp png_ptr, png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) { png_uint_32 retval = 0; @@ -805,10 +812,10 @@ } #endif /* pHYs */ png_uint_32 PNGAPI -png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette, - int *num_palette) +png_get_PLTE(png_const_structp png_ptr, png_const_infop info_ptr, + png_colorp *palette, int *num_palette) { png_debug1(1, "in %s retrieval function", "PLTE"); if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE) @@ -824,9 +831,10 @@ } #ifdef PNG_sBIT_SUPPORTED png_uint_32 PNGAPI -png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit) +png_get_sBIT(png_const_structp png_ptr, png_infop info_ptr, + png_color_8p *sig_bit) { png_debug1(1, "in %s retrieval function", "sBIT"); if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) @@ -841,10 +849,10 @@ #endif #ifdef PNG_TEXT_SUPPORTED png_uint_32 PNGAPI -png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, - int *num_text) +png_get_text(png_const_structp png_ptr, png_const_infop info_ptr, + png_textp *text_ptr, int *num_text) { if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0) { png_debug1(1, "in %s retrieval function", @@ -868,9 +876,9 @@ #endif #ifdef PNG_tIME_SUPPORTED png_uint_32 PNGAPI -png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time) +png_get_tIME(png_const_structp png_ptr, png_infop info_ptr, png_timep *mod_time) { png_debug1(1, "in %s retrieval function", "tIME"); if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) @@ -885,9 +893,9 @@ #endif #ifdef PNG_tRNS_SUPPORTED png_uint_32 PNGAPI -png_get_tRNS(png_structp png_ptr, png_infop info_ptr, +png_get_tRNS(png_const_structp png_ptr, png_infop info_ptr, png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color) { png_uint_32 retval = 0; if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) @@ -930,9 +938,9 @@ #endif #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED int PNGAPI -png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr, +png_get_unknown_chunks(png_const_structp png_ptr, png_const_infop info_ptr, png_unknown_chunkpp unknowns) { if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL) { @@ -945,24 +953,24 @@ #endif #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED png_byte PNGAPI -png_get_rgb_to_gray_status (png_structp png_ptr) +png_get_rgb_to_gray_status (png_const_structp png_ptr) { return (png_byte)(png_ptr ? png_ptr->rgb_to_gray_status : 0); } #endif #ifdef PNG_USER_CHUNKS_SUPPORTED png_voidp PNGAPI -png_get_user_chunk_ptr(png_structp png_ptr) +png_get_user_chunk_ptr(png_const_structp png_ptr) { return (png_ptr ? png_ptr->user_chunk_ptr : NULL); } #endif png_size_t PNGAPI -png_get_compression_buffer_size(png_structp png_ptr) +png_get_compression_buffer_size(png_const_structp png_ptr) { return (png_ptr ? png_ptr->zbuf_size : 0L); } @@ -970,29 +978,29 @@ #ifdef PNG_SET_USER_LIMITS_SUPPORTED /* These functions were added to libpng 1.2.6 and were enabled * by default in libpng-1.4.0 */ png_uint_32 PNGAPI -png_get_user_width_max (png_structp png_ptr) +png_get_user_width_max (png_const_structp png_ptr) { return (png_ptr ? png_ptr->user_width_max : 0); } png_uint_32 PNGAPI -png_get_user_height_max (png_structp png_ptr) +png_get_user_height_max (png_const_structp png_ptr) { return (png_ptr ? png_ptr->user_height_max : 0); } /* This function was added to libpng 1.4.0 */ png_uint_32 PNGAPI -png_get_chunk_cache_max (png_structp png_ptr) +png_get_chunk_cache_max (png_const_structp png_ptr) { return (png_ptr ? png_ptr->user_chunk_cache_max : 0); } /* This function was added to libpng 1.4.1 */ png_alloc_size_t PNGAPI -png_get_chunk_malloc_max (png_structp png_ptr) +png_get_chunk_malloc_max (png_const_structp png_ptr) { return (png_ptr ? png_ptr->user_chunk_malloc_max : 0); } #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ @@ -1004,8 +1012,17 @@ { return png_ptr->io_state; } +png_uint_32 PNGAPI +png_get_io_chunk_type (png_const_structp png_ptr) +{ + return ((png_ptr->chunk_name[0] << 24) + + (png_ptr->chunk_name[1] << 16) + + (png_ptr->chunk_name[2] << 8) + + (png_ptr->chunk_name[3])); +} + png_const_bytep PNGAPI png_get_io_chunk_name (png_structp png_ptr) { return png_ptr->chunk_name; diff -ru4NwbB libpng-1.5.0/pngmem.c libpng-1.5.1beta08/pngmem.c --- libpng-1.5.0/pngmem.c 2011-01-22 16:39:23.174837039 -0600 +++ libpng-1.5.1beta08/pngmem.c 2011-01-22 20:17:27.725025197 -0600 @@ -1,8 +1,8 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -646,9 +646,9 @@ * functions. The application should free any memory associated with this * pointer before png_write_destroy and png_read_destroy are called. */ png_voidp PNGAPI -png_get_mem_ptr(png_structp png_ptr) +png_get_mem_ptr(png_const_structp png_ptr) { if (png_ptr == NULL) return (NULL); diff -ru4NwbB libpng-1.5.0/pngpread.c libpng-1.5.1beta08/pngpread.c --- libpng-1.5.0/pngpread.c 2011-01-22 16:39:23.183892689 -0600 +++ libpng-1.5.1beta08/pngpread.c 2011-01-22 20:17:27.734269365 -0600 @@ -1,8 +1,8 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -40,8 +40,66 @@ png_process_some_data(png_ptr, info_ptr); } } +png_size_t PNGAPI +png_process_data_pause(png_structp png_ptr, int save) +{ + if (png_ptr != NULL) + { + /* It's easiest for the caller if we do the save, then the caller doesn't + * have to supply the same data again: + */ + if (save) + png_push_save_buffer(png_ptr); + else + { + /* This includes any pending saved bytes: */ + png_size_t remaining = png_ptr->buffer_size; + png_ptr->buffer_size = 0; + + /* So subtract the saved buffer size, unless all the data + * is actually 'saved', in which case we just return 0 + */ + if (png_ptr->save_buffer_size < remaining) + return remaining - png_ptr->save_buffer_size; + } + } + + return 0; +} + +png_uint_32 PNGAPI +png_process_data_skip(png_structp png_ptr) +{ + png_size_t remaining = 0; + + if (png_ptr != NULL && png_ptr->process_mode == PNG_SKIP_MODE && + png_ptr->skip_length > 0) + { + /* At the end of png_process_data the buffer size must be 0 (see the loop + * above) so we can detect a broken call here: + */ + if (png_ptr->buffer_size != 0) + png_error(png_ptr, + "png_process_data_skip called inside png_process_data"); + + /* If is impossible for there to be a saved buffer at this point - + * otherwise we could not be in SKIP mode. This will also happen if + * png_process_skip is called inside png_process_data (but only very + * rarely.) + */ + if (png_ptr->save_buffer_size != 0) + png_error(png_ptr, "png_process_data_skip called with saved data"); + + remaining = png_ptr->skip_length; + png_ptr->skip_length = 0; + png_ptr->process_mode = PNG_READ_CHUNK_MODE; + } + + return remaining; +} + /* What we do with the incoming data depends on what we were previously * doing before we ran out of data... */ void /* PRIVATE */ @@ -581,12 +639,12 @@ png_push_crc_finish(png_structp png_ptr) { if (png_ptr->skip_length && png_ptr->save_buffer_size) { - png_size_t save_size = png_ptr->current_buffer_size; + png_size_t save_size = png_ptr->save_buffer_size; png_uint_32 skip_length = png_ptr->skip_length; - /* We want the smaller of 'skip_length' and 'current_buffer_size', but + /* We want the smaller of 'skip_length' and 'save_buffer_size', but * they are of different types and we don't know which variable has the * fewest bits. Carefully select the smaller and cast it to the type of * the larger - this cannot overflow. Do not cast in the following test * - it will break on either 16 or 64 bit platforms. @@ -608,12 +666,10 @@ { png_size_t save_size = png_ptr->current_buffer_size; png_uint_32 skip_length = png_ptr->skip_length; - /* We want the smaller of 'skip_length' and 'current_buffer_size', but - * they are of different types and we don't know which variable has the - * fewest bits. Carefully select the smaller and cast it to the type of - * the larger - this cannot overflow. + /* We want the smaller of 'skip_length' and 'current_buffer_size', here, + * the same problem exists as above and the same solution. */ if (skip_length < save_size) save_size = (png_size_t)skip_length; @@ -1787,9 +1843,9 @@ png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); } png_voidp PNGAPI -png_get_progressive_ptr(png_structp png_ptr) +png_get_progressive_ptr(png_const_structp png_ptr) { if (png_ptr == NULL) return (NULL); diff -ru4NwbB libpng-1.5.0/pngread.c libpng-1.5.1beta08/pngread.c --- libpng-1.5.0/pngread.c 2011-01-22 16:39:23.192040561 -0600 +++ libpng-1.5.1beta08/pngread.c 2011-01-22 20:17:27.742481865 -0600 @@ -1,8 +1,8 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [$RDATE%] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -840,9 +840,9 @@ png_start_read_image(png_ptr); } else { - if (!(png_ptr->transformations & PNG_INTERLACE)) + if (png_ptr->interlaced && !(png_ptr->transformations & PNG_INTERLACE)) { /* Caller called png_start_read_image or png_read_update_info without * first turning on the PNG_INTERLACE transform. We can fix this here, * but the caller should do it! diff -ru4NwbB libpng-1.5.0/pngrtran.c libpng-1.5.1beta08/pngrtran.c --- libpng-1.5.0/pngrtran.c 2011-01-22 16:39:23.212597981 -0600 +++ libpng-1.5.1beta08/pngrtran.c 2011-01-22 20:17:27.762889549 -0600 @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -2426,9 +2426,9 @@ int rgb_error = 0; png_debug(1, "in png_do_rgb_to_gray"); - if ( + if (!(row_info->color_type & PNG_COLOR_MASK_PALETTE) && (row_info->color_type & PNG_COLOR_MASK_COLOR)) { png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff; png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff; @@ -3777,9 +3777,9 @@ row_info->pixel_depth = 8; row_info->rowbytes = row_width; } - else if (row_info->bit_depth == 8) + if (row_info->bit_depth == 8) { { if (trans_alpha != NULL) { diff -ru4NwbB libpng-1.5.0/pngrutil.c libpng-1.5.1beta08/pngrutil.c --- libpng-1.5.0/pngrutil.c 2011-01-22 16:39:23.226783299 -0600 +++ libpng-1.5.1beta08/pngrutil.c 2011-01-22 20:17:27.776820476 -0600 @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -607,9 +607,9 @@ png_ptr->channels); png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width); png_debug1(3, "bit_depth = %d", png_ptr->bit_depth); png_debug1(3, "channels = %d", png_ptr->channels); - png_debug1(3, "rowbytes = %u", png_ptr->rowbytes); + png_debug1(3, "rowbytes = %lu", (unsigned long)png_ptr->rowbytes); png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, color_type, interlace_type, compression_type, filter_type); } @@ -1247,9 +1247,11 @@ char umsg[80]; png_snprintf2(umsg, 80, "Ignoring iCCP chunk with declared size = %u " - "and actual length = %u", profile_size, profile_length); + "and actual length = %u", + (unsigned int) profile_size, + (unsigned int) profile_length); png_warning(png_ptr, umsg); } #else png_warning(png_ptr, @@ -1959,9 +1961,9 @@ /* Read the sCAL chunk */ void /* PRIVATE */ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { - png_size_t slength, index; + png_size_t slength, i; int state; png_debug(1, "in png_handle_sCAL"); @@ -2016,23 +2018,23 @@ /* Validate the ASCII numbers, need two ASCII numbers separated by * a '\0' and they need to fit exactly in the chunk data. */ - index = 0; + i = 0; state = 0; if (png_ptr->chunkdata[1] == 45 /* negative width */ || - !png_check_fp_number(png_ptr->chunkdata, slength, &state, &index) || - index >= slength || png_ptr->chunkdata[index++] != 0) + !png_check_fp_number(png_ptr->chunkdata, slength, &state, &i) || + i >= slength || png_ptr->chunkdata[i++] != 0) png_warning(png_ptr, "Invalid sCAL chunk ignored: bad width format"); else { - png_size_t heighti = index; + png_size_t heighti = i; - if (png_ptr->chunkdata[index] == 45 /* negative height */ || - !png_check_fp_number(png_ptr->chunkdata, slength, &state, &index) || - index != slength) + if (png_ptr->chunkdata[i] == 45 /* negative height */ || + !png_check_fp_number(png_ptr->chunkdata, slength, &state, &i) || + i != slength) png_warning(png_ptr, "Invalid sCAL chunk ignored: bad height format"); else /* This is the (only) success case. */ @@ -3604,11 +3606,11 @@ png_debug1(3, "width = %u,", png_ptr->width); png_debug1(3, "height = %u,", png_ptr->height); png_debug1(3, "iwidth = %u,", png_ptr->iwidth); png_debug1(3, "num_rows = %u,", png_ptr->num_rows); - png_debug1(3, "rowbytes = %u,", png_ptr->rowbytes); - png_debug1(3, "irowbytes = %u", - PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1); + png_debug1(3, "rowbytes = %lu,", (unsigned long)png_ptr->rowbytes); + png_debug1(3, "irowbytes = %lu", + (unsigned long)PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1); png_ptr->flags |= PNG_FLAG_ROW_INIT; } #endif /* PNG_READ_SUPPORTED */ diff -ru4NwbB libpng-1.5.0/pngset.c libpng-1.5.1beta08/pngset.c --- libpng-1.5.0/pngset.c 2011-01-22 16:39:23.235075862 -0600 +++ libpng-1.5.1beta08/pngset.c 2011-01-22 20:17:27.785034746 -0600 @@ -1,8 +1,8 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -86,9 +86,9 @@ #ifdef PNG_gAMA_SUPPORTED void PNGFAPI png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point - gamma) + file_gamma) { png_debug1(1, "in %s storage function", "gAMA"); if (png_ptr == NULL || info_ptr == NULL) @@ -97,17 +97,17 @@ /* Previously these values were limited, however they must be * wrong, therefore storing them (and setting PNG_INFO_gAMA) * must be wrong too. */ - if (gamma > (png_fixed_point)PNG_UINT_31_MAX) + if (file_gamma > (png_fixed_point)PNG_UINT_31_MAX) png_warning(png_ptr, "Gamma too large, ignored"); - else if (gamma <= 0) + else if (file_gamma <= 0) png_warning(png_ptr, "Negative or zero gamma ignored"); else { - info_ptr->gamma = gamma; + info_ptr->gamma = file_gamma; info_ptr->valid |= PNG_INFO_gAMA; } } @@ -351,9 +351,9 @@ info_ptr->scal_unit = (png_byte)unit; ++lengthw; - png_debug1(3, "allocating unit for info (%u bytes)", lengthw); + png_debug1(3, "allocating unit for info (%u bytes)", (unsigned int)lengthw); info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, lengthw); if (info_ptr->scal_s_width == NULL) @@ -365,9 +365,9 @@ png_memcpy(info_ptr->scal_s_width, swidth, lengthw); ++lengthh; - png_debug1(3, "allocating unit for info (%u bytes)", lengthh); + png_debug1(3, "allocating unit for info (%u bytes)", (unsigned int)lengthh); info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, lengthh); if (info_ptr->scal_s_height == NULL) @@ -750,12 +750,12 @@ if (textp->key == NULL) return(1); - png_debug2(2, "Allocated %lu bytes at %x in png_set_text", + png_debug2(2, "Allocated %lu bytes at %p in png_set_text", (unsigned long)(png_uint_32) (key_len + lang_len + lang_key_len + text_length + 4), - (int)textp->key); + textp->key); png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len)); *(textp->key + key_len) = '\0'; diff -ru4NwbB libpng-1.5.0/pngtrans.c libpng-1.5.1beta08/pngtrans.c --- libpng-1.5.0/pngtrans.c 2011-01-22 16:39:23.251076592 -0600 +++ libpng-1.5.1beta08/pngtrans.c 2011-01-22 20:17:27.801031465 -0600 @@ -1,8 +1,8 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -671,43 +671,53 @@ #endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED void PNGAPI png_set_user_transform_info(png_structp png_ptr, png_voidp user_transform_ptr, int user_transform_depth, int user_transform_channels) { png_debug(1, "in png_set_user_transform_info"); if (png_ptr == NULL) return; -#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED png_ptr->user_transform_ptr = user_transform_ptr; png_ptr->user_transform_depth = (png_byte)user_transform_depth; png_ptr->user_transform_channels = (png_byte)user_transform_channels; -#else - if (user_transform_ptr || user_transform_depth || user_transform_channels) - png_warning(png_ptr, - "This version of libpng does not support user transform info"); -#endif } +#endif /* This function returns a pointer to the user_transform_ptr associated with * the user transform functions. The application should free any memory * associated with this pointer before png_write_destroy and png_read_destroy * are called. */ +#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED png_voidp PNGAPI -png_get_user_transform_ptr(png_structp png_ptr) +png_get_user_transform_ptr(png_const_structp png_ptr) { if (png_ptr == NULL) return (NULL); -#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED return ((png_voidp)png_ptr->user_transform_ptr); -#else - return (NULL); +} #endif + +png_uint_32 PNGAPI +png_get_current_row_number(png_const_structp png_ptr) +{ + if (png_ptr != NULL) + return png_ptr->row_number; + return PNG_UINT_32_MAX; /* help the app not to fail silently */ +} + +png_byte PNGAPI +png_get_current_pass_number(png_const_structp png_ptr) +{ + if (png_ptr != NULL) + return png_ptr->pass; + return 8; /* invalid */ } #endif /* PNG_READ_USER_TRANSFORM_SUPPORTED || PNG_WRITE_USER_TRANSFORM_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff -ru4NwbB libpng-1.5.0/pngvalid.c libpng-1.5.1beta08/pngvalid.c --- libpng-1.5.0/pngvalid.c 2011-01-22 16:39:23.266763948 -0600 +++ libpng-1.5.1beta08/pngvalid.c 2011-01-22 20:17:27.816932228 -0600 @@ -1,8 +1,8 @@ /* pngvalid.c - validate libpng by constructing then reading png files. * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [(PENDING RELEASE)] * Copyright (c) 2011 Glenn Randers-Pehrson * Written by John Cunningham Bowler * * This code is released under the libpng license. @@ -237,27 +237,30 @@ } static unsigned int sample(png_const_bytep row, png_byte colour_type, png_byte bit_depth, - png_uint_32 x, unsigned int sample) + png_uint_32 x, unsigned int sample_index) { - png_uint_32 index, result; + png_uint_32 bit_index, result; /* Find a sample index for the desired sample: */ x *= bit_depth; - index = x; + bit_index = x; if ((colour_type & 1) == 0) /* !palette */ { if (colour_type & 2) - index *= 3, index += sample; /* Colour channels; select one */ + bit_index *= 3; if (colour_type & 4) - index += x; /* Alpha channel */ + bit_index += x; /* Alpha channel */ + + if (colour_type & (2+4)) + bit_index += sample_index * bit_depth; /* Multiple channels: select one */ } /* Return the sample from the row as an integer. */ - row += index >> 3; + row += bit_index >> 3; result = *row; if (bit_depth == 8) return result; @@ -265,10 +268,10 @@ else if (bit_depth > 8) return (result << 8) + *++row; /* Less than 8 bits per sample. */ - index &= 7; - return (result >> (8-index-bit_depth)) & ((1U<> (8-bit_index-bit_depth)) & ((1U<expect_error = !error_test[test].warning; @@ -2512,8 +2517,10 @@ } Catch (fault) ps = fault; /* expected exit, make sure ps is not clobbered */ +#undef exception__prev +#undef exception__env /* And clear these flags */ ps->expect_error = 0; ps->expect_warning = 0; @@ -3232,17 +3239,17 @@ return 1; } static void -gamma_modification_init(gamma_modification *me, png_modifier *pm, double gamma) +gamma_modification_init(gamma_modification *me, png_modifier *pm, double gammad) { double g; modification_init(&me->this); me->this.chunk = CHUNK_gAMA; me->this.modify_fn = gamma_modify; me->this.add = CHUNK_PLTE; - g = floor(gamma * 100000 + .5); + g = floor(gammad * 100000 + .5); me->gamma = (png_fixed_point)g; me->this.next = pm->modifications; pm->modifications = &me->this; } @@ -3497,9 +3504,9 @@ in_bd != out_bd; PNG_CONST unsigned int samples_per_pixel = (out_ct & 2U) ? 3U : 1U; - PNG_CONST double gamma = 1/(file_gamma*screen_gamma); /* Overall */ + PNG_CONST double gamma_correction = 1/(file_gamma*screen_gamma);/* Overall */ double maxerrout = 0, maxerrabs = 0, maxerrpc = 0; png_uint_32 y; @@ -3523,9 +3530,10 @@ PNG_CONST unsigned int isbit = id >> (in_bd-sbit); - double i, sample, encoded_sample, output, encoded_error, error; + double i, input_sample, encoded_sample, output; + double encoded_error, error; double es_lo, es_hi; /* First check on the 'perfect' result obtained from the * digitized input value, id, and compare this against the @@ -3542,9 +3550,9 @@ * quantization of the output value to the nearest digital * value (nevertheless the error is still recorded - it's * interesting ;-) */ - encoded_sample = pow(i, gamma) * outmax; + encoded_sample = pow(i, gamma_correction) * outmax; encoded_error = fabs(od-encoded_sample); if (encoded_error > maxerrout) maxerrout = encoded_error; @@ -3560,29 +3568,29 @@ * image. There's nothing we can do about this - we don't * know what it is - so assume the unencoded value is * perceptually linear. */ - sample = pow(i, 1/file_gamma); /* In range 0..1 */ + input_sample = pow(i, 1/file_gamma); /* In range 0..1 */ output = od; output /= outmax; output = pow(output, screen_gamma); /* Now we have the numbers for real errors, both absolute * values as as a percentage of the correct value (output): */ - error = fabs(sample-output); + error = fabs(input_sample-output); if (error > maxerrabs) maxerrabs = error; /* The following is an attempt to ignore the tendency of * quantization to dominate the percentage errors for low * output sample values: */ - if (sample*maxpc > .5+maxabs) + if (input_sample*maxpc > .5+maxabs) { - double pcerr = error/sample; - if (pcerr > maxerrpc) maxerrpc = pcerr; + double percentage_error = error/input_sample; + if (percentage_error > maxerrpc) maxerrpc = percentage_error; } /* Now calculate the digitization limits for * 'encoded_sample' using the 'max' values. Note that @@ -3592,29 +3600,31 @@ * First find the maximum error in linear light space, * range 0..1: */ { - double tmp = sample * maxpc; + double tmp = input_sample * maxpc; if (tmp < maxabs) tmp = maxabs; /* Low bound - the minimum of the three: */ es_lo = encoded_sample - maxout; - if (es_lo > 0 && sample-tmp > 0) + if (es_lo > 0 && input_sample-tmp > 0) { - double l = outmax * pow(sample-tmp, 1/screen_gamma); - if (l < es_lo) es_lo = l; + double low_value = outmax * pow(input_sample-tmp, + 1/screen_gamma); + if (low_value < es_lo) es_lo = low_value; } else es_lo = 0; es_hi = encoded_sample + maxout; - if (es_hi < outmax && sample+tmp < 1) + if (es_hi < outmax && input_sample+tmp < 1) { - double h = outmax * pow(sample+tmp, 1/screen_gamma); - if (h > es_hi) es_hi = h; + double high_value = outmax * pow(input_sample+tmp, + 1/screen_gamma); + if (high_value > es_hi) es_hi = high_value; } else es_hi = outmax; @@ -3641,9 +3651,9 @@ double tmp = (isbit - .5)/((1U< 0) { - is_lo = outmax * pow(tmp, gamma) - maxout; + is_lo = outmax * pow(tmp, gamma_correction) - maxout; if (is_lo < 0) is_lo = 0; } else @@ -3652,9 +3662,9 @@ tmp = (isbit + .5)/((1U< outmax) is_hi = outmax; } else @@ -3879,17 +3889,17 @@ png_byte bit_depth = 0; while (next_format(&colour_type, &bit_depth)) { - double gamma = 1.0; - while (gamma >= .4) + double test_gamma = 1.0; + while (test_gamma >= .4) { /* There's little point testing the interlacing vs non-interlacing, * but this can be set from the command line. */ gamma_threshold_test(pm, colour_type, bit_depth, pm->interlace_type, - gamma, 1/gamma); - gamma *= .95; + test_gamma, 1/test_gamma); + test_gamma *= .95; } /* And a special test for sRGB */ gamma_threshold_test(pm, colour_type, bit_depth, pm->interlace_type, diff -ru4NwbB libpng-1.5.0/pngwrite.c libpng-1.5.1beta08/pngwrite.c --- libpng-1.5.0/pngwrite.c 2011-01-22 16:39:23.281181870 -0600 +++ libpng-1.5.1beta08/pngwrite.c 2011-01-22 20:17:27.831376891 -0600 @@ -1,8 +1,8 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.1 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -782,9 +782,10 @@ png_debug1(3, "row_info->width = %u", png_ptr->row_info.width); png_debug1(3, "row_info->channels = %d", png_ptr->row_info.channels); png_debug1(3, "row_info->bit_depth = %d", png_ptr->row_info.bit_depth); png_debug1(3, "row_info->pixel_depth = %d", png_ptr->row_info.pixel_depth); - png_debug1(3, "row_info->rowbytes = %u", png_ptr->row_info.rowbytes); + png_debug1(3, "row_info->rowbytes = %lu", + (unsigned long)png_ptr->row_info.rowbytes); /* Copy user's row into buffer, leaving room for filter byte. */ png_memcpy(png_ptr->row_buf + 1, row, png_ptr->row_info.rowbytes); diff -ru4NwbB libpng-1.5.0/scripts/list libpng-1.5.1beta08/scripts/list --- libpng-1.5.0/scripts/list 1969-12-31 18:00:00.000000000 -0600 +++ libpng-1.5.1beta08/scripts/list 2011-01-21 19:15:59.267949000 -0600 @@ -0,0 +1,23 @@ +vers.dfn +symbols.dfn +sym.dfn +pnglibconf.h.prebuilt +pnglibconf.dfa +options.awk +makefile.netbsd +makefile.solaris-x86 +makefile.solaris +makefile.so9 +makefile.sgi +makefile.sggcc +makefile.openbsd +makefile.sco +makefile.linux +makefile.hpux +makefile.hpgcc +makefile.elf +makefile.dec +makefile.beos +makefile.64sunu +makefile.32sunu +def.dfn diff -ru4NwbB libpng-1.5.0/scripts/makefile.32sunu libpng-1.5.1beta08/scripts/makefile.32sunu --- libpng-1.5.0/scripts/makefile.32sunu 2011-01-22 16:39:25.237249495 -0600 +++ libpng-1.5.1beta08/scripts/makefile.32sunu 2011-01-22 20:17:29.633636034 -0600 @@ -1,7 +1,7 @@ # makefile for libpng on Solaris 2.x with cc # Contributed by William L. Sebok, based on makefile.linux -# Copyright (C) 2002, 2006, 2010 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger # This code is released under the libpng license. diff -ru4NwbB libpng-1.5.0/scripts/makefile.64sunu libpng-1.5.1beta08/scripts/makefile.64sunu --- libpng-1.5.0/scripts/makefile.64sunu 2011-01-22 16:39:25.248534094 -0600 +++ libpng-1.5.1beta08/scripts/makefile.64sunu 2011-01-22 20:17:29.644738621 -0600 @@ -1,7 +1,7 @@ # makefile for libpng on Solaris 2.x with cc # Contributed by William L. Sebok, based on makefile.linux -# Copyright (C) 2002, 2006, 2010 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger # This code is released under the libpng license. diff -ru4NwbB libpng-1.5.0/scripts/makefile.beos libpng-1.5.1beta08/scripts/makefile.beos --- libpng-1.5.0/scripts/makefile.beos 2011-01-22 16:39:25.279062342 -0600 +++ libpng-1.5.1beta08/scripts/makefile.beos 2011-01-22 20:17:29.675403439 -0600 @@ -1,7 +1,7 @@ # makefile for libpng on BeOS x86 ELF with gcc # modified from makefile.linux by Sander Stoks -# Copyright (C) 2002, 2006, 2008, 2010 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006, 2008, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 1999 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger # # This code is released under the libpng license. diff -ru4NwbB libpng-1.5.0/scripts/makefile.darwin libpng-1.5.1beta08/scripts/makefile.darwin --- libpng-1.5.0/scripts/makefile.darwin 2011-01-22 16:39:25.309588796 -0600 +++ libpng-1.5.1beta08/scripts/makefile.darwin 2011-01-22 20:17:29.706898770 -0600 @@ -1,6 +1,6 @@ # makefile for libpng on Darwin / Mac OS X -# Copyright (C) 2002, 2004, 2006, 2008, 2010 Glenn Randers-Pehrson +# Copyright (C) 2002, 2004, 2006, 2008, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 2001 Christoph Pfisterer # derived from makefile.linux: # Copyright (C) 1998, 1999 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger diff -ru4NwbB libpng-1.5.0/scripts/makefile.dec libpng-1.5.1beta08/scripts/makefile.dec --- libpng-1.5.0/scripts/makefile.dec 2011-01-22 16:39:25.320129108 -0600 +++ libpng-1.5.1beta08/scripts/makefile.dec 2011-01-22 20:17:29.717459762 -0600 @@ -1,6 +1,6 @@ # makefile for libpng on DEC Alpha Unix -# Copyright (C) 2000-2002, 2006, 2010 Glenn Randers-Pehrson +# Copyright (C) 2000-2002, 2006, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer diff -ru4NwbB libpng-1.5.0/scripts/makefile.dj2 libpng-1.5.1beta08/scripts/makefile.dj2 --- libpng-1.5.0/scripts/makefile.dj2 2011-01-22 16:39:25.329615334 -0600 +++ libpng-1.5.1beta08/scripts/makefile.dj2 2011-01-22 20:17:29.726813827 -0600 @@ -1,6 +1,6 @@ # DJGPP (DOS gcc) makefile for libpng -# Copyright (C) 2002, 2006, 2009-2010 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006, 2009-2010-2011 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer diff -ru4NwbB libpng-1.5.0/scripts/makefile.elf libpng-1.5.1beta08/scripts/makefile.elf --- libpng-1.5.0/scripts/makefile.elf 2011-01-22 16:39:25.340558448 -0600 +++ libpng-1.5.1beta08/scripts/makefile.elf 2011-01-22 20:17:29.737713844 -0600 @@ -1,6 +1,6 @@ # makefile for libpng.a and libpng%N%.so on Linux ELF with gcc -# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010 Greg Roelofs +# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2011 Greg Roelofs # and Glenn Randers-Pehrson # Copyright (C) 1996, 1997 Andreas Dilger # # This code is released under the libpng license. diff -ru4NwbB libpng-1.5.0/scripts/makefile.hp64 libpng-1.5.1beta08/scripts/makefile.hp64 --- libpng-1.5.0/scripts/makefile.hp64 2011-01-22 16:39:25.370160292 -0600 +++ libpng-1.5.1beta08/scripts/makefile.hp64 2011-01-22 20:17:29.769857257 -0600 @@ -1,6 +1,6 @@ # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product. -# Copyright (C) 1999-2002, 2006, 2009, 2010 Glenn Randers-Pehrson +# Copyright (C) 1999-2002, 2006, 2009, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42 # contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard # # This code is released under the libpng license. diff -ru4NwbB libpng-1.5.0/scripts/makefile.hpgcc libpng-1.5.1beta08/scripts/makefile.hpgcc --- libpng-1.5.0/scripts/makefile.hpgcc 2011-01-22 16:39:25.380908154 -0600 +++ libpng-1.5.1beta08/scripts/makefile.hpgcc 2011-01-22 20:17:29.780475437 -0600 @@ -1,6 +1,6 @@ # makefile for libpng on HP-UX using GCC with the HP ANSI/C linker. -# Copyright (C) 2002, 2006-2008, 2010 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006-2008, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 2001, Laurent faillie # Copyright (C) 1998, 1999 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger # diff -ru4NwbB libpng-1.5.0/scripts/makefile.hpux libpng-1.5.1beta08/scripts/makefile.hpux --- libpng-1.5.0/scripts/makefile.hpux 2011-01-22 16:39:25.391393843 -0600 +++ libpng-1.5.1beta08/scripts/makefile.hpux 2011-01-22 20:17:29.791014719 -0600 @@ -1,6 +1,6 @@ # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product. -# Copyright (C) 1999-2002, 2006, 2010 Glenn Randers-Pehrson +# Copyright (C) 1999-2002, 2006, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42 # contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard # # This code is released under the libpng license. diff -ru4NwbB libpng-1.5.0/scripts/makefile.linux libpng-1.5.1beta08/scripts/makefile.linux --- libpng-1.5.0/scripts/makefile.linux 2011-01-22 16:39:25.430684028 -0600 +++ libpng-1.5.1beta08/scripts/makefile.linux 2011-01-22 20:17:29.831892469 -0600 @@ -1,6 +1,6 @@ # makefile for libpng.a and libpng%N%.so on Linux ELF with gcc -# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010 Greg Roelofs and +# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2011 Greg Roelofs and # Glenn Randers-Pehrson # Copyright (C) 1996, 1997 Andreas Dilger # # This code is released under the libpng license. diff -ru4NwbB libpng-1.5.0/scripts/makefile.sco libpng-1.5.1beta08/scripts/makefile.sco --- libpng-1.5.0/scripts/makefile.sco 2011-01-22 16:39:25.488570529 -0600 +++ libpng-1.5.1beta08/scripts/makefile.sco 2011-01-22 20:17:29.890136336 -0600 @@ -1,8 +1,8 @@ # makefile for SCO OSr5 ELF and Unixware 7 with Native cc # Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx # force ELF build dynamic linking, SONAME setting in lib and RPATH in app -# Copyright (C) 2002, 2006, 2010 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger # # This code is released under the libpng license. diff -ru4NwbB libpng-1.5.0/scripts/makefile.sggcc libpng-1.5.1beta08/scripts/makefile.sggcc --- libpng-1.5.0/scripts/makefile.sggcc 2011-01-22 16:39:25.499590966 -0600 +++ libpng-1.5.1beta08/scripts/makefile.sggcc 2011-01-22 20:17:29.901132429 -0600 @@ -1,6 +1,6 @@ # makefile for libpng.a and libpng%N%.so, SGI IRIX with 'cc' -# Copyright (C) 2001-2002, 2006, 2010 Glenn Randers-Pehrson +# Copyright (C) 2001-2002, 2006, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer diff -ru4NwbB libpng-1.5.0/scripts/makefile.sgi libpng-1.5.1beta08/scripts/makefile.sgi --- libpng-1.5.0/scripts/makefile.sgi 2011-01-22 16:39:25.510589507 -0600 +++ libpng-1.5.1beta08/scripts/makefile.sgi 2011-01-22 20:17:29.911990157 -0600 @@ -1,6 +1,6 @@ # makefile for libpng.a and libpng%N%.so, SGI IRIX with 'cc' -# Copyright (C) 2001-2002, 2006, 2007, 2010 Glenn Randers-Pehrson +# Copyright (C) 2001-2002, 2006, 2007, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer diff -ru4NwbB libpng-1.5.0/scripts/makefile.so9 libpng-1.5.1beta08/scripts/makefile.so9 --- libpng-1.5.0/scripts/makefile.so9 2011-01-22 16:39:25.521470979 -0600 +++ libpng-1.5.1beta08/scripts/makefile.so9 2011-01-22 20:17:29.922773990 -0600 @@ -1,8 +1,8 @@ # makefile for libpng on Solaris 9 (beta) with Forte cc # Updated by Chad Schrock for Solaris 9 # Contributed by William L. Sebok, based on makefile.linux -# Copyright (C) 2002, 2006, 2008, 2010 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006, 2008, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 1998-2001 Greg Roelofs # Copyright (C) 1996-1997 Andreas Dilger # # This code is released under the libpng license. diff -ru4NwbB libpng-1.5.0/scripts/makefile.solaris libpng-1.5.1beta08/scripts/makefile.solaris --- libpng-1.5.0/scripts/makefile.solaris 2011-01-22 16:39:25.532506227 -0600 +++ libpng-1.5.1beta08/scripts/makefile.solaris 2011-01-22 20:17:29.933523584 -0600 @@ -1,6 +1,6 @@ # makefile for libpng on Solaris 2.x with gcc -# Copyright (C) 2004, 2006-2008, 2010 Glenn Randers-Pehrson +# Copyright (C) 2004, 2006-2008, 2010-2011 Glenn Randers-Pehrson # Contributed by William L. Sebok, based on makefile.linux # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger # diff -ru4NwbB libpng-1.5.0/scripts/makefile.solaris-x86 libpng-1.5.1beta08/scripts/makefile.solaris-x86 --- libpng-1.5.0/scripts/makefile.solaris-x86 2011-01-22 16:39:25.543324227 -0600 +++ libpng-1.5.1beta08/scripts/makefile.solaris-x86 2011-01-22 20:17:29.944246932 -0600 @@ -1,6 +1,6 @@ # makefile for libpng on Solaris 2.x with gcc -# Copyright (C) 2004, 2006-2008, 2010 Glenn Randers-Pehrson +# Copyright (C) 2004, 2006-2008, 2010-2011 Glenn Randers-Pehrson # Contributed by William L. Sebok, based on makefile.linux # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger diff -ru4NwbB libpng-1.5.0/scripts/options.awk libpng-1.5.1beta08/scripts/options.awk --- libpng-1.5.0/scripts/options.awk 2011-01-06 06:22:09.000000000 -0600 +++ libpng-1.5.1beta08/scripts/options.awk 2011-01-21 19:19:11.118462000 -0600 @@ -2,9 +2,9 @@ # scripts/options.awk - library build configuration control # # last changed in libpng version 1.5.0 - January 6, 2011 # -# Copyright (c) 1998-2010 Glenn Randers-Pehrson +# Copyright (c) 1998-2011 Glenn Randers-Pehrson # # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer # and license in png.h diff -ru4NwbB libpng-1.5.0/scripts/pnglibconf.dfa libpng-1.5.1beta08/scripts/pnglibconf.dfa --- libpng-1.5.0/scripts/pnglibconf.dfa 2011-01-06 06:22:21.000000000 -0600 +++ libpng-1.5.1beta08/scripts/pnglibconf.dfa 2011-01-22 18:03:50.437008000 -0600 @@ -7,9 +7,9 @@ com pnglibconf.h - library build configuration com com libpng version 1.5.0 - January 6, 2011 com -com Copyright (c) 1998-2010 Glenn Randers-Pehrson +com Copyright (c) 1998-2011 Glenn Randers-Pehrson com com This code is released under the libpng license. com For conditions of distribution and use, see the disclaimer com and license in png.h @@ -379,10 +379,12 @@ option WRITE_WEIGHTED_FILTER requires WRITE option WRITE_FLUSH requires WRITE -# Note: this can be turned off explicitly, is this correct? +# Note: these can be turned off explicitly if not required by the +# apps implementing the user transforms option USER_TRANSFORM_PTR if READ_USER_TRANSFORM WRITE_USER_TRANSFORM +option USER_TRANSFORM_INFO if READ_USER_TRANSFORM WRITE_USER_TRANSFORM # Any chunks you are not interested in, you can undef here. The # ones that allocate memory may be expecially important (hIST, # tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info diff -ru4NwbB libpng-1.5.0/scripts/pnglibconf.dfa.orig libpng-1.5.1beta08/scripts/pnglibconf.dfa.orig --- libpng-1.5.0/scripts/pnglibconf.dfa.orig 1969-12-31 18:00:00.000000000 -0600 +++ libpng-1.5.1beta08/scripts/pnglibconf.dfa.orig 2011-01-21 19:22:50.542374000 -0600 @@ -0,0 +1,547 @@ +# scripts/pnglibconf.dfa - library build configuration control +# +@/*- pnglibconf.dfn intermediate file +@ * generated from scripts/pnglibconf.dfa +@ */ +# +com pnglibconf.h - library build configuration +com +com libpng version 1.5.0 - January 6, 2011 +com +com Copyright (c) 1998-2011 Glenn Randers-Pehrson +com +com This code is released under the libpng license. +com For conditions of distribution and use, see the disclaimer +com and license in png.h +com + +file pnglibconf.h scripts/pnglibconf.dfa PNGLCONF_H + +# This file is preprocessed by scripts/options.awk and the +# C compiler to generate 'pnglibconf.h' - a list of all the +# configuration options. The file lists the various options +# that can *only* be specified during the libpng build; +# pnglibconf.h freezes the definitons selected for the specific +# build. +# +# The syntax is detailed in scripts/options.awk, this is a summary +# only: +# +# setting [requires ...] [default] +# #define PNG_ /* value comes from current setting */ +# option [requires ...] [if ...] [enables ...] [disabled] +# #define PNG__SUPPORTED if the requirements are met and +# enable the other options listed +# chunk [requires ...] [disabled] +# Enable chunk processing for the given ancillary chunk +# +# Note that the 'on' and 'off' keywords, while valid on both option +# and chunk, should not be used in this file because they force the +# relevant options on or off. + +#---------------------------------------------------------------------- + +# The following setting, option and chunk values can all be changed +# while building libpng: +# +# setting: change 'setting' lines to fine tune library performance, +# changes to the settings don't affect the libpng API functionally +# +# option: change 'option' lines to remove or add capabilities from +# or to the library; options change the library API +# +# chunk: change 'chunk' lines to remove capabilities to process +# optional ('ancillary') chunks. This does not prevent PNG +# decoding but does change the libpng API because some chunks +# will be ignored. +# +# There are three ways of disabling features, in no particular order: +# +# 1) Create 'pngusr.h', enter the required private build information +# detailed below and #define PNG_NO_