Return TypeFunction nameArguments
unsigned inthzChain::AppendSub(hzChain&,unsigned int,unsigned int,)

Declared in file: hzChain.h
Defined in file : hzChain.cpp

Function Logic:

0:START 1:hzChain::Size 2:!Z.Size() 3:Return 0 4:!mx 5:mx mx 6:!mx->m_Begin 7:_zblk_alloc mx mx 8:curBlk 9:!curBlk 10:hzexit Z zi 11:!zi.eof()&&nBytesWritten 12:curBlk->m_nUsage==ZBLKSIZE 13:_zblk_alloc newBlk _zblk::Prev _zblk::Next curBlk mx 14:curBlk items items items 15:Return nBytesWritten

Function body:

unsigned int hzChain::AppendSub (hzChain& Z, unsigned int nStart, unsigned int nBytes)
{
   _hzfunc("hzChain::Append(hzChain,Start,noBytes)") ;
   chIter      zi ;
   _zblk*      curBlk ;
   _zblk*      newBlk ;
   uint32_t    nBytesWritten = 0;
   if (!Z.Size())
       return 0;
   if (!mx)
       { mx = new _chain() ; mx->m_Test = mx ; }
   if (!mx->m_Begin)
       mx->m_Begin = mx->m_End = _zblk_alloc() ;
   curBlk = (_zblk*) mx->m_End ;
   if (!curBlk)
       hzexit(E_MEMORY, "Chain %p has no end block\n", this) ;
   for (zi = Z, zi += nStart ; !zi.eof() && nBytesWritten < nBytes ; zi++)
   {
       if (curBlk->m_nUsage == ZBLKSIZE)
       {
           newBlk = _zblk_alloc() ;
           newBlk->Prev(curBlk) ;
           curBlk->Next(newBlk) ;
           mx->m_End = curBlk = newBlk ;
       }
       curBlk->m_Data[curBlk->m_nUsage] = *zi ;
       curBlk->m_nUsage++ ;
       mx->m_nSize++ ;
       nBytesWritten++ ;
   }
   return nBytesWritten ;
}