aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-simple-data-wrapper.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-simple-data-wrapper.c
parentbba2b0a352933d8aa8894fe1b7a8a5185378990f (diff)
downloadgsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar.gz
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar.bz2
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar.lz
gsoc2013-evolution-e9c6d8921cce940e590f763a881794323a9e6703.tar.xz
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-simple-data-wrapper.c')
-rw-r--r--camel/camel-simple-data-wrapper.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/camel/camel-simple-data-wrapper.c b/camel/camel-simple-data-wrapper.c
index eaf62bb0a7..a2203a52e8 100644
--- a/camel/camel-simple-data-wrapper.c
+++ b/camel/camel-simple-data-wrapper.c
@@ -122,28 +122,36 @@ static void
_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
{
CamelSimpleDataWrapper *simple_data_wrapper = CAMEL_SIMPLE_DATA_WRAPPER (data_wrapper);
- guint current_index;
- guint nb_bytes_read;
- guint nb_bytes_left;
+ gint nb_bytes_read;
static gchar *tmp_buf;
GByteArray *array;
+
CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering _construct_from_stream\n");
g_assert (data_wrapper);
g_assert (stream);
- if (!tmp_buf) tmp_buf = g_new (gchar, _CMSDW_TMP_BUF_SIZE);
-
+ if (!tmp_buf) {
+ CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream allocating new temp buffer "
+ "with %d bytes\n", _CMSDW_TMP_BUF_SIZE);
+ tmp_buf = g_new (gchar, _CMSDW_TMP_BUF_SIZE);
+ }
+
array = simple_data_wrapper->byte_array;
- if (array)
+ if (array) {
+ CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream freeing old byte array\n");
g_byte_array_free (array, FALSE);
+ }
array = g_byte_array_new();
+ CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream new byte array address:%p\n", array);
simple_data_wrapper->byte_array = array;
- do {
+ nb_bytes_read = camel_stream_read (stream, tmp_buf, _CMSDW_TMP_BUF_SIZE);
+ while (nb_bytes_read>0) {
+ CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream read %d bytes from stream\n", nb_bytes_read);
+ if (nb_bytes_read>0) g_byte_array_append (array, tmp_buf, nb_bytes_read);
nb_bytes_read = camel_stream_read (stream, tmp_buf, _CMSDW_TMP_BUF_SIZE);
- if (nb_bytes_read) g_byte_array_append (array, tmp_buf, nb_bytes_read);
- } while (nb_bytes_read);
+ };
CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Leaving _construct_from_stream\n");
}