Appends chain with a single byte. Takes the single arg as the char to append, returns either E_OK if successful but E_MEMORY if not. The latter is a fatal condition. Returns: E_OK

Return TypeFunction nameArguments
hzEcodehzXbuf::AddByte(const char,)

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

Function Logic:

0:START 1:unknown 2:mx 3:unknown 4:mx 5:mx 6:curBlk 7:unknown 8:items 9:unknown 10:newBlk 11:unknown 12:items 13:items mx curBlk 14:curBlk items items 15:Return E_OK

Function body:

hzEcode hzXbuf::AddByte (const char C)
{
   //  Appends chain with a single byte. Takes the single arg as the char to append, returns either E_OK if successful but E_MEMORY
   //  if not. The latter is a fatal condition.
   //  
   //  Arguments: 1) C Char to add
   //  
   //  Returns: E_OK
   _hzfunc("hzXbuf::AddByte") ;
   //  Place char C on the end of the chain. Must detect physical end of 
   //  the current block and add new block
   _xblk*  curBlk ;        //  Working block pointer
   _xblk*  newBlk ;        //  Working block pointer
   if (!mx)
       mx = new _xbuf() ;
   if (!mx->m_Begin)
       mx->m_Begin = mx->m_End = _xblk_alloc() ;
   curBlk = (_xblk*) mx->m_End ;
   if (!curBlk)
       Fatal("Chain %p has no end block\n", this) ;
   if (curBlk->xize == XBLKSIZE)
   {
       //  Out of space - make new block
       newBlk = _xblk_alloc() ;
       if (!newBlk)
           Fatal("No allocation (case 2)\n") ;
       //  newBlk->Prev((_xblk*) mx->m_End) ;
       curBlk->Next(newBlk) ;
       mx->m_End = newBlk ;
       curBlk = newBlk ;
   }
   curBlk->m_Data[curBlk->xize] = C ;
   curBlk->xize++ ;
   mx->m_nSize++ ;
   return E_OK ;
}