diff options
Diffstat (limited to 'camel/camel-stream-fs.c')
-rw-r--r-- | camel/camel-stream-fs.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c index 3216f6ffdf..0e006a28f3 100644 --- a/camel/camel-stream-fs.c +++ b/camel/camel-stream-fs.c @@ -41,10 +41,11 @@ static void _flush (CamelStream *stream); static gint _available (CamelStream *stream); static gboolean _eos (CamelStream *stream); static void _close (CamelStream *stream); +static gint _seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy); static void -camel_stream_fs_class_init (CamelStreamClass *camel_stream_fs_class) +camel_stream_fs_class_init (CamelStreamFsClass *camel_stream_fs_class) { CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_fs_class); parent_class = gtk_type_class (gtk_object_get_type ()); @@ -58,6 +59,7 @@ camel_stream_fs_class_init (CamelStreamClass *camel_stream_fs_class) camel_stream_class->available = _available; camel_stream_class->eos = _eos; camel_stream_class->close = _close; + camel_stream_class->seek = _seek; } @@ -249,3 +251,26 @@ _close (CamelStream *stream) { close ((CAMEL_STREAM_FS (stream))->fd); } + + +static gint +_seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy) +{ + int whence; + switch (policy) { + case CAMEL_STREAM_SET: + whence = SEEK_SET; + break; + case CAMEL_STREAM_CUR: + whence = SEEK_CUR; + break; + case CAMEL_STREAM_END: + whence = SEEK_END; + break; + default: + return -1; + } + + + return lseek ((CAMEL_STREAM_FS (stream))->fd, offset, whence); +} |