if (pData->bDisplaying)
READ_CHUNK (read_prom){  mng_uint8 iColortype;  mng_uint8 iSampledepth;  mng_uint8 iFilltype;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_PROM, MNG_LC_START)#endif                                       /* sequence checks */  if ((!pData->bHasMHDR) || (!pData->bHasDHDR))    MNG_ERROR (pData, MNG_SEQUENCEERROR)  if (iRawlen != 3)                    /* gotta be exactly 3 bytes */    MNG_ERROR (pData, MNG_INVALIDLENGTH)  iColortype   = *pRawdata;            /* check fields for validity */  iSampledepth = *(pRawdata+1);  iFilltype    = *(pRawdata+2);  if ((iColortype != MNG_COLORTYPE_GRAY   ) &&      (iColortype != MNG_COLORTYPE_RGB    ) &&      (iColortype != MNG_COLORTYPE_INDEXED) &&      (iColortype != MNG_COLORTYPE_GRAYA  ) &&      (iColortype != MNG_COLORTYPE_RGBA   )    )    MNG_ERROR (pData, MNG_INVALIDCOLORTYPE)  if ((iSampledepth != MNG_BITDEPTH_1 ) &&      (iSampledepth != MNG_BITDEPTH_2 ) &&      (iSampledepth != MNG_BITDEPTH_4 ) &&      (iSampledepth != MNG_BITDEPTH_8 ) &&      (iSampledepth != MNG_BITDEPTH_16)    )    MNG_ERROR (pData, MNG_INVSAMPLEDEPTH)  if ((iFilltype != MNG_FILLMETHOD_LEFTBITREPLICATE) &&      (iFilltype != MNG_FILLMETHOD_ZEROFILL        )    )    MNG_ERROR (pData, MNG_INVFILLMETHOD)#ifdef MNG_SUPPORT_DISPLAY  if (pData->bDisplaying)  {    mng_retcode iRetcode;    iRetcode = create_ani_prom (pData, iSampledepth, iColortype, iFilltype);    if (iRetcode)                      /* on error bail out */      return iRetcode;                                       /* display processing ? */    if ((pData->bDisplaying) && (pData->bRunning) && (!pData->bFreezing))    {      iRetcode = process_display_prom (pData, iSampledepth,                                       iColortype, iFilltype);      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_promp)*ppChunk)->iColortype   = iColortype;    ((mng_promp)*ppChunk)->iSampledepth = iSampledepth;    ((mng_promp)*ppChunk)->iFilltype    = iFilltype;  }#endif /* MNG_STORE_CHUNKS */#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_PROM, MNG_LC_END)#endif  return MNG_NOERROR;                  /* done */}