pData->pCurrentobj           = 0;     pData->pCurraniobj           = 0; pData->pTermaniobj           = 0; pData->pLastclone            = 0; pData->pStoreobj             = 0; pData->pStorebuf             = 0; pData->pRetrieveobj          = 0;  pData->pSavedata             = 0;
pData->pCurrentobj           = MNG_NULL; pData->pCurraniobj           = MNG_NULL; pData->pTermaniobj           = MNG_NULL; pData->pLastclone            = MNG_NULL; pData->pStoreobj             = MNG_NULL; pData->pStorebuf             = MNG_NULL; pData->pRetrieveobj          = MNG_NULL;  pData->pSavedata             = MNG_NULL;
mng_retcode MNG_DECL mng_reset (mng_handle hHandle){  mng_datap   pData;#ifdef MNG_SUPPORT_DISPLAY  mng_retcode iRetcode;  mng_imagep  pImage;#endif#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (((mng_datap)hHandle), MNG_FN_RESET, MNG_LC_START)#endif  MNG_VALIDHANDLE (hHandle)            /* check validity handle */  pData = ((mng_datap)(hHandle));      /* address main structure */#ifdef MNG_SUPPORT_DISPLAY  mng_drop_savedata (pData);           /* cleanup saved-data from SAVE/SEEK */#endif#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_FULL_CMS)  mng_clear_cms (pData);               /* cleanup left-over cms stuff if any */#endif#ifdef MNG_INCLUDE_JNG  mngjpeg_cleanup (pData);             /* cleanup jpeg stuff */#endif#ifdef MNG_INCLUDE_ZLIB  if (pData->bInflating)               /* if we've been inflating */  {#ifdef MNG_INCLUDE_DISPLAY_PROCS    cleanup_rowproc (pData);           /* cleanup row-processing, */#endif    mngzlib_inflatefree (pData);       /* cleanup inflate! */  }#endif /* MNG_INCLUDE_ZLIB */#ifdef MNG_SUPPORT_READ                /* cleanup default read buffers */  MNG_FREE (pData, pData->pReadbuf,    pData->iReadbufsize)  MNG_FREE (pData, pData->pLargebuf,   pData->iLargebufsize)  MNG_FREE (pData, pData->pSuspendbuf, pData->iSuspendbufsize)#endif#ifdef MNG_SUPPORT_WRITE               /* cleanup default write buffer */  MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize)#endif#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)  mng_drop_chunks  (pData);            /* drop stored chunks (if any) */#endif#ifdef MNG_SUPPORT_DISPLAY  mng_drop_objects (pData, MNG_TRUE);  /* drop stored objects (if any) */  if (pData->iGlobalProfilesize)       /* drop global profile (if any) */    MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize)#endif  pData->eSigtype              = mng_it_unknown;  pData->eImagetype            = mng_it_unknown;  pData->iWidth                = 0;    /* these are unknown yet */  pData->iHeight               = 0;  pData->iTicks                = 0;  pData->iLayercount           = 0;  pData->iFramecount           = 0;  pData->iPlaytime             = 0;  pData->iImagelevel           = 0;    /* no image encountered */  pData->iMagnify              = 0;    /* 1-to-1 display */  pData->iOffsetx              = 0;    /* no offsets */  pData->iOffsety              = 0;  pData->iCanvaswidth          = 0;    /* let the app decide during processheader */  pData->iCanvasheight         = 0;                                       /* so far, so good */  pData->iErrorcode            = MNG_NOERROR;  pData->iSeverity             = 0;  pData->iErrorx1              = 0;  pData->iErrorx2              = 0;  pData->zErrortext            = MNG_NULL;#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)                                       /* let's assume the best scenario */  pData->bPreDraft48           = MNG_FALSE;                                       /* the unknown chunk */  pData->iChunkname            = MNG_UINT_HUH;  pData->iChunkseq             = 0;  pData->pFirstchunk           = 0;  pData->pLastchunk            = 0;                                       /* nothing processed yet */  pData->bHasheader            = MNG_FALSE;  pData->bHasMHDR              = MNG_FALSE;  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->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;  pData->bHasSAVE              = MNG_FALSE;  pData->bHasBACK              = MNG_FALSE;  pData->bHasFRAM              = MNG_FALSE;  pData->bHasTERM              = MNG_FALSE;  pData->bHasLOOP              = MNG_FALSE;                                       /* there's no global stuff yet either */  pData->bHasglobalPLTE        = MNG_FALSE;  pData->bHasglobalTRNS        = MNG_FALSE;  pData->bHasglobalGAMA        = MNG_FALSE;  pData->bHasglobalCHRM        = MNG_FALSE;  pData->bHasglobalSRGB        = MNG_FALSE;  pData->bHasglobalICCP        = MNG_FALSE;  pData->iDatawidth            = 0;    /* no IHDR/BASI/DHDR done yet */  pData->iDataheight           = 0;  pData->iBitdepth             = 0;  pData->iColortype            = 0;  pData->iCompression          = 0;  pData->iFilter               = 0;  pData->iInterlace            = 0;#ifdef MNG_INCLUDE_JNG  pData->iJHDRcolortype        = 0;    /* no JHDR data */  pData->iJHDRimgbitdepth      = 0;  pData->iJHDRimgcompression   = 0;  pData->iJHDRimginterlace     = 0;  pData->iJHDRalphabitdepth    = 0;  pData->iJHDRalphacompression = 0;  pData->iJHDRalphafilter      = 0;  pData->iJHDRalphainterlace   = 0;#endif#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */#ifdef MNG_SUPPORT_READ                /* no reading done */  pData->bReading              = MNG_FALSE;  pData->bHavesig              = MNG_FALSE;  pData->bEOF                  = MNG_FALSE;  pData->iReadbufsize          = 0;  pData->pReadbuf              = MNG_NULL;  pData->iLargebufsize         = 0;  pData->pLargebuf             = MNG_NULL;  pData->iSuspendtime          = 0;  pData->bSuspended            = MNG_FALSE;  pData->iSuspendpoint         = 0;  pData->pSuspendbufnext       = pData->pSuspendbuf;  pData->iSuspendbufleft       = 0;#endif /* MNG_SUPPORT_READ */#ifdef MNG_SUPPORT_WRITE               /* no creating/writing done */  pData->bCreating             = MNG_FALSE;  pData->bWriting              = MNG_FALSE;  pData->iFirstchunkadded      = 0;  pData->iWritebufsize         = 0;  pData->pWritebuf             = 0;#endif /* MNG_SUPPORT_WRITE */#ifdef MNG_SUPPORT_DISPLAY             /* done nuttin' yet */  pData->bDisplaying           = MNG_FALSE;  pData->iFrameseq             = 0;  pData->iLayerseq             = 0;  pData->iFrametime            = 0;  pData->iRequestframe         = 0;  pData->iRequestlayer         = 0;  pData->iRequesttime          = 0;  pData->bSearching            = MNG_FALSE;  pData->iRuntime              = 0;  pData->iSynctime             = 0;  pData->iStarttime            = 0;  pData->iEndtime              = 0;  pData->bRunning              = MNG_FALSE;  pData->bTimerset             = MNG_FALSE;  pData->iBreakpoint           = 0;  pData->bSectionwait          = MNG_FALSE;  pData->bFreezing             = MNG_FALSE;  pData->bResetting            = MNG_FALSE;  pData->bNeedrefresh          = MNG_FALSE;  pData->pCurrentobj           = 0;    /* these don't exist yet */  pData->pCurraniobj           = 0;  pData->pTermaniobj           = 0;  pData->pLastclone            = 0;  pData->pStoreobj             = 0;  pData->pStorebuf             = 0;  pData->pRetrieveobj          = 0;  pData->pSavedata             = 0;    /* no saved data ! */                                       /* TODO: remove in 1.0.0 !!! */  pData->bEMNGMAhack           = MNG_FALSE;  pData->iUpdateleft           = 0;    /* no region updated yet */  pData->iUpdateright          = 0;  pData->iUpdatetop            = 0;  pData->iUpdatebottom         = 0;  pData->iPass                 = 0;    /* interlacing stuff and temp buffers */  pData->iRow                  = 0;  pData->iRowinc               = 0;  pData->iCol                  = 0;  pData->iColinc               = 0;  pData->iRowsamples           = 0;  pData->iSamplemul            = 0;  pData->iSampleofs            = 0;  pData->iSamplediv            = 0;  pData->iRowsize              = 0;  pData->iRowmax               = 0;  pData->pWorkrow              = 0;  pData->pPrevrow              = 0;  pData->pRGBArow              = 0;  pData->bIsRGBA16             = MNG_TRUE;  pData->bIsOpaque             = MNG_TRUE;  pData->iFilterbpp            = 1;  pData->iSourcel              = 0;    /* always initialized just before */  pData->iSourcer              = 0;    /* compositing the next layer */  pData->iSourcet              = 0;  pData->iSourceb              = 0;  pData->iDestl                = 0;  pData->iDestr                = 0;  pData->iDestt                = 0;  pData->iDestb                = 0;  pData->pFirstimgobj          = 0;    /* lists are empty */  pData->pLastimgobj           = 0;  pData->pFirstaniobj          = 0;  pData->pLastaniobj           = 0;  pData->fDisplayrow           = 0;    /* no processing callbacks */  pData->fRestbkgdrow          = 0;  pData->fCorrectrow           = 0;  pData->fRetrieverow          = 0;  pData->fStorerow             = 0;  pData->fProcessrow           = 0;  pData->fInitrowproc          = 0;  pData->iPLTEcount            = 0;    /* no PLTE data */  pData->iDEFIobjectid         = 0;    /* no DEFI data */  pData->iDEFIdonotshow        = 0;  pData->iDEFIconcrete         = 0;  pData->bDEFIhasloca          = MNG_FALSE;  pData->iDEFIlocax            = 0;  pData->iDEFIlocay            = 0;  pData->bDEFIhasclip          = MNG_FALSE;  pData->iDEFIclipl            = 0;  pData->iDEFIclipr            = 0;  pData->iDEFIclipt            = 0;  pData->iDEFIclipb            = 0;  pData->iBACKred              = 0;    /* no BACK data */  pData->iBACKgreen            = 0;  pData->iBACKblue             = 0;  pData->iBACKmandatory        = 0;  pData->iBACKimageid          = 0;  pData->iBACKtile             = 0;  pData->iFRAMmode             = 1;     /* default global FRAM variables */  pData->iFRAMdelay            = 1;  pData->iFRAMtimeout          = 0x7fffffffl;  pData->bFRAMclipping         = MNG_FALSE;  pData->iFRAMclipl            = 0;  pData->iFRAMclipr            = 0;  pData->iFRAMclipt            = 0;  pData->iFRAMclipb            = 0;  pData->iFramemode            = 1;     /* again for the current frame */  pData->iFramedelay           = 1;  pData->iFrametimeout         = 0x7fffffffl;  pData->bFrameclipping        = MNG_FALSE;  pData->iFrameclipl           = 0;  pData->iFrameclipr           = 0;  pData->iFrameclipt           = 0;  pData->iFrameclipb           = 0;  pData->iNextdelay            = 1;  pData->iSHOWmode             = 0;    /* no SHOW data */  pData->iSHOWfromid           = 0;  pData->iSHOWtoid             = 0;  pData->iSHOWnextid           = 0;  pData->iSHOWskip             = 0;  pData->iGlobalPLTEcount      = 0;    /* no global PLTE data */  pData->iGlobalTRNSrawlen     = 0;    /* no global tRNS data */  pData->iGlobalGamma          = 0;    /* no global gAMA data */  pData->iGlobalWhitepointx    = 0;    /* no global cHRM data */  pData->iGlobalWhitepointy    = 0;  pData->iGlobalPrimaryredx    = 0;  pData->iGlobalPrimaryredy    = 0;  pData->iGlobalPrimarygreenx  = 0;  pData->iGlobalPrimarygreeny  = 0;  pData->iGlobalPrimarybluex   = 0;  pData->iGlobalPrimarybluey   = 0;  pData->iGlobalRendintent     = 0;    /* no global sRGB data */  pData->iGlobalProfilesize    = 0;    /* no global iCCP data */  pData->pGlobalProfile        = MNG_NULL;  pData->iGlobalBKGDred        = 0;    /* no global bKGD data */  pData->iGlobalBKGDgreen      = 0;  pData->iGlobalBKGDblue       = 0;                                       /* no delta-image */  pData->pDeltaImage           = MNG_NULL;  pData->iDeltaImagetype       = 0;  pData->iDeltatype            = 0;  pData->iDeltaBlockwidth      = 0;  pData->iDeltaBlockheight     = 0;  pData->iDeltaBlockx          = 0;  pData->iDeltaBlocky          = 0;  pData->bDeltaimmediate       = MNG_FALSE;#endif#ifdef MNG_INCLUDE_ZLIB  pData->bInflating            = 0;    /* no inflating or deflating */  pData->bDeflating            = 0;    /* going on at the moment */#endif#ifdef MNG_SUPPORT_DISPLAY             /* reset object 0 */  pImage   = (mng_imagep)pData->pObjzero;  iRetcode = reset_object_details (pData, pImage, 0, 0, 0, 0, 0, 0, 0, MNG_TRUE);  if (iRetcode)                        /* on error bail out */    return iRetcode;  pImage->bVisible             = MNG_TRUE;  pImage->bViewable            = MNG_TRUE;  pImage->iPosx                = 0;  pImage->iPosy                = 0;  pImage->bClipped             = MNG_FALSE;  pImage->iClipl               = 0;  pImage->iClipr               = 0;  pImage->iClipt               = 0;  pImage->iClipb               = 0;#endif#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (((mng_datap)hHandle), MNG_FN_RESET, MNG_LC_END)#endif  return MNG_NOERROR;}