aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-mem.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>1999-08-03 18:19:39 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-03 18:19:39 +0800
commite9c6d8921cce940e590f763a881794323a9e6703 (patch)
treed8e989d8119fe6d8c825364c0b7dd16c6c2179be /camel/camel-stream-mem.c
parentbba2b0a352933d8aa8894fe1b7a8a5185378990f (diff)
downloadgsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar.gz
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar.zst
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.zip
Multipart Mime message parsing works with plain text parts. Woohooo :))))
Making it work with other types is now just a matter of writing the various data wrappers. And display them will just be a matter of writing the good bonobo components. 1999-08-03 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-simple-data-wrapper.c (_construct_from_stream): more debugging output + nb_bytes_read is now a signed int to avoid bug when eos is encountered. * camel/camel-mime-part.c (_construct_from_stream): sync to data_wrapper_repository function name changes. Use default "text/plain" type when conten-type field is not found. (following RFC 2046 spec). * camel/data-wrapper-repository.c (data_wrapper_repository_set_data_wrapper_type): (data_wrapper_repository_get_data_wrapper_type): change function name prefix (s/data_wrapper/data_wrapper_repository/) * camel/camel-multipart.c (_read_part): add `\n` at eol but not before boundary. * camel/gmime-utils.c (get_header_table_from_stream): correct implementation of end of stream detection. svn path=/trunk/; revision=1070
Diffstat (limited to 'camel/camel-stream-mem.c')
-rw-r--r--camel/camel-stream-mem.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/camel/camel-stream-mem.c b/camel/camel-stream-mem.c
index 55900554ab..2fa2c7c306 100644
--- a/camel/camel-stream-mem.c
+++ b/camel/camel-stream-mem.c
@@ -125,10 +125,11 @@ _read (CamelStream *stream, gchar *buffer, gint n)
g_assert (stream);
nb_bytes_to_read = MIN (n, (camel_stream_mem->buffer)->len - camel_stream_mem->position);
- if (nb_bytes_to_read) {
+ if (nb_bytes_to_read>0) {
memcpy (buffer, (camel_stream_mem->buffer)->data + camel_stream_mem->position, nb_bytes_to_read);
camel_stream_mem->position += nb_bytes_to_read;
- }
+ } else nb_bytes_to_read = -1;
+
return nb_bytes_to_read;
}
@@ -150,6 +151,7 @@ _write (CamelStream *stream, const gchar *buffer, gint n)
CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (stream);
g_assert (stream);
+ g_return_val_if_fail (camel_stream_mem->position>=0, -1);
camel_stream_mem->buffer = g_byte_array_append (camel_stream_mem->buffer, (const guint8 *)buffer, n);
camel_stream_mem->position += n;