[libpng17] Merge pngvalid.c and pngfix.c with libpng-1.6.14beta04

This commit is contained in:
Glenn Randers-Pehrson 2014-09-28 10:37:26 -05:00
parent 776d1768aa
commit 4f8050416f
2 changed files with 21 additions and 9 deletions

View File

@ -396,9 +396,9 @@ next_format(png_bytep colour_type, png_bytep bit_depth,
/* Palette images are restricted to 8 bit depth */ /* Palette images are restricted to 8 bit depth */
if (*bit_depth <= 8 if (*bit_depth <= 8
# ifdef DO_16BIT #ifdef DO_16BIT
|| (*colour_type != 3 && *bit_depth <= 16) || (*colour_type != 3 && *bit_depth <= 16)
# endif #endif
) )
return 1; return 1;
@ -3165,10 +3165,10 @@ init_standard_palette(png_store *ps, png_structp pp, png_infop pi, int npalette,
for (; i<256; ++i) for (; i<256; ++i)
tRNS[i] = 24; tRNS[i] = 24;
# ifdef PNG_WRITE_tRNS_SUPPORTED #ifdef PNG_WRITE_tRNS_SUPPORTED
if (j > 0) if (j > 0)
png_set_tRNS(pp, pi, tRNS, j, 0/*color*/); png_set_tRNS(pp, pi, tRNS, j, 0/*color*/);
# endif #endif
} }
} }

View File

@ -2,7 +2,7 @@
* *
* Copyright (c) 2014 John Cunningham Bowler * Copyright (c) 2014 John Cunningham Bowler
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.14 [(PENDING RELEASE)]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@ -49,6 +49,9 @@
# error "pngfix will not work with libpng prior to 1.6.3" # error "pngfix will not work with libpng prior to 1.6.3"
#endif #endif
#ifdef PNG_SETJMP_SUPPORTED
#include <setjmp.h>
#if defined(PNG_READ_SUPPORTED) && defined(PNG_EASY_ACCESS_SUPPORTED) #if defined(PNG_READ_SUPPORTED) && defined(PNG_EASY_ACCESS_SUPPORTED)
/* zlib.h defines the structure z_stream, an instance of which is included /* zlib.h defines the structure z_stream, an instance of which is included
* in this structure and is required for decompressing the LZ compressed * in this structure and is required for decompressing the LZ compressed
@ -79,7 +82,7 @@
# error "pngfix not supported in this libpng version" # error "pngfix not supported in this libpng version"
#endif #endif
#if PNG_ZLIB_VERNUM >= 0x1240 #if ZLIB_VERNUM >= 0x1240
/* Copied from pngpriv.h */ /* Copied from pngpriv.h */
#ifdef __cplusplus #ifdef __cplusplus
@ -4014,16 +4017,16 @@ main(int argc, const char **argv)
return global_end(&global); return global_end(&global);
} }
#else /* PNG_ZLIB_VERNUM < 0x1240 */ #else /* ZLIB_VERNUM < 0x1240 */
int int
main(void) main(void)
{ {
fprintf(stderr, fprintf(stderr,
"pngfix needs libpng with a zlib >=1.2.4 (not 0x%x)\n", "pngfix needs libpng with a zlib >=1.2.4 (not 0x%x)\n",
PNG_ZLIB_VERNUM); ZLIB_VERNUM);
return 77; return 77;
} }
#endif /* PNG_ZLIB_VERNUM */ #endif /* ZLIB_VERNUM */
#else /* No read support */ #else /* No read support */
@ -4034,3 +4037,12 @@ main(void)
return 77; return 77;
} }
#endif /* PNG_READ_SUPPORTED && PNG_EASY_ACCESS_SUPPORTED */ #endif /* PNG_READ_SUPPORTED && PNG_EASY_ACCESS_SUPPORTED */
#else /* No setjmp support */
int
main(void)
{
fprintf(stderr, "pngfix does not work without setjmp support\n");
return 77;
}
#endif /* PNG_SETJMP_SUPPORTED */