[libgdata] core: Take offset into account multiple times in GDataBuffer
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] core: Take offset into account multiple times in GDataBuffer
- Date: Mon, 20 Dec 2010 13:50:09 +0000 (UTC)
commit 756cdd54d364bea57a751eb8a543219847d84fdb
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 c62d9d3..061c113 100644
--- a/gdata/gdata-buffer.c
+++ b/gdata/gdata-buffer.c
@@ -290,8 +290,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]