--- a/src/common/buffer.cc Wed Apr 23 09:05:18 2008 -0700
+++ b/src/common/buffer.cc Wed Apr 23 09:11:55 2008 -0700
@@ -434,9 +434,10 @@
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::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 @@
destStart.Prev (src.GetSize ());
destStart.Write (src.Begin (), src.End ());
*this = dst;
+ return m_start - orgStart;
}
void
--- a/src/common/buffer.h Wed Apr 23 09:05:18 2008 -0700
+++ b/src/common/buffer.h Wed Apr 23 09:11:55 2008 -0700
@@ -423,7 +423,20 @@
*/
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
*