fix implementation so that it writes properly to the output stream even.

2000-03-02  bertrand  <bertrand@helixcode.com>

	* 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
This commit is contained in:
bertrand
2000-03-02 15:09:45 +00:00
committed by Bertrand Guiheneuf
parent d932fda48b
commit 01b2d34d03
3 changed files with 24 additions and 6 deletions

View File

@ -1,3 +1,12 @@
2000-03-02 bertrand <bertrand@helixcode.com>
* 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 <bertrand@helixcode.com>
* camel-stream-b64.c (camel_stream_b64_write_to_stream): new

View File

@ -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);
}
}

View File

@ -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);
}
}