add adjustment report to overloaded Buffer::AddAtEnd method
This commit is contained in:
@@ -434,9 +434,10 @@ Buffer::AddAtEnd (uint32_t end)
|
||||
return delta;
|
||||
}
|
||||
|
||||
void
|
||||
int32_t
|
||||
Buffer::AddAtEnd (const Buffer &o)
|
||||
{
|
||||
int32_t orgStart = m_start;
|
||||
if (m_end == m_zeroAreaEnd &&
|
||||
o.m_start == o.m_zeroAreaStart &&
|
||||
o.m_zeroAreaEnd - o.m_zeroAreaStart > 0)
|
||||
@@ -456,7 +457,7 @@ Buffer::AddAtEnd (const Buffer &o)
|
||||
Buffer::Iterator src = o.End ();
|
||||
src.Prev (endData);
|
||||
dst.Write (src, o.End ());
|
||||
return;
|
||||
return m_start - orgStart;
|
||||
}
|
||||
Buffer dst = CreateFullCopy ();
|
||||
Buffer src = o.CreateFullCopy ();
|
||||
@@ -466,6 +467,7 @@ Buffer::AddAtEnd (const Buffer &o)
|
||||
destStart.Prev (src.GetSize ());
|
||||
destStart.Write (src.Begin (), src.End ());
|
||||
*this = dst;
|
||||
return m_start - orgStart;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -423,7 +423,20 @@ public:
|
||||
*/
|
||||
int32_t AddAtEnd (uint32_t end);
|
||||
|
||||
void AddAtEnd (const Buffer &o);
|
||||
/**
|
||||
* \param o the buffer to append to the end of this buffer.
|
||||
* \returns the adjustment delta.
|
||||
*
|
||||
* Add bytes at the end of the Buffer.
|
||||
* Any call to this method invalidates any Iterator
|
||||
* pointing to this Buffer.
|
||||
*
|
||||
* The value returned by this method indicates how the internal
|
||||
* buffer was modified to handle the user request to reserve space.
|
||||
* If that value is zero, the buffer was not modified: the user
|
||||
* request was completed without further memory allocation.
|
||||
*/
|
||||
int32_t AddAtEnd (const Buffer &o);
|
||||
/**
|
||||
* \param start size to remove
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user