if (pData->bDisplaying)
READ_CHUNK (read_sbit){#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_SBIT, 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->bHasPLTE) || (pData->bHasIDAT) || (pData->bHasJDAT))#else  if ((pData->bHasPLTE) || (pData->bHasIDAT))#endif    MNG_ERROR (pData, MNG_SEQUENCEERROR)  if (iRawlen > 4)                     /* it just can't be bigger than that! */    MNG_ERROR (pData, MNG_INVALIDLENGTH)#ifdef MNG_INCLUDE_JNG                 /* length checks */  if (pData->bHasJHDR)  {    if ((pData->iJHDRcolortype ==  8) && (iRawlen != 1))      MNG_ERROR (pData, MNG_INVALIDLENGTH)    if ((pData->iJHDRcolortype == 10) && (iRawlen != 3))      MNG_ERROR (pData, MNG_INVALIDLENGTH)    if ((pData->iJHDRcolortype == 12) && (iRawlen != 2))      MNG_ERROR (pData, MNG_INVALIDLENGTH)    if ((pData->iJHDRcolortype == 14) && (iRawlen != 4))      MNG_ERROR (pData, MNG_INVALIDLENGTH)  }  else#endif /* MNG_INCLUDE_JNG */  if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR))  {    if ((pData->iColortype == 0) && (iRawlen != 1))      MNG_ERROR (pData, MNG_INVALIDLENGTH)    if ((pData->iColortype == 2) && (iRawlen != 3))      MNG_ERROR (pData, MNG_INVALIDLENGTH)    if ((pData->iColortype == 3) && (iRawlen != 3))      MNG_ERROR (pData, MNG_INVALIDLENGTH)    if ((pData->iColortype == 4) && (iRawlen != 2))      MNG_ERROR (pData, MNG_INVALIDLENGTH)    if ((pData->iColortype == 6) && (iRawlen != 4))      MNG_ERROR (pData, MNG_INVALIDLENGTH)  }  else  {                                    /* global = empty or RGBA */    if ((iRawlen != 0) && (iRawlen != 4))      MNG_ERROR (pData, MNG_INVALIDLENGTH)  }#ifdef MNG_SUPPORT_DISPLAY  if (pData->bDisplaying)  {    /* TODO: something !!! */  }#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_sbitp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0);    if (iRawlen)    {#ifdef MNG_INCLUDE_JNG      if (pData->bHasJHDR)        ((mng_sbitp)*ppChunk)->iType = pData->iJHDRcolortype;      else#endif      if (pData->bHasIHDR)        ((mng_sbitp)*ppChunk)->iType = pData->iColortype;      else                             /* global ! */        ((mng_sbitp)*ppChunk)->iType = 6;      if (iRawlen > 0)        ((mng_sbitp)*ppChunk)->aBits [0] = *pRawdata;      if (iRawlen > 1)        ((mng_sbitp)*ppChunk)->aBits [1] = *(pRawdata+1);      if (iRawlen > 2)        ((mng_sbitp)*ppChunk)->aBits [2] = *(pRawdata+2);      if (iRawlen > 3)        ((mng_sbitp)*ppChunk)->aBits [3] = *(pRawdata+3);    }  }#endif /* MNG_STORE_CHUNKS */#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_READ_SBIT, MNG_LC_END)#endif  return MNG_NOERROR;                  /* done */}