diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 2000-02-15 06:03:58 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 2000-02-15 06:03:58 +0800 |
commit | fe058b1be72112298e356343f3a8b35fd60a072b (patch) | |
tree | 0e2fe60abb27fa6070dc20f1e427b002c6db6f5a /camel/camel-stream-fs.c | |
parent | d8efd64ed0bc53ad0a74115c1d14a700b3874013 (diff) | |
download | gsoc2013-evolution-fe058b1be72112298e356343f3a8b35fd60a072b.tar gsoc2013-evolution-fe058b1be72112298e356343f3a8b35fd60a072b.tar.gz gsoc2013-evolution-fe058b1be72112298e356343f3a8b35fd60a072b.tar.bz2 gsoc2013-evolution-fe058b1be72112298e356343f3a8b35fd60a072b.tar.lz gsoc2013-evolution-fe058b1be72112298e356343f3a8b35fd60a072b.tar.xz gsoc2013-evolution-fe058b1be72112298e356343f3a8b35fd60a072b.tar.zst gsoc2013-evolution-fe058b1be72112298e356343f3a8b35fd60a072b.zip |
make a blocking version of the header parser. When the fs stream uses
2000-02-14 bertrand <Bertrand.Guiheneuf@aful.org>
* 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.
2000-02-11 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/camel-stream-fs.c:
everywhere, when using the cur_pos field, do it
on the CamelSeekableStream object.
(_seek): small fix.
* camel/camel-seekable-stream.c (camel_seekable_stream_seek):
s/camel_stream_seek/camel_seekable_stream_seek/g
* camel/camel-seekable-stream.h:
(struct ): added a field to store the
current position.
* camel/camel-seekable-stream.c (camel_seekable_stream_get_current_position):
New function. Allows to get the current position
of a seekable stream.
In fact much more changes, but I am lazy.
This is the begining of some major changes
in camel.
svn path=/trunk/; revision=1778
Diffstat (limited to 'camel/camel-stream-fs.c')
-rw-r--r-- | camel/camel-stream-fs.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c index 26dde90803..e816f88b6b 100644 --- a/camel/camel-stream-fs.c +++ b/camel/camel-stream-fs.c @@ -168,13 +168,13 @@ _set_bounds (CamelStreamFs *stream_fs, guint32 inf_bound, guint32 sup_bound) /* go to the first position */ lseek (stream_fs->fd, inf_bound, SEEK_SET); - stream_fs->cur_pos = inf_bound; + CAMEL_SEEKABLE_STREAM (stream_fs)->cur_pos = inf_bound; CAMEL_LOG_FULL_DEBUG ("In CamelStreamFs::_set_bounds, " "setting inf bound to %u, " "sup bound to %ld, current postion to %u from %u\n", stream_fs->inf_bound, stream_fs->sup_bound, - stream_fs->cur_pos, inf_bound); + CAMEL_SEEKABLE_STREAM (stream_fs)->cur_pos, inf_bound); } @@ -187,7 +187,7 @@ _init_with_fd (CamelStreamFs *stream_fs, int fd) stream_fs->fd = fd; stream_fs->inf_bound = 0; stream_fs->sup_bound = -1; - stream_fs->cur_pos = 0; + CAMEL_SEEKABLE_STREAM (stream_fs)->cur_pos = 0; } @@ -219,12 +219,12 @@ _init_with_name (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode if (mode & CAMEL_STREAM_FS_READ){ if (mode & CAMEL_STREAM_FS_WRITE) - flags = O_RDWR | O_CREAT; + flags = O_RDWR | O_CREAT | O_NONBLOCK; else - flags = O_RDONLY; + flags = O_RDONLY | O_NONBLOCK; } else { if (mode & CAMEL_STREAM_FS_WRITE) - flags = O_WRONLY | O_CREAT; + flags = O_WRONLY | O_CREAT | O_NONBLOCK; else return; } @@ -245,7 +245,7 @@ _init_with_name (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode stream_fs->name = g_strdup (name); CSFS_CLASS (stream_fs)->init_with_fd (stream_fs, fd); - + } @@ -260,7 +260,7 @@ _init_with_name_and_bounds (CamelStreamFs *stream_fs, const gchar *name, CamelSt "setting inf bound to %u, " "sup bound to %ld, current postion to %u\n", stream_fs->inf_bound, stream_fs->sup_bound, - stream_fs->cur_pos); + CAMEL_SEEKABLE_STREAM (stream)->cur_pos); } @@ -345,7 +345,7 @@ _read (CamelStream *stream, gchar *buffer, gint n) gint nb_to_read; if (stream_fs->sup_bound != -1) - nb_to_read = MIN (stream_fs->sup_bound - stream_fs->cur_pos, n); + nb_to_read = MIN (stream_fs->sup_bound - CAMEL_SEEKABLE_STREAM (stream)->cur_pos, n); else nb_to_read = n; @@ -355,7 +355,7 @@ _read (CamelStream *stream, gchar *buffer, gint n) if (v<0) CAMEL_LOG_FULL_DEBUG ("CamelStreamFs::read v=%d\n", v); else - stream_fs->cur_pos += v; + CAMEL_SEEKABLE_STREAM (stream)->cur_pos += v; return v; } @@ -384,7 +384,7 @@ _write (CamelStream *stream, const gchar *buffer, gint n) CAMEL_LOG_FULL_DEBUG ( "CamelStreamFs:: entering write. n=%d\n", n); if (stream_fs->sup_bound != -1) - nb_to_write = MIN (stream_fs->sup_bound - stream_fs->cur_pos, n); + nb_to_write = MIN (stream_fs->sup_bound - CAMEL_SEEKABLE_STREAM (stream)->cur_pos, n); else nb_to_write = n; @@ -400,7 +400,7 @@ _write (CamelStream *stream, const gchar *buffer, gint n) #endif if (v>0) - stream_fs->cur_pos += v; + CAMEL_SEEKABLE_STREAM (stream)->cur_pos += v; return v; @@ -484,10 +484,10 @@ _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy) break; case CAMEL_STREAM_CUR: - if ((stream_fs->sup_bound == -1) && ((stream_fs->cur_pos + offset) > stream_fs->sup_bound)) { + if ((stream_fs->sup_bound != -1) && ((CAMEL_SEEKABLE_STREAM (stream)->cur_pos + offset) > stream_fs->sup_bound)) { real_offset = stream_fs->sup_bound; whence = SEEK_SET; - } else if ((stream_fs->cur_pos + offset) < stream_fs->inf_bound) { + } else if ((CAMEL_SEEKABLE_STREAM (stream)->cur_pos + offset) < stream_fs->inf_bound) { real_offset = stream_fs->inf_bound; whence = SEEK_SET; } else @@ -515,7 +515,7 @@ _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy) return_position = lseek (stream_fs->fd, real_offset, whence) - stream_fs->inf_bound; - stream_fs->cur_pos = return_position; + CAMEL_SEEKABLE_STREAM (stream)->cur_pos = return_position; return return_position; } |