aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNotZed <notzed@zedzone.helixcode.com>2000-02-10 11:54:22 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-02-10 11:54:22 +0800
commit3ef8dbd93ad44e08503f69d4929428362fc383ea (patch)
tree07a5a83c66613435ece6bb81055704a93bddc050
parent8c9cb1454e15437096c3a3fb891239bcc0f3e593 (diff)
downloadgsoc2013-evolution-3ef8dbd93ad44e08503f69d4929428362fc383ea.tar
gsoc2013-evolution-3ef8dbd93ad44e08503f69d4929428362fc383ea.tar.gz
gsoc2013-evolution-3ef8dbd93ad44e08503f69d4929428362fc383ea.tar.bz2
gsoc2013-evolution-3ef8dbd93ad44e08503f69d4929428362fc383ea.tar.lz
gsoc2013-evolution-3ef8dbd93ad44e08503f69d4929428362fc383ea.tar.xz
gsoc2013-evolution-3ef8dbd93ad44e08503f69d4929428362fc383ea.tar.zst
gsoc2013-evolution-3ef8dbd93ad44e08503f69d4929428362fc383ea.zip
Increment the copy source address to match the data read offset. (seek):
2000-02-09 NotZed <notzed@zedzone.helixcode.com> * camel/camel-simple-data-wrapper-stream.c (read): Increment the copy source address to match the data read offset. (seek): Actually implement the seek. svn path=/trunk/; revision=1722
-rw-r--r--ChangeLog4
-rw-r--r--camel/camel-simple-data-wrapper-stream.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index abdd2026d7..b475971882 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2000-02-09 NotZed <notzed@zedzone.helixcode.com>
+ * camel/camel-simple-data-wrapper-stream.c (read): Increment the
+ copy source address to match the data read offset.
+ (seek): Actually implement the seek.
+
* camel/camel-mime-part-utils.c
(camel_mime_part_store_stream_in_buffer): If we get a -1 read,
DONT update the total bytes, and try and truncate the array in
diff --git a/camel/camel-simple-data-wrapper-stream.c b/camel/camel-simple-data-wrapper-stream.c
index 7316997c03..5e89734729 100644
--- a/camel/camel-simple-data-wrapper-stream.c
+++ b/camel/camel-simple-data-wrapper-stream.c
@@ -50,7 +50,7 @@ read (CamelStream *stream,
len = MIN (n, array->len - wrapper_stream->current_position);
if (len > 0) {
- memcpy (buffer, array->data, len);
+ memcpy (buffer, wrapper_stream->current_position + array->data, len);
wrapper_stream->current_position += len;
return len;
} else {
@@ -161,13 +161,18 @@ seek (CamelSeekableStream *stream,
new_position = wrapper_stream->current_position + offset;
break;
case CAMEL_STREAM_END:
- new_position = wrapper_stream->wrapper->byte_array->len;
+ new_position = wrapper_stream->wrapper->byte_array->len - offset;
break;
default:
g_warning ("Unknown CamelStreamSeekPolicy %d.", policy);
return -1;
}
+ if (new_position<0)
+ new_position = 0;
+ else if (new_position>=wrapper_stream->wrapper->byte_array->len)
+ new_position = wrapper_stream->wrapper->byte_array->len-1;
+
wrapper_stream->current_position = new_position;
return new_position;
}