if ((pData->bHasJHDR) && (pData->iJHDRalphacompression != MNG_COMPRESSION_DEFLATE)) MNG_ERROR (pData, MNG_SEQUENCEERROR)
READ_CHUNK (read_idat){#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_IDAT, MNG_LC_START)#endif#ifdef MNG_INCLUDE_JNG                 /* sequence checks */  if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR))#else  if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR))#endif    MNG_ERROR (pData, MNG_SEQUENCEERROR)#ifdef MNG_INCLUDE_JNG  if (pData->bHasJSEP)    MNG_ERROR (pData, MNG_SEQUENCEERROR)#endif                                       /* not allowed for for deltatype NO_CHANGE */  if ((pData->bHasDHDR) && ((pData->iDeltatype == MNG_DELTATYPE_NOCHANGE)))    MNG_ERROR (pData, MNG_CHUNKNOTALLOWED)                                       /* can only be empty in BASI-block! */  if ((iRawlen == 0) && (!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 */#ifdef MNG_SUPPORT_DISPLAY  if (iRawlen)  {                                    /* display processing */    mng_retcode iRetcode = process_display_idat (pData, iRawlen, pRawdata);    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_idatp)*ppChunk)->bEmpty    = (mng_bool)(iRawlen == 0);    ((mng_idatp)*ppChunk)->iDatasize = iRawlen;    if (iRawlen != 0)                  /* is there any data ? */    {      MNG_ALLOC (pData, ((mng_idatp)*ppChunk)->pData, iRawlen)      MNG_COPY  (((mng_idatp)*ppChunk)->pData, pRawdata, iRawlen)    }  }#endif /* MNG_STORE_CHUNKS */#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_IDAT, MNG_LC_END)#endif  return MNG_NOERROR;                  /* done */}