if ((!iRetcode) && (pData->bDisplaying))
if (!iRetcode)
READ_CHUNK (read_save){#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_SAVE, MNG_LC_START)#endif                                       /* sequence checks */  if ((!pData->bHasMHDR) || (pData->bHasSAVE))    MNG_ERROR (pData, MNG_SEQUENCEERROR)#ifdef MNG_INCLUDE_JNG  if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR))#else  if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR))#endif    MNG_ERROR (pData, MNG_SEQUENCEERROR)  pData->bHasSAVE = MNG_TRUE;  if (pData->fProcesssave)             /* inform the application ? */  {    mng_bool bOke = pData->fProcesssave ((mng_handle)pData);    if (!bOke)      MNG_ERROR (pData, MNG_APPMISCERROR)  }#ifdef MNG_SUPPORT_DISPLAY  {    mng_retcode iRetcode;    /* TODO: something with the parameters */                                       /* create a SAVE animation object */    iRetcode = create_ani_save (pData);                                       /* process it */    if ((!iRetcode) && (pData->bDisplaying))      iRetcode = process_display_save (pData);    if (iRetcode)                      /* on error bail out */      return iRetcode;  }#endif /* MNG_SUPPORT_DISPLAY */#ifdef MNG_STORE_CHUNKS  if (pData->bStorechunks)  {                                    /* initialize storage */    mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk);    if (iRetcode)                      /* on error bail out */      return iRetcode;                                       /* store the fields */    ((mng_savep)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0);    if (iRawlen)                       /* not empty ? */    {      mng_uint8       iOtype = *pRawdata;      mng_uint8       iEtype;      mng_uint32      iCount = 0;      mng_uint8p      pTemp;      mng_uint8p      pNull;      mng_uint32      iLen;      mng_uint32      iOffset[2];      mng_uint32      iStarttime[2];      mng_uint32      iFramenr;      mng_uint32      iLayernr;      mng_uint32      iX;      mng_save_entryp pEntry = MNG_NULL;      mng_uint32      iNamesize;      if ((iOtype != 4) && (iOtype != 8))        MNG_ERROR (pData, MNG_INVOFFSETSIZE);      ((mng_savep)*ppChunk)->iOffsettype = iOtype;      for (iX = 0; iX < 2; iX++)       /* do this twice to get the count first ! */      {        pTemp = pRawdata + 1;        iLen  = iRawlen  - 1;        if (iX)                        /* second run ? */        {          MNG_ALLOC (pData, pEntry, (iCount * sizeof (mng_save_entry)))          ((mng_savep)*ppChunk)->iCount   = iCount;          ((mng_savep)*ppChunk)->pEntries = pEntry;        }        while (iLen)                   /* anything left ? */        {          iEtype = *pTemp;             /* entrytype */          if ((iEtype != 0) && (iEtype != 1) && (iEtype != 2) && (iEtype != 3))            MNG_ERROR (pData, MNG_INVENTRYTYPE);          pTemp++;          if (iEtype > 1)          {            iOffset    [0] = 0;            iOffset    [1] = 0;            iStarttime [0] = 0;            iStarttime [1] = 0;            iLayernr       = 0;            iFramenr       = 0;          }          else          {            if (iOtype == 4)            {              iOffset [0] = 0;              iOffset [1] = mng_get_uint32 (pTemp);              pTemp += 4;            }            else            {              iOffset [0] = mng_get_uint32 (pTemp);              iOffset [1] = mng_get_uint32 (pTemp+4);              pTemp += 8;            }            if (iEtype > 0)            {              iStarttime [0] = 0;              iStarttime [1] = 0;              iLayernr       = 0;              iFramenr       = 0;            }            else            {              if (iOtype == 4)              {                iStarttime [0] = 0;                iStarttime [1] = mng_get_uint32 (pTemp+0);                iLayernr       = mng_get_uint32 (pTemp+4);                iFramenr       = mng_get_uint32 (pTemp+8);                pTemp += 12;              }              else              {                iStarttime [0] = mng_get_uint32 (pTemp+0);                iStarttime [1] = mng_get_uint32 (pTemp+4);                iLayernr       = mng_get_uint32 (pTemp+8);                iFramenr       = mng_get_uint32 (pTemp+12);                pTemp += 16;              }            }          }          pNull = find_null (pTemp);   /* get the name length */          if ((pNull - pRawdata) > (mng_int32)iRawlen)          {            iNamesize = iLen;          /* no null found; so end of SAVE */            iLen      = 0;          }          else          {            iNamesize = pNull - pTemp; /* should be another entry */            iLen     -= iNamesize;            if (!iLen)                 /* must not end with a null ! */              MNG_ERROR (pData, MNG_ENDWITHNULL)          }          if (!pEntry)          {            iCount++;          }          else          {            pEntry->iEntrytype     = iEtype;            pEntry->iOffset    [0] = iOffset    [0];            pEntry->iOffset    [1] = iOffset    [1];            pEntry->iStarttime [0] = iStarttime [0];            pEntry->iStarttime [1] = iStarttime [1];            pEntry->iLayernr       = iLayernr;            pEntry->iFramenr       = iFramenr;            pEntry->iNamesize      = iNamesize;            if (iNamesize)            {              MNG_ALLOC (pData, pEntry->zName, iNamesize+1)              MNG_COPY (pEntry->zName, pTemp, iNamesize)            }            pEntry++;          }          pTemp += iNamesize;        }      }    }  }#endif /* MNG_STORE_CHUNKS */#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_SAVE, MNG_LC_END)#endif  return MNG_NOERROR;                  /* done */}