if ((pData->bHasIDAT) || (pData->bHasPLTE) || (pData->bHasJDAT))
if ((pData->bHasIDAT) || (pData->bHasPLTE) || (pData->bHasJDAT) || (pData->bHasJDAA))
READ_CHUNK (read_srgb){#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_SRGB, MNG_LC_START)#endif                                       /* sequence checks */#ifdef MNG_INCLUDE_JNG  if ((!pData->bHasMHDR) && (!pData->bHasIHDR) &&      (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR))#else  if ((!pData->bHasMHDR) && (!pData->bHasIHDR) &&      (!pData->bHasBASI) && (!pData->bHasDHDR)    )#endif    MNG_ERROR (pData, MNG_SEQUENCEERROR)#ifdef MNG_INCLUDE_JNG  if ((pData->bHasIDAT) || (pData->bHasPLTE) || (pData->bHasJDAT))#else  if ((pData->bHasIDAT) || (pData->bHasPLTE))#endif    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  {                                    /* length must be exactly 1 */    if (iRawlen != 1)      MNG_ERROR (pData, MNG_INVALIDLENGTH)  }  else  {                                    /* length must be empty or exactly 1 */    if ((iRawlen != 0) && (iRawlen != 1))      MNG_ERROR (pData, MNG_INVALIDLENGTH)  }#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)(iRawlen != 0);#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;    if (pData->bHasDHDR)               /* update delta image ? */    {                                  /* store in object 0 ! */      pImage = (mng_imagep)pData->pObjzero;                                       /* store for color-processing routines */      pImage->pImgbuf->iRenderingintent = *pRawdata;      pImage->pImgbuf->bHasSRGB         = MNG_TRUE;    }    else    {      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 = *pRawdata;      pImage->pImgbuf->bHasSRGB         = MNG_TRUE;    }  }  else  {                                    /* store as global */    if (iRawlen != 0)      pData->iGlobalRendintent = *pRawdata;    {                                  /* create an animation object */      mng_retcode iRetcode = create_ani_srgb (pData, (mng_bool)(iRawlen == 0),                                              pData->iGlobalRendintent);      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_srgbp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0);    if (iRawlen)      ((mng_srgbp)*ppChunk)->iRenderingintent = *pRawdata;  }    #endif /* MNG_STORE_CHUNKS */#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_SRGB, MNG_LC_END)#endif  return MNG_NOERROR;                  /* done */}