From 01b2d34d032d0a675ef5f0fdcb811cdd41d690ed Mon Sep 17 00:00:00 2001 From: bertrand Date: Thu, 2 Mar 2000 15:09:45 +0000 Subject: fix implementation so that it writes properly to the output stream even. 2000-03-02 bertrand * camel-data-wrapper.c (my_write_to_stream): fix implementation so that it writes properly to the output stream even. * camel-stream-b64.c (camel_stream_b64_write_to_stream): fix implementation. svn path=/trunk/; revision=2013 --- camel/ChangeLog | 9 +++++++++ camel/camel-data-wrapper.c | 6 ++++-- camel/camel-stream-b64.c | 15 +++++++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index d41d94a239..c095ee4025 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,12 @@ +2000-03-02 bertrand + + * camel-data-wrapper.c (my_write_to_stream): + fix implementation so that it writes properly + to the output stream even. + + * camel-stream-b64.c (camel_stream_b64_write_to_stream): + fix implementation. + 2000-02-29 bertrand * camel-stream-b64.c (camel_stream_b64_write_to_stream): new diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c index 8fc258ac24..7110adcc60 100644 --- a/camel/camel-data-wrapper.c +++ b/camel/camel-data-wrapper.c @@ -236,6 +236,7 @@ my_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) { gchar tmp_buf[4096]; gint nb_read; + gint nb_written; CamelStream *output_stream; /* @@ -249,8 +250,9 @@ my_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) while (!camel_stream_eos (output_stream)) { nb_read = camel_stream_read (output_stream, tmp_buf, 4096); - if (nb_read) - camel_stream_write (stream, tmp_buf, nb_read); + nb_written = 0; + while (nb_written < nb_read) + nb_written += camel_stream_write (stream, tmp_buf, nb_read); } } diff --git a/camel/camel-stream-b64.c b/camel/camel-stream-b64.c index 29c89ba92b..cedc9f914f 100644 --- a/camel/camel-stream-b64.c +++ b/camel/camel-stream-b64.c @@ -557,18 +557,25 @@ camel_stream_b64_write_to_stream (CamelStream *stream, { gchar tmp_buf[4096]; gint nb_read; + gint nb_written; /* * default implementation that uses the input - * stream and stream it in a blocking way. + * stream and stream it in a blocking way + * to an output stream. */ g_assert (output_stream); g_assert (stream); - while (!camel_stream_eos (output_stream)) { + while (!camel_stream_eos (stream)) { nb_read = camel_stream_read (stream, tmp_buf, 4096); - if (nb_read) - camel_stream_write (output_stream, tmp_buf, nb_read); + nb_written = 0; + while (nb_written < nb_read) + nb_written += camel_stream_write (output_stream, tmp_buf, nb_read); } } + + + + -- cgit v1.2.3