aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-seekable-substream.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>2000-02-17 02:04:40 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>2000-02-17 02:04:40 +0800
commit7f04720b1efe9baea8770813e85cb17cd600d077 (patch)
treea4749e3ecc075439dddf3928584a88b8d11d3e76 /camel/camel-seekable-substream.c
parentd2239da3e7758ed99263b6623ab258561e10994d (diff)
downloadgsoc2013-evolution-7f04720b1efe9baea8770813e85cb17cd600d077.tar.gz
gsoc2013-evolution-7f04720b1efe9baea8770813e85cb17cd600d077.tar.zst
gsoc2013-evolution-7f04720b1efe9baea8770813e85cb17cd600d077.zip
don't seek the begining of the substream. (_eos): fix eos condition
2000-02-16 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-seekable-substream.c (_set_bounds): don't seek the begining of the substream. (_eos): fix eos condition testing. (_finalize): unref parent stream (_init_with_seekable_stream_and_bounds): ref parent stream * camel/gstring-util.c (g_string_equal_for_hash): (g_string_equal_for_glist): return type is int. * camel/camel.h: * camel/camel.c (camel_init): use (void) instead of (). A lot of other small changes to make the set_input_stream scheme work. It actually works. svn path=/trunk/; revision=1798
Diffstat (limited to 'camel/camel-seekable-substream.c')
-rw-r--r--camel/camel-seekable-substream.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/camel/camel-seekable-substream.c b/camel/camel-seekable-substream.c
index 6777eeb12d..6d59d8994c 100644
--- a/camel/camel-seekable-substream.c
+++ b/camel/camel-seekable-substream.c
@@ -142,11 +142,14 @@ _destroy (GtkObject *object)
static void
_finalize (GtkObject *object)
{
-
-
+ CamelSeekableStream *seekable_stream;
CAMEL_LOG_FULL_DEBUG ("Entering CamelSeekableSubstream::finalize\n");
- /* does nothing for the moment */
+ seekable_stream = CAMEL_SEEKABLE_STREAM (object);
+
+ if (seekable_stream->parent_stream)
+ gtk_object_unref (seekable_stream->parent_stream);
+
GTK_OBJECT_CLASS (parent_class)->finalize (object);
CAMEL_LOG_FULL_DEBUG ("Leaving CamelSeekableSubstream::finalize\n");
}
@@ -165,8 +168,6 @@ _set_bounds (CamelSeekableSubstream *seekable_substream, guint32 inf_bound, gint
seekable_substream->inf_bound = inf_bound;
seekable_substream->sup_bound = sup_bound;
- /* go to the first position */
- camel_seekable_stream_seek (seekable_substream->parent_stream, inf_bound, SEEK_SET);
seekable_substream->cur_pos = 0;
@@ -194,7 +195,8 @@ _init_with_seekable_stream_and_bounds (CamelSeekableSubstream *seekable_substre
/* store the parent stream */
seekable_substream->parent_stream = parent_stream;
-
+ gtk_object_ref (parent_stream);
+
/* set the bound of the substream */
_set_bounds (seekable_substream, inf_bound, sup_bound);
}
@@ -245,7 +247,6 @@ _read (CamelStream *stream, gchar *buffer, gint n)
g_assert (stream);
g_assert (seekable_substream->parent_stream);
- g_assert (seekable_substream->open);
@@ -300,14 +301,7 @@ _read (CamelStream *stream, gchar *buffer, gint n)
seekable_stream->cur_pos += v;
-#if 0
- /* restore the parent position */
- camel_seekable_stream_seek (seekable_substream->parent_stream,
- parent_stream_current_position,
- CAMEL_STREAM_SET);
-
-#endif
/* return the number of bytes read */
return v;
}
@@ -384,11 +378,10 @@ _eos (CamelStream *stream)
gboolean eos;
g_assert (stream);
- g_assert (seekable_substream->open);
if (seekable_substream->sup_bound != -1) {
substream_len = seekable_substream->sup_bound - seekable_substream->inf_bound;
- eos = ( seekable_stream->cur_pos > substream_len);
+ eos = ( seekable_stream->cur_pos >= substream_len);
} else {
eos = camel_stream_eos (CAMEL_STREAM (seekable_substream->parent_stream));
}