summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/iconv.c2
-rw-r--r--mailbox/rfc2047.c26
2 files changed, 23 insertions, 5 deletions
diff --git a/examples/iconv.c b/examples/iconv.c
index d1c964aaa..c96a5ab86 100644
--- a/examples/iconv.c
+++ b/examples/iconv.c
@@ -42,7 +42,7 @@ main (int argc, char **argv)
rc = stdio_stream_create (&in, stdin, 0);
assert (rc == 0);
assert (stream_open (in) == 0);
- assert (filter_iconv_create (&cvt, in, argv[1], argv[2], 0) == 0);
+ assert (filter_iconv_create (&cvt, in, argv[1], argv[2], 0, mu_fallback_none) == 0);
assert (stream_open (cvt) == 0);
rc = stdio_stream_create (&out, stdout, 0);
diff --git a/mailbox/rfc2047.c b/mailbox/rfc2047.c
index 89e8bd995..c12a64a12 100644
--- a/mailbox/rfc2047.c
+++ b/mailbox/rfc2047.c
@@ -27,6 +27,8 @@
#include <mailutils/filter.h>
#include <mailutils/errno.h>
+enum mu_iconv_fallback_mode rfc2047_fallback_mode = mu_fallback_copy_octal;
+
int
rfc2047_decode (const char *tocode, const char *input, char **ptostr)
{
@@ -121,14 +123,30 @@ rfc2047_decode (const char *tocode, const char *input, char **ptostr)
if (status != 0)
break;
- status = filter_iconv_create (&cvt, filter, fromcode, tocode, 0);
+ status = filter_iconv_create (&cvt, filter, fromcode, tocode,
+ MU_STREAM_NO_CLOSE,
+ rfc2047_fallback_mode);
if (status)
- cvt = filter;
- if (stream_open (cvt))
{
- stream_destroy (cvt, stream_get_owner (cvt));
cvt = filter;
+ /* Note: the filter stream is already open! */
}
+ else
+ {
+ if (stream_open (cvt))
+ {
+ stream_destroy (&cvt, stream_get_owner (cvt));
+ cvt = filter;
+ }
+ else
+ {
+ int flags;
+ stream_get_flags (cvt, &flags);
+ flags &= ~MU_STREAM_NO_CLOSE;
+ stream_set_flags (cvt, flags);
+ }
+ }
+
while (stream_sequential_read (cvt, buffer + bufpos,
bufsize - bufpos,
&nbytes) == 0 && nbytes)

Return to:

Send suggestions and report system problems to the System administrator.