aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-filter.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-06-07 06:55:06 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-06-07 06:55:06 +0800
commit4b82b86ee5df1cfcbcbc46cc421804a6a0cb8da2 (patch)
tree122b4b705f90414589e8b0d07586ceb7a2489067 /camel/camel-stream-filter.c
parentaf805a2733c9e2ca44e27360c6162d60cfc1aa53 (diff)
downloadgsoc2013-evolution-4b82b86ee5df1cfcbcbc46cc421804a6a0cb8da2.tar.gz
gsoc2013-evolution-4b82b86ee5df1cfcbcbc46cc421804a6a0cb8da2.tar.zst
gsoc2013-evolution-4b82b86ee5df1cfcbcbc46cc421804a6a0cb8da2.zip
Changed the read and write method prototypes to return an ssize_t type
2000-06-06 Jeffrey Stedfast <fejj@helixcode.com> * camel-stream.[c,h]: Changed the read and write method prototypes to return an ssize_t type rather than an int and also changed the 'number of bytes' to read or write to a size_t type * camel-stream-fs.c: same as above * camel-stream-mem.c: again, same as above * camel-stream-buffer.c: same * camel-imap-stream.[c,h]: Added this new stream, cache's previously read data so each successive call will instead read from the cache svn path=/trunk/; revision=3450
Diffstat (limited to 'camel/camel-stream-filter.c')
-rw-r--r--camel/camel-stream-filter.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/camel/camel-stream-filter.c b/camel/camel-stream-filter.c
index 3aaa1a20ed..547796c660 100644
--- a/camel/camel-stream-filter.c
+++ b/camel/camel-stream-filter.c
@@ -48,8 +48,8 @@ struct _CamelStreamFilterPrivate {
static void camel_stream_filter_class_init (CamelStreamFilterClass *klass);
static void camel_stream_filter_init (CamelStreamFilter *obj);
-static int do_read (CamelStream *stream, char *buffer, unsigned int n);
-static int do_write (CamelStream *stream, const char *buffer, unsigned int n);
+static ssize_t do_read (CamelStream *stream, char *buffer, size_t n);
+static ssize_t do_write (CamelStream *stream, const char *buffer, size_t n);
static int do_flush (CamelStream *stream);
static int do_close (CamelStream *stream);
static gboolean do_eos (CamelStream *stream);
@@ -215,12 +215,12 @@ camel_stream_filter_remove(CamelStreamFilter *filter, int id)
}
}
-static int
-do_read (CamelStream *stream, char *buffer, unsigned int n)
+static ssize_t
+do_read (CamelStream *stream, char *buffer, size_t n)
{
CamelStreamFilter *filter = (CamelStreamFilter *)stream;
struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- int size;
+ ssize_t size;
struct _filter *f;
p->last_was_read = TRUE;
@@ -229,26 +229,28 @@ do_read (CamelStream *stream, char *buffer, unsigned int n)
int presize = READ_SIZE;
size = camel_stream_read(filter->source, p->buffer, READ_SIZE);
- if (size<=0) {
+ if (size <= 0) {
/* this is somewhat untested */
if (camel_stream_eos(filter->source)) {
f = p->filters;
p->filtered = p->buffer;
p->filteredlen = 0;
while (f) {
- camel_mime_filter_complete(f->filter, p->filtered, p->filteredlen, presize, &p->filtered, &p->filteredlen, &presize);
+ camel_mime_filter_complete(f->filter, p->filtered, p->filteredlen,
+ presize, &p->filtered, &p->filteredlen, &presize);
f = f->next;
}
size = p->filteredlen;
}
- if (size<=0)
+ if (size <= 0)
return size;
} else {
f = p->filters;
p->filtered = p->buffer;
p->filteredlen = size;
while (f) {
- camel_mime_filter_filter(f->filter, p->filtered, p->filteredlen, presize, &p->filtered, &p->filteredlen, &presize);
+ camel_mime_filter_filter(f->filter, p->filtered, p->filteredlen, presize,
+ &p->filtered, &p->filteredlen, &presize);
f = f->next;
}
}
@@ -262,8 +264,8 @@ do_read (CamelStream *stream, char *buffer, unsigned int n)
return size;
}
-static int
-do_write (CamelStream *stream, const char *buf, unsigned int n)
+static ssize_t
+do_write (CamelStream *stream, const char *buf, size_t n)
{
CamelStreamFilter *filter = (CamelStreamFilter *)stream;
struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
@@ -305,7 +307,7 @@ do_flush (CamelStream *stream)
camel_mime_filter_complete(f->filter, buffer, len, presize, &buffer, &len, &presize);
f = f->next;
}
- if (len>0 && camel_stream_write(filter->source, buffer, len) == -1)
+ if (len > 0 && camel_stream_write(filter->source, buffer, len) == -1)
return -1;
return camel_stream_flush(filter->source);
}
@@ -328,7 +330,7 @@ do_eos (CamelStream *stream)
CamelStreamFilter *filter = (CamelStreamFilter *)stream;
struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
- if (p->filteredlen >0)
+ if (p->filteredlen > 0)
return FALSE;
return camel_stream_eos(filter->source);