if ((pData->iSimplicity & 0x00000001) == 0) pData->iAlphadepth = 16;            else if ((pData->iSimplicity & 0x00000008) == 0) pData->iAlphadepth = 0;             else if ((pData->iSimplicity & 0x00000140) == 0x00000040) pData->iAlphadepth = 1;             else pData->iAlphadepth = 16;
READ_CHUNK (read_mhdr){#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_MHDR, MNG_LC_START)#endif  if (pData->eSigtype != mng_it_mng)   /* sequence checks */    MNG_ERROR (pData, MNG_CHUNKNOTALLOWED)  if (pData->bHasheader)               /* can only be the first chunk! */    MNG_ERROR (pData, MNG_SEQUENCEERROR)                                       /* correct length ? */  if ((iRawlen != 28) && (iRawlen != 12))    MNG_ERROR (pData, MNG_INVALIDLENGTH);  pData->bHasMHDR       = MNG_TRUE;    /* oh boy, a real MNG */  pData->bHasheader     = MNG_TRUE;    /* we've got a header */  pData->eImagetype     = mng_it_mng;  /* fill header fields */  pData->iWidth         = mng_get_uint32 (pRawdata);  pData->iHeight        = mng_get_uint32 (pRawdata+4);  pData->iTicks         = mng_get_uint32 (pRawdata+8);  if (iRawlen == 28)                   /* proper MHDR ? */  {    pData->iLayercount  = mng_get_uint32 (pRawdata+12);    pData->iFramecount  = mng_get_uint32 (pRawdata+16);    pData->iPlaytime    = mng_get_uint32 (pRawdata+20);    pData->iSimplicity  = mng_get_uint32 (pRawdata+24);    pData->bPreDraft48  = MNG_FALSE;  }  else                                 /* probably pre-draft48 then */  {    pData->iLayercount  = 0;    pData->iFramecount  = 0;    pData->iPlaytime    = 0;    pData->iSimplicity  = 0;    pData->bPreDraft48  = MNG_TRUE;  }                                       /* fits on maximum canvas ? */  if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight))    MNG_WARNING (pData, MNG_IMAGETOOLARGE)  if (pData->fProcessheader)           /* inform the app ? */    if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight))      MNG_ERROR (pData, MNG_APPMISCERROR)  pData->iImagelevel++;                /* one level deeper */#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_mhdrp)*ppChunk)->iWidth      = pData->iWidth;    ((mng_mhdrp)*ppChunk)->iHeight     = pData->iHeight;    ((mng_mhdrp)*ppChunk)->iTicks      = pData->iTicks;    ((mng_mhdrp)*ppChunk)->iLayercount = pData->iLayercount;    ((mng_mhdrp)*ppChunk)->iFramecount = pData->iFramecount;    ((mng_mhdrp)*ppChunk)->iPlaytime   = pData->iPlaytime;    ((mng_mhdrp)*ppChunk)->iSimplicity = pData->iSimplicity;  }#endif /* MNG_STORE_CHUNKS */#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_MHDR, MNG_LC_END)#endif  return MNG_NOERROR;                  /* done */}