aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-b64.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-stream-b64.c')
-rw-r--r--camel/camel-stream-b64.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/camel/camel-stream-b64.c b/camel/camel-stream-b64.c
index df4f755fac..eb99f40058 100644
--- a/camel/camel-stream-b64.c
+++ b/camel/camel-stream-b64.c
@@ -356,7 +356,8 @@ my_read_encode (CamelStream *stream,
* read to write in the stream
*/
if (status->state == 3) {
- buffer [j++] = status->keep;
+ buffer [j++] = six_bits_to_char [status->keep];
+ status->state = 0;
status->keep = 0;
status->line_length++;
break;
@@ -418,7 +419,7 @@ my_read_encode (CamelStream *stream,
* we are at the end of the input stream
* we must pad the output with '='.
*/
-
+ printf ("%d\n", status->end_state);
while ((j<n) && (status->end_state != 6)) {
if (status->end_state == 5) {
@@ -465,7 +466,6 @@ my_read_encode (CamelStream *stream,
}
- status->end_state++;
break;
@@ -570,8 +570,9 @@ camel_stream_b64_write_to_stream (CamelStreamB64 *stream_b64,
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);
+ nb_written += camel_stream_write (output_stream, tmp_buf + nb_written, nb_read - nb_written);
}
}