Imported from libpng-1.0.7beta14.tar

This commit is contained in:
Glenn Randers-Pehrson
2000-05-17 17:39:34 -05:00
parent ec61c23d56
commit fc4a143ec6
42 changed files with 202 additions and 153 deletions

121
png.c
View File

@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* libpng version 1.0.7beta13 - May 16, 2000
* libpng version 1.0.7beta14 - May 17, 2000
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -14,14 +14,14 @@
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_7beta13 Your_png_h_is_not_version_1_0_7beta13;
typedef version_1_0_7beta14 Your_png_h_is_not_version_1_0_7beta14;
/* Version information for C files. This had better match the version
* string defined in png.h. */
#ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */
char png_libpng_ver[12] = "1.0.7beta13";
char png_libpng_ver[12] = "1.0.7beta14";
/* png_sig was changed to a function in version 1.0.5c */
/* Place to hold the signature string for a PNG file. */
@@ -289,14 +289,14 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num
#if defined(PNG_TEXT_SUPPORTED)
/* free text item num or (if num == -1) all text items */
#ifdef PNG_FREE_ME_SUPPORTED
if (mask & info_ptr->free_me & PNG_FREE_TEXT)
if ((mask & PNG_FREE_TEXT) & info_ptr->free_me)
#else
if (mask & PNG_FREE_TEXT)
#endif
{
if (num != -1)
{
if (info_ptr->text[num].key)
if (info_ptr->text && info_ptr->text[num].key)
{
png_free(png_ptr, info_ptr->text[num].key);
info_ptr->text[num].key = NULL;
@@ -304,15 +304,12 @@ if (mask & PNG_FREE_TEXT)
}
else
{
if (info_ptr->text != NULL)
{
int i;
for (i = 0; i < info_ptr->num_text; i++)
png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, i);
png_free(png_ptr, info_ptr->text);
info_ptr->text = NULL;
info_ptr->num_text=0;
}
}
}
#endif
@@ -320,94 +317,82 @@ if (mask & PNG_FREE_TEXT)
#if defined(PNG_tRNS_SUPPORTED)
/* free any tRNS entry */
#ifdef PNG_FREE_ME_SUPPORTED
if (mask & PNG_FREE_TRNS & info_ptr->free_me)
if ((mask & PNG_FREE_TRNS) & info_ptr->free_me)
#else
if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS))
#endif
{
if (info_ptr->valid & PNG_INFO_tRNS)
{
png_free(png_ptr, info_ptr->trans);
info_ptr->valid &= ~PNG_INFO_tRNS;
}
png_free(png_ptr, info_ptr->trans);
info_ptr->valid &= ~PNG_INFO_tRNS;
}
#endif
#if defined(PNG_sCAL_SUPPORTED)
/* free any sCAL entry */
#ifdef PNG_FREE_ME_SUPPORTED
if (mask & PNG_FREE_SCAL & info_ptr->free_me)
if ((mask & PNG_FREE_SCAL) & info_ptr->free_me)
#else
if (mask & PNG_FREE_SCAL)
#endif
{
if (info_ptr->valid & PNG_INFO_sCAL)
{
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
png_free(png_ptr, info_ptr->scal_s_width);
png_free(png_ptr, info_ptr->scal_s_height);
png_free(png_ptr, info_ptr->scal_s_width);
png_free(png_ptr, info_ptr->scal_s_height);
#endif
info_ptr->valid &= ~PNG_INFO_sCAL;
}
info_ptr->valid &= ~PNG_INFO_sCAL;
}
#endif
#if defined(PNG_pCAL_SUPPORTED)
/* free any pCAL entry */
#ifdef PNG_FREE_ME_SUPPORTED
if (mask & PNG_FREE_PCAL & info_ptr->free_me)
if ((mask & PNG_FREE_PCAL) & info_ptr->free_me)
#else
if (mask & PNG_FREE_PCAL)
#endif
{
if (info_ptr->valid & PNG_INFO_pCAL)
{
png_free(png_ptr, info_ptr->pcal_purpose);
png_free(png_ptr, info_ptr->pcal_units);
if (info_ptr->pcal_params != NULL)
{
int i;
for (i = 0; i < (int)info_ptr->pcal_nparams; i++)
{
png_free(png_ptr, info_ptr->pcal_params[i]);
}
png_free(png_ptr, info_ptr->pcal_params);
info_ptr->valid &= ~PNG_INFO_pCAL;
}
}
png_free(png_ptr, info_ptr->pcal_purpose);
png_free(png_ptr, info_ptr->pcal_units);
if (info_ptr->pcal_params != NULL)
{
int i;
for (i = 0; i < (int)info_ptr->pcal_nparams; i++)
png_free(png_ptr, info_ptr->pcal_params[i]);
png_free(png_ptr, info_ptr->pcal_params);
}
info_ptr->valid &= ~PNG_INFO_pCAL;
}
#endif
#if defined(PNG_iCCP_SUPPORTED)
/* free any iCCP entry */
#ifdef PNG_FREE_ME_SUPPORTED
if (mask & PNG_FREE_ICCP & info_ptr->free_me)
if ((mask & PNG_FREE_ICCP) & info_ptr->free_me)
#else
if (mask & PNG_FREE_ICCP)
#endif
{
if (info_ptr->valid & PNG_INFO_iCCP)
{
png_free(png_ptr, info_ptr->iccp_name);
png_free(png_ptr, info_ptr->iccp_profile);
info_ptr->valid &= ~PNG_INFO_iCCP;
}
png_free(png_ptr, info_ptr->iccp_name);
png_free(png_ptr, info_ptr->iccp_profile);
info_ptr->valid &= ~PNG_INFO_iCCP;
}
#endif
#if defined(PNG_sPLT_SUPPORTED)
/* free a given sPLT entry, or (if num == -1) all sPLT entries */
#ifdef PNG_FREE_ME_SUPPORTED
if (mask & PNG_FREE_SPLT & info_ptr->free_me)
if ((mask & PNG_FREE_SPLT) & info_ptr->free_me)
#else
if (mask & PNG_FREE_SPLT)
#endif
{
if (num != -1)
{
png_free(png_ptr, info_ptr->splt_palettes[num].name);
png_free(png_ptr, info_ptr->splt_palettes[num].entries);
info_ptr->valid &= ~PNG_INFO_sPLT;
if(info_ptr->splt_palettes)
{
png_free(png_ptr, info_ptr->splt_palettes[num].name);
png_free(png_ptr, info_ptr->splt_palettes[num].entries);
}
}
else
{
@@ -420,21 +405,25 @@ if (mask & PNG_FREE_SPLT)
png_free(png_ptr, info_ptr->splt_palettes);
info_ptr->splt_palettes_num = 0;
}
info_ptr->valid &= ~PNG_INFO_sPLT;
}
}
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_FREE_ME_SUPPORTED
if (mask & info_ptr->free_me & PNG_FREE_UNKN)
if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
#else
if (mask & PNG_FREE_UNKN)
#endif
{
if (num != -1)
{
png_free(png_ptr, info_ptr->unknown_chunks[num].data);
info_ptr->unknown_chunks[num].data = NULL;
if(info_ptr->unknown_chunks)
{
png_free(png_ptr, info_ptr->unknown_chunks[num].data);
info_ptr->unknown_chunks[num].data = NULL;
}
}
else
{
@@ -455,38 +444,32 @@ if (mask & PNG_FREE_UNKN)
#if defined(PNG_hIST_SUPPORTED)
/* free any hIST entry */
#ifdef PNG_FREE_ME_SUPPORTED
if (mask & PNG_FREE_HIST & info_ptr->free_me)
if ((mask & PNG_FREE_HIST) & info_ptr->free_me)
#else
if ((mask & PNG_FREE_HIST) && (png_ptr->flags & PNG_FLAG_FREE_HIST))
#endif
{
if (info_ptr->valid & PNG_INFO_hIST)
{
png_free(png_ptr, info_ptr->hist);
info_ptr->valid &= ~PNG_INFO_hIST;
}
png_free(png_ptr, info_ptr->hist);
info_ptr->valid &= ~PNG_INFO_hIST;
}
#endif
/* free any PLTE entry that was internally allocated */
#ifdef PNG_FREE_ME_SUPPORTED
if (mask & PNG_FREE_PLTE & info_ptr->free_me)
if ((mask & PNG_FREE_PLTE) & info_ptr->free_me)
#else
if ((mask & PNG_FREE_PLTE) && (png_ptr->flags & PNG_FLAG_FREE_PLTE))
#endif
{
if (info_ptr->valid & PNG_INFO_PLTE)
{
png_zfree(png_ptr, info_ptr->palette);
info_ptr->valid &= ~(PNG_INFO_PLTE);
info_ptr->num_palette = 0;
}
png_zfree(png_ptr, info_ptr->palette);
info_ptr->valid &= ~PNG_INFO_PLTE;
info_ptr->num_palette = 0;
}
#if defined(PNG_INFO_IMAGE_SUPPORTED)
/* free any image bits attached to the info structure */
#ifdef PNG_FREE_ME_SUPPORTED
if (mask & info_ptr->free_me & PNG_FREE_ROWS)
if ((mask & PNG_FREE_ROWS) & info_ptr->free_me)
#else
if (mask & PNG_FREE_ROWS)
#endif
@@ -499,8 +482,10 @@ if (mask & PNG_FREE_ROWS)
png_free(png_ptr, info_ptr->row_pointers);
info_ptr->row_pointers=NULL;
}
info_ptr->valid &= ~PNG_INFO_IDAT;
}
#endif
#ifdef PNG_FREE_ME_SUPPORTED
if(num == -1)
info_ptr->free_me &= ~mask;
@@ -606,7 +591,7 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
return ("\n libpng version 1.0.7beta13 - May 16, 2000\n\
return ("\n libpng version 1.0.7beta14 - May 17, 2000\n\
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\
Copyright (c) 1996, 1997 Andreas Dilger\n\
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson\n");
@@ -624,8 +609,8 @@ png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
return("1.0.7beta13");
return("1.0.7beta13");
return("1.0.7beta14");
return("1.0.7beta14");
}
png_charp PNGAPI