Imported from libpng-1.4.0beta49.tar

This commit is contained in:
Glenn Randers-Pehrson
2009-02-28 06:08:20 -06:00
parent 79134c69a4
commit 0ffb71a6af
62 changed files with 286 additions and 191 deletions

View File

@@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.4.0 [February 14, 2009]
* Last changed in libpng 1.4.0 [February 28, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -383,7 +383,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
return;
}
png_memset(info_ptr->pcal_params[nparams],0,nparams*png_sizeof(png_charp));
png_memset(info_ptr->pcal_params, 0, (nparams + 1) * png_sizeof(png_charp));
for (i = 0; i < nparams; i++)
{
@@ -518,8 +518,15 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
of num_palette entries,
in case of an invalid PNG file that has too-large sample values. */
#ifdef PNG_CALLOC_SUPPORTED
png_ptr->palette = (png_colorp)png_calloc(png_ptr,
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
#else
png_ptr->palette = (png_colorp)png_malloc(png_ptr,
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
png_memset(png_ptr->palette, 0, PNG_MAX_PALETTE_LENGTH *
png_sizeof(png_color));
#endif
png_memcpy(png_ptr->palette, palette, num_palette * png_sizeof(png_color));
info_ptr->palette = png_ptr->palette;
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;