aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorbertrand <bertrand@helixcode.com>2000-03-03 00:21:05 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>2000-03-03 00:21:05 +0800
commit8e356d0601866c7f7d8139b1135a628fd4362462 (patch)
tree498def4e208e787b1b7a2d6ff36b92ced097d2e4 /camel
parent01b2d34d032d0a675ef5f0fdcb811cdd41d690ed (diff)
downloadgsoc2013-evolution-8e356d0601866c7f7d8139b1135a628fd4362462.tar
gsoc2013-evolution-8e356d0601866c7f7d8139b1135a628fd4362462.tar.gz
gsoc2013-evolution-8e356d0601866c7f7d8139b1135a628fd4362462.tar.bz2
gsoc2013-evolution-8e356d0601866c7f7d8139b1135a628fd4362462.tar.lz
gsoc2013-evolution-8e356d0601866c7f7d8139b1135a628fd4362462.tar.xz
gsoc2013-evolution-8e356d0601866c7f7d8139b1135a628fd4362462.tar.zst
gsoc2013-evolution-8e356d0601866c7f7d8139b1135a628fd4362462.zip
use CamelStreamB64 type for the input stream.
2000-03-02 bertrand <bertrand@helixcode.com> * camel-stream-b64.c (camel_stream_b64_write_to_stream): use CamelStreamB64 type for the input stream. * camel-mime-part.c (_get_content_object): remove debugging trace (_write_content_to_stream): implement the b64 encoding the new way (that is using camel_stream_b64) svn path=/trunk/; revision=2014
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog8
-rw-r--r--camel/camel-mime-part.c11
-rw-r--r--camel/camel-stream-b64.c8
-rw-r--r--camel/camel-stream-b64.h2
4 files changed, 22 insertions, 7 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index c095ee4025..862a84656b 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,13 @@
2000-03-02 bertrand <bertrand@helixcode.com>
+ * camel-stream-b64.c (camel_stream_b64_write_to_stream):
+ use CamelStreamB64 type for the input stream.
+
+ * camel-mime-part.c (_get_content_object): remove
+ debugging trace
+ (_write_content_to_stream): implement the b64
+ encoding the new way (that is using camel_stream_b64)
+
* camel-data-wrapper.c (my_write_to_stream):
fix implementation so that it writes properly
to the output stream even.
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index b6e5b55c36..7244ab3c0d 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -630,7 +630,6 @@ _get_content_object (CamelMedium *medium)
break;
}
- printf ("*************************** encoding : %d\n", mime_part->encoding);
camel_mime_part_construct_content_from_stream (mime_part, decoded_stream);
} else {
@@ -662,6 +661,7 @@ _write_content_to_stream (CamelMimePart *mime_part, CamelStream *stream)
{
CamelMedium *medium = CAMEL_MEDIUM (mime_part);
CamelStream *wrapper_stream;
+ CamelStreamB64 *stream_b64;
CamelDataWrapper *content = medium->content;
CAMEL_LOG_FULL_DEBUG ( "Entering CamelMimePart::_write_content_to_stream\n");
@@ -675,9 +675,16 @@ _write_content_to_stream (CamelMimePart *mime_part, CamelStream *stream)
camel_data_wrapper_write_to_stream (content, stream);
break;
case CAMEL_MIME_PART_ENCODING_BASE64:
+ /* encode the data wrapper output stream in base 64 ... */
wrapper_stream = camel_data_wrapper_get_output_stream (content);
+ stream_b64 = CAMEL_STREAM_B64 (camel_stream_b64_new_with_input_stream (wrapper_stream));
+ camel_stream_b64_set_mode (stream_b64, CAMEL_STREAM_B64_ENCODER);
- gmime_encode_base64_to_stream (wrapper_stream, stream);
+ /* ... and write it to the output stream in a blocking way */
+ camel_stream_b64_write_to_stream (stream_b64, stream);
+
+ /* now free the intermediate b64 stream */
+ gtk_object_unref (GTK_OBJECT (stream_b64));
break;
default:
g_warning ("Encoding type `%s' not supported.",
diff --git a/camel/camel-stream-b64.c b/camel/camel-stream-b64.c
index cedc9f914f..df4f755fac 100644
--- a/camel/camel-stream-b64.c
+++ b/camel/camel-stream-b64.c
@@ -552,7 +552,7 @@ my_reset (CamelStream *stream)
void
-camel_stream_b64_write_to_stream (CamelStream *stream,
+camel_stream_b64_write_to_stream (CamelStreamB64 *stream_b64,
CamelStream *output_stream)
{
gchar tmp_buf[4096];
@@ -565,10 +565,10 @@ camel_stream_b64_write_to_stream (CamelStream *stream,
* to an output stream.
*/
g_assert (output_stream);
- g_assert (stream);
+ g_assert (stream_b64);
- while (!camel_stream_eos (stream)) {
- nb_read = camel_stream_read (stream, tmp_buf, 4096);
+ while (!camel_stream_eos (CAMEL_STREAM (stream_b64))) {
+ nb_read = camel_stream_read (CAMEL_STREAM (stream_b64), tmp_buf, 4096);
nb_written = 0;
while (nb_written < nb_read)
nb_written += camel_stream_write (output_stream, tmp_buf, nb_read);
diff --git a/camel/camel-stream-b64.h b/camel/camel-stream-b64.h
index 2d2932951d..5d93f122eb 100644
--- a/camel/camel-stream-b64.h
+++ b/camel/camel-stream-b64.h
@@ -118,7 +118,7 @@ void camel_stream_b64_set_mode (CamelStreamB6
/* utility function that writes the whole de/en-coded
stream to an output stream */
-void camel_stream_b64_write_to_stream (CamelStream *stream,
+void camel_stream_b64_write_to_stream (CamelStreamB64 *stream,
CamelStream *output_stream);