mork_num posDelta = (mork_num) (at - buf);
mork_num posDelta = (at - buf);
morkStream::Read(morkEnv* ev, void* outBuf, mork_size inSize){  // First we satisfy the request from buffered bytes, if any.  Then  // if additional bytes are needed, we satisfy these by direct reads  // from the content file without any local buffering (but we still need  // to adjust the buffer position to reflect the current i/o point).  mork_pos outActual = 0;  morkFile* file = mStream_ContentFile;  if ( this->IsOpenAndActiveFile() && file )  {    mork_u1* end = mStream_ReadEnd; // byte after last buffered byte    if ( end ) // file is open for read access?    {      if ( inSize ) // caller wants any output?      {        mork_u1* sink = (mork_u1*) outBuf; // where we plan to write bytes        if ( sink ) // caller passed good buffer address?        {          mork_u1* at = mStream_At;          mork_u1* buf = mStream_Buf;          if ( at >= buf && at <= end ) // expected cursor order?          {            mork_num remaining = (mork_num) (end - at); // bytes left in buffer                        mork_num quantum = inSize; // number of bytes to copy            if ( quantum > remaining ) // more than buffer content?              quantum = remaining; // restrict to buffered bytes                          if ( quantum ) // any bytes left in the buffer?            {              MORK_MEMCPY(sink, at, quantum); // from buffer bytes                            at += quantum; // advance past read bytes              mStream_At = at;              outActual += quantum;  // this much copied so far              sink += quantum;   // in case we need to copy more              inSize -= quantum; // filled this much of request              mStream_HitEof = morkBool_kFalse;            }                        if ( inSize ) // we still need to read more content?            {              // We need to read more bytes directly from the              // content file, without local buffering.  We have              // exhausted the local buffer, so we need to show              // it is now empty, and adjust the current buf pos.                            mork_num posDelta = (mork_num) (at - buf); // old buf content              mStream_BufPos += posDelta;   // past now empty buf                            mStream_At = mStream_ReadEnd = buf; // empty buffer                            file->Seek(ev, mStream_BufPos); // set file pos              if ( ev->Good() ) // no seek error?              {                mork_num actual = file->Read(ev, sink, inSize);                if ( ev->Good() ) // no read error?                {                  if ( actual )                  {                    outActual += actual;                    mStream_BufPos += actual;                    mStream_HitEof = morkBool_kFalse;                  }                  else if ( !outActual )                    mStream_HitEof = morkBool_kTrue;                }              }            }          }          else this->NewBadCursorOrderError(ev);        }        else this->NewNullStreamBufferError(ev);      }    }    else this->NewCantReadSinkError(ev);  }  else this->NewFileDownError(ev);    if ( ev->Bad() )    outActual = 0;  return (mork_size) outActual;}