commit 6a6af7ab57cef02c395da11939e3488c104572fb
parent ed483d5fb63e83071d78b1ec4f4aaa43fe5393a9
Author: Colin Leroy <colin@colino.net>
Date: Wed, 8 Apr 2009 16:10:13 +0000
2009-04-08 [colin] 3.7.1cvs42
* src/procmime.c
fix saving (but not displaying) of UTF-16
files
Diffstat:
4 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-08 [colin] 3.7.1cvs42
+
+ * src/procmime.c
+ fix saving (but not displaying) of UTF-16
+ files
+
2009-04-08 [colin] 3.7.1cvs41
* src/gtk/manage_window.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -3781,3 +3781,4 @@
( cvs diff -u -r 1.100.2.67 -r 1.100.2.68 AUTHORS; cvs diff -u -r 1.654.2.3846 -r 1.654.2.3847 configure.ac; diff -u /dev/null po/id.po; cvs diff -u -r 1.1.2.55 -r 1.1.2.56 src/gtk/authors.h; cvs diff -u -r 1.1.2.19 -r 1.1.2.20 tools/claws.i18n.status.pl; ) > 3.7.1cvs39.patchset
( cvs diff -u -r 1.150.2.114 -r 1.150.2.115 src/procmsg.c; ) > 3.7.1cvs40.patchset
( cvs diff -u -r 1.1.4.8 -r 1.1.4.9 src/gtk/manage_window.c; ) > 3.7.1cvs41.patchset
+( cvs diff -u -r 1.49.2.129 -r 1.49.2.130 src/procmime.c; ) > 3.7.1cvs42.patchset
diff --git a/configure.ac b/configure.ac
@@ -12,7 +12,7 @@ MINOR_VERSION=7
MICRO_VERSION=1
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=41
+EXTRA_VERSION=42
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/procmime.c b/src/procmime.c
@@ -350,6 +350,7 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
gboolean got_error = FALSE;
gboolean uncanonicalize = FALSE;
FILE *tmpfp = outfp;
+ gboolean null_bytes = FALSE;
if (mimeinfo->type == MIMETYPE_TEXT ||
mimeinfo->type == MIMETYPE_MESSAGE) {
@@ -366,6 +367,10 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
decoder = base64_decoder_new();
while ((ftell(infp) < readend) && (fgets(buf, sizeof(buf), infp) != NULL)) {
len = base64_decoder_decode(decoder, buf, outbuf);
+ if (uncanonicalize == TRUE && strlen(outbuf) < len) {
+ uncanonicalize = FALSE;
+ null_bytes = TRUE;
+ }
if (len < 0 && !got_error) {
g_warning("Bad BASE64 content.\n");
if (fwrite(_("[Error decoding BASE64]\n"),
@@ -378,8 +383,14 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
} else if (len >= 0) {
/* print out the error message only once
* per block */
- if (fwrite(outbuf, sizeof(gchar), len, tmpfp) < len)
- err = TRUE;
+ if (null_bytes) {
+ /* we won't uncanonicalize, output to outfp directly */
+ if (fwrite(outbuf, sizeof(gchar), len, outfp) < len)
+ err = TRUE;
+ } else {
+ if (fwrite(outbuf, sizeof(gchar), len, tmpfp) < len)
+ err = TRUE;
+ }
got_error = FALSE;
}
}