/src/FreeImage/Source/LibMNG/libmng_chunk_prc.c
C | 2618 lines | 1818 code | 598 blank | 202 comment | 41 complexity | 0ec3a3da5ddcd4d7a05a47beaa4cd4c7 MD5 | raw file
Possible License(s): LGPL-3.0, BSD-3-Clause, CPL-1.0, Unlicense, GPL-2.0, GPL-3.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, BSD-2-Clause, LGPL-2.1
- /* ************************************************************************** */
- /* * For conditions of distribution and use, * */
- /* * see copyright notice in libmng.h * */
- /* ************************************************************************** */
- /* * * */
- /* * project : libmng * */
- /* * file : libmng_chunk_prc.c copyright (c) 2000-2005 G.Juyn * */
- /* * version : 1.0.10 * */
- /* * * */
- /* * purpose : Chunk initialization & cleanup (implementation) * */
- /* * * */
- /* * author : G.Juyn * */
- /* * * */
- /* * comment : implementation of the chunk initialization & cleanup * */
- /* * routines * */
- /* * * */
- /* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
- /* * - changed strict-ANSI stuff * */
- /* * 0.5.1 - 05/12/2000 - G.Juyn * */
- /* * - changed trace to macro for callback error-reporting * */
- /* * * */
- /* * 0.9.1 - 07/19/2000 - G.Juyn * */
- /* * - fixed creation-code * */
- /* * * */
- /* * 0.9.2 - 07/31/2000 - G.Juyn * */
- /* * - put add_chunk() inside MNG_INCLUDE_WRITE_PROCS wrapper * */
- /* * 0.9.2 - 08/01/2000 - G.Juyn * */
- /* * - wrapper for add_chunk() changed * */
- /* * 0.9.2 - 08/05/2000 - G.Juyn * */
- /* * - changed file-prefixes * */
- /* * * */
- /* * 0.9.3 - 08/26/2000 - G.Juyn * */
- /* * - added MAGN chunk * */
- /* * 0.9.3 - 10/16/2000 - G.Juyn * */
- /* * - added support for JDAA * */
- /* * * */
- /* * 1.0.5 - 08/19/2002 - G.Juyn * */
- /* * - B597134 - libmng pollutes the linker namespace * */
- /* * - added HLAPI function to copy chunks * */
- /* * 1.0.5 - 09/14/2002 - G.Juyn * */
- /* * - added event handling for dynamic MNG * */
- /* * 1.0.5 - 10/04/2002 - G.Juyn * */
- /* * - fixed chunk-storage for evNT chunk * */
- /* * 1.0.5 - 10/17/2002 - G.Juyn * */
- /* * - fixed issue in freeing evNT chunk * */
- /* * * */
- /* * 1.0.6 - 07/07/2003 - G.R-P * */
- /* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */
- /* * - added MNG_NO_DELTA_PNG reduction feature * */
- /* * 1.0.6 - 07/14/2003 - G.R-P * */
- /* * - added MNG_NO_LOOP_SIGNALS_SUPPORTED conditional * */
- /* * 1.0.6 - 07/29/2003 - G.R-P * */
- /* * - added conditionals around PAST chunk support * */
- /* * 1.0.6 - 08/17/2003 - G.R-P * */
- /* * - added conditionals around non-VLC chunk support * */
- /* * * */
- /* * 1.0.7 - 03/24/2004 - G.R-P * */
- /* * - fixed SKIPCHUNK_eXPI -> fPRI typo * */
- /* * * */
- /* * 1.0.9 - 09/25/2004 - G.Juyn * */
- /* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */
- /* * 1.0.9 - 12/05/2004 - G.Juyn * */
- /* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */
- /* * 1.0.9 - 12/06/2004 - G.Juyn * */
- /* * - added conditional MNG_OPTIMIZE_CHUNKASSIGN * */
- /* * 1.0.9 - 12/20/2004 - G.Juyn * */
- /* * - cleaned up macro-invocations (thanks to D. Airlie) * */
- /* * * */
- /* * 1.0.10 - 07/30/2005 - G.Juyn * */
- /* * - fixed problem with CLON object during readdisplay() * */
- /* * 1.0.10 - 04/08/2007 - G.Juyn * */
- /* * - added support for mPNG proposal * */
- /* * 1.0.10 - 04/12/2007 - G.Juyn * */
- /* * - added support for ANG proposal * */
- /* * * */
- /* ************************************************************************** */
- #include "libmng.h"
- #include "libmng_data.h"
- #include "libmng_error.h"
- #include "libmng_trace.h"
- #ifdef __BORLANDC__
- #pragma hdrstop
- #endif
- #include "libmng_memory.h"
- #include "libmng_chunks.h"
- #include "libmng_chunk_prc.h"
- #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
- #pragma option -A /* force ANSI-C */
- #endif
- /* ************************************************************************** */
- /* * * */
- /* * General chunk routines * */
- /* * * */
- /* ************************************************************************** */
- void mng_add_chunk (mng_datap pData,
- mng_chunkp pChunk)
- {
- if (!pData->pFirstchunk) /* list is still empty ? */
- {
- pData->pFirstchunk = pChunk; /* then this becomes the first */
-
- #ifdef MNG_SUPPORT_WRITE
- if (!pData->iFirstchunkadded)
- {
- pData->iFirstchunkadded = ((mng_chunk_headerp)pChunk)->iChunkname;
- #endif
- if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_IHDR)
- pData->eImagetype = mng_it_png;
- else
- #ifdef MNG_INCLUDE_JNG
- if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_JHDR)
- pData->eImagetype = mng_it_jng;
- else
- #endif
- pData->eImagetype = mng_it_mng;
- pData->eSigtype = pData->eImagetype;
- #ifdef MNG_SUPPORT_WRITE
- }
- #endif
- }
- else
- { /* else we make appropriate links */
- ((mng_chunk_headerp)pChunk)->pPrev = pData->pLastchunk;
- ((mng_chunk_headerp)pData->pLastchunk)->pNext = pChunk;
- }
- pData->pLastchunk = pChunk; /* and it's always the last */
- return;
- }
- /* ************************************************************************** */
- /* * * */
- /* * Chunk specific initialization routines * */
- /* * * */
- /* ************************************************************************** */
- #ifdef MNG_OPTIMIZE_CHUNKINITFREE
- INIT_CHUNK_HDR (mng_init_general)
- {
- MNG_ALLOC (pData, *ppChunk, ((mng_chunk_headerp)pHeader)->iChunksize);
- MNG_COPY (*ppChunk, pHeader, sizeof (mng_chunk_header));
- return MNG_NOERROR;
- }
- #else /* MNG_OPTIMIZE_CHUNKINITFREE */
- /* ************************************************************************** */
- INIT_CHUNK_HDR (mng_init_ihdr)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_IHDR, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_ihdr));
- ((mng_ihdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_IHDR, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- /* ************************************************************************** */
- INIT_CHUNK_HDR (mng_init_plte)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PLTE, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_plte));
- ((mng_pltep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PLTE, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- /* ************************************************************************** */
- INIT_CHUNK_HDR (mng_init_idat)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_IDAT, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_idat));
- ((mng_idatp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_IDAT, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- /* ************************************************************************** */
- INIT_CHUNK_HDR (mng_init_iend)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_IEND, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_iend));
- ((mng_iendp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_IEND, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- /* ************************************************************************** */
- INIT_CHUNK_HDR (mng_init_trns)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_TRNS, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_trns));
- ((mng_trnsp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_TRNS, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_gAMA
- INIT_CHUNK_HDR (mng_init_gama)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_GAMA, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_gama));
- ((mng_gamap)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_GAMA, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_cHRM
- INIT_CHUNK_HDR (mng_init_chrm)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_CHRM, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_chrm));
- ((mng_chrmp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_CHRM, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_sRGB
- INIT_CHUNK_HDR (mng_init_srgb)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SRGB, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_srgb));
- ((mng_srgbp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SRGB, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_iCCP
- INIT_CHUNK_HDR (mng_init_iccp)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_ICCP, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_iccp));
- ((mng_iccpp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_ICCP, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_tEXt
- INIT_CHUNK_HDR (mng_init_text)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_TEXT, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_text));
- ((mng_textp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_TEXT, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_zTXt
- INIT_CHUNK_HDR (mng_init_ztxt)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_ZTXT, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_ztxt));
- ((mng_ztxtp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_ZTXT, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_iTXt
- INIT_CHUNK_HDR (mng_init_itxt)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_ITXT, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_itxt));
- ((mng_itxtp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_ITXT, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_bKGD
- INIT_CHUNK_HDR (mng_init_bkgd)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_BKGD, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_bkgd));
- ((mng_bkgdp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_BKGD, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_pHYs
- INIT_CHUNK_HDR (mng_init_phys)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PHYS, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_phys));
- ((mng_physp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PHYS, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_sBIT
- INIT_CHUNK_HDR (mng_init_sbit)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SBIT, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_sbit));
- ((mng_sbitp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SBIT, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_sPLT
- INIT_CHUNK_HDR (mng_init_splt)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SPLT, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_splt));
- ((mng_spltp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SPLT, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_hIST
- INIT_CHUNK_HDR (mng_init_hist)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_HIST, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_hist));
- ((mng_histp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_HIST, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_tIME
- INIT_CHUNK_HDR (mng_init_time)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_TIME, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_time));
- ((mng_timep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_TIME, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- INIT_CHUNK_HDR (mng_init_mhdr)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_MHDR, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_mhdr));
- ((mng_mhdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_MHDR, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- /* ************************************************************************** */
- INIT_CHUNK_HDR (mng_init_mend)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_MEND, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_mend));
- ((mng_mendp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_MEND, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_LOOP
- INIT_CHUNK_HDR (mng_init_loop)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_LOOP, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_loop));
- ((mng_loopp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_LOOP, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- /* ************************************************************************** */
- INIT_CHUNK_HDR (mng_init_endl)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_ENDL, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_endl));
- ((mng_endlp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_ENDL, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_DEFI
- INIT_CHUNK_HDR (mng_init_defi)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_DEFI, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_defi));
- ((mng_defip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_DEFI, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_BASI
- INIT_CHUNK_HDR (mng_init_basi)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_BASI, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_basi));
- ((mng_basip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_BASI, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_CLON
- INIT_CHUNK_HDR (mng_init_clon)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_CLON, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_clon));
- ((mng_clonp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_CLON, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_PAST
- INIT_CHUNK_HDR (mng_init_past)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PAST, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_past));
- ((mng_pastp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PAST, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_DISC
- INIT_CHUNK_HDR (mng_init_disc)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_DISC, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_disc));
- ((mng_discp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_DISC, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_BACK
- INIT_CHUNK_HDR (mng_init_back)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_BACK, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_back));
- ((mng_backp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_BACK, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_FRAM
- INIT_CHUNK_HDR (mng_init_fram)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_FRAM, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_fram));
- ((mng_framp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_FRAM, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_MOVE
- INIT_CHUNK_HDR (mng_init_move)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_MOVE, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_move));
- ((mng_movep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_MOVE, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_CLIP
- INIT_CHUNK_HDR (mng_init_clip)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_CLIP, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_clip));
- ((mng_clipp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_CLIP, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_SHOW
- INIT_CHUNK_HDR (mng_init_show)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SHOW, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_show));
- ((mng_showp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SHOW, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_TERM
- INIT_CHUNK_HDR (mng_init_term)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_TERM, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_term));
- ((mng_termp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_TERM, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_SAVE
- INIT_CHUNK_HDR (mng_init_save)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SAVE, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_save));
- ((mng_savep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SAVE, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_SEEK
- INIT_CHUNK_HDR (mng_init_seek)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SEEK, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_seek));
- ((mng_seekp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_SEEK, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_eXPI
- INIT_CHUNK_HDR (mng_init_expi)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_EXPI, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_expi));
- ((mng_expip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_EXPI, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_fPRI
- INIT_CHUNK_HDR (mng_init_fpri)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_FPRI, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_fpri));
- ((mng_fprip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_FPRI, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_nEED
- INIT_CHUNK_HDR (mng_init_need)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_NEED, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_need));
- ((mng_needp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_NEED, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_pHYg
- INIT_CHUNK_HDR (mng_init_phyg)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PHYG, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_phyg));
- ((mng_phygp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PHYG, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifdef MNG_INCLUDE_JNG
- INIT_CHUNK_HDR (mng_init_jhdr)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_JHDR, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_jhdr));
- ((mng_jhdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_JHDR, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif /* MNG_INCLUDE_JNG */
- /* ************************************************************************** */
- #ifdef MNG_INCLUDE_JNG
- INIT_CHUNK_HDR (mng_init_jdaa)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_JDAA, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_jdaa));
- ((mng_jdaap)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_JDAA, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif /* MNG_INCLUDE_JNG */
- /* ************************************************************************** */
- #ifdef MNG_INCLUDE_JNG
- INIT_CHUNK_HDR (mng_init_jdat)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_JDAT, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_jdat));
- ((mng_jdatp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_JDAT, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif /* MNG_INCLUDE_JNG */
- /* ************************************************************************** */
- #ifdef MNG_INCLUDE_JNG
- INIT_CHUNK_HDR (mng_init_jsep)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_JSEP, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_jsep));
- ((mng_jsepp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_JSEP, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif /* MNG_INCLUDE_JNG */
- /* ************************************************************************** */
- #ifndef MNG_NO_DELTA_PNG
- INIT_CHUNK_HDR (mng_init_dhdr)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_DHDR, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_dhdr));
- ((mng_dhdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_DHDR, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_NO_DELTA_PNG
- INIT_CHUNK_HDR (mng_init_prom)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PROM, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_prom));
- ((mng_promp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PROM, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_NO_DELTA_PNG
- INIT_CHUNK_HDR (mng_init_ipng)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_IPNG, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_ipng));
- ((mng_ipngp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_IPNG, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_NO_DELTA_PNG
- INIT_CHUNK_HDR (mng_init_pplt)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PPLT, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_pplt));
- ((mng_ppltp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_PPLT, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_NO_DELTA_PNG
- #ifdef MNG_INCLUDE_JNG
- INIT_CHUNK_HDR (mng_init_ijng)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_IJNG, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_ijng));
- ((mng_ijngp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_IJNG, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_NO_DELTA_PNG
- INIT_CHUNK_HDR (mng_init_drop)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_DROP, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_drop));
- ((mng_dropp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_DROP, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_NO_DELTA_PNG
- #ifndef MNG_SKIPCHUNK_DBYK
- INIT_CHUNK_HDR (mng_init_dbyk)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_DBYK, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_dbyk));
- ((mng_dbykp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_DBYK, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_NO_DELTA_PNG
- #ifndef MNG_SKIPCHUNK_ORDR
- INIT_CHUNK_HDR (mng_init_ordr)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_ORDR, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_ordr));
- ((mng_ordrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_ORDR, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_MAGN
- INIT_CHUNK_HDR (mng_init_magn)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_MAGN, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_magn));
- ((mng_magnp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_MAGN, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_evNT
- INIT_CHUNK_HDR (mng_init_evnt)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_EVNT, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_evnt));
- ((mng_evntp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_EVNT, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- INIT_CHUNK_HDR (mng_init_unknown)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_UNKNOWN, MNG_LC_START);
- #endif
- MNG_ALLOC (pData, *ppChunk, sizeof (mng_unknown_chunk));
- ((mng_unknown_chunkp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader);
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_INIT_UNKNOWN, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- /* ************************************************************************** */
- #endif /* MNG_OPTIMIZE_CHUNKINITFREE */
- /* ************************************************************************** */
- /* * * */
- /* * Chunk specific cleanup routines * */
- /* * * */
- /* ************************************************************************** */
- #ifdef MNG_OPTIMIZE_CHUNKINITFREE
- FREE_CHUNK_HDR (mng_free_general)
- {
- MNG_FREEX (pData, pHeader, ((mng_chunk_headerp)pHeader)->iChunksize);
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- FREE_CHUNK_HDR (mng_free_ihdr)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_IHDR, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_ihdr));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_IHDR, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- FREE_CHUNK_HDR (mng_free_plte)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PLTE, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_plte));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PLTE, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- FREE_CHUNK_HDR (mng_free_idat)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_IDAT, MNG_LC_START);
- #endif
- if (((mng_idatp)pHeader)->iDatasize)
- MNG_FREEX (pData, ((mng_idatp)pHeader)->pData,
- ((mng_idatp)pHeader)->iDatasize);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_idat));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_IDAT, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- FREE_CHUNK_HDR (mng_free_iend)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_IEND, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_iend));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_IEND, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- FREE_CHUNK_HDR (mng_free_trns)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_TRNS, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_trns));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_TRNS, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_gAMA
- FREE_CHUNK_HDR (mng_free_gama)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_GAMA, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_gama));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_GAMA, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_cHRM
- FREE_CHUNK_HDR (mng_free_chrm)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_CHRM, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_chrm));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_CHRM, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_sRGB
- FREE_CHUNK_HDR (mng_free_srgb)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SRGB, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_srgb));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SRGB, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_iCCP
- FREE_CHUNK_HDR (mng_free_iccp)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ICCP, MNG_LC_START);
- #endif
- if (((mng_iccpp)pHeader)->iNamesize)
- MNG_FREEX (pData, ((mng_iccpp)pHeader)->zName,
- ((mng_iccpp)pHeader)->iNamesize + 1);
- if (((mng_iccpp)pHeader)->iProfilesize)
- MNG_FREEX (pData, ((mng_iccpp)pHeader)->pProfile,
- ((mng_iccpp)pHeader)->iProfilesize);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_iccp));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ICCP, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_tEXt
- FREE_CHUNK_HDR (mng_free_text)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_TEXT, MNG_LC_START);
- #endif
- if (((mng_textp)pHeader)->iKeywordsize)
- MNG_FREEX (pData, ((mng_textp)pHeader)->zKeyword,
- ((mng_textp)pHeader)->iKeywordsize + 1);
- if (((mng_textp)pHeader)->iTextsize)
- MNG_FREEX (pData, ((mng_textp)pHeader)->zText,
- ((mng_textp)pHeader)->iTextsize + 1);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_text));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_TEXT, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_zTXt
- FREE_CHUNK_HDR (mng_free_ztxt)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ZTXT, MNG_LC_START);
- #endif
- if (((mng_ztxtp)pHeader)->iKeywordsize)
- MNG_FREEX (pData, ((mng_ztxtp)pHeader)->zKeyword,
- ((mng_ztxtp)pHeader)->iKeywordsize + 1);
- if (((mng_ztxtp)pHeader)->iTextsize)
- MNG_FREEX (pData, ((mng_ztxtp)pHeader)->zText,
- ((mng_ztxtp)pHeader)->iTextsize);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_ztxt));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ZTXT, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_iTXt
- FREE_CHUNK_HDR (mng_free_itxt)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ITXT, MNG_LC_START);
- #endif
- if (((mng_itxtp)pHeader)->iKeywordsize)
- MNG_FREEX (pData, ((mng_itxtp)pHeader)->zKeyword,
- ((mng_itxtp)pHeader)->iKeywordsize + 1);
- if (((mng_itxtp)pHeader)->iLanguagesize)
- MNG_FREEX (pData, ((mng_itxtp)pHeader)->zLanguage,
- ((mng_itxtp)pHeader)->iLanguagesize + 1);
- if (((mng_itxtp)pHeader)->iTranslationsize)
- MNG_FREEX (pData, ((mng_itxtp)pHeader)->zTranslation,
- ((mng_itxtp)pHeader)->iTranslationsize + 1);
- if (((mng_itxtp)pHeader)->iTextsize)
- MNG_FREEX (pData, ((mng_itxtp)pHeader)->zText,
- ((mng_itxtp)pHeader)->iTextsize);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_itxt));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ITXT, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifdef MNG_INCLUDE_MPNG_PROPOSAL
- FREE_CHUNK_HDR (mng_free_mpng)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_MPNG, MNG_LC_START);
- #endif
- if (((mng_mpngp)pHeader)->iFramessize)
- MNG_FREEX (pData, ((mng_mpngp)pHeader)->pFrames,
- ((mng_mpngp)pHeader)->iFramessize);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_mpng));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_MPNG, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifdef MNG_INCLUDE_ANG_PROPOSAL
- FREE_CHUNK_HDR (mng_free_adat)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ADAT, MNG_LC_START);
- #endif
- if (((mng_adatp)pHeader)->iTilessize)
- MNG_FREEX (pData, ((mng_adatp)pHeader)->pTiles, ((mng_adatp)pHeader)->iTilessize);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_adat));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ADAT, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_bKGD
- FREE_CHUNK_HDR (mng_free_bkgd)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_BKGD, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_bkgd));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_BKGD, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_pHYs
- FREE_CHUNK_HDR (mng_free_phys)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PHYS, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_phys));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PHYS, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_sBIT
- FREE_CHUNK_HDR (mng_free_sbit)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SBIT, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_sbit));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SBIT, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_sPLT
- FREE_CHUNK_HDR (mng_free_splt)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SPLT, MNG_LC_START);
- #endif
- if (((mng_spltp)pHeader)->iNamesize)
- MNG_FREEX (pData, ((mng_spltp)pHeader)->zName,
- ((mng_spltp)pHeader)->iNamesize + 1);
- if (((mng_spltp)pHeader)->iEntrycount)
- MNG_FREEX (pData, ((mng_spltp)pHeader)->pEntries,
- ((mng_spltp)pHeader)->iEntrycount *
- (((mng_spltp)pHeader)->iSampledepth * 3 + sizeof (mng_uint16)) );
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_splt));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SPLT, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_hIST
- FREE_CHUNK_HDR (mng_free_hist)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_HIST, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_hist));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_HIST, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_tIME
- FREE_CHUNK_HDR (mng_free_time)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_TIME, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_time));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_TIME, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- FREE_CHUNK_HDR (mng_free_mhdr)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_MHDR, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_mhdr));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_MHDR, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- FREE_CHUNK_HDR (mng_free_mend)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_MEND, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_mend));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_MEND, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_LOOP
- FREE_CHUNK_HDR (mng_free_loop)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_LOOP, MNG_LC_START);
- #endif
- #ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED
- if (((mng_loopp)pHeader)->iCount)
- MNG_FREEX (pData, ((mng_loopp)pHeader)->pSignals,
- ((mng_loopp)pHeader)->iCount * sizeof (mng_uint32) );
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_loop));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_LOOP, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- FREE_CHUNK_HDR (mng_free_endl)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ENDL, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_endl));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ENDL, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_DEFI
- FREE_CHUNK_HDR (mng_free_defi)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_DEFI, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_defi));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_DEFI, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_BASI
- FREE_CHUNK_HDR (mng_free_basi)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_BASI, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_basi));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_BASI, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_CLON
- FREE_CHUNK_HDR (mng_free_clon)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_CLON, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_clon));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_CLON, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_PAST
- FREE_CHUNK_HDR (mng_free_past)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PAST, MNG_LC_START);
- #endif
- if (((mng_pastp)pHeader)->iCount)
- MNG_FREEX (pData, ((mng_pastp)pHeader)->pSources,
- ((mng_pastp)pHeader)->iCount * sizeof (mng_past_source) );
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_past));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PAST, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_DISC
- FREE_CHUNK_HDR (mng_free_disc)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_DISC, MNG_LC_START);
- #endif
- if (((mng_discp)pHeader)->iCount)
- MNG_FREEX (pData, ((mng_discp)pHeader)->pObjectids,
- ((mng_discp)pHeader)->iCount * sizeof (mng_uint16) );
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_disc));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_DISC, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_BACK
- FREE_CHUNK_HDR (mng_free_back)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_BACK, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_back));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_BACK, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_FRAM
- FREE_CHUNK_HDR (mng_free_fram)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_FRAM, MNG_LC_START);
- #endif
- if (((mng_framp)pHeader)->iNamesize)
- MNG_FREEX (pData, ((mng_framp)pHeader)->zName,
- ((mng_framp)pHeader)->iNamesize + 1);
- if (((mng_framp)pHeader)->iCount)
- MNG_FREEX (pData, ((mng_framp)pHeader)->pSyncids,
- ((mng_framp)pHeader)->iCount * sizeof (mng_uint32) );
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_fram));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_FRAM, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_MOVE
- FREE_CHUNK_HDR (mng_free_move)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_MOVE, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_move));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_MOVE, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_CLIP
- FREE_CHUNK_HDR (mng_free_clip)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_CLIP, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_clip));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_CLIP, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_SHOW
- FREE_CHUNK_HDR (mng_free_show)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SHOW, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_show));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SHOW, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_TERM
- FREE_CHUNK_HDR (mng_free_term)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_TERM, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_term));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_TERM, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_SAVE
- FREE_CHUNK_HDR (mng_free_save)
- {
- mng_save_entryp pEntry = ((mng_savep)pHeader)->pEntries;
- mng_uint32 iX;
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SAVE, MNG_LC_START);
- #endif
- for (iX = 0; iX < ((mng_savep)pHeader)->iCount; iX++)
- {
- if (pEntry->iNamesize)
- MNG_FREEX (pData, pEntry->zName, pEntry->iNamesize);
- pEntry = pEntry + sizeof (mng_save_entry);
- }
- if (((mng_savep)pHeader)->iCount)
- MNG_FREEX (pData, ((mng_savep)pHeader)->pEntries,
- ((mng_savep)pHeader)->iCount * sizeof (mng_save_entry) );
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_save));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SAVE, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_SEEK
- FREE_CHUNK_HDR (mng_free_seek)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SEEK, MNG_LC_START);
- #endif
- if (((mng_seekp)pHeader)->iNamesize)
- MNG_FREEX (pData, ((mng_seekp)pHeader)->zName,
- ((mng_seekp)pHeader)->iNamesize + 1);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_seek));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_SEEK, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_eXPI
- FREE_CHUNK_HDR (mng_free_expi)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_EXPI, MNG_LC_START);
- #endif
- if (((mng_expip)pHeader)->iNamesize)
- MNG_FREEX (pData, ((mng_expip)pHeader)->zName,
- ((mng_expip)pHeader)->iNamesize + 1);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_expi));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_EXPI, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_fPRI
- FREE_CHUNK_HDR (mng_free_fpri)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_FPRI, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_fpri));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_FPRI, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_nEED
- FREE_CHUNK_HDR (mng_free_need)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_NEED, MNG_LC_START);
- #endif
- if (((mng_needp)pHeader)->iKeywordssize)
- MNG_FREEX (pData, ((mng_needp)pHeader)->zKeywords,
- ((mng_needp)pHeader)->iKeywordssize + 1);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_need));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_NEED, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_pHYg
- FREE_CHUNK_HDR (mng_free_phyg)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PHYG, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_phyg));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PHYG, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifdef MNG_INCLUDE_JNG
- FREE_CHUNK_HDR (mng_free_jhdr)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_JHDR, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_jhdr));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_JHDR, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif /* MNG_INCLUDE_JNG */
- #endif
- /* ************************************************************************** */
- #ifdef MNG_INCLUDE_JNG
- FREE_CHUNK_HDR (mng_free_jdaa)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_JDAA, MNG_LC_START);
- #endif
- if (((mng_jdaap)pHeader)->iDatasize)
- MNG_FREEX (pData, ((mng_jdaap)pHeader)->pData,
- ((mng_jdaap)pHeader)->iDatasize);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_jdaa));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_JDAA, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif /* MNG_INCLUDE_JNG */
- /* ************************************************************************** */
- #ifdef MNG_INCLUDE_JNG
- FREE_CHUNK_HDR (mng_free_jdat)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_JDAT, MNG_LC_START);
- #endif
- if (((mng_jdatp)pHeader)->iDatasize)
- MNG_FREEX (pData, ((mng_jdatp)pHeader)->pData,
- ((mng_jdatp)pHeader)->iDatasize);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_jdat));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_JDAT, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif /* MNG_INCLUDE_JNG */
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifdef MNG_INCLUDE_JNG
- FREE_CHUNK_HDR (mng_free_jsep)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_JSEP, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_jsep));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_JSEP, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif /* MNG_INCLUDE_JNG */
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_NO_DELTA_PNG
- FREE_CHUNK_HDR (mng_free_dhdr)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_DHDR, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_dhdr));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_DHDR, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_NO_DELTA_PNG
- FREE_CHUNK_HDR (mng_free_prom)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PROM, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_prom));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PROM, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_NO_DELTA_PNG
- FREE_CHUNK_HDR (mng_free_ipng)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_IPNG, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_ipng));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_IPNG, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_NO_DELTA_PNG
- FREE_CHUNK_HDR (mng_free_pplt)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PPLT, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_pplt));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_PPLT, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_NO_DELTA_PNG
- #ifdef MNG_INCLUDE_JNG
- FREE_CHUNK_HDR (mng_free_ijng)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_IJNG, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_ijng));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_IJNG, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_NO_DELTA_PNG
- FREE_CHUNK_HDR (mng_free_drop)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_DROP, MNG_LC_START);
- #endif
- if (((mng_dropp)pHeader)->iCount)
- MNG_FREEX (pData, ((mng_dropp)pHeader)->pChunknames,
- ((mng_dropp)pHeader)->iCount * sizeof (mng_chunkid) );
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_drop));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_DROP, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- #ifndef MNG_NO_DELTA_PNG
- #ifndef MNG_SKIPCHUNK_DBYK
- FREE_CHUNK_HDR (mng_free_dbyk)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_DBYK, MNG_LC_START);
- #endif
- if (((mng_dbykp)pHeader)->iKeywordssize)
- MNG_FREEX (pData, ((mng_dbykp)pHeader)->zKeywords,
- ((mng_dbykp)pHeader)->iKeywordssize);
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_dbyk));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_DBYK, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_NO_DELTA_PNG
- #ifndef MNG_SKIPCHUNK_ORDR
- FREE_CHUNK_HDR (mng_free_ordr)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ORDR, MNG_LC_START);
- #endif
- if (((mng_ordrp)pHeader)->iCount)
- MNG_FREEX (pData, ((mng_ordrp)pHeader)->pEntries,
- ((mng_ordrp)pHeader)->iCount * sizeof (mng_ordr_entry) );
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_ordr));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_ORDR, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- #ifndef MNG_SKIPCHUNK_MAGN
- FREE_CHUNK_HDR (mng_free_magn)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_MAGN, MNG_LC_START);
- #endif
- MNG_FREEX (pData, pHeader, sizeof (mng_magn));
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_MAGN, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif
- /* ************************************************************************** */
- #ifndef MNG_SKIPCHUNK_evNT
- FREE_CHUNK_HDR (mng_free_evnt)
- {
- mng_evnt_entryp pEntry = ((mng_evntp)pHeader)->pEntries;
- mng_uint32 iX;
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_EVNT, MNG_LC_START);
- #endif
- for (iX = 0; iX < ((mng_evntp)pHeader)->iCount; iX++)
- {
- if (pEntry->iSegmentnamesize)
- MNG_FREEX (pData, pEntry->zSegmentname, pEntry->iSegmentnamesize+1);
- pEntry++;
- }
- if (((mng_evntp)pHeader)->iCount)
- MNG_FREEX (pData, ((mng_evntp)pHeader)->pEntries,
- ((mng_evntp)pHeader)->iCount * sizeof (mng_evnt_entry) );
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- MNG_FREEX (pData, pHeader, sizeof (mng_evnt));
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_FREE_EVNT, MNG_LC_END);
- #endif
- #ifndef MNG_OPTIMIZE_CHUNKINITFREE
- return MNG_NOERROR;
- #else
- return mng_free_general(pData, pHeader);
- #endif
- }
- #endif
- /* ************************************************************************** */
- FREE_CHUNK_HDR (mng_free_unknown)