add testcase, fix bug
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 21 Jun 2007 11:07:04 +0200
changeset 898 712651f08bd5
parent 897 3d0c89af9c50
child 899 de50a2e8ce90
add testcase, fix bug
src/common/buffer.cc
--- a/src/common/buffer.cc	Thu Jun 21 11:01:15 2007 +0200
+++ b/src/common/buffer.cc	Thu Jun 21 11:07:04 2007 +0200
@@ -224,7 +224,7 @@
       uint32_t newSize = m_size + end;
       struct Buffer::BufferData *newData = Buffer::Allocate (newSize, 0);
       memcpy (newData->m_data, GetStart (), m_size);
-      newData->m_initialStart = m_data->m_initialStart;
+      newData->m_initialStart = m_data->m_initialStart - m_start;
       m_data->m_count--;
       if (m_data->m_count == 0) 
         {
@@ -663,6 +663,12 @@
   i.Prev (4);
   i.WriteU8 (1, 4);
 
+  buffer = Buffer (1);
+  buffer.AddAtEnd (100);
+  i = buffer.End ();
+  i.Prev (100);
+  i.WriteU8 (1, 100);
+
   return ok;
 }