2009-04-08 [colin] 3.7.1cvs42
authorColin Leroy <colin@colino.net>
Wed, 8 Apr 2009 16:10:13 +0000 (16:10 +0000)
committerColin Leroy <colin@colino.net>
Wed, 8 Apr 2009 16:10:13 +0000 (16:10 +0000)
* src/procmime.c
fix saving (but not displaying) of UTF-16
files

ChangeLog
PATCHSETS
configure.ac
src/procmime.c

index 6135c2e..c7b0cc0 100644 (file)
--- 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
index b4dddb2..e29e30a 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index 27ecea8..c6d40aa 100644 (file)
@@ -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=
 
index 5c6de30..8307a9f 100644 (file)
@@ -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;
                        }
                }