| /* ************************************************************************** */ |
| /* * For conditions of distribution and use, * */ |
| /* * see copyright notice in libmng.h * */ |
| /* ************************************************************************** */ |
| /* * * */ |
| /* * project : libmng * */ |
| /* * file : libmng_chunk_descr.c copyright (c) 2005-2007 G.Juyn * */ |
| /* * version : 1.0.10 * */ |
| /* * * */ |
| /* * purpose : Chunk descriptor functions (implementation) * */ |
| /* * * */ |
| /* * author : G.Juyn * */ |
| /* * * */ |
| /* * comment : implementation of the chunk- anf field-descriptor * */ |
| /* * routines * */ |
| /* * * */ |
| /* * changes : 1.0.9 - 12/06/2004 - G.Juyn * */ |
| /* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ |
| /* * 1.0.9 - 12/11/2004 - G.Juyn * */ |
| /* * - made all constants 'static' * */ |
| /* * 1.0.9 - 12/20/2004 - G.Juyn * */ |
| /* * - cleaned up macro-invocations (thanks to D. Airlie) * */ |
| /* * 1.0.9 - 01/17/2005 - G.Juyn * */ |
| /* * - fixed problem with global PLTE/tRNS * */ |
| /* * * */ |
| /* * 1.0.10 - 01/17/2005 - G.R-P. * */ |
| /* * - added typecast to appease the compiler * */ |
| /* * 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 <stddef.h> /* needed for offsetof() */ |
| |
| #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_objects.h" |
| #include "libmng_chunks.h" |
| #include "libmng_chunk_descr.h" |
| #include "libmng_object_prc.h" |
| #include "libmng_chunk_prc.h" |
| #include "libmng_chunk_io.h" |
| #include "libmng_display.h" |
| |
| #ifdef MNG_INCLUDE_ANG_PROPOSAL |
| #include "libmng_pixels.h" |
| #include "libmng_filter.h" |
| #endif |
| |
| #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) |
| #pragma option -A /* force ANSI-C */ |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifdef MNG_OPTIMIZE_CHUNKREADER |
| #if defined(MNG_INCLUDE_READ_PROCS) || defined(MNG_INCLUDE_WRITE_PROCS) |
| |
| /* ************************************************************************** */ |
| /* ************************************************************************** */ |
| /* PNG chunks */ |
| |
| MNG_LOCAL mng_field_descriptor mng_fields_ihdr [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, |
| 1, 0, 4, 4, |
| offsetof(mng_ihdr, iWidth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, |
| 1, 0, 4, 4, |
| offsetof(mng_ihdr, iHeight), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 1, 16, 1, 1, |
| offsetof(mng_ihdr, iBitdepth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 6, 1, 1, |
| offsetof(mng_ihdr, iColortype), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 1, 1, |
| offsetof(mng_ihdr, iCompression), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 1, 1, |
| offsetof(mng_ihdr, iFilter), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_ihdr, iInterlace), MNG_NULL, MNG_NULL} |
| }; |
| |
| /* ************************************************************************** */ |
| |
| MNG_LOCAL mng_field_descriptor mng_fields_plte [] = |
| { |
| {mng_debunk_plte, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| |
| /* ************************************************************************** */ |
| |
| MNG_LOCAL mng_field_descriptor mng_fields_idat [] = |
| { |
| {MNG_NULL, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| offsetof(mng_idat, pData), MNG_NULL, offsetof(mng_idat, iDatasize)} |
| }; |
| |
| /* ************************************************************************** */ |
| |
| MNG_LOCAL mng_field_descriptor mng_fields_trns [] = |
| { |
| {mng_debunk_trns, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_gAMA |
| MNG_LOCAL mng_field_descriptor mng_fields_gama [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_gama, iGamma), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_cHRM |
| MNG_LOCAL mng_field_descriptor mng_fields_chrm [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_chrm, iWhitepointx), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_chrm, iWhitepointy), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_chrm, iRedx), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_chrm, iRedy), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_chrm, iGreeny), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_chrm, iGreeny), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_chrm, iBluex), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_chrm, iBluey), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_sRGB |
| MNG_LOCAL mng_field_descriptor mng_fields_srgb [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 4, 1, 1, |
| offsetof(mng_srgb, iRenderingintent), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_iCCP |
| MNG_LOCAL mng_field_descriptor mng_fields_iccp [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_TERMINATOR, |
| 0, 0, 1, 79, |
| offsetof(mng_iccp, zName), MNG_NULL, offsetof(mng_iccp, iNamesize)}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 1, 1, |
| offsetof(mng_iccp, iCompression), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_DEFLATED, |
| 0, 0, 0, 0, |
| offsetof(mng_iccp, pProfile), MNG_NULL, offsetof(mng_iccp, iProfilesize)} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_tEXt |
| MNG_LOCAL mng_field_descriptor mng_fields_text [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_TERMINATOR, |
| 0, 0, 1, 79, |
| offsetof(mng_text, zKeyword), MNG_NULL, offsetof(mng_text, iKeywordsize)}, |
| {MNG_NULL, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| offsetof(mng_text, zText), MNG_NULL, offsetof(mng_text, iTextsize)} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_zTXt |
| MNG_LOCAL mng_field_descriptor mng_fields_ztxt [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_TERMINATOR, |
| 0, 0, 1, 79, |
| offsetof(mng_ztxt, zKeyword), MNG_NULL, offsetof(mng_ztxt, iKeywordsize)}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 1, 1, |
| offsetof(mng_ztxt, iCompression), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_DEFLATED, |
| 0, 0, 0, 0, |
| offsetof(mng_ztxt, zText), MNG_NULL, offsetof(mng_ztxt, iTextsize)} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_iTXt |
| MNG_LOCAL mng_field_descriptor mng_fields_itxt [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_TERMINATOR, |
| 0, 0, 1, 79, |
| offsetof(mng_itxt, zKeyword), MNG_NULL, offsetof(mng_itxt, iKeywordsize)}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_itxt, iCompressionflag), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 1, 1, |
| offsetof(mng_itxt, iCompressionmethod), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_TERMINATOR, |
| 0, 0, 0, 0, |
| offsetof(mng_itxt, zLanguage), MNG_NULL, offsetof(mng_itxt, iLanguagesize)}, |
| {MNG_NULL, |
| MNG_FIELD_TERMINATOR, |
| 0, 0, 0, 0, |
| offsetof(mng_itxt, zTranslation), MNG_NULL, offsetof(mng_itxt, iTranslationsize)}, |
| {mng_deflate_itxt, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_bKGD |
| MNG_LOCAL mng_field_descriptor mng_fields_bkgd [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_PUTIMGTYPE, |
| 0, 0, 0, 0, |
| offsetof(mng_bkgd, iType), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE3, |
| 0, 0xFF, 1, 1, |
| offsetof(mng_bkgd, iIndex), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE0 | MNG_FIELD_IFIMGTYPE4, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_bkgd, iGray), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE6, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_bkgd, iRed), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE6, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_bkgd, iGreen), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE6, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_bkgd, iBlue), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_pHYs |
| MNG_LOCAL mng_field_descriptor mng_fields_phys [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_phys, iSizex), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_phys, iSizey), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_phys, iUnit), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_sBIT |
| MNG_LOCAL mng_field_descriptor mng_fields_sbit [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_PUTIMGTYPE, |
| 0, 0, 0, 0, |
| offsetof(mng_sbit, iType), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_IFIMGTYPES, |
| 0, 0xFF, 1, 1, |
| offsetof(mng_sbit, aBits[0]), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE3 | MNG_FIELD_IFIMGTYPE4 | MNG_FIELD_IFIMGTYPE6, |
| 0, 0xFF, 1, 1, |
| offsetof(mng_sbit, aBits[1]), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE3 | MNG_FIELD_IFIMGTYPE6, |
| 0, 0xFF, 1, 1, |
| offsetof(mng_sbit, aBits[2]), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE6, |
| 0, 0xFF, 1, 1, |
| offsetof(mng_sbit, aBits[3]), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_sPLT |
| MNG_LOCAL mng_field_descriptor mng_fields_splt [] = |
| { |
| {MNG_NULL, |
| MNG_NULL, |
| 0, 0, 1, 79, |
| offsetof(mng_splt, zName), MNG_NULL, offsetof(mng_splt, iNamesize)}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 8, 16, 1, 1, |
| offsetof(mng_splt, iSampledepth), MNG_NULL, MNG_NULL}, |
| {mng_splt_entries, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_hIST |
| MNG_LOCAL mng_field_descriptor mng_fields_hist [] = |
| { |
| {mng_hist_entries, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_tIME |
| MNG_LOCAL mng_field_descriptor mng_fields_time [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_time, iYear), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 1, 12, 1, 1, |
| offsetof(mng_time, iMonth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 1, 31, 1, 1, |
| offsetof(mng_time, iDay), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 24, 1, 1, |
| offsetof(mng_time, iHour), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 60, 1, 1, |
| offsetof(mng_time, iMinute), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 60, 1, 1, |
| offsetof(mng_time, iSecond), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| /* ************************************************************************** */ |
| /* JNG chunks */ |
| |
| #ifdef MNG_INCLUDE_JNG |
| MNG_LOCAL mng_field_descriptor mng_fields_jhdr [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, |
| 1, 0, 4, 4, |
| offsetof(mng_jhdr, iWidth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, |
| 1, 0, 4, 4, |
| offsetof(mng_jhdr, iHeight), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 8, 16, 1, 1, |
| offsetof(mng_jhdr, iColortype), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 8, 20, 1, 1, |
| offsetof(mng_jhdr, iImagesampledepth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 8, 8, 1, 1, |
| offsetof(mng_jhdr, iImagecompression), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 8, 1, 1, |
| offsetof(mng_jhdr, iImageinterlace), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 16, 1, 1, |
| offsetof(mng_jhdr, iAlphasampledepth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 8, 1, 1, |
| offsetof(mng_jhdr, iAlphacompression), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 1, 1, |
| offsetof(mng_jhdr, iAlphafilter), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_jhdr, iAlphainterlace), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifdef MNG_INCLUDE_JNG |
| #define mng_fields_jdaa mng_fields_idat |
| #define mng_fields_jdat mng_fields_idat |
| #endif |
| |
| /* ************************************************************************** */ |
| /* ************************************************************************** */ |
| /* MNG chunks */ |
| |
| MNG_LOCAL mng_field_descriptor mng_fields_mhdr [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_mhdr, iWidth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_mhdr, iHeight), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_mhdr, iTicks), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_mhdr, iLayercount), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_mhdr, iFramecount), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_mhdr, iPlaytime), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_mhdr, iSimplicity), MNG_NULL, MNG_NULL} |
| }; |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_LOOP |
| MNG_LOCAL mng_field_descriptor mng_fields_loop [] = |
| { |
| {mng_debunk_loop, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_LOOP |
| MNG_LOCAL mng_field_descriptor mng_fields_endl [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFF, 1, 1, |
| offsetof(mng_endl, iLevel), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_DEFI |
| MNG_LOCAL mng_field_descriptor mng_fields_defi [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_defi, iObjectid), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 0xFF, 1, 1, |
| offsetof(mng_defi, iDonotshow), offsetof(mng_defi, bHasdonotshow), MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 0xFF, 1, 1, |
| offsetof(mng_defi, iConcrete), offsetof(mng_defi, bHasconcrete), MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 0, 4, 4, |
| offsetof(mng_defi, iXlocation), offsetof(mng_defi, bHasloca), MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 0, 4, 4, |
| offsetof(mng_defi, iYlocation), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, |
| 0, 0, 4, 4, |
| offsetof(mng_defi, iLeftcb), offsetof(mng_defi, bHasclip), MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, |
| 0, 0, 4, 4, |
| offsetof(mng_defi, iRightcb), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, |
| 0, 0, 4, 4, |
| offsetof(mng_defi, iTopcb), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, |
| 0, 0, 4, 4, |
| offsetof(mng_defi, iBottomcb), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_BASI |
| MNG_LOCAL mng_field_descriptor mng_fields_basi [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_basi, iWidth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_basi, iHeight), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 1, 16, 1, 1, |
| offsetof(mng_basi, iBitdepth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 6, 1, 1, |
| offsetof(mng_basi, iColortype), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 1, 1, |
| offsetof(mng_basi, iCompression), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 1, 1, |
| offsetof(mng_basi, iFilter), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_basi, iInterlace), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_basi, iRed), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_basi, iGreen), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_basi, iBlue), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_basi, iAlpha), offsetof(mng_basi, bHasalpha), MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 1, 1, 1, |
| offsetof(mng_basi, iViewable), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_CLON |
| MNG_LOCAL mng_field_descriptor mng_fields_clon [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_clon, iSourceid), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_clon, iCloneid), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 2, 1, 1, |
| offsetof(mng_clon, iClonetype), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 1, 1, 1, |
| offsetof(mng_clon, iDonotshow), offsetof(mng_clon, bHasdonotshow), MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 1, 1, 1, |
| offsetof(mng_clon, iConcrete), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 2, 1, 1, |
| offsetof(mng_clon, iLocationtype), offsetof(mng_clon, bHasloca), MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 0, 4, 4, |
| offsetof(mng_clon, iLocationx), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 0, 4, 4, |
| offsetof(mng_clon, iLocationy), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_PAST |
| MNG_LOCAL mng_field_descriptor mng_fields_past [] = |
| { |
| {mng_debunk_past, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_DISC |
| MNG_LOCAL mng_field_descriptor mng_fields_disc [] = |
| { |
| {mng_disc_entries, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_BACK |
| MNG_LOCAL mng_field_descriptor mng_fields_back [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_back, iRed), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_back, iGreen), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_back, iBlue), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 3, 1, 1, |
| offsetof(mng_back, iMandatory), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_back, iImageid), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 1, 1, 1, |
| offsetof(mng_back, iTile), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_FRAM |
| MNG_LOCAL mng_field_descriptor mng_fields_fram [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 4, 1, 1, |
| offsetof(mng_fram, iMode), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_TERMINATOR | MNG_FIELD_OPTIONAL, |
| 0, 0, 1, 79, |
| offsetof(mng_fram, zName), MNG_NULL, offsetof(mng_fram, iNamesize)}, |
| {mng_fram_remainder, |
| MNG_FIELD_OPTIONAL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_MOVE |
| MNG_LOCAL mng_field_descriptor mng_fields_move [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_move, iFirstid), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_move, iLastid), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_move, iMovetype), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_move, iMovex), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_move, iMovey), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_CLIP |
| MNG_LOCAL mng_field_descriptor mng_fields_clip [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_clip, iFirstid), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_clip, iLastid), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_clip, iCliptype), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_clip, iClipl), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_clip, iClipr), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_clip, iClipt), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_clip, iClipb), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_SHOW |
| MNG_LOCAL mng_field_descriptor mng_fields_show [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 1, 0xFFFF, 2, 2, |
| offsetof(mng_show, iFirstid), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 1, 0xFFFF, 2, 2, |
| offsetof(mng_show, iLastid), offsetof(mng_show, bHaslastid), MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL, |
| 0, 7, 1, 1, |
| offsetof(mng_show, iMode), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_TERM |
| MNG_LOCAL mng_field_descriptor mng_fields_term [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 3, 1, 1, |
| offsetof(mng_term, iTermaction), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 2, 1, 1, |
| offsetof(mng_term, iIteraction), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 0, 4, 4, |
| offsetof(mng_term, iDelay), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 0, 4, 4, |
| offsetof(mng_term, iItermax), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_SAVE |
| MNG_LOCAL mng_field_descriptor mng_fields_save [] = |
| { |
| {mng_save_entries, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_SEEK |
| MNG_LOCAL mng_field_descriptor mng_fields_seek [] = |
| { |
| {MNG_NULL, |
| MNG_NULL, |
| 0, 0, 1, 79, |
| offsetof(mng_seek, zName), MNG_NULL, offsetof(mng_seek, iNamesize)} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_eXPI |
| MNG_LOCAL mng_field_descriptor mng_fields_expi [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_expi, iSnapshotid), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_NULL, |
| 0, 0, 1, 79, |
| offsetof(mng_expi, zName), MNG_NULL, offsetof(mng_expi, iNamesize)} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_fPRI |
| MNG_LOCAL mng_field_descriptor mng_fields_fpri [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_fpri, iDeltatype), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFF, 1, 1, |
| offsetof(mng_fpri, iPriority), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_nEED |
| MNG_LOCAL mng_field_descriptor mng_fields_need [] = |
| { |
| {MNG_NULL, |
| MNG_NULL, |
| 0, 0, 1, 0, |
| offsetof(mng_need, zKeywords), MNG_NULL, offsetof(mng_need, iKeywordssize)} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_pHYg |
| #define mng_fields_phyg mng_fields_phys |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_NO_DELTA_PNG |
| MNG_LOCAL mng_field_descriptor mng_fields_dhdr [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_dhdr, iObjectid), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 2, 1, 1, |
| offsetof(mng_dhdr, iImagetype), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 7, 1, 1, |
| offsetof(mng_dhdr, iDeltatype), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 0, 4, 4, |
| offsetof(mng_dhdr, iBlockwidth), offsetof(mng_dhdr, bHasblocksize), MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, |
| 0, 0, 4, 4, |
| offsetof(mng_dhdr, iBlockheight), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, |
| 0, 0, 4, 4, |
| offsetof(mng_dhdr, iBlockx), offsetof(mng_dhdr, bHasblockloc), MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, |
| 0, 0, 4, 4, |
| offsetof(mng_dhdr, iBlocky), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_NO_DELTA_PNG |
| MNG_LOCAL mng_field_descriptor mng_fields_prom [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 14, 1, 1, |
| offsetof(mng_prom, iColortype), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 16, 1, 1, |
| offsetof(mng_prom, iSampledepth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_prom, iFilltype), MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_NO_DELTA_PNG |
| MNG_LOCAL mng_field_descriptor mng_fields_pplt [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 5, 1, 1, |
| offsetof(mng_pplt, iDeltatype), MNG_NULL, MNG_NULL}, |
| {mng_pplt_entries, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_NO_DELTA_PNG |
| MNG_LOCAL mng_field_descriptor mng_fields_drop [] = |
| { |
| {mng_drop_entries, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_NO_DELTA_PNG |
| #ifndef MNG_SKIPCHUNK_DBYK |
| MNG_LOCAL mng_field_descriptor mng_fields_dbyk [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_dbyk, iChunkname), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_dbyk, iPolarity), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_NULL, |
| 0, 0, 1, 0, |
| offsetof(mng_dbyk, zKeywords), MNG_NULL, offsetof(mng_dbyk, iKeywordssize)} |
| }; |
| #endif |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_NO_DELTA_PNG |
| #ifndef MNG_SKIPCHUNK_ORDR |
| MNG_LOCAL mng_field_descriptor mng_fields_ordr [] = |
| { |
| {mng_drop_entries, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_MAGN |
| MNG_LOCAL mng_field_descriptor mng_fields_magn [] = |
| { |
| {mng_debunk_magn, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifdef MNG_INCLUDE_MPNG_PROPOSAL |
| MNG_LOCAL mng_field_descriptor mng_fields_mpng [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 1, 0, 4, 4, |
| offsetof(mng_mpng, iFramewidth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 1, 0, 4, 4, |
| offsetof(mng_mpng, iFrameheight), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0xFFFF, 2, 2, |
| offsetof(mng_mpng, iNumplays), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 1, 0xFFFF, 2, 2, |
| offsetof(mng_mpng, iTickspersec), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 1, 1, |
| offsetof(mng_mpng, iCompressionmethod), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_DEFLATED, |
| 0, 0, 1, 0, |
| offsetof(mng_mpng, pFrames), MNG_NULL, offsetof(mng_mpng, iFramessize)} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifdef MNG_INCLUDE_ANG_PROPOSAL |
| MNG_LOCAL mng_field_descriptor mng_fields_ahdr [] = |
| { |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 1, 0, 4, 4, |
| offsetof(mng_ahdr, iNumframes), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_ahdr, iTickspersec), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 0, 4, 4, |
| offsetof(mng_ahdr, iNumplays), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 1, 0, 4, 4, |
| offsetof(mng_ahdr, iTilewidth), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 1, 0, 4, 4, |
| offsetof(mng_ahdr, iTileheight), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_ahdr, iInterlace), MNG_NULL, MNG_NULL}, |
| {MNG_NULL, |
| MNG_FIELD_INT, |
| 0, 1, 1, 1, |
| offsetof(mng_ahdr, iStillused), MNG_NULL, MNG_NULL} |
| }; |
| |
| MNG_LOCAL mng_field_descriptor mng_fields_adat [] = |
| { |
| {mng_adat_tiles, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_evNT |
| MNG_LOCAL mng_field_descriptor mng_fields_evnt [] = |
| { |
| {mng_evnt_entries, |
| MNG_NULL, |
| 0, 0, 0, 0, |
| MNG_NULL, MNG_NULL, MNG_NULL} |
| }; |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| MNG_LOCAL mng_field_descriptor mng_fields_unknown [] = |
| { |
| {MNG_NULL, |
| MNG_NULL, |
| 0, 0, 1, 0, |
| offsetof(mng_unknown_chunk, pData), MNG_NULL, offsetof(mng_unknown_chunk, iDatasize)} |
| }; |
| |
| /* ************************************************************************** */ |
| /* ************************************************************************** */ |
| /* PNG chunks */ |
| |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ihdr = |
| {mng_it_png, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_ihdr, |
| mng_fields_ihdr, (sizeof(mng_fields_ihdr) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL, |
| MNG_NULL, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOJHDR | MNG_DESCR_NOBASI | MNG_DESCR_NOIDAT | MNG_DESCR_NOPLTE}; |
| |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_plte = |
| {mng_it_png, mng_create_none, 0, offsetof(mng_plte, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_plte, |
| mng_fields_plte, (sizeof(mng_fields_plte) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED, |
| MNG_DESCR_GenHDR, |
| MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; |
| |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_idat = |
| {mng_it_png, mng_create_none, 0, offsetof(mng_idat, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_idat, |
| mng_fields_idat, (sizeof(mng_fields_idat) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_EMPTYEMBED, |
| MNG_DESCR_GenHDR, |
| MNG_DESCR_NOJSEP}; |
| |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_iend = |
| {mng_it_png, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_iend, |
| MNG_NULL, 0, |
| MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, |
| MNG_DESCR_GenHDR, |
| MNG_NULL}; |
| |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_trns = |
| {mng_it_png, mng_create_none, 0, offsetof(mng_trns, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_trns, |
| mng_fields_trns, (sizeof(mng_fields_trns) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED, |
| MNG_DESCR_GenHDR, |
| MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; |
| |
| #ifndef MNG_SKIPCHUNK_gAMA |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_gama = |
| {mng_it_png, mng_create_none, 0, offsetof(mng_gama, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_gama, |
| mng_fields_gama, (sizeof(mng_fields_gama) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_cHRM |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_chrm = |
| {mng_it_png, mng_create_none, 0, offsetof(mng_chrm, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_chrm, |
| mng_fields_chrm, (sizeof(mng_fields_chrm) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_sRGB |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_srgb = |
| {mng_it_png, mng_create_none, 0, offsetof(mng_srgb, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_srgb, |
| mng_fields_srgb, (sizeof(mng_fields_srgb) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_iCCP |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_iccp = |
| {mng_it_png, mng_create_none, 0, offsetof(mng_iccp, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_iccp, |
| mng_fields_iccp, (sizeof(mng_fields_iccp) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_tEXt |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_text = |
| {mng_it_png, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_text, |
| mng_fields_text, (sizeof(mng_fields_text) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_NULL}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_zTXt |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ztxt = |
| {mng_it_png, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_ztxt, |
| mng_fields_ztxt, (sizeof(mng_fields_ztxt) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_NULL}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_iTXt |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_itxt = |
| {mng_it_png, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_itxt, |
| mng_fields_itxt, (sizeof(mng_fields_itxt) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_NULL}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_bKGD |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_bkgd = |
| {mng_it_png, mng_create_none, 0, offsetof(mng_bkgd, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_bkgd, |
| mng_fields_bkgd, (sizeof(mng_fields_bkgd) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_pHYs |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_phys = |
| {mng_it_png, mng_create_none, 0, offsetof(mng_phys, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_phys, |
| mng_fields_phys, (sizeof(mng_fields_phys) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_sBIT |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_sbit = |
| {mng_it_png, mng_create_none, 0, offsetof(mng_sbit, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_sbit, |
| mng_fields_sbit, (sizeof(mng_fields_sbit) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_sPLT |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_splt = |
| {mng_it_png, mng_create_none, 0, offsetof(mng_splt, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_splt, |
| mng_fields_splt, (sizeof(mng_fields_splt) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_hIST |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_hist = |
| {mng_it_png, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_hist, |
| mng_fields_hist, (sizeof(mng_fields_hist) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_GenHDR | MNG_DESCR_PLTE, |
| MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_tIME |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_time = |
| {mng_it_png, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_time, |
| mng_fields_time, (sizeof(mng_fields_time) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_GLOBAL, |
| MNG_DESCR_GenHDR, |
| MNG_NULL}; |
| #endif |
| |
| /* ************************************************************************** */ |
| /* JNG chunks */ |
| |
| #ifdef MNG_INCLUDE_JNG |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jhdr = |
| {mng_it_jng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_jhdr, |
| mng_fields_jhdr, (sizeof(mng_fields_jhdr) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_NULL, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifdef MNG_INCLUDE_JNG |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jdaa = |
| {mng_it_jng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_jdaa, |
| mng_fields_jdaa, (sizeof(mng_fields_jdaa) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_JngHDR, |
| MNG_DESCR_NOJSEP}; |
| #endif |
| |
| #ifdef MNG_INCLUDE_JNG |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jdat = |
| {mng_it_jng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_jdat, |
| mng_fields_jdat, (sizeof(mng_fields_jdat) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_EMPTYEMBED, |
| MNG_DESCR_JngHDR, |
| MNG_NULL}; |
| #endif |
| |
| #ifdef MNG_INCLUDE_JNG |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jsep = |
| {mng_it_jng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_jsep, |
| MNG_NULL, 0, |
| MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, |
| MNG_DESCR_JngHDR, |
| MNG_DESCR_NOJSEP}; |
| #endif |
| |
| /* ************************************************************************** */ |
| /* MNG chunks */ |
| |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_mhdr = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_mhdr, |
| mng_fields_mhdr, (sizeof(mng_fields_mhdr) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_NULL, |
| MNG_DESCR_NOMHDR | MNG_DESCR_NOIHDR | MNG_DESCR_NOJHDR}; |
| |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_mend = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_mend, |
| MNG_NULL, 0, |
| MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_MHDR, |
| MNG_NULL}; |
| |
| #ifndef MNG_SKIPCHUNK_LOOP |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_loop = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_loop, |
| mng_fields_loop, (sizeof(mng_fields_loop) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_endl = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_endl, |
| mng_fields_endl, (sizeof(mng_fields_endl) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_DEFI |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_defi = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_defi, |
| mng_fields_defi, (sizeof(mng_fields_defi) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_BASI |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_basi = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_basi, |
| mng_fields_basi, (sizeof(mng_fields_basi) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_CLON |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_clon = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_clon, |
| mng_fields_clon, (sizeof(mng_fields_clon) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_PAST |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_past = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_past, |
| mng_fields_past, (sizeof(mng_fields_past) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_DISC |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_disc = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_disc, |
| mng_fields_disc, (sizeof(mng_fields_disc) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_BACK |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_back = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_back, |
| mng_fields_back, (sizeof(mng_fields_back) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_FRAM |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_fram = |
| {mng_it_mng, mng_create_none, 0, offsetof(mng_fram, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_fram, |
| mng_fields_fram, (sizeof(mng_fields_fram) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_MOVE |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_move = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_move, |
| mng_fields_move, (sizeof(mng_fields_move) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_CLIP |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_clip = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_clip, |
| mng_fields_clip, (sizeof(mng_fields_clip) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_SHOW |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_show = |
| {mng_it_mng, mng_create_none, 0, offsetof(mng_show, bEmpty), |
| MNG_NULL, MNG_NULL, mng_special_show, |
| mng_fields_show, (sizeof(mng_fields_show) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_TERM |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_term = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_term, |
| mng_fields_term, (sizeof(mng_fields_term) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR | MNG_DESCR_NOTERM | MNG_DESCR_NOLOOP}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_SAVE |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_save = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_save, |
| mng_fields_save, (sizeof(mng_fields_save) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOSAVE | MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_SEEK |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_seek = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_seek, |
| mng_fields_seek, (sizeof(mng_fields_seek) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, |
| MNG_DESCR_MHDR | MNG_DESCR_SAVE, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_eXPI |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_expi = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_expi, |
| mng_fields_expi, (sizeof(mng_fields_expi) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_fPRI |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_fpri = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_fpri, |
| mng_fields_fpri, (sizeof(mng_fields_fpri) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_nEED |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_need = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_need, |
| mng_fields_need, (sizeof(mng_fields_need) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_pHYg |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_phyg = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_phyg, |
| mng_fields_phyg, (sizeof(mng_fields_phyg) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_NO_DELTA_PNG |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_dhdr = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_dhdr, |
| mng_fields_dhdr, (sizeof(mng_fields_dhdr) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_NO_DELTA_PNG |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_prom = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_prom, |
| mng_fields_prom, (sizeof(mng_fields_prom) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR | MNG_DESCR_DHDR, |
| MNG_NULL}; |
| #endif |
| |
| #ifndef MNG_NO_DELTA_PNG |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ipng = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_ipng, |
| MNG_NULL, 0, |
| MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, |
| MNG_DESCR_MHDR | MNG_DESCR_DHDR, |
| MNG_NULL}; |
| #endif |
| |
| #ifndef MNG_NO_DELTA_PNG |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_pplt = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_pplt, |
| mng_fields_pplt, (sizeof(mng_fields_pplt) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR | MNG_DESCR_DHDR, |
| MNG_NULL}; |
| #endif |
| |
| #ifndef MNG_NO_DELTA_PNG |
| #ifdef MNG_INCLUDE_JNG |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ijng = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_ijng, |
| MNG_NULL, 0, |
| MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, |
| MNG_DESCR_MHDR | MNG_DESCR_DHDR, |
| MNG_NULL}; |
| #endif |
| #endif |
| |
| #ifndef MNG_NO_DELTA_PNG |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_drop = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_drop, |
| mng_fields_drop, (sizeof(mng_fields_drop) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR | MNG_DESCR_DHDR, |
| MNG_NULL}; |
| #endif |
| |
| #ifndef MNG_NO_DELTA_PNG |
| #ifndef MNG_SKIPCHUNK_DBYK |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_dbyk = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_dbyk, |
| mng_fields_dbyk, (sizeof(mng_fields_dbyk) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, |
| MNG_DESCR_MHDR | MNG_DESCR_DHDR, |
| MNG_NULL}; |
| #endif |
| #endif |
| |
| #ifndef MNG_NO_DELTA_PNG |
| #ifndef MNG_SKIPCHUNK_ORDR |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ordr = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_ordr, |
| mng_fields_ordr, (sizeof(mng_fields_ordr) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR | MNG_DESCR_DHDR, |
| MNG_NULL}; |
| #endif |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_MAGN |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_magn = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_magn, |
| mng_fields_magn, (sizeof(mng_fields_magn) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| #ifndef MNG_SKIPCHUNK_evNT |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_evnt = |
| {mng_it_mng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_evnt, |
| mng_fields_evnt, (sizeof(mng_fields_evnt) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_MHDR, |
| MNG_DESCR_NOSAVE}; |
| #endif |
| |
| #ifdef MNG_INCLUDE_MPNG_PROPOSAL |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_mpng = |
| {mng_it_mpng, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_mpng, |
| mng_fields_mpng, (sizeof(mng_fields_mpng) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_NULL, |
| MNG_DESCR_NOMHDR | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT}; |
| #endif |
| |
| #ifdef MNG_INCLUDE_ANG_PROPOSAL |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ahdr = |
| {mng_it_ang, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_ahdr, |
| mng_fields_ahdr, (sizeof(mng_fields_ahdr) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_IHDR, |
| MNG_DESCR_NOMHDR | MNG_DESCR_NOJHDR | MNG_DESCR_NOIDAT}; |
| |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_adat = |
| {mng_it_ang, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_adat, |
| mng_fields_adat, (sizeof(mng_fields_adat) / sizeof(mng_field_descriptor)), |
| MNG_NULL, |
| MNG_DESCR_IHDR, |
| MNG_DESCR_NOMHDR | MNG_DESCR_NOJHDR}; |
| #endif |
| |
| /* ************************************************************************** */ |
| /* ************************************************************************** */ |
| /* the good ol' unknown babe */ |
| |
| MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_unknown = |
| {mng_it_png, mng_create_none, 0, 0, |
| MNG_NULL, MNG_NULL, mng_special_unknown, |
| mng_fields_unknown, (sizeof(mng_fields_unknown) / sizeof(mng_field_descriptor)), |
| MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, |
| MNG_NULL, |
| MNG_NULL}; |
| |
| /* ************************************************************************** */ |
| /* ************************************************************************** */ |
| |
| MNG_LOCAL mng_chunk_header mng_chunk_unknown = |
| {MNG_UINT_HUH, mng_init_general, mng_free_unknown, |
| mng_read_general, mng_write_unknown, mng_assign_unknown, |
| 0, 0, sizeof(mng_unknown_chunk), &mng_chunk_descr_unknown}; |
| |
| /* ************************************************************************** */ |
| |
| /* the table-idea & binary search code was adapted from |
| libpng 1.1.0 (pngread.c) */ |
| /* NOTE1: the table must remain sorted by chunkname, otherwise the binary |
| search will break !!! (ps. watch upper-/lower-case chunknames !!) */ |
| /* NOTE2: the layout must remain equal to the header part of all the |
| chunk-structures (yes, that means even the pNext and pPrev fields; |
| it's wasting a bit of space, but hey, the code is a lot easier) */ |
| |
| MNG_LOCAL mng_chunk_header mng_chunk_table [] = |
| { |
| #ifndef MNG_SKIPCHUNK_BACK |
| {MNG_UINT_BACK, mng_init_general, mng_free_general, mng_read_general, mng_write_back, mng_assign_general, 0, 0, sizeof(mng_back), &mng_chunk_descr_back}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_BASI |
| {MNG_UINT_BASI, mng_init_general, mng_free_general, mng_read_general, mng_write_basi, mng_assign_general, 0, 0, sizeof(mng_basi), &mng_chunk_descr_basi}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_CLIP |
| {MNG_UINT_CLIP, mng_init_general, mng_free_general, mng_read_general, mng_write_clip, mng_assign_general, 0, 0, sizeof(mng_clip), &mng_chunk_descr_clip}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_CLON |
| {MNG_UINT_CLON, mng_init_general, mng_free_general, mng_read_general, mng_write_clon, mng_assign_general, 0, 0, sizeof(mng_clon), &mng_chunk_descr_clon}, |
| #endif |
| #ifndef MNG_NO_DELTA_PNG |
| #ifndef MNG_SKIPCHUNK_DBYK |
| {MNG_UINT_DBYK, mng_init_general, mng_free_dbyk, mng_read_general, mng_write_dbyk, mng_assign_dbyk, 0, 0, sizeof(mng_dbyk), &mng_chunk_descr_dbyk}, |
| #endif |
| #endif |
| #ifndef MNG_SKIPCHUNK_DEFI |
| {MNG_UINT_DEFI, mng_init_general, mng_free_general, mng_read_general, mng_write_defi, mng_assign_general, 0, 0, sizeof(mng_defi), &mng_chunk_descr_defi}, |
| #endif |
| #ifndef MNG_NO_DELTA_PNG |
| {MNG_UINT_DHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_dhdr, mng_assign_general, 0, 0, sizeof(mng_dhdr), &mng_chunk_descr_dhdr}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_DISC |
| {MNG_UINT_DISC, mng_init_general, mng_free_disc, mng_read_general, mng_write_disc, mng_assign_disc, 0, 0, sizeof(mng_disc), &mng_chunk_descr_disc}, |
| #endif |
| #ifndef MNG_NO_DELTA_PNG |
| #ifndef MNG_SKIPCHUNK_DROP |
| {MNG_UINT_DROP, mng_init_general, mng_free_drop, mng_read_general, mng_write_drop, mng_assign_drop, 0, 0, sizeof(mng_drop), &mng_chunk_descr_drop}, |
| #endif |
| #endif |
| #ifndef MNG_SKIPCHUNK_LOOP |
| {MNG_UINT_ENDL, mng_init_general, mng_free_general, mng_read_general, mng_write_endl, mng_assign_general, 0, 0, sizeof(mng_endl), &mng_chunk_descr_endl}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_FRAM |
| {MNG_UINT_FRAM, mng_init_general, mng_free_fram, mng_read_general, mng_write_fram, mng_assign_fram, 0, 0, sizeof(mng_fram), &mng_chunk_descr_fram}, |
| #endif |
| {MNG_UINT_IDAT, mng_init_general, mng_free_idat, mng_read_general, mng_write_idat, mng_assign_idat, 0, 0, sizeof(mng_idat), &mng_chunk_descr_idat}, /* 12-th element! */ |
| {MNG_UINT_IEND, mng_init_general, mng_free_general, mng_read_general, mng_write_iend, mng_assign_general, 0, 0, sizeof(mng_iend), &mng_chunk_descr_iend}, |
| {MNG_UINT_IHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_ihdr, mng_assign_general, 0, 0, sizeof(mng_ihdr), &mng_chunk_descr_ihdr}, |
| #ifndef MNG_NO_DELTA_PNG |
| #ifdef MNG_INCLUDE_JNG |
| {MNG_UINT_IJNG, mng_init_general, mng_free_general, mng_read_general, mng_write_ijng, mng_assign_general, 0, 0, sizeof(mng_ijng), &mng_chunk_descr_ijng}, |
| #endif |
| {MNG_UINT_IPNG, mng_init_general, mng_free_general, mng_read_general, mng_write_ipng, mng_assign_general, 0, 0, sizeof(mng_ipng), &mng_chunk_descr_ipng}, |
| #endif |
| #ifdef MNG_INCLUDE_JNG |
| {MNG_UINT_JDAA, mng_init_general, mng_free_jdaa, mng_read_general, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa), &mng_chunk_descr_jdaa}, |
| {MNG_UINT_JDAT, mng_init_general, mng_free_jdat, mng_read_general, mng_write_jdat, mng_assign_jdat, 0, 0, sizeof(mng_jdat), &mng_chunk_descr_jdat}, |
| {MNG_UINT_JHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_jhdr, mng_assign_general, 0, 0, sizeof(mng_jhdr), &mng_chunk_descr_jhdr}, |
| {MNG_UINT_JSEP, mng_init_general, mng_free_general, mng_read_general, mng_write_jsep, mng_assign_general, 0, 0, sizeof(mng_jsep), &mng_chunk_descr_jsep}, |
| {MNG_UINT_JdAA, mng_init_general, mng_free_jdaa, mng_read_general, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa), &mng_chunk_descr_jdaa}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_LOOP |
| {MNG_UINT_LOOP, mng_init_general, mng_free_loop, mng_read_general, mng_write_loop, mng_assign_loop, 0, 0, sizeof(mng_loop), &mng_chunk_descr_loop}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_MAGN |
| {MNG_UINT_MAGN, mng_init_general, mng_free_general, mng_read_general, mng_write_magn, mng_assign_general, 0, 0, sizeof(mng_magn), &mng_chunk_descr_magn}, |
| #endif |
| {MNG_UINT_MEND, mng_init_general, mng_free_general, mng_read_general, mng_write_mend, mng_assign_general, 0, 0, sizeof(mng_mend), &mng_chunk_descr_mend}, |
| {MNG_UINT_MHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_mhdr, mng_assign_general, 0, 0, sizeof(mng_mhdr), &mng_chunk_descr_mhdr}, |
| #ifndef MNG_SKIPCHUNK_MOVE |
| {MNG_UINT_MOVE, mng_init_general, mng_free_general, mng_read_general, mng_write_move, mng_assign_general, 0, 0, sizeof(mng_move), &mng_chunk_descr_move}, |
| #endif |
| #ifndef MNG_NO_DELTA_PNG |
| #ifndef MNG_SKIPCHUNK_ORDR |
| {MNG_UINT_ORDR, mng_init_general, mng_free_ordr, mng_read_general, mng_write_ordr, mng_assign_ordr, 0, 0, sizeof(mng_ordr), &mng_chunk_descr_ordr}, |
| #endif |
| #endif |
| #ifndef MNG_SKIPCHUNK_PAST |
| {MNG_UINT_PAST, mng_init_general, mng_free_past, mng_read_general, mng_write_past, mng_assign_past, 0, 0, sizeof(mng_past), &mng_chunk_descr_past}, |
| #endif |
| {MNG_UINT_PLTE, mng_init_general, mng_free_general, mng_read_general, mng_write_plte, mng_assign_general, 0, 0, sizeof(mng_plte), &mng_chunk_descr_plte}, |
| #ifndef MNG_NO_DELTA_PNG |
| {MNG_UINT_PPLT, mng_init_general, mng_free_general, mng_read_general, mng_write_pplt, mng_assign_general, 0, 0, sizeof(mng_pplt), &mng_chunk_descr_pplt}, |
| {MNG_UINT_PROM, mng_init_general, mng_free_general, mng_read_general, mng_write_prom, mng_assign_general, 0, 0, sizeof(mng_prom), &mng_chunk_descr_prom}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_SAVE |
| {MNG_UINT_SAVE, mng_init_general, mng_free_save, mng_read_general, mng_write_save, mng_assign_save, 0, 0, sizeof(mng_save), &mng_chunk_descr_save}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_SEEK |
| {MNG_UINT_SEEK, mng_init_general, mng_free_seek, mng_read_general, mng_write_seek, mng_assign_seek, 0, 0, sizeof(mng_seek), &mng_chunk_descr_seek}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_SHOW |
| {MNG_UINT_SHOW, mng_init_general, mng_free_general, mng_read_general, mng_write_show, mng_assign_general, 0, 0, sizeof(mng_show), &mng_chunk_descr_show}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_TERM |
| {MNG_UINT_TERM, mng_init_general, mng_free_general, mng_read_general, mng_write_term, mng_assign_general, 0, 0, sizeof(mng_term), &mng_chunk_descr_term}, |
| #endif |
| #ifdef MNG_INCLUDE_ANG_PROPOSAL |
| {MNG_UINT_adAT, mng_init_general, mng_free_adat, mng_read_general, mng_write_adat, mng_assign_adat, 0, 0, sizeof(mng_adat), &mng_chunk_descr_adat}, |
| {MNG_UINT_ahDR, mng_init_general, mng_free_general, mng_read_general, mng_write_ahdr, mng_assign_ahdr, 0, 0, sizeof(mng_ahdr), &mng_chunk_descr_ahdr}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_bKGD |
| {MNG_UINT_bKGD, mng_init_general, mng_free_general, mng_read_general, mng_write_bkgd, mng_assign_general, 0, 0, sizeof(mng_bkgd), &mng_chunk_descr_bkgd}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_cHRM |
| {MNG_UINT_cHRM, mng_init_general, mng_free_general, mng_read_general, mng_write_chrm, mng_assign_general, 0, 0, sizeof(mng_chrm), &mng_chunk_descr_chrm}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_eXPI |
| {MNG_UINT_eXPI, mng_init_general, mng_free_expi, mng_read_general, mng_write_expi, mng_assign_expi, 0, 0, sizeof(mng_expi), &mng_chunk_descr_expi}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_evNT |
| {MNG_UINT_evNT, mng_init_general, mng_free_evnt, mng_read_general, mng_write_evnt, mng_assign_evnt, 0, 0, sizeof(mng_evnt), &mng_chunk_descr_evnt}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_fPRI |
| {MNG_UINT_fPRI, mng_init_general, mng_free_general, mng_read_general, mng_write_fpri, mng_assign_general, 0, 0, sizeof(mng_fpri), &mng_chunk_descr_fpri}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_gAMA |
| {MNG_UINT_gAMA, mng_init_general, mng_free_general, mng_read_general, mng_write_gama, mng_assign_general, 0, 0, sizeof(mng_gama), &mng_chunk_descr_gama}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_hIST |
| {MNG_UINT_hIST, mng_init_general, mng_free_general, mng_read_general, mng_write_hist, mng_assign_general, 0, 0, sizeof(mng_hist), &mng_chunk_descr_hist}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_iCCP |
| {MNG_UINT_iCCP, mng_init_general, mng_free_iccp, mng_read_general, mng_write_iccp, mng_assign_iccp, 0, 0, sizeof(mng_iccp), &mng_chunk_descr_iccp}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_iTXt |
| {MNG_UINT_iTXt, mng_init_general, mng_free_itxt, mng_read_general, mng_write_itxt, mng_assign_itxt, 0, 0, sizeof(mng_itxt), &mng_chunk_descr_itxt}, |
| #endif |
| #ifdef MNG_INCLUDE_MPNG_PROPOSAL |
| {MNG_UINT_mpNG, mng_init_general, mng_free_mpng, mng_read_general, mng_write_mpng, mng_assign_mpng, 0, 0, sizeof(mng_mpng), &mng_chunk_descr_mpng}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_nEED |
| {MNG_UINT_nEED, mng_init_general, mng_free_need, mng_read_general, mng_write_need, mng_assign_need, 0, 0, sizeof(mng_need), &mng_chunk_descr_need}, |
| #endif |
| /* TODO: {MNG_UINT_oFFs, 0, 0, 0, 0, 0, 0}, */ |
| /* TODO: {MNG_UINT_pCAL, 0, 0, 0, 0, 0, 0}, */ |
| #ifndef MNG_SKIPCHUNK_pHYg |
| {MNG_UINT_pHYg, mng_init_general, mng_free_general, mng_read_general, mng_write_phyg, mng_assign_general, 0, 0, sizeof(mng_phyg), &mng_chunk_descr_phyg}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_pHYs |
| {MNG_UINT_pHYs, mng_init_general, mng_free_general, mng_read_general, mng_write_phys, mng_assign_general, 0, 0, sizeof(mng_phys), &mng_chunk_descr_phys}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_sBIT |
| {MNG_UINT_sBIT, mng_init_general, mng_free_general, mng_read_general, mng_write_sbit, mng_assign_general, 0, 0, sizeof(mng_sbit), &mng_chunk_descr_sbit}, |
| #endif |
| /* TODO: {MNG_UINT_sCAL, 0, 0, 0, 0, 0, 0}, */ |
| #ifndef MNG_SKIPCHUNK_sPLT |
| {MNG_UINT_sPLT, mng_init_general, mng_free_splt, mng_read_general, mng_write_splt, mng_assign_splt, 0, 0, sizeof(mng_splt), &mng_chunk_descr_splt}, |
| #endif |
| {MNG_UINT_sRGB, mng_init_general, mng_free_general, mng_read_general, mng_write_srgb, mng_assign_general, 0, 0, sizeof(mng_srgb), &mng_chunk_descr_srgb}, |
| #ifndef MNG_SKIPCHUNK_tEXt |
| {MNG_UINT_tEXt, mng_init_general, mng_free_text, mng_read_general, mng_write_text, mng_assign_text, 0, 0, sizeof(mng_text), &mng_chunk_descr_text}, |
| #endif |
| #ifndef MNG_SKIPCHUNK_tIME |
| {MNG_UINT_tIME, mng_init_general, mng_free_general, mng_read_general, mng_write_time, mng_assign_general, 0, 0, sizeof(mng_time), &mng_chunk_descr_time}, |
| #endif |
| {MNG_UINT_tRNS, mng_init_general, mng_free_general, mng_read_general, mng_write_trns, mng_assign_general, 0, 0, sizeof(mng_trns), &mng_chunk_descr_trns}, |
| #ifndef MNG_SKIPCHUNK_zTXt |
| {MNG_UINT_zTXt, mng_init_general, mng_free_ztxt, mng_read_general, mng_write_ztxt, mng_assign_ztxt, 0, 0, sizeof(mng_ztxt), &mng_chunk_descr_ztxt}, |
| #endif |
| }; |
| |
| /* ************************************************************************** */ |
| /* ************************************************************************** */ |
| |
| void mng_get_chunkheader (mng_chunkid iChunkname, |
| mng_chunk_headerp pResult) |
| { |
| /* binary search variables */ |
| mng_int32 iTop, iLower, iUpper, iMiddle; |
| mng_chunk_headerp pEntry; /* pointer to found entry */ |
| /* determine max index of table */ |
| iTop = (sizeof (mng_chunk_table) / sizeof (mng_chunk_table [0])) - 1; |
| |
| /* binary search; with 54 chunks, worst-case is 7 comparisons */ |
| iLower = 0; |
| #ifndef MNG_NO_DELTA_PNG |
| iMiddle = 11; /* start with the IDAT entry */ |
| #else |
| iMiddle = 8; |
| #endif |
| iUpper = iTop; |
| pEntry = 0; /* no goods yet! */ |
| |
| do /* the binary search itself */ |
| { |
| if (mng_chunk_table [iMiddle].iChunkname < iChunkname) |
| iLower = iMiddle + 1; |
| else if (mng_chunk_table [iMiddle].iChunkname > iChunkname) |
| iUpper = iMiddle - 1; |
| else |
| { |
| pEntry = &mng_chunk_table [iMiddle]; |
| break; |
| } |
| iMiddle = (iLower + iUpper) >> 1; |
| } |
| while (iLower <= iUpper); |
| |
| if (!pEntry) /* unknown chunk ? */ |
| pEntry = &mng_chunk_unknown; /* make it so! */ |
| |
| MNG_COPY (pResult, pEntry, sizeof(mng_chunk_header)); |
| |
| return; |
| } |
| |
| /* ************************************************************************** */ |
| /* ************************************************************************** */ |
| /* PNG chunks */ |
| |
| MNG_C_SPECIALFUNC (mng_special_ihdr) |
| { |
| pData->bHasIHDR = MNG_TRUE; /* indicate IHDR is present */ |
| /* and store interesting fields */ |
| if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_NOCHANGE)) |
| { |
| pData->iDatawidth = ((mng_ihdrp)pChunk)->iWidth; |
| pData->iDataheight = ((mng_ihdrp)pChunk)->iHeight; |
| } |
| |
| pData->iBitdepth = ((mng_ihdrp)pChunk)->iBitdepth; |
| pData->iColortype = ((mng_ihdrp)pChunk)->iColortype; |
| pData->iCompression = ((mng_ihdrp)pChunk)->iCompression; |
| pData->iFilter = ((mng_ihdrp)pChunk)->iFilter; |
| pData->iInterlace = ((mng_ihdrp)pChunk)->iInterlace; |
| |
| #if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) |
| pData->iPNGmult = 1; |
| pData->iPNGdepth = pData->iBitdepth; |
| #endif |
| |
| #ifdef MNG_NO_1_2_4BIT_SUPPORT |
| if (pData->iBitdepth < 8) |
| pData->iBitdepth = 8; |
| #endif |
| |
| #ifdef MNG_NO_16BIT_SUPPORT |
| if (pData->iBitdepth > 8) |
| { |
| pData->iBitdepth = 8; |
| pData->iPNGmult = 2; |
| } |
| #endif |
| |
| if ((pData->iBitdepth != 8) /* parameter validity checks */ |
| #ifndef MNG_NO_1_2_4BIT_SUPPORT |
| && (pData->iBitdepth != 1) && |
| (pData->iBitdepth != 2) && |
| (pData->iBitdepth != 4) |
| #endif |
| #ifndef MNG_NO_16BIT_SUPPORT |
| && (pData->iBitdepth != 16) |
| #endif |
| ) |
| MNG_ERROR (pData, MNG_INVALIDBITDEPTH); |
| |
| if ((pData->iColortype != MNG_COLORTYPE_GRAY ) && |
| (pData->iColortype != MNG_COLORTYPE_RGB ) && |
| (pData->iColortype != MNG_COLORTYPE_INDEXED) && |
| (pData->iColortype != MNG_COLORTYPE_GRAYA ) && |
| (pData->iColortype != MNG_COLORTYPE_RGBA ) ) |
| MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); |
| |
| if ((pData->iColortype == MNG_COLORTYPE_INDEXED) && (pData->iBitdepth > 8)) |
| MNG_ERROR (pData, MNG_INVALIDBITDEPTH); |
| |
| if (((pData->iColortype == MNG_COLORTYPE_RGB ) || |
| (pData->iColortype == MNG_COLORTYPE_GRAYA ) || |
| (pData->iColortype == MNG_COLORTYPE_RGBA ) ) && |
| (pData->iBitdepth < 8 ) ) |
| MNG_ERROR (pData, MNG_INVALIDBITDEPTH); |
| |
| if (pData->iCompression != MNG_COMPRESSION_DEFLATE) |
| MNG_ERROR (pData, MNG_INVALIDCOMPRESS); |
| |
| #if defined(FILTER192) || defined(FILTER193) |
| if ((pData->iFilter != MNG_FILTER_ADAPTIVE ) && |
| #if defined(FILTER192) && defined(FILTER193) |
| (pData->iFilter != MNG_FILTER_DIFFERING) && |
| (pData->iFilter != MNG_FILTER_NOFILTER ) ) |
| #else |
| #ifdef FILTER192 |
| (pData->iFilter != MNG_FILTER_DIFFERING) ) |
| #else |
| (pData->iFilter != MNG_FILTER_NOFILTER ) ) |
| #endif |
| #endif |
| MNG_ERROR (pData, MNG_INVALIDFILTER); |
| #else |
| if (pData->iFilter) |
| MNG_ERROR (pData, MNG_INVALIDFILTER); |
| #endif |
| |
| if ((pData->iInterlace != MNG_INTERLACE_NONE ) && |
| (pData->iInterlace != MNG_INTERLACE_ADAM7) ) |
| MNG_ERROR (pData, MNG_INVALIDINTERLACE); |
| |
| #ifdef MNG_SUPPORT_DISPLAY |
| #ifndef MNG_NO_DELTA_PNG |
| if (pData->bHasDHDR) /* check the colortype for delta-images ! */ |
| { |
| mng_imagedatap pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; |
| |
| if (pData->iColortype != pBuf->iColortype) |
| { |
| if ( ( (pData->iColortype != MNG_COLORTYPE_INDEXED) || |
| (pBuf->iColortype == MNG_COLORTYPE_GRAY ) ) && |
| ( (pData->iColortype != MNG_COLORTYPE_GRAY ) || |
| (pBuf->iColortype == MNG_COLORTYPE_INDEXED) ) ) |
| MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); |
| } |
| } |
| #endif |
| #endif |
| |
| if (!pData->bHasheader) /* first chunk ? */ |
| { |
| pData->bHasheader = MNG_TRUE; /* we've got a header */ |
| pData->eImagetype = mng_it_png; /* then this must be a PNG */ |
| pData->iWidth = pData->iDatawidth; |
| pData->iHeight = pData->iDataheight; |
| /* predict alpha-depth ! */ |
| if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) || |
| (pData->iColortype == MNG_COLORTYPE_RGBA ) ) |
| pData->iAlphadepth = pData->iBitdepth; |
| else |
| if (pData->iColortype == MNG_COLORTYPE_INDEXED) |
| pData->iAlphadepth = 8; /* worst case scenario */ |
| else |
| pData->iAlphadepth = 1; /* Possible tRNS cheap binary transparency */ |
| /* fits on maximum canvas ? */ |
| if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) |
| MNG_WARNING (pData, MNG_IMAGETOOLARGE); |
| |
| #if !defined(MNG_INCLUDE_MPNG_PROPOSAL) || !defined(MNG_SUPPORT_DISPLAY) |
| if (pData->fProcessheader) /* inform the app ? */ |
| if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) |
| MNG_ERROR (pData, MNG_APPMISCERROR); |
| #endif |
| } |
| |
| if (!pData->bHasDHDR) |
| pData->iImagelevel++; /* one level deeper */ |
| |
| #ifdef MNG_SUPPORT_DISPLAY |
| return mng_process_display_ihdr (pData); |
| #else |
| return MNG_NOERROR; |
| #endif /* MNG_SUPPORT_DISPLAY */ |
| } |
| |
| /* ************************************************************************** */ |
| |
| MNG_F_SPECIALFUNC (mng_debunk_plte) |
| { |
| mng_pltep pPLTE = (mng_pltep)pChunk; |
| mng_uint32 iRawlen = *piRawlen; |
| mng_uint8p pRawdata = *ppRawdata; |
| /* length must be multiple of 3 */ |
| if (((iRawlen % 3) != 0) || (iRawlen > 768)) |
| MNG_ERROR (pData, MNG_INVALIDLENGTH); |
| /* this is the exact length */ |
| pPLTE->iEntrycount = iRawlen / 3; |
| |
| MNG_COPY (pPLTE->aEntries, pRawdata, iRawlen); |
| |
| *piRawlen = 0; |
| |
| return MNG_NOERROR; |
| } |
| |
| /* ************************************************************************** */ |
| |
| MNG_C_SPECIALFUNC (mng_special_plte) |
| { /* multiple PLTE only inside BASI */ |
| if ((pData->bHasPLTE) && (!pData->bHasBASI)) |
| MNG_ERROR (pData, MNG_MULTIPLEERROR); |
| |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| { /* only allowed for indexed-color or |
| rgb(a)-color! */ |
| if ((pData->iColortype != MNG_COLORTYPE_RGB ) && |
| (pData->iColortype != MNG_COLORTYPE_INDEXED) && |
| (pData->iColortype != MNG_COLORTYPE_RGBA ) ) |
| MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); |
| /* empty only allowed if global present */ |
| if ((((mng_pltep)pChunk)->bEmpty) && (!pData->bHasglobalPLTE)) |
| MNG_ERROR (pData, MNG_CANNOTBEEMPTY); |
| } |
| else |
| { |
| if (((mng_pltep)pChunk)->bEmpty) /* cannot be empty as global! */ |
| MNG_ERROR (pData, MNG_CANNOTBEEMPTY); |
| } |
| |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| pData->bHasPLTE = MNG_TRUE; /* got it! */ |
| else |
| pData->bHasglobalPLTE = MNG_TRUE; |
| |
| pData->iPLTEcount = ((mng_pltep)pChunk)->iEntrycount; |
| |
| #ifdef MNG_SUPPORT_DISPLAY |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| { |
| mng_imagep pImage; |
| mng_imagedatap pBuf; |
| |
| #ifndef MNG_NO_DELTA_PNG |
| if (pData->bHasDHDR) /* processing delta-image ? */ |
| { /* store in object 0 !!! */ |
| pImage = (mng_imagep)pData->pObjzero; |
| pBuf = pImage->pImgbuf; |
| pBuf->bHasPLTE = MNG_TRUE; /* it's definitely got a PLTE now */ |
| pBuf->iPLTEcount = ((mng_pltep)pChunk)->iEntrycount; |
| MNG_COPY (pBuf->aPLTEentries, ((mng_pltep)pChunk)->aEntries, |
| sizeof (pBuf->aPLTEentries)); |
| } |
| else |
| #endif |
| { /* get the current object */ |
| pImage = (mng_imagep)pData->pCurrentobj; |
| if (!pImage) /* no object then dump it in obj 0 */ |
| pImage = (mng_imagep)pData->pObjzero; |
| |
| pBuf = pImage->pImgbuf; /* address the object buffer */ |
| pBuf->bHasPLTE = MNG_TRUE; /* and tell it it's got a PLTE now */ |
| |
| if (((mng_pltep)pChunk)->bEmpty) /* if empty, inherit from global */ |
| { |
| pBuf->iPLTEcount = pData->iGlobalPLTEcount; |
| MNG_COPY (pBuf->aPLTEentries, pData->aGlobalPLTEentries, |
| sizeof (pBuf->aPLTEentries)); |
| |
| if (pData->bHasglobalTRNS) /* also copy global tRNS ? */ |
| { |
| mng_uint32 iRawlen2 = pData->iGlobalTRNSrawlen; |
| mng_uint8p pRawdata2 = (mng_uint8p)(pData->aGlobalTRNSrawdata); |
| /* indicate tRNS available */ |
| pBuf->bHasTRNS = MNG_TRUE; |
| /* global length oke ? */ |
| if ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount)) |
| MNG_ERROR (pData, MNG_GLOBALLENGTHERR); |
| /* copy it */ |
| pBuf->iTRNScount = iRawlen2; |
| MNG_COPY (pBuf->aTRNSentries, pRawdata2, iRawlen2); |
| } |
| } |
| else |
| { /* store fields for future reference */ |
| pBuf->iPLTEcount = ((mng_pltep)pChunk)->iEntrycount; |
| MNG_COPY (pBuf->aPLTEentries, ((mng_pltep)pChunk)->aEntries, |
| sizeof (pBuf->aPLTEentries)); |
| } |
| } |
| } |
| else /* store as global */ |
| { |
| pData->iGlobalPLTEcount = ((mng_pltep)pChunk)->iEntrycount; |
| MNG_COPY (pData->aGlobalPLTEentries, ((mng_pltep)pChunk)->aEntries, |
| sizeof (pData->aGlobalPLTEentries)); |
| /* create an animation object */ |
| return mng_create_ani_plte (pData); |
| } |
| #endif /* MNG_SUPPORT_DISPLAY */ |
| |
| return MNG_NOERROR; /* done */ |
| } |
| |
| /* ************************************************************************** */ |
| |
| MNG_C_SPECIALFUNC (mng_special_idat) |
| { |
| #ifdef MNG_INCLUDE_JNG |
| if ((pData->bHasJHDR) && |
| (pData->iJHDRalphacompression != MNG_COMPRESSION_DEFLATE)) |
| MNG_ERROR (pData, MNG_SEQUENCEERROR); |
| #endif |
| /* not allowed for deltatype NO_CHANGE */ |
| #ifndef MNG_NO_DELTA_PNG |
| if ((pData->bHasDHDR) && ((pData->iDeltatype == MNG_DELTATYPE_NOCHANGE))) |
| MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); |
| #endif |
| /* can only be empty in BASI-block! */ |
| if ((((mng_idatp)pChunk)->bEmpty) && (!pData->bHasBASI)) |
| MNG_ERROR (pData, MNG_INVALIDLENGTH); |
| /* indexed-color requires PLTE */ |
| if ((pData->bHasIHDR) && (pData->iColortype == 3) && (!pData->bHasPLTE)) |
| MNG_ERROR (pData, MNG_PLTEMISSING); |
| |
| pData->bHasIDAT = MNG_TRUE; /* got some IDAT now, don't we */ |
| |
| return MNG_NOERROR; /* done */ |
| } |
| |
| /* ************************************************************************** */ |
| |
| MNG_C_SPECIALFUNC (mng_special_iend) |
| { /* IHDR-block requires IDAT */ |
| if ((pData->bHasIHDR) && (!pData->bHasIDAT)) |
| MNG_ERROR (pData, MNG_IDATMISSING); |
| |
| pData->iImagelevel--; /* one level up */ |
| |
| #ifdef MNG_SUPPORT_DISPLAY |
| { /* create an animation object */ |
| mng_retcode iRetcode = mng_create_ani_image (pData); |
| if (iRetcode) /* on error bail out */ |
| return iRetcode; |
| /* display processing */ |
| iRetcode = mng_process_display_iend (pData); |
| if (iRetcode) /* on error bail out */ |
| return iRetcode; |
| } |
| #endif /* MNG_SUPPORT_DISPLAY */ |
| |
| #ifdef MNG_SUPPORT_DISPLAY |
| if (!pData->bTimerset) /* reset only if not broken !!! */ |
| { |
| #endif |
| /* IEND signals the end for most ... */ |
| pData->bHasIHDR = MNG_FALSE; |
| pData->bHasBASI = MNG_FALSE; |
| pData->bHasDHDR = MNG_FALSE; |
| #ifdef MNG_INCLUDE_JNG |
| pData->bHasJHDR = MNG_FALSE; |
| pData->bHasJSEP = MNG_FALSE; |
| pData->bHasJDAA = MNG_FALSE; |
| pData->bHasJDAT = MNG_FALSE; |
| #endif |
| pData->bHasPLTE = MNG_FALSE; |
| pData->bHasTRNS = MNG_FALSE; |
| pData->bHasGAMA = MNG_FALSE; |
| pData->bHasCHRM = MNG_FALSE; |
| pData->bHasSRGB = MNG_FALSE; |
| pData->bHasICCP = MNG_FALSE; |
| pData->bHasBKGD = MNG_FALSE; |
| pData->bHasIDAT = MNG_FALSE; |
| #ifdef MNG_SUPPORT_DISPLAY |
| } |
| #endif |
| |
| return MNG_NOERROR; /* done */ |
| } |
| |
| /* ************************************************************************** */ |
| |
| MNG_F_SPECIALFUNC (mng_debunk_trns) |
| { |
| mng_trnsp pTRNS = (mng_trnsp)pChunk; |
| mng_uint32 iRawlen = *piRawlen; |
| mng_uint8p pRawdata = *ppRawdata; |
| |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| { /* not global! */ |
| pTRNS->bGlobal = MNG_FALSE; |
| pTRNS->iType = pData->iColortype; |
| |
| if (iRawlen != 0) |
| { |
| switch (pData->iColortype) /* store fields */ |
| { |
| case 0: { /* gray */ |
| if (iRawlen != 2) |
| MNG_ERROR (pData, MNG_INVALIDLENGTH); |
| pTRNS->iGray = mng_get_uint16 (pRawdata); |
| break; |
| } |
| case 2: { /* rgb */ |
| if (iRawlen != 6) |
| MNG_ERROR (pData, MNG_INVALIDLENGTH); |
| pTRNS->iRed = mng_get_uint16 (pRawdata); |
| pTRNS->iGreen = mng_get_uint16 (pRawdata+2); |
| pTRNS->iBlue = mng_get_uint16 (pRawdata+4); |
| break; |
| } |
| case 3: { /* indexed */ |
| if (iRawlen > 256) |
| MNG_ERROR (pData, MNG_INVALIDLENGTH); |
| pTRNS->iCount = iRawlen; |
| MNG_COPY (pTRNS->aEntries, pRawdata, iRawlen); |
| break; |
| } |
| } |
| } |
| } |
| else /* it's global! */ |
| { |
| if (iRawlen == 0) |
| MNG_ERROR (pData, MNG_INVALIDLENGTH); |
| pTRNS->bGlobal = MNG_TRUE; |
| pTRNS->iType = 0; |
| pTRNS->iRawlen = iRawlen; |
| MNG_COPY (pTRNS->aRawdata, pRawdata, iRawlen); |
| |
| pData->iGlobalTRNSrawlen = iRawlen; |
| MNG_COPY (pData->aGlobalTRNSrawdata, pRawdata, iRawlen); |
| } |
| |
| *piRawlen = 0; |
| |
| return MNG_NOERROR; |
| } |
| |
| /* ************************************************************************** */ |
| |
| MNG_C_SPECIALFUNC (mng_special_trns) |
| { /* multiple tRNS only inside BASI */ |
| if ((pData->bHasTRNS) && (!pData->bHasBASI)) |
| MNG_ERROR (pData, MNG_MULTIPLEERROR); |
| |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| { /* not allowed with full alpha-channel */ |
| if ((pData->iColortype == 4) || (pData->iColortype == 6)) |
| MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); |
| |
| if (!((mng_trnsp)pChunk)->bEmpty) /* filled ? */ |
| { |
| #ifdef MNG_SUPPORT_DISPLAY |
| if (pData->iColortype == 3) |
| { |
| mng_imagep pImage = (mng_imagep)pData->pCurrentobj; |
| mng_imagedatap pBuf; |
| |
| if (!pImage) /* no object then check obj 0 */ |
| pImage = (mng_imagep)pData->pObjzero; |
| |
| pBuf = pImage->pImgbuf; /* address object buffer */ |
| |
| if (((mng_trnsp)pChunk)->iCount > pBuf->iPLTEcount) |
| MNG_ERROR (pData, MNG_INVALIDLENGTH); |
| } |
| #endif |
| } |
| else /* if empty there must be global stuff! */ |
| { |
| if (!pData->bHasglobalTRNS) |
| MNG_ERROR (pData, MNG_CANNOTBEEMPTY); |
| } |
| } |
| |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| pData->bHasTRNS = MNG_TRUE; /* indicate tRNS available */ |
| else |
| pData->bHasglobalTRNS = MNG_TRUE; |
| |
| #ifdef MNG_SUPPORT_DISPLAY |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| { |
| mng_imagep pImage; |
| mng_imagedatap pBuf; |
| mng_uint8p pRawdata2; |
| mng_uint32 iRawlen2; |
| |
| #ifndef MNG_NO_DELTA_PNG |
| if (pData->bHasDHDR) /* processing delta-image ? */ |
| { /* store in object 0 !!! */ |
| #if defined(MNG_NO_1_2_4BIT_SUPPORT) |
| mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1,0,0,0,0,0,0,0,1}; |
| #endif |
| pImage = (mng_imagep)pData->pObjzero; |
| pBuf = pImage->pImgbuf; /* address object buffer */ |
| pBuf->bHasTRNS = MNG_TRUE; /* tell it it's got a tRNS now */ |
| pBuf->iTRNSgray = 0; |
| pBuf->iTRNSred = 0; |
| pBuf->iTRNSgreen = 0; |
| pBuf->iTRNSblue = 0; |
| pBuf->iTRNScount = 0; |
| |
| switch (pData->iColortype) /* store fields for future reference */ |
| { |
| case 0: { /* gray */ |
| pBuf->iTRNSgray = ((mng_trnsp)pChunk)->iGray; |
| #if defined(MNG_NO_1_2_4BIT_SUPPORT) |
| pBuf->iTRNSgray *= multiplier[pData->iPNGdepth]; |
| #endif |
| #if defined(MNG_NO_16BIT_SUPPORT) |
| if (pData->iPNGmult == 2) |
| pBuf->iTRNSgray >>= 8; |
| #endif |
| break; |
| } |
| case 2: { /* rgb */ |
| pBuf->iTRNSred = ((mng_trnsp)pChunk)->iRed; |
| pBuf->iTRNSgreen = ((mng_trnsp)pChunk)->iGreen; |
| pBuf->iTRNSblue = ((mng_trnsp)pChunk)->iBlue; |
| #if defined(MNG_NO_16BIT_SUPPORT) |
| if (pData->iPNGmult == 2) |
| { |
| pBuf->iTRNSred >>= 8; |
| pBuf->iTRNSgreen >>= 8; |
| pBuf->iTRNSblue >>= 8; |
| } |
| #endif |
| break; |
| } |
| case 3: { /* indexed */ |
| pBuf->iTRNScount = ((mng_trnsp)pChunk)->iCount; |
| MNG_COPY (pBuf->aTRNSentries, |
| ((mng_trnsp)pChunk)->aEntries, |
| ((mng_trnsp)pChunk)->iCount); |
| break; |
| } |
| } |
| } |
| else |
| #endif |
| { /* address current object */ |
| pImage = (mng_imagep)pData->pCurrentobj; |
| |
| if (!pImage) /* no object then dump it in obj 0 */ |
| pImage = (mng_imagep)pData->pObjzero; |
| |
| pBuf = pImage->pImgbuf; /* address object buffer */ |
| pBuf->bHasTRNS = MNG_TRUE; /* and tell it it's got a tRNS now */ |
| pBuf->iTRNSgray = 0; |
| pBuf->iTRNSred = 0; |
| pBuf->iTRNSgreen = 0; |
| pBuf->iTRNSblue = 0; |
| pBuf->iTRNScount = 0; |
| |
| if (((mng_trnsp)pChunk)->bEmpty) /* if empty, inherit from global */ |
| { |
| iRawlen2 = pData->iGlobalTRNSrawlen; |
| pRawdata2 = (mng_ptr)(pData->aGlobalTRNSrawdata); |
| /* global length oke ? */ |
| if ((pData->iColortype == 0) && (iRawlen2 != 2)) |
| MNG_ERROR (pData, MNG_GLOBALLENGTHERR); |
| |
| if ((pData->iColortype == 2) && (iRawlen2 != 6)) |
| MNG_ERROR (pData, MNG_GLOBALLENGTHERR); |
| |
| if ((pData->iColortype == 3) && ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount))) |
| MNG_ERROR (pData, MNG_GLOBALLENGTHERR); |
| |
| switch (pData->iColortype) /* store fields for future reference */ |
| { |
| case 0: { /* gray */ |
| pBuf->iTRNSgray = mng_get_uint16 (pRawdata2); |
| #if defined(MNG_NO_16BIT_SUPPORT) |
| if (pData->iPNGmult == 2) |
| pBuf->iTRNSgray >>= 8; |
| #endif |
| break; |
| } |
| case 2: { /* rgb */ |
| pBuf->iTRNSred = mng_get_uint16 (pRawdata2); |
| pBuf->iTRNSgreen = mng_get_uint16 (pRawdata2+2); |
| pBuf->iTRNSblue = mng_get_uint16 (pRawdata2+4); |
| #if defined(MNG_NO_16BIT_SUPPORT) |
| if (pData->iPNGmult == 2) |
| { |
| pBuf->iTRNSred >>= 8; |
| pBuf->iTRNSgreen >>= 8; |
| pBuf->iTRNSblue >>= 8; |
| } |
| #endif |
| break; |
| } |
| case 3: { /* indexed */ |
| pBuf->iTRNScount = iRawlen2; |
| MNG_COPY (pBuf->aTRNSentries, pRawdata2, iRawlen2); |
| break; |
| } |
| } |
| } |
| else |
| { |
| switch (pData->iColortype) /* store fields for future reference */ |
| { |
| case 0: { /* gray */ |
| pBuf->iTRNSgray = ((mng_trnsp)pChunk)->iGray; |
| #if defined(MNG_NO_16BIT_SUPPORT) |
| if (pData->iPNGmult == 2) |
| pBuf->iTRNSgray >>= 8; |
| #endif |
| break; |
| } |
| case 2: { /* rgb */ |
| pBuf->iTRNSred = ((mng_trnsp)pChunk)->iRed; |
| pBuf->iTRNSgreen = ((mng_trnsp)pChunk)->iGreen; |
| pBuf->iTRNSblue = ((mng_trnsp)pChunk)->iBlue; |
| #if defined(MNG_NO_16BIT_SUPPORT) |
| if (pData->iPNGmult == 2) |
| { |
| pBuf->iTRNSred >>= 8; |
| pBuf->iTRNSgreen >>= 8; |
| pBuf->iTRNSblue >>= 8; |
| } |
| #endif |
| break; |
| } |
| case 3: { /* indexed */ |
| pBuf->iTRNScount = ((mng_trnsp)pChunk)->iCount; |
| MNG_COPY (pBuf->aTRNSentries, |
| ((mng_trnsp)pChunk)->aEntries, |
| ((mng_trnsp)pChunk)->iCount); |
| break; |
| } |
| } |
| } |
| } |
| } |
| else |
| { /* create an animation object */ |
| return mng_create_ani_trns (pData); |
| } |
| #endif /* MNG_SUPPORT_DISPLAY */ |
| |
| return MNG_NOERROR; /* done */ |
| } |
| |
| /* ************************************************************************** */ |
| |
| MNG_C_SPECIALFUNC (mng_special_gama) |
| { |
| #ifdef MNG_INCLUDE_JNG |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) |
| #else |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| #endif |
| pData->bHasGAMA = MNG_TRUE; /* indicate we've got it */ |
| else |
| pData->bHasglobalGAMA = (mng_bool)!((mng_gamap)pChunk)->bEmpty; |
| |
| #ifdef MNG_SUPPORT_DISPLAY |
| #ifdef MNG_INCLUDE_JNG |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) |
| #else |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| #endif |
| { |
| mng_imagep pImage; |
| |
| #ifndef MNG_NO_DELTA_PNG |
| if (pData->bHasDHDR) /* update delta image ? */ |
| pImage = (mng_imagep)pData->pObjzero; |
| else |
| #endif |
| { |
| pImage = (mng_imagep)pData->pCurrentobj; |
| if (!pImage) /* no object then dump it in obj 0 */ |
| pImage = (mng_imagep)pData->pObjzero; |
| } |
| /* store for color-processing routines */ |
| pImage->pImgbuf->iGamma = ((mng_gamap)pChunk)->iGamma; |
| pImage->pImgbuf->bHasGAMA = MNG_TRUE; |
| } |
| else |
| { /* store as global */ |
| if (!((mng_gamap)pChunk)->bEmpty) |
| pData->iGlobalGamma = ((mng_gamap)pChunk)->iGamma; |
| /* create an animation object */ |
| return mng_create_ani_gama (pData, pChunk); |
| } |
| #endif /* MNG_SUPPORT_DISPLAY */ |
| |
| return MNG_NOERROR; /* done */ |
| } |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_cHRM |
| MNG_C_SPECIALFUNC (mng_special_chrm) |
| { |
| #ifdef MNG_INCLUDE_JNG |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) |
| #else |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| #endif |
| pData->bHasCHRM = MNG_TRUE; /* indicate we've got it */ |
| else |
| pData->bHasglobalCHRM = (mng_bool)!((mng_chrmp)pChunk)->bEmpty; |
| |
| #ifdef MNG_SUPPORT_DISPLAY |
| { |
| #ifdef MNG_INCLUDE_JNG |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) |
| #else |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| #endif |
| { |
| mng_imagep pImage; |
| mng_imagedatap pBuf; |
| |
| #ifndef MNG_NO_DELTA_PNG |
| if (pData->bHasDHDR) /* update delta image ? */ |
| pImage = (mng_imagep)pData->pObjzero; |
| else |
| #endif |
| { |
| pImage = (mng_imagep)pData->pCurrentobj; |
| if (!pImage) /* no object then dump it in obj 0 */ |
| pImage = (mng_imagep)pData->pObjzero; |
| } |
| |
| pBuf = pImage->pImgbuf; /* address object buffer */ |
| pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */ |
| /* store for color-processing routines */ |
| pBuf->iWhitepointx = ((mng_chrmp)pChunk)->iWhitepointx; |
| pBuf->iWhitepointy = ((mng_chrmp)pChunk)->iWhitepointy; |
| pBuf->iPrimaryredx = ((mng_chrmp)pChunk)->iRedx; |
| pBuf->iPrimaryredy = ((mng_chrmp)pChunk)->iRedy; |
| pBuf->iPrimarygreenx = ((mng_chrmp)pChunk)->iGreenx; |
| pBuf->iPrimarygreeny = ((mng_chrmp)pChunk)->iGreeny; |
| pBuf->iPrimarybluex = ((mng_chrmp)pChunk)->iBluex; |
| pBuf->iPrimarybluey = ((mng_chrmp)pChunk)->iBluey; |
| } |
| else |
| { /* store as global */ |
| if (!((mng_chrmp)pChunk)->bEmpty) |
| { |
| pData->iGlobalWhitepointx = ((mng_chrmp)pChunk)->iWhitepointx; |
| pData->iGlobalWhitepointy = ((mng_chrmp)pChunk)->iWhitepointy; |
| pData->iGlobalPrimaryredx = ((mng_chrmp)pChunk)->iRedx; |
| pData->iGlobalPrimaryredy = ((mng_chrmp)pChunk)->iRedy; |
| pData->iGlobalPrimarygreenx = ((mng_chrmp)pChunk)->iGreenx; |
| pData->iGlobalPrimarygreeny = ((mng_chrmp)pChunk)->iGreeny; |
| pData->iGlobalPrimarybluex = ((mng_chrmp)pChunk)->iBluex; |
| pData->iGlobalPrimarybluey = ((mng_chrmp)pChunk)->iBluey; |
| } |
| /* create an animation object */ |
| return mng_create_ani_chrm (pData, pChunk); |
| } |
| } |
| #endif /* MNG_SUPPORT_DISPLAY */ |
| |
| return MNG_NOERROR; /* done */ |
| } |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| MNG_C_SPECIALFUNC (mng_special_srgb) |
| { |
| #ifdef MNG_INCLUDE_JNG |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) |
| #else |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| #endif |
| pData->bHasSRGB = MNG_TRUE; /* indicate we've got it */ |
| else |
| pData->bHasglobalSRGB = (mng_bool)!((mng_srgbp)pChunk)->bEmpty; |
| |
| #ifdef MNG_SUPPORT_DISPLAY |
| #ifdef MNG_INCLUDE_JNG |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) |
| #else |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| #endif |
| { |
| mng_imagep pImage; |
| |
| #ifndef MNG_NO_DELTA_PNG |
| if (pData->bHasDHDR) /* update delta image ? */ |
| pImage = (mng_imagep)pData->pObjzero; |
| else |
| #endif |
| { |
| pImage = (mng_imagep)pData->pCurrentobj; |
| if (!pImage) /* no object then dump it in obj 0 */ |
| pImage = (mng_imagep)pData->pObjzero; |
| } |
| /* store for color-processing routines */ |
| pImage->pImgbuf->iRenderingintent = ((mng_srgbp)pChunk)->iRenderingintent; |
| pImage->pImgbuf->bHasSRGB = MNG_TRUE; |
| } |
| else |
| { /* store as global */ |
| if (!((mng_srgbp)pChunk)->bEmpty) |
| pData->iGlobalRendintent = ((mng_srgbp)pChunk)->iRenderingintent; |
| /* create an animation object */ |
| return mng_create_ani_srgb (pData, pChunk); |
| } |
| #endif /* MNG_SUPPORT_DISPLAY */ |
| |
| return MNG_NOERROR; /* done */ |
| } |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_iCCP |
| MNG_C_SPECIALFUNC (mng_special_iccp) |
| { |
| mng_retcode iRetcode; |
| mng_chunk_headerp pDummy; |
| |
| #ifdef MNG_CHECK_BAD_ICCP /* Check for bad iCCP chunk */ |
| if (!strncmp (((mng_iccpp)pChunk)->zName, "Photoshop ICC profile", 21)) |
| { |
| if (((mng_iccpp)pChunk)->iProfilesize == 2615) /* is it the sRGB profile ? */ |
| { |
| mng_chunk_header chunk_srgb; |
| mng_get_chunkheader (MNG_UINT_sRGB, &chunk_srgb); |
| /* pretend it's an sRGB chunk then ! */ |
| iRetcode = mng_read_general (pData, &chunk_srgb, 1, (mng_ptr)"0", &pDummy); |
| if (iRetcode) /* on error bail out */ |
| return iRetcode; |
| |
| pDummy->fCleanup (pData, pDummy); |
| } |
| } |
| else |
| { |
| #endif /* MNG_CHECK_BAD_ICCP */ |
| |
| #ifdef MNG_INCLUDE_JNG |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) |
| #else |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| #endif |
| pData->bHasICCP = MNG_TRUE; /* indicate we've got it */ |
| else |
| pData->bHasglobalICCP = (mng_bool)!((mng_iccpp)pChunk)->bEmpty; |
| |
| #ifdef MNG_SUPPORT_DISPLAY |
| #ifdef MNG_INCLUDE_JNG |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) |
| #else |
| if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) |
| #endif |
| { |
| mng_imagep pImage; |
| |
| #ifndef MNG_NO_DELTA_PNG |
| if (pData->bHasDHDR) /* update delta image ? */ |
| { /* store in object 0 ! */ |
| pImage = (mng_imagep)pData->pObjzero; |
| |
| if (pImage->pImgbuf->pProfile) /* profile existed ? */ |
| MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize); |
| /* allocate a buffer & copy it */ |
| MNG_ALLOC (pData, pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->iProfilesize); |
| MNG_COPY (pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->pProfile, ((mng_iccpp)pChunk)->iProfilesize); |
| /* store its length as well */ |
| pImage->pImgbuf->iProfilesize = ((mng_iccpp)pChunk)->iProfilesize; |
| pImage->pImgbuf->bHasICCP = MNG_TRUE; |
| } |
| else |
| #endif |
| { |
| pImage = (mng_imagep)pData->pCurrentobj; |
| |
| if (!pImage) /* no object then dump it in obj 0 */ |
| pImage = (mng_imagep)pData->pObjzero; |
| |
| if (pImage->pImgbuf->pProfile) /* profile existed ? */ |
| MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize); |
| /* allocate a buffer & copy it */ |
| MNG_ALLOC (pData, pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->iProfilesize); |
| MNG_COPY (pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->pProfile, ((mng_iccpp)pChunk)->iProfilesize); |
| /* store its length as well */ |
| pImage->pImgbuf->iProfilesize = ((mng_iccpp)pChunk)->iProfilesize; |
| pImage->pImgbuf->bHasICCP = MNG_TRUE; |
| } |
| } |
| else |
| { /* store as global */ |
| if (pData->pGlobalProfile) /* did we have a global profile ? */ |
| MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); |
| |
| if (((mng_iccpp)pChunk)->bEmpty) /* empty chunk ? */ |
| { |
| pData->iGlobalProfilesize = 0; /* reset to null */ |
| pData->pGlobalProfile = MNG_NULL; |
| } |
| else |
| { /* allocate a global buffer & copy it */ |
| MNG_ALLOC (pData, pData->pGlobalProfile, ((mng_iccpp)pChunk)->iProfilesize); |
| MNG_COPY (pData->pGlobalProfile, ((mng_iccpp)pChunk)->pProfile, ((mng_iccpp)pChunk)->iProfilesize); |
| /* store its length as well */ |
| pData->iGlobalProfilesize = ((mng_iccpp)pChunk)->iProfilesize; |
| } |
| /* create an animation object */ |
| return mng_create_ani_iccp (pData, pChunk); |
| } |
| #endif /* MNG_SUPPORT_DISPLAY */ |
| |
| #ifdef MNG_CHECK_BAD_ICCP |
| } |
| #endif |
| |
| return MNG_NOERROR; /* done */ |
| } |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_tEXt |
| MNG_C_SPECIALFUNC (mng_special_text) |
| { |
| if (pData->fProcesstext) /* inform the application ? */ |
| { |
| mng_bool bOke = pData->fProcesstext ((mng_handle)pData, MNG_TYPE_TEXT, |
| ((mng_textp)pChunk)->zKeyword, |
| ((mng_textp)pChunk)->zText, 0, 0); |
| if (!bOke) |
| MNG_ERROR (pData, MNG_APPMISCERROR); |
| } |
| |
| return MNG_NOERROR; /* done */ |
| } |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_zTXt |
| MNG_C_SPECIALFUNC (mng_special_ztxt) |
| { |
| if (pData->fProcesstext) /* inform the application ? */ |
| { |
| mng_bool bOke = pData->fProcesstext ((mng_handle)pData, MNG_TYPE_ZTXT, |
| ((mng_ztxtp)pChunk)->zKeyword, |
| ((mng_ztxtp)pChunk)->zText, 0, 0); |
| if (!bOke) |
| MNG_ERROR (pData, MNG_APPMISCERROR); |
| } |
| |
| return MNG_NOERROR; /* done */ |
| } |
| #endif |
| |
| /* ************************************************************************** */ |
| |
| #ifndef MNG_SKIPCHUNK_iTXt |
| MNG_F_SPECIALFUNC (mng_deflate_itxt) |
| { |
| mng_itxtp pITXT = (mng_itxtp)pChunk; |
| mng_uint32 iBufsize = 0; |
| mng_uint8p pBuf = 0; |
| mng_uint32 iTextlen = 0; |
| |
| if (pITXT->iCompressionflag) /* decompress the text ? */ |
| { |
| mng_retcode iRetcode = mng_inflate_buffer (pData, *ppRawdata, *piRawlen, |
| &pBuf, &iBufsize, &iTextlen); |