From 6cffd8501c17f06066196a19674d6af225ff6381 Mon Sep 17 00:00:00 2001 From: bertrand Date: Mon, 14 Feb 2000 22:27:54 +0000 Subject: use the eos stream method. (gmime_read_line_from_stream): ditto. 2000-02-14 bertrand * camel/gmime-utils.c (get_header_array_from_stream): use the eos stream method. (gmime_read_line_from_stream): ditto. * camel/camel-stream-fs.h (struct ): add the eof field cosmetics changes. * camel/camel-stream-fs.c (camel_stream_fs_init): set eof. (_read): set eof on end of file. (_eos): implemented. * camel/gmime-utils.c (get_header_array_from_stream): make a blocking version of the header parser. When the fs stream uses gnome-vfs, this should be changed. (gmime_read_line_from_stream): ditto. svn path=/trunk/; revision=1779 --- camel/camel-stream-fs.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'camel/camel-stream-fs.c') diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c index e816f88b6b..4571687ca7 100644 --- a/camel/camel-stream-fs.c +++ b/camel/camel-stream-fs.c @@ -43,7 +43,7 @@ static CamelSeekableStreamClass *parent_class=NULL; static gint _read (CamelStream *stream, gchar *buffer, gint n); static gint _write (CamelStream *stream, const gchar *buffer, gint n); static void _flush (CamelStream *stream); -static gint _available (CamelStream *stream); +static gboolean _available (CamelStream *stream); static gboolean _eos (CamelStream *stream); static void _close (CamelStream *stream); static gint _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy); @@ -93,6 +93,7 @@ camel_stream_fs_init (gpointer object, gpointer klass) CamelStreamFs *stream = CAMEL_STREAM_FS (object); stream->name = NULL; + stream->eof = FALSE; } @@ -357,6 +358,9 @@ _read (CamelStream *stream, gchar *buffer, gint n) else CAMEL_SEEKABLE_STREAM (stream)->cur_pos += v; + if (v == 0) + stream_fs->eof = TRUE; + return v; } @@ -430,11 +434,11 @@ _flush (CamelStream *stream) * * Return value: the number of bytes available **/ -static gint +static gboolean _available (CamelStream *stream) { g_warning ("Not implemented yet"); - return -1; + return FALSE; } @@ -449,8 +453,10 @@ _available (CamelStream *stream) static gboolean _eos (CamelStream *stream) { - g_warning ("Not implemented yet"); - return FALSE; + CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream); + + g_assert (stream_fs); + return stream_fs->eof; } -- cgit v1.2.3