diff options
author | NotZed <NotZed@HelixCode.com> | 2000-04-21 07:48:45 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-04-21 07:48:45 +0800 |
commit | 383f245d39b8b806a4b6ce4dea7b0ab7f1658450 (patch) | |
tree | b6447bbcd6bd8c4b31582a343ce062e8d2c548c4 /camel/camel-stream.c | |
parent | 6b5b1f6de926a4c9dec95dbd55ae53a5b30fb6a5 (diff) | |
download | gsoc2013-evolution-383f245d39b8b806a4b6ce4dea7b0ab7f1658450.tar gsoc2013-evolution-383f245d39b8b806a4b6ce4dea7b0ab7f1658450.tar.gz gsoc2013-evolution-383f245d39b8b806a4b6ce4dea7b0ab7f1658450.tar.bz2 gsoc2013-evolution-383f245d39b8b806a4b6ce4dea7b0ab7f1658450.tar.lz gsoc2013-evolution-383f245d39b8b806a4b6ce4dea7b0ab7f1658450.tar.xz gsoc2013-evolution-383f245d39b8b806a4b6ce4dea7b0ab7f1658450.tar.zst gsoc2013-evolution-383f245d39b8b806a4b6ce4dea7b0ab7f1658450.zip |
MERGE NEW_PARSER branch into HEAD, fixed conflicts.
2000-04-20 NotZed <NotZed@HelixCode.com>
* MERGE NEW_PARSER branch into HEAD, fixed conflicts.
* gmime-content-field.c (_print_parameter): Duh, removed again
(@@#$@ cvs merge).
* camel-mime-utils.c (header_content_type_is): Constify.
(header_content_type_unref): Killed a couple warnings.
* camel-folder.c (_init): Removed more log crap.
* providers/Makefile.am (SUBDIRS): Removed nntp, pending fixes for
summary changes.
* providers/mbox/camel-mbox-folder.c (_get_message_by_number):
Fixed for new summary interface. Added a warning for using this
broken api.
(_get_message_by_uid): Fixed for message new with session
vanishing.
svn path=/trunk/; revision=2531
Diffstat (limited to 'camel/camel-stream.c')
-rw-r--r-- | camel/camel-stream.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/camel/camel-stream.c b/camel/camel-stream.c index 4e7a6c640c..aaa782620e 100644 --- a/camel/camel-stream.c +++ b/camel/camel-stream.c @@ -242,3 +242,45 @@ camel_stream_write_strings (CamelStream *stream, ... ) } va_end (args); } + +/** + * camel_stream_write_to_stream: + * @stream: Source CamelStream. + * @output_stream: Destination CamelStream. + * + * Write all of a stream (until eos) into another stream, in a blocking + * fashion. + * + * FIXME: This really needs to return an error code. + **/ +void +camel_stream_write_to_stream (CamelStream *stream, + CamelStream *output_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 + * to an output stream. + */ + g_assert (output_stream); + g_assert (stream); + + while (!camel_stream_eos (CAMEL_STREAM (stream))) { + nb_read = camel_stream_read (CAMEL_STREAM (stream), tmp_buf, 4096); + if (nb_read>0) { + nb_written = 0; + + while (nb_written < nb_read) { + int len = camel_stream_write (output_stream, tmp_buf + nb_written, nb_read - nb_written); + /* FIXME: what about length 0? */ + if (len<0) + return; + nb_written += len; + } + } + } +} |