[libgdata/libgdata-0-7] core: Take offset into account multiple times in GDataBuffer



commit c64836c2a2feeba77a4777618da6e8819193c702
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Dec 19 17:23:49 2010 +0000

    core: Take offset into account multiple times in GDataBuffer
    
    If many small pops are requested of a GDataBuffer which has only had large
    pushes done on it, the head_read_offset should be used to return the correct
    data from increasing positions in the first chunk. Previously, it wasn't.

 gdata/gdata-buffer.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gdata/gdata-buffer.c b/gdata/gdata-buffer.c
index f75bcf7..db11848 100644
--- a/gdata/gdata-buffer.c
+++ b/gdata/gdata-buffer.c
@@ -291,8 +291,8 @@ gdata_buffer_pop_data (GDataBuffer *self, guint8 *data, gsize length_requested,
 		g_assert (chunk != NULL);
 
 		/* Copy the requested data to the output */
-		memcpy (data, chunk->data, length_remaining);
-		self->head_read_offset = length_remaining;
+		memcpy (data, chunk->data + self->head_read_offset, length_remaining);
+		self->head_read_offset += length_remaining;
 	}
 
 	self->head = chunk;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]