Append the current chain with the supplied uchar string operand.
| Return Type | Function name | Arguments |
|---|---|---|
| hzXbuf& | hzXbuf::operator+= | (unsigned char*,) |
Declared in file: hzXbuf.h
Defined in file : hzXbuf.cpp
Function Logic:
Function body:
hzXbuf& hzXbuf::operator+= (unsigned char* s)
{
// Append the current chain with the supplied uchar string operand.
//
// Arguments: 1) s The null terminated string to add to the chain
//
// Returns: Reference to this chain
_hzfunc("hzXbuf::operator+=(uchar*)") ;
_xblk* curBlk ; // Block pointer
_xblk* newBlk ; // Working block pointer
const uchar* i ; // Supplied string iterator
if (!s || !s[0])
return *this ;
// If nothing in chain, create the first block
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) ;
for (i = s ; *i ; i++)
{
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] = *i ;
curBlk->xize++ ;
mx->m_nSize++ ;
}
return *this ;
}