[evolution-groupwise] Prefer g_seekable_seek() over camel_stream_reset().
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-groupwise] Prefer g_seekable_seek() over camel_stream_reset().
- Date: Tue, 5 Jul 2011 15:31:59 +0000 (UTC)
commit 29f5d16b64219fca6e20310df0c94caeac6b88fc
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Jul 5 08:06:07 2011 -0400
Prefer g_seekable_seek() over camel_stream_reset().
When a stream is obviously a file or memory stream (both of which
implement the GSeekable interface), use g_seekable_seek() instead of
camel_stream_reset().
This is helping me discover if it's safe to remove camel_stream_reset().
We want to eventually move to GIO streams, which have no reset method.
src/camel/camel-groupwise-folder.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/camel/camel-groupwise-folder.c b/src/camel/camel-groupwise-folder.c
index d8e63f7..844b80e 100644
--- a/src/camel/camel-groupwise-folder.c
+++ b/src/camel/camel-groupwise-folder.c
@@ -2657,9 +2657,16 @@ groupwise_folder_get_message_sync (CamelFolder *folder,
stream = camel_stream_mem_new ();
if (cache_stream) {
msg = camel_mime_message_new ();
- camel_stream_reset (stream, NULL);
- camel_stream_write_to_stream (cache_stream, stream, cancellable, NULL);
- camel_stream_reset (stream, NULL);
+
+ g_seekable_seek (
+ G_SEEKABLE (stream), 0, G_SEEK_SET, NULL, NULL);
+
+ camel_stream_write_to_stream (
+ cache_stream, stream, cancellable, NULL);
+
+ g_seekable_seek (
+ G_SEEKABLE (stream), 0, G_SEEK_SET, NULL, NULL);
+
if (!camel_data_wrapper_construct_from_stream_sync ((CamelDataWrapper *) msg, stream, cancellable, error)) {
if (errno == EINTR) {
g_object_unref (msg);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]