Write out to the supplied buffer, from the current position, upto maxBytes. Do not increment the iterator.

Return TypeFunction nameArguments
uint32_thzChain::Iter::Write(void*,uint32_t,)

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

Function Logic:

0:START 1:unknown 2:Return -1 3:zp 4:unknown 5:Return -1 6:nOset i 7:unknown 8:unknown 9:zp 10:unknown 11:nOset zp 12:nAvail 13:unknown 14:maxBytes 15:nAvail 16:items nOset i nWritten 17:Return nWritten

Function body:

uint32_t hzChain::Iter::Write (void* pBuf)uint32_t maxBytes, 
{
   //  Write out to the supplied buffer, from the current position, upto maxBytes. Do not increment the iterator.
   //  
   //  Arguments: 1) pBuf  The output buffer
   //     2) maxBytes The maximum number to write (size of buffer)
   //  
   //  Returns: Number of bytes written to the buffer
   _hzfunc("hzChain::Iter::Write") ;
   _zblk*      zp ;                //  Working block pointer
   char*       i ;                 //  Input iterator
   uint32_t    nOset ;             //  Current offset
   uint32_t    nAvail ;            //  Max number of bytes that can be written from current block
   uint32_t    nWritten = 0;       //  Limiter
   if (maxBytes < 0)
       return -1;
   zp = (_zblk*) m_block ;
   if (!zp)
       return -1;
   nOset = m_nOset ;
   i = (char*) pBuf ;
   for (; nWritten < maxBytes ;)
   {
       if (nOset == zp->m_nUsage)
       {
           //  At end of current block, move to next
           zp = zp->Next() ;
           if (!zp)
               break ;
           nOset = 0;
       }
       nAvail = zp->m_nUsage - nOset ;
       if ((nWritten + nAvail) > maxBytes)
           nAvail = maxBytes - nWritten ;
       //  Add bytes to current block
       memcpy(i, zp->m_Data + nOset, nAvail) ;
       nOset += nAvail ;
       i += nAvail ;
       nWritten += nAvail ;
   }
   return nWritten ;
}